Check for KNotifications version
[quassel.git] / src / qtui / knotificationbackend.cpp
index feb0d26..5282bd7 100644 (file)
@@ -25,6 +25,7 @@
 
 #include <KNotifications/KNotification>
 #include <KNotifyConfig/KNotifyConfigWidget>
+#include <knotifications_version.h>
 
 #include "client.h"
 #include "icon.h"
@@ -73,7 +74,11 @@ void KNotificationBackend::notify(const Notification& n)
             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)));