Debian Codegraph @

src/gui/kstatusnotifier/libdbusmenu-qt/dbusmenuexporterprivate_p.h

raw symbols SCIP
1 /* This file is part of the dbusmenu-qt library
2 SPDX-FileCopyrightText: 2010 Canonical
3 Author: Aurelien Gateau <[email protected]>
4
5 SPDX-License-Identifier: LGPL-2.0-or-later
6 */
7 #ifndef DBUSMENUEXPORTERPRIVATE_P_H
8 #define DBUSMENUEXPORTERPRIVATE_P_H
9
10 // Local
11 #include "dbusmenuexporter.h"
12 #include "dbusmenutypes_p.h"
13
14 // Qt
15 #include <QHash>
16 #include <QMap>
17 #include <QSet>
18 #include <QVariant>
19
20 class QMenu;
21 class QTimer;
22
23 class DBusMenuExporterDBus;
24
25 class DBusMenuExporterPrivate
26 {
27 public:
28 DBusMenuExporter *q = nullptr;
29
30 QString m_objectPath;
31
32 DBusMenuExporterDBus *m_dbusObject = nullptr;
33
34 QMenu *m_rootMenu = nullptr;
35 QHash<QAction *, QVariantMap> m_actionProperties;
36 QMap<int, QAction *> m_actionForId;
37 QMap<QAction *, int> m_idForAction;
38 int m_nextId;
39 uint m_revision;
40 bool m_emittedLayoutUpdatedOnce;
41
42 QSet<int> m_itemUpdatedIds;
43 QTimer *m_itemUpdatedTimer = nullptr;
44
45 QSet<int> m_layoutUpdatedIds;
46 QTimer *m_layoutUpdatedTimer = nullptr;
47
48 int idForAction(QAction *action) const;
49 void addMenu(QMenu *menu, int parentId);
50 QVariantMap propertiesForAction(QAction *action) const;
51 QVariantMap propertiesForKMenuTitleAction(QAction *action_) const;
52 QVariantMap propertiesForSeparatorAction(QAction *action) const;
53 QVariantMap propertiesForStandardAction(QAction *action) const;
54 QMenu *menuForId(int id) const;
55 void fillLayoutItem(DBusMenuLayoutItem *item, QMenu *menu, int id, int depth, const QStringList &propertyNames);
56
57 void addAction(QAction *action, int parentId);
58 void updateAction(QAction *action);
59 void removeAction(QAction *action, int parentId);
60 /**
61 * Removes any reference from action in the exporter, but do not notify the
62 * change outside. This is useful when a submenu is destroyed because we do
63 * not receive QEvent::ActionRemoved events for its actions.
64 * IMPORTANT: action might have already been destroyed when this method is
65 * called, so don't dereference the pointer (it is a QObject to avoid being
66 * tempted to dereference)
67 */
68 void removeActionInternal(QObject *action);
69
70 void emitLayoutUpdated(int id);
71
72 void insertIconProperty(QVariantMap *map, QAction *action) const;
73
74 void collapseSeparators(QMenu *);
75 };
76
77 #endif /* DBUSMENUEXPORTERPRIVATE_P_H */