X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Fsystraynotificationbackend.cpp;h=c6be4baab895e0671ac2778e9291b6c602029a32;hp=1608225852fb7cf754d32cd614b8e5545d965adf;hb=68878dc8366f2f4a0afe132847aad9a51a80cdbf;hpb=1cb02004ee5973b89368bd84f234d4652794690d diff --git a/src/qtui/systraynotificationbackend.cpp b/src/qtui/systraynotificationbackend.cpp index 16082258..c6be4baa 100644 --- a/src/qtui/systraynotificationbackend.cpp +++ b/src/qtui/systraynotificationbackend.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2015 by the Quassel Project * + * Copyright (C) 2005-2018 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -92,15 +92,16 @@ void SystrayNotificationBackend::close(uint notificationId) void SystrayNotificationBackend::notificationActivated(uint notificationId) { if (!_blockActivation) { - if (_notifications.count()) { - if (QtUi::mainWindow()->systemTray()->mode() == SystemTray::Legacy) - _blockActivation = true; // prevent double activation because both tray icon and bubble might send a signal - if (!notificationId) - notificationId = _notifications.count() ? _notifications.last().notificationId : 0; - emit activated(notificationId); + QList::iterator i = _notifications.begin(); + while (i != _notifications.end()) { + if (i->notificationId == notificationId) { + if (QtUi::mainWindow()->systemTray()->mode() == SystemTray::Legacy) + _blockActivation = true; // prevent double activation because both tray icon and bubble might send a signal + emit activated(notificationId); + break; + } + ++i; } - else - GraphicalUi::toggleMainWidget(); } } @@ -108,7 +109,10 @@ void SystrayNotificationBackend::notificationActivated(uint notificationId) void SystrayNotificationBackend::notificationActivated(SystemTray::ActivationReason reason) { if (reason == SystemTray::Trigger) { - notificationActivated(0); + if (_notifications.count()) + notificationActivated(_notifications.last().notificationId); + else + GraphicalUi::toggleMainWidget(); } }