fixed two deprecates and added a simple test

This commit is contained in:
Patrick von Reth 2014-01-10 18:54:30 +01:00
parent 329f36ac38
commit f19a561799
4 changed files with 11 additions and 3 deletions

View File

@ -92,8 +92,7 @@ uint FreedesktopFrontend::Notify(const QString &app_name, uint replaces_id,
#endif #endif
Application *a = new Application(app_name,appIcon); Application *a = new Application(app_name,appIcon);
a->addAlert(new Alert("DBus Alert","DBus Alert",appIcon)); a->addAlert(new Alert("DBus Alert","DBus Alert",appIcon));
snore()->addApplication(a); snore()->registerApplication(a);
snore()->applicationIsInitialized(a);
} }
if (hints.contains("urgency")) { if (hints.contains("urgency")) {

View File

@ -71,7 +71,7 @@ void SnoreNotify::save(){
void SnoreNotify::exit(){ void SnoreNotify::exit(){
qDebug()<<"Saving snore settings"; qDebug()<<"Saving snore settings";
foreach(Application *a,m_snore->aplications()){ foreach(Application *a,m_snore->aplications()){
m_snore->removeApplication(a->name()); m_snore->deregisterApplication(a);
} }
save(); save();
m_trayIcon->hide(); m_trayIcon->hide();

View File

@ -40,6 +40,8 @@ void TrayIcon::initConextMenu(SnoreCore *snore){
_trayMenu = new QMenu("SnoreNotify"); _trayMenu = new QMenu("SnoreNotify");
_trayMenu->addAction(QString("SnoreNotify ").append(Version::version())); _trayMenu->addAction(QString("SnoreNotify ").append(Version::version()));
_trayMenu->addSeparator(); _trayMenu->addSeparator();
connect(_trayMenu->addAction(QString("Test")), SIGNAL(triggered()), this, SLOT(slotTestNotification()));
_trayMenu->addSeparator();
foreach(const QString &back,_snore->notificationBackends()){ foreach(const QString &back,_snore->notificationBackends()){
QAction *b= new QAction(back,this); QAction *b= new QAction(back,this);
connect(b,SIGNAL(triggered()),this,SLOT(setPrimaryBackend())); 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);
}

View File

@ -44,6 +44,7 @@ private:
public slots: public slots:
void setPrimaryBackend(); void setPrimaryBackend();
void slotTestNotification();
}; };
#endif // TRAYICON_H #endif // TRAYICON_H