X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Fsystraynotificationbackend.cpp;h=c6be4baab895e0671ac2778e9291b6c602029a32;hp=ae16ac2e5b6ad883c88b74904286cf37d565fe13;hb=68878dc8366f2f4a0afe132847aad9a51a80cdbf;hpb=4a5065255e652dd0c301bac0db41b7afb777ef49 diff --git a/src/qtui/systraynotificationbackend.cpp b/src/qtui/systraynotificationbackend.cpp index ae16ac2e..c6be4baa 100644 --- a/src/qtui/systraynotificationbackend.cpp +++ b/src/qtui/systraynotificationbackend.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2013 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 * @@ -21,14 +21,13 @@ #include #include #include +#include #include #include "systraynotificationbackend.h" #include "client.h" #include "clientsettings.h" -#include "icon.h" -#include "iconloader.h" #include "mainwin.h" #include "networkmodel.h" #include "qtui.h" @@ -93,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(); } } @@ -109,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(); } } @@ -154,7 +157,7 @@ SettingsPage *SystrayNotificationBackend::createConfigWidget() const SystrayNotificationBackend::ConfigWidget::ConfigWidget(QWidget *parent) : SettingsPage("Internal", "SystrayNotification", parent) { _showBubbleBox = new QCheckBox(tr("Show a message in a popup")); - _showBubbleBox->setIcon(SmallIcon("dialog-information")); + _showBubbleBox->setIcon(QIcon::fromTheme("dialog-information")); connect(_showBubbleBox, SIGNAL(toggled(bool)), this, SLOT(widgetChanged())); QHBoxLayout *layout = new QHBoxLayout(this); layout->addWidget(_showBubbleBox);