File indexing completed on 2025-01-12 03:40:51

0001 /* This file is part of the dbusmenu-qt library
0002    SPDX-FileCopyrightText: 2010 Canonical
0003    Author: Aurelien Gateau <aurelien.gateau@canonical.com>
0004 
0005    SPDX-License-Identifier: LGPL-2.0-or-later
0006 */
0007 #ifndef DBUSMENUEXPORTERDBUS_P_H
0008 #define DBUSMENUEXPORTERDBUS_P_H
0009 
0010 // Local
0011 #include "dbusmenutypes_p.h"
0012 
0013 // Qt
0014 #include <QDBusAbstractAdaptor>
0015 #include <QDBusVariant>
0016 #include <QObject>
0017 #include <QVariant>
0018 
0019 class DBusMenuExporter;
0020 
0021 /**
0022  * Internal class implementing the DBus side of DBusMenuExporter
0023  * This avoid exposing the implementation of the DBusMenu spec to the outside
0024  * world.
0025  */
0026 class DBusMenuExporterDBus : public QObject
0027 {
0028     Q_OBJECT
0029     Q_CLASSINFO("D-Bus Interface", "com.canonical.dbusmenu")
0030     Q_PROPERTY(uint Version READ Version)
0031     Q_PROPERTY(QString Status READ status)
0032 public:
0033     DBusMenuExporterDBus(DBusMenuExporter *m_exporter);
0034 
0035     uint Version() const
0036     {
0037         return 2;
0038     }
0039 
0040     QString status() const;
0041     void setStatus(const QString &status);
0042 
0043 public Q_SLOTS:
0044     Q_NOREPLY void Event(int id, const QString &eventId, const QDBusVariant &data, uint timestamp);
0045     QDBusVariant GetProperty(int id, const QString &property);
0046     uint GetLayout(int parentId, int recursionDepth, const QStringList &propertyNames, DBusMenuLayoutItem &item);
0047     DBusMenuItemList GetGroupProperties(const QList<int> &ids, const QStringList &propertyNames);
0048     bool AboutToShow(int id);
0049 
0050 Q_SIGNALS:
0051     void ItemsPropertiesUpdated(DBusMenuItemList, DBusMenuItemKeysList);
0052     void LayoutUpdated(uint revision, int parentId);
0053     void ItemActivationRequested(int id, uint timeStamp);
0054 
0055 private:
0056     DBusMenuExporter *m_exporter = nullptr;
0057     QString m_status;
0058 
0059     friend class DBusMenuExporter;
0060     friend class DBusMenuExporterPrivate;
0061 
0062     QVariantMap getProperties(int id, const QStringList &names) const;
0063 };
0064 
0065 #endif /* DBUSMENUEXPORTERDBUS_P_H */