diff --git a/src/plugins/snarlnetwork/snarlnetwork.cpp b/src/plugins/snarlnetwork/snarlnetwork.cpp index aee88fc..8b9e13d 100644 --- a/src/plugins/snarlnetwork/snarlnetwork.cpp +++ b/src/plugins/snarlnetwork/snarlnetwork.cpp @@ -95,6 +95,7 @@ void SnarlNetworkFrontend::handleMessages(){ } void SnarlNetworkFrontend::callback(const SnarlNotification &sn,QString msg){ + qDebug()<<"SnarlNetwork callback:"<id(); notifications.remove(sn.notification->id()); if(sn.clientSocket!=NULL&&!msg.isEmpty()){ msg+=QString::number(sn.notification->id()); diff --git a/src/snorenotify.cpp b/src/snorenotify.cpp index 4cf170d..8a5c67d 100644 --- a/src/snorenotify.cpp +++ b/src/snorenotify.cpp @@ -52,9 +52,10 @@ SnoreNotify::SnoreNotify() } + load(); + _trayIcon->initConextMenu(_snore); - load(); connect(qApp,SIGNAL(aboutToQuit()),this,SLOT(exit())); } diff --git a/src/trayicon.cpp b/src/trayicon.cpp index 3804a86..7a29894 100644 --- a/src/trayicon.cpp +++ b/src/trayicon.cpp @@ -36,6 +36,10 @@ void TrayIcon::initConextMenu(SnoreServer *snore){ foreach(Notification_Backend *back,_snore->primaryNotificationBackends()){ QAction *b= new QAction(back->name(),this); connect(b,SIGNAL(triggered()),this,SLOT(setPrimaryBackend())); + b->setCheckable(true); + if(back->name() == _snore->primaryNotificationBackend()->name()) + b->setChecked(true); + _backendActions.append(b); _trayMenu->addAction(b); } _trayMenu->addSeparator(); @@ -56,6 +60,12 @@ QSystemTrayIcon* TrayIcon::trayIcon(){ void TrayIcon::setPrimaryBackend(){ QAction *a= dynamic_cast(sender()); _snore->setPrimaryNotificationBackend(_snore->primaryNotificationBackends().value(a->text())); + + foreach(QAction *action,_backendActions){ + action->setChecked(false); + } + a->setChecked(true); + } diff --git a/src/trayicon.h b/src/trayicon.h index 49d0550..7ea39df 100644 --- a/src/trayicon.h +++ b/src/trayicon.h @@ -31,6 +31,7 @@ public: private: class QSystemTrayIcon *_trayIcon; class QMenu *_trayMenu; + class QList _backendActions; class SnoreServer *_snore;