1 | /**************************************************************************** |
2 | ** |
3 | ** Copyright (C) 2016 The Qt Company Ltd. |
4 | ** Contact: https://www.qt.io/licensing/ |
5 | ** |
6 | ** This file is part of the QtGui module of the Qt Toolkit. |
7 | ** |
8 | ** $QT_BEGIN_LICENSE:LGPL$ |
9 | ** Commercial License Usage |
10 | ** Licensees holding valid commercial Qt licenses may use this file in |
11 | ** accordance with the commercial license agreement provided with the |
12 | ** Software or, alternatively, in accordance with the terms contained in |
13 | ** a written agreement between you and The Qt Company. For licensing terms |
14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
15 | ** information use the contact form at https://www.qt.io/contact-us. |
16 | ** |
17 | ** GNU Lesser General Public License Usage |
18 | ** Alternatively, this file may be used under the terms of the GNU Lesser |
19 | ** General Public License version 3 as published by the Free Software |
20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the |
21 | ** packaging of this file. Please review the following information to |
22 | ** ensure the GNU Lesser General Public License version 3 requirements |
23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. |
24 | ** |
25 | ** GNU General Public License Usage |
26 | ** Alternatively, this file may be used under the terms of the GNU |
27 | ** General Public License version 2.0 or (at your option) the GNU General |
28 | ** Public license version 3 or any later version approved by the KDE Free |
29 | ** Qt Foundation. The licenses are as published by the Free Software |
30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 |
31 | ** included in the packaging of this file. Please review the following |
32 | ** information to ensure the GNU General Public License requirements will |
33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and |
34 | ** https://www.gnu.org/licenses/gpl-3.0.html. |
35 | ** |
36 | ** $QT_END_LICENSE$ |
37 | ** |
38 | ****************************************************************************/ |
39 | |
40 | /* |
41 | This file was originally created by qdbusxml2cpp version 0.8 |
42 | Command line was: |
43 | qdbusxml2cpp -p qxdgnotificationproxy ../../3rdparty/dbus-ifaces/org.freedesktop.Notifications.xml |
44 | |
45 | However it is maintained manually. |
46 | |
47 | It is also not part of the public API. This header file may change from |
48 | version to version without notice, or even be removed. |
49 | */ |
50 | |
51 | #ifndef QXDGNOTIFICATIONPROXY_P_H |
52 | #define QXDGNOTIFICATIONPROXY_P_H |
53 | |
54 | // |
55 | // W A R N I N G |
56 | // ------------- |
57 | // |
58 | // This file is not part of the Qt API. It exists for the convenience |
59 | // of other Qt classes. This header file may change from version to |
60 | // version without notice, or even be removed. |
61 | // |
62 | // We mean it. |
63 | // |
64 | |
65 | #include <QtCore/QObject> |
66 | #include <QtCore/QByteArray> |
67 | #include <QtCore/QList> |
68 | #include <QtCore/QLoggingCategory> |
69 | #include <QtCore/QMap> |
70 | #include <QtCore/QString> |
71 | #include <QtCore/QStringList> |
72 | #include <QtCore/QVariant> |
73 | #include <QtDBus/QtDBus> |
74 | |
75 | QT_BEGIN_NAMESPACE |
76 | |
77 | Q_DECLARE_LOGGING_CATEGORY(qLcTray) |
78 | |
79 | /* |
80 | * Proxy class for interface org.freedesktop.Notifications |
81 | */ |
82 | class QXdgNotificationInterface: public QDBusAbstractInterface |
83 | { |
84 | Q_OBJECT |
85 | public: |
86 | static inline const char *staticInterfaceName() |
87 | { return "org.freedesktop.Notifications" ; } |
88 | |
89 | public: |
90 | QXdgNotificationInterface(const QString &service, const QString &path, |
91 | const QDBusConnection &connection, QObject *parent = nullptr); |
92 | |
93 | ~QXdgNotificationInterface(); |
94 | |
95 | public Q_SLOTS: // METHODS |
96 | inline QDBusPendingReply<> closeNotification(uint id) |
97 | { |
98 | return asyncCall(QStringLiteral("CloseNotification" ), id); |
99 | } |
100 | |
101 | inline QDBusPendingReply<QStringList> getCapabilities() |
102 | { |
103 | return asyncCall(QStringLiteral("GetCapabilities" )); |
104 | } |
105 | |
106 | inline QDBusPendingReply<QString, QString, QString, QString> getServerInformation() |
107 | { |
108 | return asyncCall(QStringLiteral("GetServerInformation" )); |
109 | } |
110 | inline QDBusReply<QString> getServerInformation(QString &vendor, QString &version, QString &specVersion) |
111 | { |
112 | QDBusMessage reply = call(QDBus::Block, QStringLiteral("GetServerInformation" )); |
113 | if (reply.type() == QDBusMessage::ReplyMessage && reply.arguments().count() == 4) { |
114 | vendor = qdbus_cast<QString>(reply.arguments().at(1)); |
115 | version = qdbus_cast<QString>(reply.arguments().at(2)); |
116 | specVersion = qdbus_cast<QString>(reply.arguments().at(3)); |
117 | } |
118 | return reply; |
119 | } |
120 | |
121 | // see https://developer.gnome.org/notification-spec/#basic-design |
122 | inline QDBusPendingReply<uint> notify(const QString &appName, uint replacesId, const QString &appIcon, |
123 | const QString &summary, const QString &body, const QStringList &actions, |
124 | const QVariantMap &hints, int timeout) |
125 | { |
126 | qCDebug(qLcTray) << appName << replacesId << appIcon << summary << body << actions << hints << timeout; |
127 | return asyncCall(QStringLiteral("Notify" ), appName, replacesId, appIcon, summary, body, actions, hints, timeout); |
128 | } |
129 | |
130 | Q_SIGNALS: |
131 | void ActionInvoked(uint id, const QString &action_key); |
132 | void NotificationClosed(uint id, uint reason); |
133 | }; |
134 | |
135 | QT_END_NAMESPACE |
136 | |
137 | namespace org { |
138 | namespace freedesktop { |
139 | using Notifications = QT_PREPEND_NAMESPACE(QXdgNotificationInterface); |
140 | } |
141 | } |
142 | |
143 | #endif |
144 | |