From b34d7de18f0de977916629ed46faac1434543e9e Mon Sep 17 00:00:00 2001 From: Patrick von Reth Date: Sat, 11 Jan 2014 15:10:46 +0100 Subject: [PATCH] refactoring --- src/core/CMakeLists.txt | 1 + src/core/notification/icon.cpp | 3 +- src/core/plugins/plugincontainer.cpp | 13 +- src/core/plugins/snorebackend.cpp | 12 +- src/core/plugins/snorebackend.h | 2 +- src/core/plugins/snorefrontend.cpp | 4 +- src/core/snore.cpp | 151 ++++++++---------- src/core/snore.h | 36 +---- src/core/snore_p.cpp | 59 +++++++ src/core/snore_p.h | 51 ++++++ src/core/version.cpp.in | 4 + src/core/version.h | 2 + src/plugins/backends/growl/growl.cpp | 3 +- src/plugins/backends/snarl/snarl.cpp | 3 +- .../backends/snoretoast/snoretoast.cpp | 3 +- .../backends/trayicon/trayiconnotifer.cpp | 3 +- 16 files changed, 218 insertions(+), 132 deletions(-) create mode 100644 src/core/snore_p.cpp create mode 100644 src/core/snore_p.h diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 1601d0f..d1c347e 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -14,6 +14,7 @@ add_subdirectory(plugins) set ( SnoreNotify_SRCS ${SnoreNotify_SRCS} snore.cpp + snore_p.cpp application.cpp hint.cpp ${CMAKE_CURRENT_BINARY_DIR}/version.cpp diff --git a/src/core/notification/icon.cpp b/src/core/notification/icon.cpp index a269b86..9ac5a94 100644 --- a/src/core/notification/icon.cpp +++ b/src/core/notification/icon.cpp @@ -16,6 +16,7 @@ #include "icon.h" #include "../snore.h" +#include "../snore_p.h" #include "notification/icon_p.h" @@ -71,7 +72,7 @@ QString Icon::localUrl()const{ } else { - d->m_localUrl = QString("%1%2.png").arg(SnoreCore::snoreTMP(), hash()); + d->m_localUrl = QString("%1%2.png").arg(SnoreCorePrivate::snoreTMP(), hash()); image().save(d->m_localUrl ,"PNG"); m_localImageCache[hash()] = d->m_localUrl; } diff --git a/src/core/plugins/plugincontainer.cpp b/src/core/plugins/plugincontainer.cpp index c487022..7ca9f27 100644 --- a/src/core/plugins/plugincontainer.cpp +++ b/src/core/plugins/plugincontainer.cpp @@ -19,6 +19,7 @@ #include "../snore.h" +#include "../snore_p.h" #include "plugins.h" #include "snorebackend.h" #include "snorefrontend.h" @@ -35,7 +36,7 @@ QSettings &PluginContainer::cacheFile(){ #ifdef Q_OS_LINUX static QSettings cache("TheOneRing","libsnore"); #else - static QSettings cache(SnoreCore::pluginDir().absoluteFilePath("plugin.cache"),QSettings::IniFormat); + static QSettings cache(SnoreCorePrivate::pluginDir().absoluteFilePath("plugin.cache"),QSettings::IniFormat); #endif return cache; } @@ -60,7 +61,7 @@ SnorePlugin *PluginContainer::load() { if(m_instance != NULL) return m_instance; - QPluginLoader loader ( SnoreCore::pluginDir().absoluteFilePath(file())); + QPluginLoader loader ( SnoreCorePrivate::pluginDir().absoluteFilePath(file())); qDebug() << "Trying to load" << file(); if ( !loader.load()) { @@ -131,7 +132,7 @@ void PluginContainer::updatePluginCache(){ cache.clear(); foreach(const QString &type,PluginContainer::types()){ - QDir plPath(SnoreCore::pluginDir().absoluteFilePath(type)); + QDir plPath(SnoreCorePrivate::pluginDir().absoluteFilePath(type)); qDebug() << "Searching for plugins in" << plPath.path(); foreach (QString fileName, plPath.entryList(QDir::Files)) { QString filepath(plPath.absoluteFilePath(fileName)); @@ -148,7 +149,7 @@ void PluginContainer::updatePluginCache(){ plugin->deleteLater(); continue; } - PluginContainer *info = new PluginContainer( SnoreCore::pluginDir().relativeFilePath(filepath),sp->name(),PluginContainer::typeFromString(type)); + PluginContainer *info = new PluginContainer( SnoreCorePrivate::pluginDir().relativeFilePath(filepath),sp->name(),PluginContainer::typeFromString(type)); s_pluginCache.insert(info->name(),info); sp->deleteLater(); qDebug() << "added" << info->name() << "to cache"; @@ -157,7 +158,7 @@ void PluginContainer::updatePluginCache(){ qDebug()< plugins = s_pluginCache.values(); cache.beginWriteArray("plugins"); for(int i=0;i< plugins.size();++i) { @@ -176,7 +177,7 @@ QHash PluginContainer::pluginCache(){ QString version = cache.value("version").toString(); QString path = cache.value("pluginPath").toString(); int size = cache.beginReadArray("plugins"); - if(size == 0 || version != Version::revision() || path != SnoreCore::pluginDir().path()){ + if(size == 0 || version != Version::revision() || path != SnoreCorePrivate::pluginDir().path()){ cache.endArray(); updatePluginCache(); }else{ diff --git a/src/core/plugins/snorebackend.cpp b/src/core/plugins/snorebackend.cpp index 3c73a1c..01127ac 100644 --- a/src/core/plugins/snorebackend.cpp +++ b/src/core/plugins/snorebackend.cpp @@ -19,6 +19,7 @@ #include "snorebackend.h" #include "../snore.h" +#include "../snore_p.h" #include "../application.h" #include "../notification/notification.h" @@ -26,6 +27,7 @@ #include #include + namespace Snore{ SnoreBackend::SnoreBackend (const QString &name , bool canCloseNotification, bool supportsRichtext) : @@ -45,9 +47,11 @@ SnoreBackend::~SnoreBackend() bool SnoreBackend::init( SnoreCore *snore ) { if(!SnorePlugin::init(snore)) + { return false; - connect( snore,SIGNAL( applicationInitialized( Snore::Application* ) ),this,SLOT( slotRegisterApplication( Snore::Application* ) ) ); - connect( snore,SIGNAL( applicationRemoved( Snore::Application* ) ),this,SLOT( slotUnregisterApplication( Snore::Application* ) ) ); + } + connect( snore->d(), SIGNAL(applicationRegistered(Snore::Application*)), this, SLOT(slotRegisterApplication(Snore::Application*))); + connect( snore->d(), SIGNAL(applicationDeregistered(Snore::Application*)), this, SLOT(slotUnregisterApplication(Snore::Application*))); foreach(Application *a,snore->aplications()){ this->slotRegisterApplication(a); @@ -78,7 +82,7 @@ void SnoreBackend::closeNotification(Notification n, NotificationEnums::CloseRea } n.setCloseReason(reason); slotCloseNotification(n); - emit closeNotification(n); + emit notificationClosed(n); } void SnoreBackend::slotCloseNotification(Notification notification) @@ -99,7 +103,7 @@ SnoreSecondaryBackend::~SnoreSecondaryBackend() bool SnoreSecondaryBackend::init(SnoreCore *snore) { - connect( snore,SIGNAL( slotNotify(SnoreCore::Notification) ),this,SLOT( slotNotify( SnoreCore::Notification ) ) ); + connect( snore->d() ,SIGNAL( slotNotify(SnoreCore::Notification) ),this,SLOT( slotNotify( SnoreCore::Notification ) ) ); return SnoreBackend::init(snore); } diff --git a/src/core/plugins/snorebackend.h b/src/core/plugins/snorebackend.h index 0ff694b..0ec12a1 100644 --- a/src/core/plugins/snorebackend.h +++ b/src/core/plugins/snorebackend.h @@ -46,7 +46,7 @@ public: bool supportsRichtext(); signals: - void closeNotification( Snore::Notification ); + void notificationClosed( Snore::Notification ); public slots: diff --git a/src/core/plugins/snorefrontend.cpp b/src/core/plugins/snorefrontend.cpp index 7222654..99b1f6d 100644 --- a/src/core/plugins/snorefrontend.cpp +++ b/src/core/plugins/snorefrontend.cpp @@ -40,8 +40,10 @@ SnoreFrontend::~SnoreFrontend() bool SnoreFrontend::init( SnoreCore *snore ) { if(!SnorePlugin::init(snore)) + { return false; - connect( snore,SIGNAL ( notificationClosed( 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 e9b0cdd..ff2d09a 100644 --- a/src/core/snore.cpp +++ b/src/core/snore.cpp @@ -18,6 +18,7 @@ */ #include "snore.h" +#include "snore_p.h" #include "notification/notification.h" #include "plugins/plugincontainer.h" #include "plugins/plugins.h" @@ -36,41 +37,23 @@ using namespace Snore; -void SnoreCore::slotNotificationClosed(Notification n) + +SnoreCore::SnoreCore(QSystemTrayIcon *trayIcon ): + d_ptr(new SnoreCorePrivate(trayIcon )) { - emit notificationClosed(n); + Q_D(SnoreCore); + d->q_ptr = this; } -QString const SnoreCore::snoreTMP(){ - static const QString tmp = QString("%1/SnoreNotify/").arg(QDir::temp().path()); - return tmp; -} - - -SnoreCore::SnoreCore ( QSystemTrayIcon *trayIcon ) : - m_trayIcon ( trayIcon ) +SnoreCore::~SnoreCore() { - QDir home ( snoreTMP() ); - if ( !home.exists() ){ - home.cdUp(); - home.mkdir("SnoreNotify"); - } - + Q_D(SnoreCore); + d->deleteLater(); } -const QDir &SnoreCore::pluginDir(){ - static QDir path(QString("%1/snoreplugins").arg(qApp->applicationDirPath())); - if(!path.exists()) - { - path = QDir(LIBSNORE_PLUGIN_PATH); - } - qDebug() << "PluginDir" << path.absolutePath(); - return path; -} - - -void SnoreCore::loadPlugins ( PluginContainer::PluginTypes types ) +void SnoreCore::loadPlugins( PluginContainer::PluginTypes types ) { + Q_D(SnoreCore); qDebug() << "PluginInfo" << PluginContainer::pluginCache().keys(); foreach ( PluginContainer *info, PluginContainer::pluginCache().values()) { @@ -81,7 +64,7 @@ void SnoreCore::loadPlugins ( PluginContainer::PluginTypes types ) case PluginContainer::BACKEND: { qDebug() <name()<<"is a Notification_Backend"; - m_notificationBackends.append( info->name()); + d->m_notificationBackends.append( info->name()); break; } case PluginContainer::SECONDARY_BACKEND: @@ -90,7 +73,7 @@ void SnoreCore::loadPlugins ( PluginContainer::PluginTypes types ) info->unload(); break; } - m_secondaryNotificationBackends.append(info->name()); + d->m_secondaryNotificationBackends.append(info->name()); break; } case PluginContainer::FRONTEND: @@ -100,7 +83,7 @@ void SnoreCore::loadPlugins ( PluginContainer::PluginTypes types ) info->unload(); break; } - m_Frontends.append(info->name()); + d->m_Frontends.append(info->name()); break; } case PluginContainer::PLUGIN: @@ -110,7 +93,7 @@ void SnoreCore::loadPlugins ( PluginContainer::PluginTypes types ) info->unload(); break; } - m_plugins.append(info->name()); + d->m_plugins.append(info->name()); break; } default: @@ -127,87 +110,69 @@ void SnoreCore::loadPlugins ( PluginContainer::PluginTypes types ) void SnoreCore::broadcastNotification ( Notification notification ) { + Q_D(SnoreCore); qDebug()<<"Broadcasting"<notify ( notification ); + if ( d->m_notificationBackend != NULL ) { - if(!m_notificationBackend->isInitialized()){ - qDebug()<<"Notification backend "<m_notificationBackend->isInitialized()){ + qDebug()<<"Notification backend "<m_notificationBackend<<" isnt initialized will snore will exit now"; qApp->quit(); } - m_notificationBackend->slotNotify( notification ); - m_notificationBackend->addActiveNotification(notification); - } -} - - -void SnoreCore::notificationActionInvoked ( Notification notification ) -{ - emit actionInvoked(notification); - SnoreFrontend *nf = notification.source(); - if ( nf != NULL ) - { - nf->actionInvoked ( notification ); + d->m_notificationBackend->slotNotify( notification ); + d->m_notificationBackend->addActiveNotification(notification); } } void SnoreCore::registerApplication(Application *application) { - if(!m_applications.contains(application->name())) + Q_D(SnoreCore); + if(!d->m_applications.contains(application->name())) { - m_applications.insert ( application->name(),application ); - emit applicationInitialized ( application ); + d->m_applications.insert ( application->name(),application ); + emit d->applicationRegistered ( application ); } } -void SnoreCore::addApplication ( Application *application ) -{ - registerApplication(application); -} - -void SnoreCore::applicationIsInitialized ( Application *application ) -{ - registerApplication(application); -} - -void SnoreCore::removeApplication ( const QString& appName ) -{ - deregisterApplication( m_applications.value ( appName ) ); -} - void SnoreCore::deregisterApplication(Application *application) { - emit applicationRemoved (application ); - m_applications.take ( application->name() ); + Q_D(SnoreCore); + emit d->applicationDeregistered (application ); + d->m_applications.take ( application->name() ); application->deleteLater(); } const ApplicationsList &SnoreCore::aplications() const { - return m_applications; + Q_D(const SnoreCore); + return d->m_applications; } const QStringList &SnoreCore::notificationBackends() const { - return m_notificationBackends; + Q_D(const SnoreCore); + return d->m_notificationBackends; } const QStringList &SnoreCore::notificationFrontends() const { - return m_Frontends; + Q_D(const SnoreCore); + return d->m_Frontends; } const QStringList &SnoreCore::secondaryNotificationBackends() const { - return m_secondaryNotificationBackends; + Q_D(const SnoreCore); + return d->m_secondaryNotificationBackends; } bool SnoreCore::setPrimaryNotificationBackend ( const QString &backend ) { + Q_D(SnoreCore); if(!PluginContainer::pluginCache().contains(backend)){ qDebug()<<"Unknown Backend:"<(PluginContainer::pluginCache()[backend]->load()); @@ -216,13 +181,13 @@ bool SnoreCore::setPrimaryNotificationBackend ( const QString &backend ) qDebug() << "Failed to initialize" << b->name(); return false; } - if(m_notificationBackend) + if(d->m_notificationBackend) { - disconnect(m_notificationBackend, SIGNAL(closeNotification)); + disconnect(d->m_notificationBackend, SIGNAL(notificationClosed(Snore::Notification))); } - connect(b, SIGNAL(closeNotification), this, SLOT(slotNotificationClosed)); + connect(b, SIGNAL(notificationClosed(Snore::Notification)), d, SLOT(slotNotificationClosed(Snore::Notification))); } - m_notificationBackend = b; + d->m_notificationBackend = b; return true; } @@ -265,37 +230,49 @@ bool SnoreCore::setPrimaryNotificationBackend() const QString SnoreCore::primaryNotificationBackend() const { - if(m_notificationBackend.isNull()) + Q_D(const SnoreCore); + if(d->m_notificationBackend.isNull()) { return QString::null; } - return m_notificationBackend->name(); + return d->m_notificationBackend->name(); } QSystemTrayIcon *SnoreCore::trayIcon(){ - return m_trayIcon; + Q_D(SnoreCore); + return d->m_trayIcon; } Notification SnoreCore::getActiveNotificationByID(uint id) { - if(!m_notificationBackend->isInitialized()){ - qDebug()<<"Notification backend "<m_notificationBackend->isInitialized()){ + qDebug() << "Notification backend " << d->m_notificationBackend << " isn't initialized will snore will exit now"; qApp->quit(); } - return m_notificationBackend->getActiveNotificationByID(id); + return d->m_notificationBackend->getActiveNotificationByID(id); } void SnoreCore::requestCloseNotification(Notification n, NotificationEnums::CloseReasons::closeReasons r) { - m_notificationBackend->requestCloseNotification(n,r); + Q_D(SnoreCore); + d->m_notificationBackend->requestCloseNotification(n,r); } bool SnoreCore::primaryBackendSupportsRichtext() { - return m_notificationBackend->supportsRichtext(); + Q_D(SnoreCore); + return d->m_notificationBackend->supportsRichtext(); } Hint &SnoreCore::hints() { - return m_hints; + Q_D(SnoreCore); + return d->m_hints; +} + +const SnoreCorePrivate *SnoreCore::d() +{ + Q_D(SnoreCore); + return d; } diff --git a/src/core/snore.h b/src/core/snore.h index e48baa7..6a0131c 100644 --- a/src/core/snore.h +++ b/src/core/snore.h @@ -31,32 +31,26 @@ #include class QSystemTrayIcon; -class QDir; namespace Snore{ +class SnoreCorePrivate; + class SNORE_EXPORT SnoreCore : public QObject { + Q_DECLARE_PRIVATE(SnoreCore) Q_OBJECT -public: - static const QString snoreTMP(); - static const QDir &pluginDir(); - public: SnoreCore (QSystemTrayIcon *trayIcon = NULL ); + ~SnoreCore(); void loadPlugins ( PluginContainer::PluginTypes types ); void broadcastNotification( Notification notification ); - void notificationActionInvoked( Notification notification );//TODO: move to private header void registerApplication( Application *application ); void deregisterApplication( Application *application ); - void Q_DECL_DEPRECATED addApplication ( Application *application ); - void Q_DECL_DEPRECATED applicationIsInitialized ( Application* application ); - void Q_DECL_DEPRECATED removeApplication ( const QString& appName ); - const ApplicationsList &aplications() const; const QStringList ¬ificationBackends() const; @@ -76,31 +70,17 @@ public: Hint &hints(); + const SnoreCorePrivate *d(); + + signals: - void applicationInitialized( Snore::Application* ); - void applicationRemoved( Snore::Application* ); - void notify( Snore::Notification noti ); void actionInvoked( Snore::Notification ); void notificationClosed(Snore::Notification ); -private slots: - void slotNotificationClosed(Snore::Notification); - - private: - Hint m_hints; - - ApplicationsList m_applications; + SnoreCorePrivate *d_ptr; - QStringList m_notificationBackends; - QStringList m_Frontends; - QStringList m_secondaryNotificationBackends; - QStringList m_plugins; - - QPointer m_notificationBackend; - - QSystemTrayIcon *m_trayIcon; }; diff --git a/src/core/snore_p.cpp b/src/core/snore_p.cpp new file mode 100644 index 0000000..a30ca91 --- /dev/null +++ b/src/core/snore_p.cpp @@ -0,0 +1,59 @@ +#include "snore_p.h" +#include "snore.h" +#include "plugins/plugins.h" +#include "plugins/snorebackend.h" +#include "plugins/snorefrontend.h" + +#include + +using namespace Snore; + + +QString const SnoreCorePrivate::snoreTMP(){ + static const QString tmp = QString("%1/SnoreNotify/").arg(QDir::temp().path()); + return tmp; +} + +const QDir &SnoreCorePrivate::pluginDir(){ + static QDir path(QString("%1/snoreplugins").arg(qApp->applicationDirPath())); + if(!path.exists()) + { + path = QDir(LIBSNORE_PLUGIN_PATH); + } + qDebug() << "PluginDir" << path.absolutePath(); + return path; +} + + +SnoreCorePrivate::SnoreCorePrivate(QSystemTrayIcon *trayIcon): + m_trayIcon(trayIcon) +{ + QDir home ( snoreTMP() ); + if ( !home.exists() ){ + home.cdUp(); + home.mkdir("SnoreNotify"); + } +} + +SnoreCorePrivate::~SnoreCorePrivate() +{ + +} + +void SnoreCorePrivate::notificationActionInvoked(Notification notification) const +{ + Q_Q(const SnoreCore); + emit const_cast(q)->actionInvoked(notification); + SnoreFrontend *nf = notification.source(); + if ( nf != NULL ) + { + nf->actionInvoked ( notification ); + } +} + +void SnoreCorePrivate::slotNotificationClosed(Notification n) +{ + Q_Q(SnoreCore); + emit q->notificationClosed(n); +} + diff --git a/src/core/snore_p.h b/src/core/snore_p.h new file mode 100644 index 0000000..adde2a7 --- /dev/null +++ b/src/core/snore_p.h @@ -0,0 +1,51 @@ +#ifndef SNORECOREPRIVATE_H +#define SNORECOREPRIVATE_H + +#include "snore.h" + +#include + +namespace Snore +{ +class SNORE_EXPORT SnoreCorePrivate : public QObject +{ + Q_DECLARE_PUBLIC(SnoreCore) + Q_OBJECT + +public: + static const QString snoreTMP(); + static const QDir &pluginDir(); +public: + SnoreCorePrivate(QSystemTrayIcon *trayIcon); + ~SnoreCorePrivate(); + + + void notificationActionInvoked(Notification notification) const; + +signals: + void applicationRegistered(Snore::Application*); + void applicationDeregistered(Snore::Application*); + void notify(Snore::Notification noti); + +private slots: + void slotNotificationClosed(Snore::Notification); + +private: + SnoreCore *q_ptr; + Hint m_hints; + + ApplicationsList m_applications; + + + QStringList m_notificationBackends; + QStringList m_Frontends; + QStringList m_secondaryNotificationBackends; + QStringList m_plugins; + + QPointer m_notificationBackend; + + QSystemTrayIcon *m_trayIcon; +}; +} + +#endif // SNORECOREPRIVATE_H diff --git a/src/core/version.cpp.in b/src/core/version.cpp.in index a2fedb4..be73c09 100644 --- a/src/core/version.cpp.in +++ b/src/core/version.cpp.in @@ -22,4 +22,8 @@ const QString Version::revision(){ return QLatin1String("${SNORE_REVISION}"); } +const QString Version::buildTime(){ + return QLatin1String(__TIMESTAMP__); +} + } diff --git a/src/core/version.h b/src/core/version.h index 92c41cb..6b54415 100644 --- a/src/core/version.h +++ b/src/core/version.h @@ -21,6 +21,8 @@ static const QString suffix(); static const QString revision(); +static const QString buildTime(); + }; } diff --git a/src/plugins/backends/growl/growl.cpp b/src/plugins/backends/growl/growl.cpp index 46286f8..4080549 100644 --- a/src/plugins/backends/growl/growl.cpp +++ b/src/plugins/backends/growl/growl.cpp @@ -21,6 +21,7 @@ #include "gntp.h" #include "core/snore.h" +#include "core/snore_p.h" #include @@ -147,7 +148,7 @@ void Growl::gntpCallback(const int &id,const std::string &reason,const std::stri else if(reason == "CLICK") { r = NotificationEnums::CloseReasons::CLOSED; - s_instance->snore()->notificationActionInvoked(n); + s_instance->snore()->d()->notificationActionInvoked(n); } s_instance->closeNotification(n,r); } diff --git a/src/plugins/backends/snarl/snarl.cpp b/src/plugins/backends/snarl/snarl.cpp index b6b683f..86bed06 100644 --- a/src/plugins/backends/snarl/snarl.cpp +++ b/src/plugins/backends/snarl/snarl.cpp @@ -20,6 +20,7 @@ #include "snarl.h" #include "core/snore.h" +#include "core/snore_p.h" #include "core/plugins/plugins.h" #include "core/plugins/snorebackend.h" @@ -88,7 +89,7 @@ public: if(notification.isValid()) { notification.setActionInvoked(data); - m_snarl->snore()->notificationActionInvoked(notification); + m_snarl->snore()->d()->notificationActionInvoked(notification); } break; case SnarlEnums::CallbackClosed: diff --git a/src/plugins/backends/snoretoast/snoretoast.cpp b/src/plugins/backends/snoretoast/snoretoast.cpp index 68f882e..4c54efd 100644 --- a/src/plugins/backends/snoretoast/snoretoast.cpp +++ b/src/plugins/backends/snoretoast/snoretoast.cpp @@ -1,5 +1,6 @@ #include "snoretoast.h" #include "core/snore.h" +#include "core/snore_p.h" #include "core/plugins/plugins.h" #include "core/plugins/snorebackend.h" @@ -110,7 +111,7 @@ void SnoreToast::slotToastNotificationClosed(int code, QProcess::ExitStatus) { case 0: reason = NotificationEnums::CloseReasons::CLOSED; - snore()->notificationActionInvoked(n); + snore()->d()->notificationActionInvoked(n); break; case 1: //hidden; diff --git a/src/plugins/backends/trayicon/trayiconnotifer.cpp b/src/plugins/backends/trayicon/trayiconnotifer.cpp index 92a736c..2be2a6c 100644 --- a/src/plugins/backends/trayicon/trayiconnotifer.cpp +++ b/src/plugins/backends/trayicon/trayiconnotifer.cpp @@ -1,5 +1,6 @@ #include "trayiconnotifer.h" #include "core/snore.h" +#include "core/snore_p.h" #include #include @@ -70,7 +71,7 @@ void TrayIconNotifer::actionInvoked(){ Notification n = snore()->getActiveNotificationByID(m_displayed); if(n.isValid()){ - snore()->notificationActionInvoked(n); + snore()->d()->notificationActionInvoked(n); closeNotification(n,NotificationEnums::CloseReasons::CLOSED); }