Merge branch 'master' of git://gitorious.org/snorenotify/snorenotify

This commit is contained in:
Patrick von Reth 2011-01-02 01:14:20 +01:00
commit fd7098652a
4 changed files with 14 additions and 1 deletions

View File

@ -95,6 +95,7 @@ void SnarlNetworkFrontend::handleMessages(){
}
void SnarlNetworkFrontend::callback(const SnarlNotification &sn,QString msg){
qDebug()<<"SnarlNetwork callback:"<<sn.notification->id();
notifications.remove(sn.notification->id());
if(sn.clientSocket!=NULL&&!msg.isEmpty()){
msg+=QString::number(sn.notification->id());

View File

@ -52,9 +52,10 @@ SnoreNotify::SnoreNotify()
}
load();
_trayIcon->initConextMenu(_snore);
load();
connect(qApp,SIGNAL(aboutToQuit()),this,SLOT(exit()));
}

View File

@ -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<QAction*>(sender());
_snore->setPrimaryNotificationBackend(_snore->primaryNotificationBackends().value(a->text()));
foreach(QAction *action,_backendActions){
action->setChecked(false);
}
a->setChecked(true);
}

View File

@ -31,6 +31,7 @@ public:
private:
class QSystemTrayIcon *_trayIcon;
class QMenu *_trayMenu;
class QList<class QAction*> _backendActions;
class SnoreServer *_snore;