X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Fsystraynotificationbackend.cpp;h=ec66bddb113e9fbd281a806c0ee01800f5e83aed;hp=6b67b2028a9b0c56d6804b46344020ec238ca173;hb=6f442c275cc5a2d5f1084ac2ceca5f1ffce1d024;hpb=308e090392713b0fa2e402156fbae2fa74cab96a diff --git a/src/qtui/systraynotificationbackend.cpp b/src/qtui/systraynotificationbackend.cpp index 6b67b202..ec66bddb 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) { @@ -67,6 +69,7 @@ void SystrayNotificationBackend::close(uint notificationId) { if(_notifications.isEmpty()) { */ _notifications.clear(); + _activeId = 0; closeBubble(); QtUi::mainWindow()->systemTray()->setAlert(false); } @@ -74,7 +77,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 +94,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) {