X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Fsystraynotificationbackend.cpp;h=e82af91a1b6e8f887b3f97c9ff275f86e5d72202;hp=545c22dd9c062e8b466a972a390d6cf46dfec877;hb=e543fd403c4315d8569ea09d868b6fface37b207;hpb=7da3e74627f876b958fb48b89696f0975cd7d590 diff --git a/src/qtui/systraynotificationbackend.cpp b/src/qtui/systraynotificationbackend.cpp index 545c22dd..e82af91a 100644 --- a/src/qtui/systraynotificationbackend.cpp +++ b/src/qtui/systraynotificationbackend.cpp @@ -41,6 +41,8 @@ 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) { @@ -70,6 +72,7 @@ void SystrayNotificationBackend::close(uint notificationId) { if(_notifications.isEmpty()) { */ _notifications.clear(); + _activeId = 0; closeBubble(); QtUi::mainWindow()->systemTray()->setAlert(false); } @@ -77,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); @@ -93,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) {