X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Fknotificationbackend.cpp;h=fda674d25b37f0c4cfee523e6687cd8214edf29e;hp=df6fe7e57ae624da95825ad253f89a2530a960be;hb=16c9fb5606113ddbcbe4be61f8ed2b775f31055e;hpb=f824db0e31b54969e0b7fa0b5405b1e9173d482c
diff --git a/src/qtui/knotificationbackend.cpp b/src/qtui/knotificationbackend.cpp
index df6fe7e5..fda674d2 100644
--- a/src/qtui/knotificationbackend.cpp
+++ b/src/qtui/knotificationbackend.cpp
@@ -30,6 +30,7 @@
#include "iconloader.h"
#include "networkmodel.h"
#include "qtui.h"
+#include "systemtray.h"
KNotificationBackend::KNotificationBackend(QObject *parent) : AbstractNotificationBackend(parent) {
@@ -40,15 +41,32 @@ void KNotificationBackend::notify(const Notification &n) {
QString message = QString("<%1> %2").arg(n.sender, n.message);
KNotification *notification = KNotification::event("Highlight", message, DesktopIcon("dialog-information"), QtUi::mainWindow(),
KNotification::Persistent|KNotification::RaiseWidgetOnActivation|KNotification::CloseWhenWidgetActivated);
- connect(notification, SIGNAL(activated()), SLOT(notificationActivated()));
+ connect(notification, SIGNAL(activated(uint)), SLOT(notificationActivated()));
+ connect(notification, SIGNAL(closed()), SLOT(notificationClosed()));
+ notification->setActions(QStringList("View"));
+ _notificationIds[notification] = n.notificationId;
+
+ QtUi::mainWindow()->systemTray()->setAlert(true);
}
void KNotificationBackend::close(uint notificationId) {
Q_UNUSED(notificationId);
+ QtUi::mainWindow()->systemTray()->setAlert(false);
}
void KNotificationBackend::notificationActivated() {
- emit activated();
+ uint id = 0;
+ KNotification *n = qobject_cast(sender());
+ if(n && _notificationIds.contains(n))
+ id = _notificationIds.value(n);
+
+ emit activated(id);
+}
+
+void KNotificationBackend::notificationClosed() {
+ KNotification *n = qobject_cast(sender());
+ if(n && _notificationIds.contains(n))
+ _notificationIds.remove(n);
}
SettingsPage *KNotificationBackend::createConfigWidget() const {