/***************************************************************************
- * Copyright (C) 2005-2012 by the Quassel Project *
+ * Copyright (C) 2005-2016 by the Quassel Project *
* devel@quassel-irc.org *
* *
* This program is free software; you can redistribute it and/or modify *
#include <QApplication>
#include <QCheckBox>
#include <QGroupBox>
+#include <QIcon>
#include <QHBoxLayout>
#include "systraynotificationbackend.h"
#include "client.h"
#include "clientsettings.h"
-#include "icon.h"
-#include "iconloader.h"
#include "mainwin.h"
#include "networkmodel.h"
#include "qtui.h"
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<Notification>::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();
}
}
void SystrayNotificationBackend::notificationActivated(SystemTray::ActivationReason reason)
{
if (reason == SystemTray::Trigger) {
- notificationActivated(0);
+ if (_notifications.count())
+ notificationActivated(_notifications.last().notificationId);
+ else
+ GraphicalUi::toggleMainWidget();
}
}
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);