- KNotification *notification = KNotification::event(type, message, icon::get("dialog-information").pixmap(48), QtUi::mainWindow(),
- KNotification::RaiseWidgetOnActivation
- |KNotification::CloseWhenWidgetActivated
- |KNotification::CloseOnTimeout);
- connect(notification, selectOverload<uint>(&KNotification::activated), this, selectOverload<>(&KNotificationBackend::notificationActivated));
- notification->setActions(QStringList("View"));
+ 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