X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fqtui%2Fsystraynotificationbackend.cpp;h=c6be4baab895e0671ac2778e9291b6c602029a32;hb=092e6b212637ffbf68800584b7c1f32d1931b602;hp=551ae98ecb093c18a079b3c48f32cf2a5e18f1e0;hpb=f3d6f8088d8be6af9319a99fb8d2fee2837b540a;p=quassel.git diff --git a/src/qtui/systraynotificationbackend.cpp b/src/qtui/systraynotificationbackend.cpp index 551ae98e..c6be4baa 100644 --- a/src/qtui/systraynotificationbackend.cpp +++ b/src/qtui/systraynotificationbackend.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2014 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(); } }