#include "client.h"
#include "icon.h"
#include "iconloader.h"
+#include "mainwin.h"
#include "networkmodel.h"
#include "qtui.h"
{
connect(QtUi::mainWindow()->systemTray(), SIGNAL(activated(SystemTray::ActivationReason)),
SLOT(notificationActivated(SystemTray::ActivationReason)));
+
+ updateToolTip();
}
void KNotificationBackend::notify(const Notification &n) {
_notifications.append(qMakePair(n.notificationId, QPointer<KNotification>(notification)));
+ updateToolTip();
QtUi::mainWindow()->systemTray()->setAlert(true);
}
} else
++i;
}
+ updateToolTip();
}
void KNotificationBackend::close(uint notificationId) {
removeNotificationById(notificationId);
- if(!_notifications.count())
+ //if(!_notifications.count()) // FIXME make configurable
QtUi::mainWindow()->systemTray()->setAlert(false);
}
}
void KNotificationBackend::notificationActivated(SystemTray::ActivationReason reason) {
- if(reason == SystemTray::Trigger && _notifications.count()) {
- notificationActivated(_notifications.first().first); // oldest one
+ if(reason == SystemTray::Trigger) {
+ if( _notifications.count())
+ notificationActivated(_notifications.first().first); // oldest one
+ else
+ GraphicalUi::toggleMainWidget();
}
}
void KNotificationBackend::notificationActivated(uint notificationId) {
- QtUi::mainWindow()->systemTray()->setInhibitActivation();
emit activated(notificationId);
+}
+void KNotificationBackend::updateToolTip() {
+ QtUi::mainWindow()->systemTray()->setToolTip("Quassel IRC",
+ _notifications.count()? tr("%n pending highlights", "", _notifications.count()) : QString());
}
SettingsPage *KNotificationBackend::createConfigWidget() const {