From 9163753039f1114b86eebce9725dc5b42c74e720 Mon Sep 17 00:00:00 2001 From: Patrick von Reth Date: Sat, 18 Jan 2014 20:20:59 +0100 Subject: [PATCH] fixd linux --- src/core/plugins/snorebackend.cpp | 5 +++++ src/core/plugins/snorebackend.h | 1 + .../freedesktopnotification_backend.cpp | 19 ++++++++++++++++--- .../freedesktopnotification_backend.h | 3 ++- 4 files changed, 24 insertions(+), 4 deletions(-) diff --git a/src/core/plugins/snorebackend.cpp b/src/core/plugins/snorebackend.cpp index c813dba..52b8295 100644 --- a/src/core/plugins/snorebackend.cpp +++ b/src/core/plugins/snorebackend.cpp @@ -91,6 +91,11 @@ void SnoreBackend::closeNotification(Notification n, NotificationEnums::CloseRea emit notificationClosed(n); } +void SnoreBackend::setSupportsRichtext(bool b) +{ + m_supportsRichtext = b; +} + void SnoreBackend::slotCloseNotification(Notification notification) { Q_UNUSED(notification) diff --git a/src/core/plugins/snorebackend.h b/src/core/plugins/snorebackend.h index 257636e..5e485cc 100644 --- a/src/core/plugins/snorebackend.h +++ b/src/core/plugins/snorebackend.h @@ -58,6 +58,7 @@ public slots: protected: void closeNotification(Snore::Notification,Snore::NotificationEnums::CloseReasons::closeReasons); + void setSupportsRichtext(bool b); private: diff --git a/src/plugins/backends/freedesktop/freedesktopnotification_backend.cpp b/src/plugins/backends/freedesktop/freedesktopnotification_backend.cpp index cf4fc1e..fbeeefd 100644 --- a/src/plugins/backends/freedesktop/freedesktopnotification_backend.cpp +++ b/src/plugins/backends/freedesktop/freedesktopnotification_backend.cpp @@ -21,7 +21,7 @@ FreedesktopBackend::FreedesktopBackend () : { } -bool FreedesktopBackend::init(SnoreCore *snore){ +bool FreedesktopBackend::initialize(SnoreCore *snore){ m_interface = new org::freedesktop::Notifications( "org.freedesktop.Notifications", "/org/freedesktop/Notifications", QDBusConnection::sessionBus(), this ); @@ -29,11 +29,24 @@ bool FreedesktopBackend::init(SnoreCore *snore){ QDBusPendingReply reply = m_interface->GetCapabilities(); reply.waitForFinished(); QStringList caps = reply.value(); - m_supportsRichtext = caps.contains( "body-markup" ); + setSupportsRichtext(caps.contains( "body-markup" )); connect(m_interface, SIGNAL(ActionInvoked(uint,QString)), this, SLOT(slotActionInvoked(uint,QString))); connect(m_interface, SIGNAL(NotificationClosed(uint,uint)), this , SLOT(slotNotificationClosed(uint,uint))); - return SnoreBackend::init(snore); + return SnoreBackend::initialize(snore); +} + +bool FreedesktopBackend::deinitialize() +{ + if(SnoreBackend::deinitialize()) + { + disconnect(m_interface, SIGNAL(ActionInvoked(uint,QString)), this, SLOT(slotActionInvoked(uint,QString))); + disconnect(m_interface, SIGNAL(NotificationClosed(uint,uint)), this , SLOT(slotNotificationClosed(uint,uint))); + m_interface->deleteLater(); + m_interface = NULL; + return true; + } + return false; } void FreedesktopBackend::slotNotify ( Notification noti ) diff --git a/src/plugins/backends/freedesktop/freedesktopnotification_backend.h b/src/plugins/backends/freedesktop/freedesktopnotification_backend.h index 06b087d..458a465 100644 --- a/src/plugins/backends/freedesktop/freedesktopnotification_backend.h +++ b/src/plugins/backends/freedesktop/freedesktopnotification_backend.h @@ -10,7 +10,8 @@ class FreedesktopBackend:public Snore::SnoreBackend Q_PLUGIN_METADATA(IID "org.Snore.NotificationBackend/1.0") public: FreedesktopBackend(); - virtual bool init(Snore::SnoreCore *snore); + virtual bool initialize(Snore::SnoreCore *snore); + virtual bool deinitialize(); public slots: void slotNotify( Snore::Notification notification );