1 | /*************************************************************************** |
2 | * Copyright 2009 by Marco Martin <notmart@gmail.com> * |
3 | * * |
4 | * This program is free software; you can redistribute it and/or modify * |
5 | * it under the terms of the GNU General Public License as published by * |
6 | * the Free Software Foundation; either version 2 of the License, or * |
7 | * (at your option) any later version. * |
8 | * * |
9 | * This program is distributed in the hope that it will be useful, * |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
12 | * GNU General Public License for more details. * |
13 | * * |
14 | * You should have received a copy of the GNU General Public License * |
15 | * along with this program; if not, write to the * |
16 | * Free Software Foundation, Inc., * |
17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * |
18 | ***************************************************************************/ |
19 | |
20 | #ifndef STATUSNOTIFIERWATCHER_H |
21 | #define STATUSNOTIFIERWATCHER_H |
22 | |
23 | #include <kdedmodule.h> |
24 | |
25 | #include <QDBusContext> |
26 | #include <QObject> |
27 | #include <QStringList> |
28 | #include <QSet> |
29 | |
30 | class QDBusServiceWatcher; |
31 | |
32 | class StatusNotifierWatcher : public KDEDModule, protected QDBusContext |
33 | { |
34 | Q_OBJECT |
35 | Q_PROPERTY(QStringList RegisteredStatusNotifierItems READ RegisteredStatusNotifierItems) |
36 | Q_PROPERTY(bool IsStatusNotifierHostRegistered READ IsStatusNotifierHostRegistered) |
37 | Q_PROPERTY(int ProtocolVersion READ ProtocolVersion) |
38 | |
39 | public: |
40 | StatusNotifierWatcher(QObject *parent, const QList<QVariant>&); |
41 | ~StatusNotifierWatcher(); |
42 | |
43 | QStringList RegisteredStatusNotifierItems() const; |
44 | |
45 | bool IsStatusNotifierHostRegistered() const; |
46 | |
47 | int ProtocolVersion() const; |
48 | |
49 | public Q_SLOTS: |
50 | void RegisterStatusNotifierItem(const QString &service); |
51 | |
52 | void RegisterStatusNotifierHost(const QString &service); |
53 | |
54 | protected Q_SLOTS: |
55 | void serviceUnregistered(const QString& name); |
56 | |
57 | Q_SIGNALS: |
58 | void StatusNotifierItemRegistered(const QString &service); |
59 | //TODO: decide if this makes sense, the systray itself could notice the vanishing of items, but looks complete putting it here |
60 | void StatusNotifierItemUnregistered(const QString &service); |
61 | void StatusNotifierHostRegistered(); |
62 | void StatusNotifierHostUnregistered(); |
63 | |
64 | private: |
65 | QDBusServiceWatcher *m_serviceWatcher; |
66 | QStringList m_registeredServices; |
67 | QSet<QString> m_statusNotifierHostServices; |
68 | }; |
69 | #endif |
70 | |