From f19a561799fa98ad55077de3dac984080842f934 Mon Sep 17 00:00:00 2001 From: Patrick von Reth Date: Fri, 10 Jan 2014 18:54:30 +0100 Subject: [PATCH] fixed two deprecates and added a simple test --- .../freedesktop/freedesktopnotificationfrontend.cpp | 3 +-- src/snorenotify.cpp | 2 +- src/trayicon.cpp | 8 ++++++++ src/trayicon.h | 1 + 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/plugins/frontends/freedesktop/freedesktopnotificationfrontend.cpp b/src/plugins/frontends/freedesktop/freedesktopnotificationfrontend.cpp index 47c3652..6024b4e 100644 --- a/src/plugins/frontends/freedesktop/freedesktopnotificationfrontend.cpp +++ b/src/plugins/frontends/freedesktop/freedesktopnotificationfrontend.cpp @@ -92,8 +92,7 @@ uint FreedesktopFrontend::Notify(const QString &app_name, uint replaces_id, #endif Application *a = new Application(app_name,appIcon); a->addAlert(new Alert("DBus Alert","DBus Alert",appIcon)); - snore()->addApplication(a); - snore()->applicationIsInitialized(a); + snore()->registerApplication(a); } if (hints.contains("urgency")) { diff --git a/src/snorenotify.cpp b/src/snorenotify.cpp index b7b2a05..bb14a57 100644 --- a/src/snorenotify.cpp +++ b/src/snorenotify.cpp @@ -71,7 +71,7 @@ void SnoreNotify::save(){ void SnoreNotify::exit(){ qDebug()<<"Saving snore settings"; foreach(Application *a,m_snore->aplications()){ - m_snore->removeApplication(a->name()); + m_snore->deregisterApplication(a); } save(); m_trayIcon->hide(); diff --git a/src/trayicon.cpp b/src/trayicon.cpp index 8aa7125..3460b99 100644 --- a/src/trayicon.cpp +++ b/src/trayicon.cpp @@ -40,6 +40,8 @@ void TrayIcon::initConextMenu(SnoreCore *snore){ _trayMenu = new QMenu("SnoreNotify"); _trayMenu->addAction(QString("SnoreNotify ").append(Version::version())); _trayMenu->addSeparator(); + connect(_trayMenu->addAction(QString("Test")), SIGNAL(triggered()), this, SLOT(slotTestNotification())); + _trayMenu->addSeparator(); foreach(const QString &back,_snore->notificationBackends()){ QAction *b= new QAction(back,this); connect(b,SIGNAL(triggered()),this,SLOT(setPrimaryBackend())); @@ -75,3 +77,9 @@ void TrayIcon::setPrimaryBackend(){ } +void TrayIcon::slotTestNotification() +{ + Notification n("SnoreNotify","Default","Hello World","This is Snore",Icon(":/root/snore.png")); + _snore->broadcastNotification(n); +} + diff --git a/src/trayicon.h b/src/trayicon.h index dedb44e..0a0d8a5 100644 --- a/src/trayicon.h +++ b/src/trayicon.h @@ -44,6 +44,7 @@ private: public slots: void setPrimaryBackend(); + void slotTestNotification(); }; #endif // TRAYICON_H