Warning, file /plasma/plasma-workspace/gmenu-dbusmenu-proxy/menu.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* 0002 SPDX-FileCopyrightText: 2018 Kai Uwe Broulik <kde@privat.broulik.de> 0003 0004 SPDX-License-Identifier: LGPL-2.1-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include <QList> 0010 #include <QObject> 0011 #include <QString> 0012 0013 #include "../libdbusmenuqt/dbusmenutypes_p.h" 0014 #include "gdbusmenutypes_p.h" 0015 #include "gtkmenus_interface.h" 0016 0017 class Menu : public QObject 0018 { 0019 Q_OBJECT 0020 0021 public: 0022 Menu(const QString &serviceName, const QString &objectPath, QObject *parent = nullptr); 0023 ~Menu() override; 0024 0025 void init(); 0026 void cleanup(); 0027 0028 void start(uint id); 0029 void stop(const QList<uint> &ids); 0030 0031 bool hasMenu() const; 0032 bool hasSubscription(uint subscription) const; 0033 0034 GMenuItem getSection(int id, bool *ok = nullptr) const; 0035 GMenuItem getSection(int subscription, int sectionId, bool *ok = nullptr) const; 0036 0037 QVariantMap getItem(int id) const; // bool ok argument? 0038 QVariantMap getItem(int subscription, int sectionId, int id) const; 0039 0040 public Q_SLOTS: 0041 void actionsChanged(const QStringList &dirtyActions, const QString &prefix); 0042 0043 Q_SIGNALS: 0044 void menuAppeared(); // emitted the first time a menu was successfully loaded 0045 void menuDisappeared(); 0046 0047 void subscribed(uint id); 0048 void failedToSubscribe(uint id); 0049 0050 void itemsChanged(const QList<uint> &itemIds); 0051 void menusChanged(const QList<uint> &menuIds); 0052 0053 private Q_SLOTS: 0054 void onMenuChanged(const GMenuChangeList &changes); 0055 0056 private: 0057 void initMenu(); 0058 0059 void menuChanged(const GMenuChangeList &changes); 0060 0061 // QSet? 0062 QList<uint> m_subscriptions; // keeps track of which menu trees we're subscribed to 0063 0064 QHash<uint, GMenuItemList> m_menus; 0065 0066 QScopedPointer<OrgGtkMenusInterface, QScopedPointerDeleteLater> m_interface; 0067 };