summaryrefslogtreecommitdiff
path: root/src/notificationmonitor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/notificationmonitor.cpp')
-rw-r--r--src/notificationmonitor.cpp27
1 files changed, 7 insertions, 20 deletions
diff --git a/src/notificationmonitor.cpp b/src/notificationmonitor.cpp
index 50f7b91..50b2e3e 100644
--- a/src/notificationmonitor.cpp
+++ b/src/notificationmonitor.cpp
@@ -1,33 +1,25 @@
#include <QtCore/QDebug>
#include <QtDBus/QDBusConnection>
#include <QtDBus/QDBusConnectionInterface>
-
#include "notificationmonitor.h"
static NotificationMonitor *global_monitor = 0;
-namespace
-{
-
-}
-
NotificationMonitor::NotificationMonitor(QObject *parent) :
QObject(parent)
{
QDBusConnection bus = QDBusConnection::sessionBus();
-
- _watcher = new QDBusServiceWatcher("org.freedesktop.Notifications", bus,
- QDBusServiceWatcher::WatchForOwnerChange,
- this);
- connect(_watcher, &QDBusServiceWatcher::serviceOwnerChanged,
- this, &NotificationMonitor::handleServiceOwnerChanged);
-
- bus.interface()->call("AddMatch",
- "interface='org.freedesktop.Notifications',member='Notify',type='method_call',eavesdrop='true'");
+ QDBusConnectionInterface *dbus = bus.interface();
+ dbus->call("AddMatch",
+ "interface='org.freedesktop.Notifications',member='Notify',type='method_call',eavesdrop='true'");
}
NotificationMonitor::~NotificationMonitor()
{
+ QDBusConnection bus = QDBusConnection::sessionBus();
+ QDBusConnectionInterface *dbus = bus.interface();
+ dbus->call("RemoveMatch",
+ "interface='org.freedesktop.Notifications',member='Notify',type='method_call',eavesdrop='true'");
}
NotificationMonitor *NotificationMonitor::instance()
@@ -37,8 +29,3 @@ NotificationMonitor *NotificationMonitor::instance()
}
return global_monitor;
}
-
-void NotificationMonitor::handleServiceOwnerChanged(const QString &serviceName, const QString &oldOwner, const QString &newOwner)
-{
- qDebug() << "Service owner changed" << serviceName << oldOwner << newOwner;
-}