X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fqtui%2Fsystraynotificationbackend.cpp;h=e82af91a1b6e8f887b3f97c9ff275f86e5d72202;hb=86a1220cc45c658954860e6dedbc18e38986ca94;hp=6b67b2028a9b0c56d6804b46344020ec238ca173;hpb=5941801a1a5a61dc6d3e409ba33ab413adc9005f;p=quassel.git diff --git a/src/qtui/systraynotificationbackend.cpp b/src/qtui/systraynotificationbackend.cpp index 6b67b202..e82af91a 100644 --- a/src/qtui/systraynotificationbackend.cpp +++ b/src/qtui/systraynotificationbackend.cpp @@ -41,9 +41,14 @@ SystrayNotificationBackend::SystrayNotificationBackend(QObject *parent) notificationSettings.notify("Systray/Animate", this, SLOT(animateChanged(const QVariant &))); connect(QtUi::mainWindow()->systemTray(), SIGNAL(messageClicked()), SLOT(notificationActivated())); + connect(QtUi::mainWindow()->systemTray(), SIGNAL(activated(QSystemTrayIcon::ActivationReason)), + SLOT(notificationActivated(QSystemTrayIcon::ActivationReason))); } void SystrayNotificationBackend::notify(const Notification ¬ification) { + if(notification.type != Highlight && notification.type != PrivMsg) + return; + /* fancy stuff to be implemented later: show notifications in order _notifications.append(notification); if(_showBubble && _notifications.count() == 1) { @@ -67,6 +72,7 @@ void SystrayNotificationBackend::close(uint notificationId) { if(_notifications.isEmpty()) { */ _notifications.clear(); + _activeId = 0; closeBubble(); QtUi::mainWindow()->systemTray()->setAlert(false); } @@ -74,7 +80,8 @@ void SystrayNotificationBackend::close(uint notificationId) { void SystrayNotificationBackend::showBubble() { // fancy stuff later: show messages in order // for now, we just show the last message - if(_notifications.isEmpty()) return; + if(_notifications.isEmpty()) + return; Notification n = _notifications.takeLast(); _activeId = n.notificationId; QString title = Client::networkModel()->networkName(n.bufferId) + " - " + Client::networkModel()->bufferName(n.bufferId); @@ -90,7 +97,16 @@ void SystrayNotificationBackend::closeBubble() { } void SystrayNotificationBackend::notificationActivated() { - emit activated(_activeId); + if(QtUi::mainWindow()->systemTray()->isAlerted()) { + QtUi::mainWindow()->systemTray()->setInhibitActivation(); + emit activated(_activeId); + } +} + +void SystrayNotificationBackend::notificationActivated(QSystemTrayIcon::ActivationReason reason) { + if(reason == QSystemTrayIcon::Trigger) { + notificationActivated(); + } } void SystrayNotificationBackend::showBubbleChanged(const QVariant &v) {