diff --git a/src/core/notification/NotificationEnums.h b/src/core/notification/NotificationEnums.h new file mode 100644 index 0000000..ab1d212 --- /dev/null +++ b/src/core/notification/NotificationEnums.h @@ -0,0 +1,48 @@ +/**************************************************************************************** + * Copyright (c) 2013 Patrick von Reth * + * * + * This program is free software; you can redistribute it and/or modify it under * + * the terms of the GNU General Public License as published by the Free Software * + * Foundation; either version 2 of the License, or (at your option) any later * + * version. * + * * + * This program is distributed in the hope that it will be useful, but WITHOUT ANY * + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * + * PARTICULAR PURPOSE. See the GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License along with * + * this program. If not, see . * + ****************************************************************************************/ + + +#ifndef NOTIFICATIONENUMS_H +#define NOTIFICATIONENUMS_H + +#include + +namespace Snore{ +namespace NotificationEnums{ + +namespace Prioritys{ +enum priority{ + LOW = -1, + NORMAL = 0, + HIGH = +1 +}; +Q_DECLARE_FLAGS(prioritys, priority) +Q_DECLARE_OPERATORS_FOR_FLAGS(prioritys) +} +namespace CloseReasons{ +enum closeReason +{ + NONE, + TIMED_OUT, + DISMISSED, + CLOSED +}; +Q_DECLARE_FLAGS(closeReasons, closeReason) +Q_DECLARE_OPERATORS_FOR_FLAGS(closeReasons) +} +} +} +#endif // NOTIFICATIONENUMS_H diff --git a/src/core/notification/notification.h b/src/core/notification/notification.h index 38f53e6..20cc0f5 100644 --- a/src/core/notification/notification.h +++ b/src/core/notification/notification.h @@ -19,33 +19,11 @@ #include "../snore_exports.h" #include "icon.h" +#include "NotificationEnums.h" + #include namespace Snore{ -namespace NotificationEnums{ - -namespace Prioritys{ -enum priority{ - LOW = -1, - NORMAL = 0, - HIGH = +1 -}; -Q_DECLARE_FLAGS(prioritys, priority) -Q_DECLARE_OPERATORS_FOR_FLAGS(prioritys) -} -namespace CloseReasons{ -enum closeReason -{ - NONE, - TIMED_OUT, - DISMISSED, - CLOSED -}; -Q_DECLARE_FLAGS(closeReasons, closeReason) -Q_DECLARE_OPERATORS_FOR_FLAGS(closeReasons) -} -} - class SNORE_EXPORT Notification { public: @@ -70,12 +48,10 @@ public: QString toString() const; const uint &id() const; - void setId(const uint &id); //timeout in seconds //0 means sticky const int &timeout() const; - void setActionInvoked ( Action *action ); - void setActionInvoked ( const int &actionID); + const Action* actionInvoked() const; void setSource(class SnoreFrontend *source)const; class SnoreFrontend *source() const; @@ -99,12 +75,18 @@ public: const QObject *data() const; +//protected://TODO::make only accesable from a backend + void setActionInvoked ( Action *action ); + void setActionInvoked ( const int &actionID); + void setId(const uint &id); + private: class NotificationData; NotificationData* d; static int notificationCount; static int notificationMetaID; + }; } diff --git a/src/core/plugins/plugins.cpp b/src/core/plugins/plugins.cpp index bfd8582..c4d4c4f 100644 --- a/src/core/plugins/plugins.cpp +++ b/src/core/plugins/plugins.cpp @@ -84,7 +84,7 @@ void SnorePlugin::notificationTimedOut(){ m_timeouts.take(id)->deleteLater(); Notification n = snore()->getActiveNotificationByID(id); if(n.isValid()){ - snore()->closeNotification(n,NotificationEnums::CloseReasons::TIMED_OUT); + snore()->requestCloseNotification(n,NotificationEnums::CloseReasons::TIMED_OUT); } } diff --git a/src/core/plugins/plugins.h b/src/core/plugins/plugins.h index 6c9a376..44e69b7 100644 --- a/src/core/plugins/plugins.h +++ b/src/core/plugins/plugins.h @@ -17,10 +17,10 @@ #ifndef SNORE_PLUGINS_H #define SNORE_PLUGINS_H #include "../snore_exports.h" -#include "../notification/notification.h" #include -#include +#include +#include namespace Snore{ class Application; diff --git a/src/core/plugins/snorebackend.cpp b/src/core/plugins/snorebackend.cpp index 11742bd..1a61336 100644 --- a/src/core/plugins/snorebackend.cpp +++ b/src/core/plugins/snorebackend.cpp @@ -17,6 +17,7 @@ #include "snorebackend.h" #include "../snore.h" #include "../application.h" +#include "../notification/notification.h" #include #include @@ -41,17 +42,34 @@ bool SnoreBackend::init( SnoreCore *snore ) { if(!SnorePlugin::init(snore)) return false; - connect( snore,SIGNAL( closeNotify( Snore::Notification ) ),this,SLOT( closeNotification( Snore::Notification) ) ); - connect( snore,SIGNAL( applicationInitialized( Snore::Application* ) ),this,SLOT( registerApplication( Snore::Application* ) ) ); - connect( snore,SIGNAL( applicationRemoved( Snore::Application* ) ),this,SLOT( unregisterApplication( Snore::Application* ) ) ); + connect( snore,SIGNAL( applicationInitialized( Snore::Application* ) ),this,SLOT( slotRegisterApplication( Snore::Application* ) ) ); + connect( snore,SIGNAL( applicationRemoved( Snore::Application* ) ),this,SLOT( slotUnregisterApplication( Snore::Application* ) ) ); foreach(Application *a,snore->aplications()){ - this->registerApplication(a); + this->slotRegisterApplication(a); } return true; } + +bool SnoreBackend::requestCloseNotification ( Notification notification,NotificationEnums::CloseReasons::closeReasons reason ) +{ + if(slotCloseNotification(notification)) + { + notification.setCloseReason(reason); + return true; + } + return false; +} + +void SnoreBackend::closeNotification(Notification n, NotificationEnums::CloseReasons::closeReasons reason) +{ + m_activeNotifications.remove(n.id()); + n.setCloseReason(reason); + emit closeNotification(n); +} + SnoreSecondaryBackend::SnoreSecondaryBackend(const QString &name) :SnoreBackend(name) { @@ -65,9 +83,20 @@ SnoreSecondaryBackend::~SnoreSecondaryBackend() bool SnoreSecondaryBackend::init(SnoreCore *snore) { - connect( snore,SIGNAL( notify(SnoreCore::Notification) ),this,SLOT( notify( SnoreCore::Notification ) ) ); + connect( snore,SIGNAL( slotNotify(SnoreCore::Notification) ),this,SLOT( slotNotify( SnoreCore::Notification ) ) ); return SnoreBackend::init(snore); } +Snore::Notification SnoreBackend::getActiveNotificationByID(uint id) +{ + return m_activeNotifications[id]; +} + +void SnoreBackend::addActiveNotification(Notification n) +{ + m_activeNotifications[n.id()] = n; +} + + } #include "snorebackend.moc" diff --git a/src/core/plugins/snorebackend.h b/src/core/plugins/snorebackend.h index 84b9a11..466433c 100644 --- a/src/core/plugins/snorebackend.h +++ b/src/core/plugins/snorebackend.h @@ -17,8 +17,8 @@ #ifndef SNORE_BACKEND_H #define SNORE_BACKEND_H #include "../snore_exports.h" -#include "../notification/notification.h" #include "plugins.h" +#include "../notification/notification.h" #include #include @@ -27,7 +27,7 @@ namespace Snore{ class SnoreCore; -class SNORE_EXPORT SnoreBackend:public SnorePlugin +class SNORE_EXPORT SnoreBackend : public SnorePlugin { Q_OBJECT Q_INTERFACES(Snore::SnorePlugin) @@ -36,13 +36,27 @@ public: virtual ~SnoreBackend(); virtual bool init(SnoreCore *snore); + bool requestCloseNotification( Snore::Notification notification,NotificationEnums::CloseReasons::closeReasons reason ); + + Snore::Notification getActiveNotificationByID(uint id); + void addActiveNotification(Notification n); + +signals: + void closeNotification( Snore::Notification ); public slots: - virtual void registerApplication ( Snore::Application *application ) = 0; - virtual void unregisterApplication ( Snore::Application *application ) = 0; - virtual uint notify ( Snore::Notification notification ) = 0; - virtual void closeNotification ( Snore::Notification notification ) =0; + virtual void slotRegisterApplication ( Snore::Application *application ) = 0; + virtual void slotUnregisterApplication ( Snore::Application *application ) = 0; + virtual uint slotNotify ( Snore::Notification notification ) = 0; + virtual bool slotCloseNotification ( Snore::Notification notification ) =0; + +protected: + void closeNotification(Snore::Notification,Snore::NotificationEnums::CloseReasons::closeReasons); + + +private: + QHash m_activeNotifications; diff --git a/src/core/plugins/snorefrontend.cpp b/src/core/plugins/snorefrontend.cpp index 2fe696a..a016651 100644 --- a/src/core/plugins/snorefrontend.cpp +++ b/src/core/plugins/snorefrontend.cpp @@ -39,7 +39,7 @@ bool SnoreFrontend::init( SnoreCore *snore ) { if(!SnorePlugin::init(snore)) return false; - connect( snore,SIGNAL ( closeNotify( Snore::Notification ) ),this,SLOT ( notificationClosed( Snore::Notification) ) ); + connect( snore,SIGNAL ( notificationClosed( Snore::Notification ) ),this,SLOT ( notificationClosed( Snore::Notification) ) ); return true; } } diff --git a/src/core/snore.cpp b/src/core/snore.cpp index 0e064c6..3df0401 100644 --- a/src/core/snore.cpp +++ b/src/core/snore.cpp @@ -46,6 +46,11 @@ QSettings *SnoreCore::cacheFile(){ #endif } +void SnoreCore::slotNotificationClosed(Notification n) +{ + emit notificationClosed(n); +} + QString const SnoreCore::version(){ static QString ver(QString().append(Version::major()).append(".").append(Version::minor()).append(Version::suffix())); return ver; @@ -223,19 +228,13 @@ uint SnoreCore::broadcastNotification ( Notification notification ) qDebug()<<"Notification backend "<quit(); } - notification.setId(m_notificationBackend->notify( notification )); - m_activeNotifications[notification.id()] = notification; + m_notificationBackend->slotNotify( notification ); + m_notificationBackend->addActiveNotification(notification); return notification.id(); } return -1; } -void SnoreCore::closeNotification ( Notification notification,const NotificationEnums::CloseReasons::closeReasons &reason ) -{ - notification.setCloseReason(reason); - m_activeNotifications.remove(notification.id()); - emit closeNotify ( notification ); -} void SnoreCore::notificationActionInvoked ( Notification notification ) { @@ -299,8 +298,10 @@ void SnoreCore::setPrimaryNotificationBackend ( const QString &backend ) qDebug()<<"Failed to initialize"<name(); return; } + connect(b,SIGNAL(closeNotification(Snore::Notification)),this,SLOT(slotNotificationClosed(Snore::Notification))); } + m_notificationBackend = b; } @@ -318,7 +319,19 @@ QSystemTrayIcon *SnoreCore::trayIcon(){ Notification SnoreCore::getActiveNotificationByID(uint id) { - return m_activeNotifications[id]; + if(!m_notificationBackend->isInitialized()){ + qDebug()<<"Notification backend "<quit(); + } + return m_notificationBackend->getActiveNotificationByID(id); +} + +void SnoreCore::requestCloseNotification(Notification n, NotificationEnums::CloseReasons::closeReasons r) +{ + if(m_notificationBackend->requestCloseNotification(n,r)) + { + emit notificationClosed(n); + } } } diff --git a/src/core/snore.h b/src/core/snore.h index 287dc3c..ba39164 100644 --- a/src/core/snore.h +++ b/src/core/snore.h @@ -46,7 +46,6 @@ public: uint broadcastNotification ( Notification notification ); - void closeNotification ( Notification notification, const NotificationEnums::CloseReasons::closeReasons &reason ); void notificationActionInvoked ( Notification notification ); void addApplication ( Application *application ); @@ -64,6 +63,9 @@ public: Notification getActiveNotificationByID(uint id); + void requestCloseNotification(Notification,NotificationEnums::CloseReasons::closeReasons); + + private: @@ -74,7 +76,6 @@ private: static QDir *s_pluginDir; ApplicationsList m_applications; - QHash m_activeNotifications; QStringList m_notificationBackends; @@ -92,7 +93,10 @@ signals: void applicationRemoved( Snore::Application* ); void notify( Snore::Notification noti ); void actionInvoked( Snore::Notification ); - void closeNotify( Snore::Notification ); + void notificationClosed(Snore::Notification ); + +private slots: + void slotNotificationClosed(Snore::Notification); }; diff --git a/src/plugins/backends/growl/CMakeLists.txt b/src/plugins/backends/growl/CMakeLists.txt index d692784..6500314 100644 --- a/src/plugins/backends/growl/CMakeLists.txt +++ b/src/plugins/backends/growl/CMakeLists.txt @@ -13,7 +13,8 @@ if( WITH_GROWL_BACKEND ) if(MINGW) #fiexes a multiple defenition error with static boost - SET_TARGET_PROPERTIES(growl PROPERTIES LINK_FLAGS -Wl,--allow-multiple-definition) + SET_TARGET_PROPERTIES(growl PROPERTIES LINK_FLAGS -Wl,--allow-multiple-definition COMPILE_FLAGS + "-Wno-undef -Wno-unused-parameter -Wno-unknown-pragmas -Wno-unused-local-typedefs -Wno-missing-field-initializers -Wno-strict-aliasing -Wno-reorder -Wno-unused-variable -Wno-unused-function" ) endif(MINGW) if(WIN32) diff --git a/src/plugins/backends/growl/growl.cpp b/src/plugins/backends/growl/growl.cpp index 0facadc..05c1909 100644 --- a/src/plugins/backends/growl/growl.cpp +++ b/src/plugins/backends/growl/growl.cpp @@ -38,12 +38,12 @@ Growl::Growl(): Growl::~Growl(){ if(snore() != NULL){ foreach(Application *a,snore()->aplications()){ - this->unregisterApplication(a); + this->slotUnregisterApplication(a); } } } -void Growl::registerApplication(Application *application){ +void Growl::slotRegisterApplication(Application *application){ gntp *growl = new gntp(application->name().toUtf8().constData(),application->icon().localUrl().toUtf8().constData()); @@ -62,14 +62,14 @@ void Growl::registerApplication(Application *application){ m_applications.insert(application->name(),growl); } -void Growl::unregisterApplication(Application *application){ +void Growl::slotUnregisterApplication(Application *application){ gntp *growl = m_applications.take(application->name()); if(growl == NULL) return; delete growl; } -uint Growl::notify(Notification notification){ +uint Growl::slotNotify(Notification notification){ gntp *growl = m_applications.value(notification.application()); if(growl == NULL) return -1; @@ -86,8 +86,9 @@ uint Growl::notify(Notification notification){ return m_id++; } -void Growl::closeNotification(Notification notification){ +bool Growl::slotCloseNotification(Notification notification){ Q_UNUSED(notification); + return false; } void Growl::gntpCallback(const int &id,const std::string &reason,const std::string &data){ @@ -103,7 +104,7 @@ void Growl::gntpCallback(const int &id,const std::string &reason,const std::stri n.setActionInvoked(QString(data.c_str()).toInt()); s_instance->snore()->notificationActionInvoked(n); } - s_instance->snore()->closeNotification(n,r); + s_instance->closeNotification(n,r); } diff --git a/src/plugins/backends/growl/growl.h b/src/plugins/backends/growl/growl.h index 74723ce..83b55c9 100644 --- a/src/plugins/backends/growl/growl.h +++ b/src/plugins/backends/growl/growl.h @@ -36,10 +36,10 @@ private: QHash m_applications; public slots: - void registerApplication(Snore::Application *application); - void unregisterApplication(Snore::Application *application); - uint notify(Snore::Notification notification); - void closeNotification(Snore::Notification notification); + void slotRegisterApplication(Snore::Application *application); + void slotUnregisterApplication(Snore::Application *application); + uint slotNotify(Snore::Notification notification); + bool slotCloseNotification(Snore::Notification notification); }; diff --git a/src/plugins/backends/snarl/CMakeLists.txt b/src/plugins/backends/snarl/CMakeLists.txt index b261a13..392b5ae 100644 --- a/src/plugins/backends/snarl/CMakeLists.txt +++ b/src/plugins/backends/snarl/CMakeLists.txt @@ -1,12 +1,17 @@ if(WIN32) message(STATUS "Adding Snarl notification backend") + + set( SNARL_SRC SnarlInterface.cpp snarl.cpp ) add_library(snarl MODULE ${SNARL_SRC} ) target_link_libraries(snarl snorecore ${QT_QTCORE_LIBRARY} ) + if(MINGW) + set_target_properties(snarl PROPERTIES COMPILE_FLAGS "-Wno-conversion-null") + endif(MINGW) install(TARGETS snarl ${SNORE_BACKEND_INSTALL_PATH}) diff --git a/src/plugins/backends/snarl/SnarlInterface.h b/src/plugins/backends/snarl/SnarlInterface.h index 436cb94..e4a23e0 100644 --- a/src/plugins/backends/snarl/SnarlInterface.h +++ b/src/plugins/backends/snarl/SnarlInterface.h @@ -1,7 +1,7 @@ #ifndef SNARL_INTERFACE_V42_H #define SNARL_INTERFACE_V42_H -#ifdef __MINGW32__ +#if defined(__MINGW32__) && !defined(MINGW_HAS_SECURE_API) #define MINGW_HAS_SECURE_API #endif diff --git a/src/plugins/backends/snarl/snarl.cpp b/src/plugins/backends/snarl/snarl.cpp index 99ca6ff..59e2f64 100644 --- a/src/plugins/backends/snarl/snarl.cpp +++ b/src/plugins/backends/snarl/snarl.cpp @@ -51,7 +51,7 @@ public: int action = msg->wParam; if(action == SnarlEnums::SnarlLaunched){ foreach(Application *a,m_snarl->snore()->aplications()){ - m_snarl->registerApplication(a); + m_snarl->slotRegisterApplication(a); } } @@ -88,7 +88,7 @@ public: qDebug()<<"Unknown snarl action found!!"; return false; } - m_snarl->snore()->closeNotification(notification,reason); + m_snarl->closeNotification(notification,reason); return true; } return false; @@ -112,7 +112,7 @@ SnarlBackend::~SnarlBackend() { if(snore() != NULL){ foreach(Application *a,snore()->aplications()){ - this->unregisterApplication(a); + this->slotUnregisterApplication(a); } } if(m_defautSnarlinetrface) @@ -130,7 +130,7 @@ bool SnarlBackend::init(SnoreCore *snore){ return SnoreBackend::init(snore); } -void SnarlBackend::registerApplication(Application *application){ +void SnarlBackend::slotRegisterApplication(Application *application){ SnarlInterface *snarlInterface = NULL; if(m_applications.contains(application->name())){ snarlInterface = m_applications.value(application->name()); @@ -154,7 +154,7 @@ void SnarlBackend::registerApplication(Application *application){ } } -void SnarlBackend::unregisterApplication(Application *application){ +void SnarlBackend::slotUnregisterApplication(Application *application){ SnarlInterface *snarlInterface = m_applications.take(application->name()); if(snarlInterface == NULL) return; @@ -164,7 +164,7 @@ void SnarlBackend::unregisterApplication(Application *application){ delete snarlInterface; } -uint SnarlBackend::notify(Notification notification){ +uint SnarlBackend::slotNotify(Notification notification){ SnarlInterface *snarlInterface = m_applications.value(notification.application()); if(snarlInterface == NULL){ qDebug()<Hide(notification.id()); + return true; } #include "snarl.moc" diff --git a/src/plugins/backends/snarl/snarl.h b/src/plugins/backends/snarl/snarl.h index eaf2205..761acfe 100644 --- a/src/plugins/backends/snarl/snarl.h +++ b/src/plugins/backends/snarl/snarl.h @@ -37,10 +37,10 @@ private: Snarl::V42::SnarlInterface* m_defautSnarlinetrface; public slots: - void registerApplication(Snore::Application *application); - void unregisterApplication(Snore::Application *application); - uint notify(Snore::Notification notification); - void closeNotification(Snore::Notification notification); + void slotRegisterApplication(Snore::Application *application); + void slotUnregisterApplication(Snore::Application *application); + uint slotNotify(Snore::Notification notification); + bool slotCloseNotification(Snore::Notification notification); }; diff --git a/src/plugins/backends/snoretoast/snoretoast.cpp b/src/plugins/backends/snoretoast/snoretoast.cpp index f3bf3ac..825dd39 100644 --- a/src/plugins/backends/snoretoast/snoretoast.cpp +++ b/src/plugins/backends/snoretoast/snoretoast.cpp @@ -49,17 +49,17 @@ bool SnoreToast::init(SnoreCore *snore) return SnoreBackend::init(snore); } -void SnoreToast::registerApplication(Application *application) +void SnoreToast::slotRegisterApplication(Application *application) { Q_UNUSED(application) } -void SnoreToast::unregisterApplication(Application *application) +void SnoreToast::slotUnregisterApplication(Application *application) { Q_UNUSED(application) } -uint SnoreToast::notify(Notification notification) +uint SnoreToast::slotNotify(Notification notification) { QProcess *p = new QProcess(this); @@ -87,9 +87,10 @@ uint SnoreToast::notify(Notification notification) } -void SnoreToast::closeNotification(Notification notification) +bool SnoreToast::slotCloseNotification(Notification notification) { Q_UNUSED(notification) + return false; } void SnoreToast::slotToastNotificationClosed(int code, QProcess::ExitStatus) @@ -123,7 +124,7 @@ void SnoreToast::slotToastNotificationClosed(int code, QProcess::ExitStatus) break; } - snore()->closeNotification(n,reason); + closeNotification(n,reason); } diff --git a/src/plugins/backends/snoretoast/snoretoast.h b/src/plugins/backends/snoretoast/snoretoast.h index 5a2f1f1..5cc3603 100644 --- a/src/plugins/backends/snoretoast/snoretoast.h +++ b/src/plugins/backends/snoretoast/snoretoast.h @@ -15,10 +15,10 @@ public: // SnoreBackend interface public slots: - void registerApplication(Snore::Application *application); - void unregisterApplication(Snore::Application *application); - uint notify(Snore::Notification notification); - void closeNotification(Snore::Notification notification); + void slotRegisterApplication(Snore::Application *application); + void slotUnregisterApplication(Snore::Application *application); + uint slotNotify(Snore::Notification notification); + bool slotCloseNotification(Snore::Notification notification); private slots: void slotToastNotificationClosed(int code, QProcess::ExitStatus); diff --git a/src/plugins/backends/trayicon/trayiconnotifer.cpp b/src/plugins/backends/trayicon/trayiconnotifer.cpp index e98f0ae..db5db45 100644 --- a/src/plugins/backends/trayicon/trayiconnotifer.cpp +++ b/src/plugins/backends/trayicon/trayiconnotifer.cpp @@ -12,9 +12,9 @@ Q_EXPORT_PLUGIN2(trayicon,TrayIconNotifer) TrayIconNotifer::TrayIconNotifer () : SnoreBackend ( "SystemTray" ), + m_trayIcon(NULL), m_id ( 0 ), - m_displayed(-1), - m_trayIcon(NULL) + m_displayed(-1) { } @@ -27,16 +27,16 @@ bool TrayIconNotifer::init(SnoreCore *snore){ return SnoreBackend::init(snore); } -void TrayIconNotifer::registerApplication ( Application *application ) +void TrayIconNotifer::slotRegisterApplication ( Application *application ) { Q_UNUSED ( application ) } -void TrayIconNotifer::unregisterApplication ( Application *application ) +void TrayIconNotifer::slotUnregisterApplication ( Application *application ) { Q_UNUSED ( application ) } -uint TrayIconNotifer::notify ( Notification notification ) +uint TrayIconNotifer::slotNotify ( Notification notification ) { m_notificationQue.append(notification); if(m_lastNotify.elapsed()> Notification::DefaultTimeout * 1000){ @@ -45,21 +45,17 @@ uint TrayIconNotifer::notify ( Notification notification ) return m_id++; } -void TrayIconNotifer::closeNotification ( Notification notification ) +bool TrayIconNotifer::slotCloseNotification( Notification notification ) { Q_UNUSED ( notification ) -} - -bool TrayIconNotifer::isPrimaryNotificationBackend() -{ - return true; + return false; } void TrayIconNotifer::displayNotification(){ qDebug()<<"Display"<getActiveNotificationByID(m_displayed); if(n.isValid()){ - snore()->closeNotification(n,NotificationEnums::CloseReasons::TIMED_OUT); + closeNotification(n,NotificationEnums::CloseReasons::TIMED_OUT); } displayNotification(); } @@ -85,7 +81,7 @@ void TrayIconNotifer::actionInvoked(){ n.setActionInvoked(n.actions().keys().first()); snore()->notificationActionInvoked(n); } - snore()->closeNotification(n,NotificationEnums::CloseReasons::CLOSED); + closeNotification(n,NotificationEnums::CloseReasons::CLOSED); } diff --git a/src/plugins/backends/trayicon/trayiconnotifer.h b/src/plugins/backends/trayicon/trayiconnotifer.h index 34245e4..8c31c20 100644 --- a/src/plugins/backends/trayicon/trayiconnotifer.h +++ b/src/plugins/backends/trayicon/trayiconnotifer.h @@ -18,13 +18,12 @@ class TrayIconNotifer:public Snore::SnoreBackend public: TrayIconNotifer (); virtual bool init(Snore::SnoreCore *snore); - bool isPrimaryNotificationBackend(); public slots: - void registerApplication ( Snore::Application *application ); - void unregisterApplication ( Snore::Application *application ); - uint notify ( Snore::Notification notification ); - void closeNotification ( Snore::Notification notification ); + void slotRegisterApplication ( Snore::Application *application ); + void slotUnregisterApplication ( Snore::Application *application ); + uint slotNotify ( Snore::Notification notification ); + bool slotCloseNotification ( Snore::Notification notification ); private: QSystemTrayIcon *m_trayIcon; @@ -36,7 +35,7 @@ private: private slots: void displayNotification(); void actionInvoked(); - void closeNotification(); + void slotCloseNotification(); }; #endif // TRAYICONNOTIFER_H diff --git a/src/plugins/frontends/freedesktop/freedesktopnotificationfrontend.cpp b/src/plugins/frontends/freedesktop/freedesktopnotificationfrontend.cpp index c725f32..824a0b6 100644 --- a/src/plugins/frontends/freedesktop/freedesktopnotificationfrontend.cpp +++ b/src/plugins/frontends/freedesktop/freedesktopnotificationfrontend.cpp @@ -107,7 +107,7 @@ void FreedesktopFrontend::CloseNotification(uint id){ Notification noti = snore()->getActiveNotificationByID(id); if(noti.isValid()) { - snore()->closeNotification(noti,NotificationEnums::CloseReasons::TIMED_OUT); + snore()->requestCloseNotification(noti,NotificationEnums::CloseReasons::TIMED_OUT); } }