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 QtDBus 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 -a dbusmenu ../../3rdparty/dbus-ifaces/dbus-menu.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 DBUSMENUADAPTOR_H
52 #define DBUSMENUADAPTOR_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 purely as an
59 // implementation detail.  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 <QtDBus/QtDBus>
67 #include "qdbusmenutypes_p.h"
68 
69 QT_BEGIN_NAMESPACE
70 
71 /*
72  * Adaptor class for interface com.canonical.dbusmenu
73  */
74 class QDBusMenuAdaptor: public QDBusAbstractAdaptor
75 {
76     Q_OBJECT
77     Q_CLASSINFO("D-Bus Interface", "com.canonical.dbusmenu")
78     Q_CLASSINFO("D-Bus Introspection", ""
79 "  <interface name=\"com.canonical.dbusmenu\">\n"
80 "    <property access=\"read\" type=\"u\" name=\"Version\">\n"
81 "    </property>\n"
82 "    <property access=\"read\" type=\"s\" name=\"TextDirection\">\n"
83 "    </property>\n"
84 "    <property access=\"read\" type=\"s\" name=\"Status\">\n"
85 "    </property>\n"
86 "    <property access=\"read\" type=\"as\" name=\"IconThemePath\">\n"
87 "    </property>\n"
88 "    <method name=\"GetLayout\">\n"
89 "      <annotation value=\"QDBusMenuLayoutItem\" name=\"org.qtproject.QtDBus.QtTypeName.Out1\"/>\n"
90 "      <arg direction=\"in\" type=\"i\" name=\"parentId\"/>\n"
91 "      <arg direction=\"in\" type=\"i\" name=\"recursionDepth\"/>\n"
92 "      <arg direction=\"in\" type=\"as\" name=\"propertyNames\"/>\n"
93 "      <arg direction=\"out\" type=\"u\" name=\"revision\"/>\n"
94 "      <arg direction=\"out\" type=\"(ia{sv}av)\" name=\"layout\"/>\n"
95 "    </method>\n"
96 "    <method name=\"GetGroupProperties\">\n"
97 "      <annotation value=\"QList&lt;int&gt;\" name=\"org.qtproject.QtDBus.QtTypeName.In0\"/>\n"
98 "      <annotation value=\"QDBusMenuItemList\" name=\"org.qtproject.QtDBus.QtTypeName.Out0\"/>\n"
99 "      <arg direction=\"in\" type=\"ai\" name=\"ids\"/>\n"
100 "      <arg direction=\"in\" type=\"as\" name=\"propertyNames\"/>\n"
101 "      <arg direction=\"out\" type=\"a(ia{sv})\" name=\"properties\"/>\n"
102 "    </method>\n"
103 "    <method name=\"GetProperty\">\n"
104 "      <arg direction=\"in\" type=\"i\" name=\"id\"/>\n"
105 "      <arg direction=\"in\" type=\"s\" name=\"name\"/>\n"
106 "      <arg direction=\"out\" type=\"v\" name=\"value\"/>\n"
107 "    </method>\n"
108 "    <method name=\"Event\">\n"
109 "      <arg direction=\"in\" type=\"i\" name=\"id\"/>\n"
110 "      <arg direction=\"in\" type=\"s\" name=\"eventId\"/>\n"
111 "      <arg direction=\"in\" type=\"v\" name=\"data\"/>\n"
112 "      <arg direction=\"in\" type=\"u\" name=\"timestamp\"/>\n"
113 "    </method>\n"
114 "    <method name=\"EventGroup\">\n"
115 "      <annotation value=\"QList&lt;QDBusMenuEvent&gt;\" name=\"org.qtproject.QtDBus.QtTypeName.In0\"/>\n"
116 "      <annotation value=\"QList&lt;int&gt;\" name=\"org.qtproject.QtDBus.QtTypeName.Out0\"/>\n"
117 "      <arg direction=\"in\" type=\"a(isvu)\" name=\"events\"/>\n"
118 "      <arg direction=\"out\" type=\"ai\" name=\"idErrors\"/>\n"
119 "    </method>\n"
120 "    <method name=\"AboutToShow\">\n"
121 "      <arg direction=\"in\" type=\"i\" name=\"id\"/>\n"
122 "      <arg direction=\"out\" type=\"b\" name=\"needUpdate\"/>\n"
123 "    </method>\n"
124 "    <method name=\"AboutToShowGroup\">\n"
125 "      <annotation value=\"QList&lt;int&gt;\" name=\"org.qtproject.QtDBus.QtTypeName.In0\"/>\n"
126 "      <annotation value=\"QList&lt;int&gt;\" name=\"org.qtproject.QtDBus.QtTypeName.Out0\"/>\n"
127 "      <annotation value=\"QList&lt;int&gt;\" name=\"org.qtproject.QtDBus.QtTypeName.Out1\"/>\n"
128 "      <arg direction=\"in\" type=\"ai\" name=\"ids\"/>\n"
129 "      <arg direction=\"out\" type=\"ai\" name=\"updatesNeeded\"/>\n"
130 "      <arg direction=\"out\" type=\"ai\" name=\"idErrors\"/>\n"
131 "    </method>\n"
132 "    <signal name=\"ItemsPropertiesUpdated\">\n"
133 "      <annotation value=\"QDBusMenuItemList\" name=\"org.qtproject.QtDBus.QtTypeName.In0\"/>\n"
134 "      <annotation value=\"QDBusMenuItemKeysList\" name=\"org.qtproject.QtDBus.QtTypeName.In1\"/>\n"
135 "      <arg direction=\"out\" type=\"a(ia{sv})\" name=\"updatedProps\"/>\n"
136 "      <arg direction=\"out\" type=\"a(ias)\" name=\"removedProps\"/>\n"
137 "    </signal>\n"
138 "    <signal name=\"LayoutUpdated\">\n"
139 "      <arg direction=\"out\" type=\"u\" name=\"revision\"/>\n"
140 "      <arg direction=\"out\" type=\"i\" name=\"parent\"/>\n"
141 "    </signal>\n"
142 "    <signal name=\"ItemActivationRequested\">\n"
143 "      <arg direction=\"out\" type=\"i\" name=\"id\"/>\n"
144 "      <arg direction=\"out\" type=\"u\" name=\"timestamp\"/>\n"
145 "    </signal>\n"
146 "  </interface>\n"
147         "")
148 public:
149     QDBusMenuAdaptor(QDBusPlatformMenu *topLevelMenu);
150     virtual ~QDBusMenuAdaptor();
151 
152 public: // PROPERTIES
153     Q_PROPERTY(QString Status READ status)
154     QString status() const;
155 
156     Q_PROPERTY(QString TextDirection READ textDirection)
157     QString textDirection() const;
158 
159     Q_PROPERTY(uint Version READ version)
160     uint version() const;
161 
162 public Q_SLOTS: // METHODS
163     bool AboutToShow(int id);
164     QList<int> AboutToShowGroup(const QList<int> &ids, QList<int> &idErrors);
165     void Event(int id, const QString &eventId, const QDBusVariant &data, uint timestamp);
166     QList<int> EventGroup(const QDBusMenuEventList &events);
167     QDBusMenuItemList GetGroupProperties(const QList<int> &ids, const QStringList &propertyNames);
168     uint GetLayout(int parentId, int recursionDepth, const QStringList &propertyNames, QDBusMenuLayoutItem &layout);
169     QDBusVariant GetProperty(int id, const QString &name);
170 
171 Q_SIGNALS: // SIGNALS
172     void ItemActivationRequested(int id, uint timestamp);
173     void ItemsPropertiesUpdated(const QDBusMenuItemList &updatedProps, const QDBusMenuItemKeysList &removedProps);
174     void LayoutUpdated(uint revision, int parent);
175 
176 private:
177     QDBusPlatformMenu *m_topLevelMenu;
178 };
179 
180 QT_END_NAMESPACE
181 
182 #endif // DBUSMENUADAPTOR_H
183