cmake: avoid de-duplication of user's CXXFLAGS
[quassel.git] / src / qtui / knotificationbackend.cpp
index a3415d5..903446a 100644 (file)
@@ -1,5 +1,5 @@
 /***************************************************************************
- *   Copyright (C) 2005-2019 by the Quassel Project                        *
+ *   Copyright (C) 2005-2022 by the Quassel Project                        *
  *   devel@quassel-irc.org                                                 *
  *                                                                         *
  *   This program is free software; you can redistribute it and/or modify  *
@@ -25,6 +25,7 @@
 
 #include <KNotifications/KNotification>
 #include <KNotifyConfig/KNotifyConfigWidget>
+#include <knotifications_version.h>
 
 #include "client.h"
 #include "icon.h"
@@ -65,7 +66,7 @@ void KNotificationBackend::notify(const Notification& n)
     QString message = QString("<b>&lt;%1&gt;</b> %2").arg(n.sender, n.message.toHtmlEscaped());
     KNotification* notification = KNotification::event(type,
                                                        message,
-                                                       icon::get("dialog-information").pixmap(48),
+                                                       QStringLiteral("dialog-information"),
                                                        QtUi::mainWindow(),
                                                        KNotification::RaiseWidgetOnActivation | KNotification::CloseWhenWidgetActivated
                                                            | KNotification::CloseOnTimeout);
@@ -73,7 +74,11 @@ void KNotificationBackend::notify(const Notification& n)
             selectOverload<uint>(&KNotification::activated),
             this,
             selectOverload<>(&KNotificationBackend::notificationActivated));
-    notification->setActions(QStringList("View"));
+#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)));