1 #ifndef DBUSINTERFACE_H
2 #define DBUSINTERFACE_H
3 
4 #include <QObject>
5 #include <QtDBus/QtDBus>
6 #include <QtDBus/QDBusMessage>
7 #include <QtDBus/QDBusServiceWatcher>
8 #include "message.h"
9 
10 class DBusInterface : public QDBusAbstractAdaptor
11 {
12     Q_OBJECT
13     Q_CLASSINFO("D-Bus Interface", "org.freedesktop.Notifications")
14 public:
15     DBusInterface(QObject* parent = 0);
16 
17 public slots:
18     void GetCapabilities(QStringList& capabilities);
19     void CloseNotification(unsigned int id);
20     void GetServerInformation(
21         QString& name,
22         QString& vendor,
23         QString& version,
24         QString& specVersion
25     );
26     void Notify(
27         const QString& appName,
28         unsigned int id,
29         const QString& icon,
30         const QString& summary,
31         const QString& body,
32         const QStringList& actions,
33         const QVariantMap& hints,
34         int timeout,
35         unsigned int& return_id
36     );
37 
38 signals:
39     void messageReceived(const Message& msg);
40 
41 private:
42     QString serviceName;
43     QDBusConnection dbus_conn;
44     QDBusServiceWatcher serviceWatcher;
45     unsigned int lastNid;
46 };
47 
48 #endif // DBUSINTERFACE_H
49