1 | /* |
2 | This file is part of the KDE project. |
3 | |
4 | Copyright (c) 2011 Lionel Chauvin <megabigbug@yahoo.fr> |
5 | Copyright (c) 2011,2012 Cédric Bellegarde <gnumdk@gmail.com> |
6 | |
7 | Permission is hereby granted, free of charge, to any person obtaining a |
8 | copy of this software and associated documentation files (the "Software"), |
9 | to deal in the Software without restriction, including without limitation |
10 | the rights to use, copy, modify, merge, publish, distribute, sublicense, |
11 | and/or sell copies of the Software, and to permit persons to whom the |
12 | Software is furnished to do so, subject to the following conditions: |
13 | |
14 | The above copyright notice and this permission notice shall be included in |
15 | all copies or substantial portions of the Software. |
16 | |
17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
20 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
22 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
23 | DEALINGS IN THE SOFTWARE. |
24 | */ |
25 | |
26 | #ifndef MENUIMPORTER_H |
27 | #define MENUIMPORTER_H |
28 | |
29 | // Qt |
30 | #include <QDBusContext> |
31 | #include <QDBusObjectPath> |
32 | #include <QObject> |
33 | #include <QWidget> // For WId |
34 | |
35 | class QDBusObjectPath; |
36 | class QDBusPendingCallWatcher; |
37 | class QDBusServiceWatcher; |
38 | class ; |
39 | |
40 | /** |
41 | * Represents an item with its children. GetLayout() returns a |
42 | * DBusMenuLayoutItemList. |
43 | */ |
44 | struct |
45 | { |
46 | int ; |
47 | QVariantMap ; |
48 | QList<DBusMenuLayoutItem> ; |
49 | }; |
50 | Q_DECLARE_METATYPE(DBusMenuLayoutItem) |
51 | |
52 | class : public QObject, protected QDBusContext |
53 | { |
54 | Q_OBJECT |
55 | |
56 | public: |
57 | (QObject*); |
58 | (); |
59 | |
60 | bool (); |
61 | |
62 | bool (WId id) { return m_menuServices.contains(id); } |
63 | QString (WId id) { return m_menuServices.value(id); } |
64 | |
65 | bool (WId id) { return m_menuPaths.contains(id); } |
66 | QString (WId id) { return m_menuPaths.value(id).path(); } |
67 | |
68 | QList<WId> () { return m_menuServices.keys(); } |
69 | |
70 | /** |
71 | * Return id of first transient/friend window with a menu available |
72 | */ |
73 | WId (WId id); |
74 | |
75 | Q_SIGNALS: |
76 | void (WId id, const QString& service, const QDBusObjectPath&); |
77 | void (WId id); |
78 | |
79 | public Q_SLOTS: |
80 | Q_NOREPLY void (WId id, const QDBusObjectPath& path); |
81 | Q_NOREPLY void (WId id); |
82 | QString (WId id, QDBusObjectPath& path); |
83 | |
84 | private Q_SLOTS: |
85 | void (const QString& service); |
86 | void (uint revision, int parentId); |
87 | void (QDBusPendingCallWatcher*); |
88 | |
89 | private: |
90 | QDBusServiceWatcher* ; |
91 | QHash<WId, QString> ; |
92 | QHash<WId, QDBusObjectPath> ; |
93 | QHash<WId, QString> ; |
94 | |
95 | void (); |
96 | }; |
97 | |
98 | #endif /* MENUIMPORTER_H */ |
99 | |