| 1 | // Copyright (C) 2021 The Qt Company Ltd. |
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 3 | |
| 4 | /* |
| 5 | This file was originally created by qdbusxml2cpp version 0.8 |
| 6 | Command line was: |
| 7 | qdbusxml2cpp -p qxdgnotificationproxy ../../3rdparty/dbus-ifaces/org.freedesktop.Notifications.xml |
| 8 | |
| 9 | However it is maintained manually. |
| 10 | |
| 11 | It is also not part of the public API. This header file may change from |
| 12 | version to version without notice, or even be removed. |
| 13 | */ |
| 14 | |
| 15 | #ifndef QXDGNOTIFICATIONPROXY_P_H |
| 16 | #define QXDGNOTIFICATIONPROXY_P_H |
| 17 | |
| 18 | // |
| 19 | // W A R N I N G |
| 20 | // ------------- |
| 21 | // |
| 22 | // This file is not part of the Qt API. It exists for the convenience |
| 23 | // of other Qt classes. This header file may change from version to |
| 24 | // version without notice, or even be removed. |
| 25 | // |
| 26 | // We mean it. |
| 27 | // |
| 28 | |
| 29 | #include <QObject> |
| 30 | #include <QByteArray> |
| 31 | #include <QList> |
| 32 | #include <QLoggingCategory> |
| 33 | #include <QMap> |
| 34 | #include <QString> |
| 35 | #include <QStringList> |
| 36 | #include <QVariant> |
| 37 | #include <QDBusAbstractInterface> |
| 38 | #include <QDBusPendingReply> |
| 39 | #include <QDBusReply> |
| 40 | #include <private/qglobal_p.h> |
| 41 | |
| 42 | QT_BEGIN_NAMESPACE |
| 43 | |
| 44 | Q_DECLARE_LOGGING_CATEGORY(qLcTray) |
| 45 | |
| 46 | /* |
| 47 | * Proxy class for interface org.freedesktop.Notifications |
| 48 | */ |
| 49 | class QXdgNotificationInterface: public QDBusAbstractInterface |
| 50 | { |
| 51 | Q_OBJECT |
| 52 | public: |
| 53 | static inline const char *staticInterfaceName() |
| 54 | { return "org.freedesktop.Notifications" ; } |
| 55 | |
| 56 | public: |
| 57 | QXdgNotificationInterface(const QString &service, const QString &path, |
| 58 | const QDBusConnection &connection, QObject *parent = nullptr); |
| 59 | |
| 60 | ~QXdgNotificationInterface(); |
| 61 | |
| 62 | public Q_SLOTS: // METHODS |
| 63 | inline QDBusPendingReply<> closeNotification(uint id) |
| 64 | { |
| 65 | return asyncCall(QStringLiteral("CloseNotification" ), args&: id); |
| 66 | } |
| 67 | |
| 68 | inline QDBusPendingReply<QStringList> getCapabilities() |
| 69 | { |
| 70 | return asyncCall(QStringLiteral("GetCapabilities" )); |
| 71 | } |
| 72 | |
| 73 | inline QDBusPendingReply<QString, QString, QString, QString> getServerInformation() |
| 74 | { |
| 75 | return asyncCall(QStringLiteral("GetServerInformation" )); |
| 76 | } |
| 77 | inline QDBusReply<QString> getServerInformation(QString &vendor, QString &version, QString &specVersion) |
| 78 | { |
| 79 | QDBusMessage reply = call(mode: QDBus::Block, QStringLiteral("GetServerInformation" )); |
| 80 | if (reply.type() == QDBusMessage::ReplyMessage && reply.arguments().size() == 4) { |
| 81 | vendor = qdbus_cast<QString>(v: reply.arguments().at(i: 1)); |
| 82 | version = qdbus_cast<QString>(v: reply.arguments().at(i: 2)); |
| 83 | specVersion = qdbus_cast<QString>(v: reply.arguments().at(i: 3)); |
| 84 | } |
| 85 | return reply; |
| 86 | } |
| 87 | |
| 88 | // see https://developer.gnome.org/notification-spec/#basic-design |
| 89 | inline QDBusPendingReply<uint> notify(const QString &appName, uint replacesId, const QString &appIcon, |
| 90 | const QString &summary, const QString &body, const QStringList &actions, |
| 91 | const QVariantMap &hints, int timeout) |
| 92 | { |
| 93 | qCDebug(qLcTray) << appName << replacesId << appIcon << summary << body << actions << hints << timeout; |
| 94 | return asyncCall(QStringLiteral("Notify" ), args: appName, args&: replacesId, args: appIcon, args: summary, args: body, args: actions, args: hints, args&: timeout); |
| 95 | } |
| 96 | |
| 97 | Q_SIGNALS: |
| 98 | void ActionInvoked(uint id, const QString &action_key); |
| 99 | void NotificationClosed(uint id, uint reason); |
| 100 | }; |
| 101 | |
| 102 | QT_END_NAMESPACE |
| 103 | |
| 104 | namespace org { |
| 105 | namespace freedesktop { |
| 106 | using Notifications = QT_PREPEND_NAMESPACE(QXdgNotificationInterface); |
| 107 | } |
| 108 | } |
| 109 | |
| 110 | #endif |
| 111 | |