- type = "PrivMsgFocused"; break;
- }
-
- QString message = QString("<b><%1></b> %2").arg(n.sender, Qt::escape(n.message));
- KNotification *notification = KNotification::event(type, message, DesktopIcon("dialog-information"), QtUi::mainWindow(),
- KNotification::RaiseWidgetOnActivation
- |KNotification::CloseWhenWidgetActivated
- |KNotification::CloseOnTimeout);
- connect(notification, SIGNAL(activated(uint)), SLOT(notificationActivated()));
- notification->setActions(QStringList("View"));
- notification->setProperty("notificationId", n.notificationId);
-
- _notifications.append(qMakePair(n.notificationId, QPointer<KNotification>(notification)));
-
- updateToolTip();
- QtUi::mainWindow()->systemTray()->setAlert(true);
+ type = "PrivMsgFocused";
+ break;
+ }
+
+ QString message = QString("<b><%1></b> %2").arg(n.sender, n.message.toHtmlEscaped());
+ KNotification* notification = KNotification::event(type,
+ message,
+ QStringLiteral("dialog-information"),
+ QtUi::mainWindow(),
+ KNotification::RaiseWidgetOnActivation | KNotification::CloseWhenWidgetActivated
+ | KNotification::CloseOnTimeout);
+ connect(notification,
+ selectOverload<uint>(&KNotification::activated),
+ this,
+ selectOverload<>(&KNotificationBackend::notificationActivated));
+#if KNOTIFICATIONS_VERSION >= QT_VERSION_CHECK(5,31,0)
+ notification->setDefaultAction(tr("View"));
+#else
+ notification->setActions(QStringList{tr("View")});
+#endif
+ notification->setProperty("notificationId", n.notificationId);
+
+ _notifications.append(qMakePair(n.notificationId, QPointer<KNotification>(notification)));
+
+ updateToolTip();