summaryrefslogtreecommitdiff
path: root/src/lib/xdgstatusnotifierwatcher.h
diff options
context:
space:
mode:
authorFabien Proriol <fabien.proriol@kazoe.org>2025-05-25 12:13:31 +0200
committerFabien Proriol <fabien.proriol@kazoe.org>2025-05-25 12:13:31 +0200
commit1dbc0e3c88ba271ba35bc3f82e7864c4f35e1236 (patch)
tree8c491cd196e2eff4c59f8c23f566f7ff26981586 /src/lib/xdgstatusnotifierwatcher.h
Initial Commit
Diffstat (limited to 'src/lib/xdgstatusnotifierwatcher.h')
-rw-r--r--src/lib/xdgstatusnotifierwatcher.h48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/lib/xdgstatusnotifierwatcher.h b/src/lib/xdgstatusnotifierwatcher.h
new file mode 100644
index 0000000..8e2275c
--- /dev/null
+++ b/src/lib/xdgstatusnotifierwatcher.h
@@ -0,0 +1,48 @@
+#ifndef XDGSTATUSNOTIFIERWATCHER_H
+#define XDGSTATUSNOTIFIERWATCHER_H
+
+#include <QObject>
+
+class QDBusServiceWatcher;
+#define XDG_STATUS_NOTIFIER_WATCHER_PROTOCOL_VERSION 1
+
+namespace xdg {
+
+ class StatusNotifierWatcher: public QObject
+ {
+ Q_OBJECT
+
+ Q_PROPERTY(QStringList RegisteredStatusNotifierItems READ RegisteredStatusNotifierItems NOTIFY RegisteredStatusNotifierItemsChanged)
+ Q_PROPERTY(bool IsStatusNotifierHostRegistered READ IsStatusNotifierHostRegistered NOTIFY IsStatusNotifierHostRegisteredChanged)
+ Q_PROPERTY(int ProtocolVersion READ ProtocolVersion CONSTANT)
+
+ public:
+ StatusNotifierWatcher(QObject *parent = nullptr);
+ virtual ~StatusNotifierWatcher();
+
+ void RegisterStatusNotifierItem(const QString &service);
+ void RegisterStatusNotifierHost(const QString &service);
+
+ QStringList RegisteredStatusNotifierItems() const;
+ bool IsStatusNotifierHostRegistered() const;
+ int ProtocolVersion() const;
+
+ signals:
+ void StatusNotifierItemRegistered(QString id);
+ void StatusNotifierItemUnregistered(QString id);
+ void StatusNotifierHostRegistered();
+ void StatusNotifierHostUnregistered();
+ void RegisteredStatusNotifierItemsChanged();
+ void IsStatusNotifierHostRegisteredChanged();
+
+ private:
+ QStringList m_hosts;
+ QStringList m_items;
+ QDBusServiceWatcher *m_serviceWatcher = nullptr;
+
+ private slots:
+ void _serviceUnregistered(const QString &name);
+ };
+};
+
+#endif // XDGSTATUSNOTIFIERWATCHER_H