Use KNotifications if Frameworks integration is enabled
authorManuel Nickschas <sputnick@quassel-irc.org>
Sun, 15 Feb 2015 21:48:09 +0000 (22:48 +0100)
committerManuel Nickschas <sputnick@quassel-irc.org>
Sun, 15 Feb 2015 21:48:09 +0000 (22:48 +0100)
This brings back proper support for KNotify if KDE Frameworks
integration is enabled.

Note that quassel.notifyrc is installed in a different location
if KF5 as opposed to KDE4. If you don't have a system installation
of Quassel, you may have to manually copy that file from data/
to $HOME/.local/share/knofitications5 for KNotify to know about
Quassel.

CMakeLists.txt
data/CMakeLists.txt
src/qtui/CMakeLists.txt
src/qtui/knotificationbackend.cpp
src/qtui/knotificationbackend.h
src/qtui/mainwin.cpp

index 1cd2cca..4ec9377 100644 (file)
@@ -262,7 +262,7 @@ if (USE_QT5)
         endif()
 
         if (WITH_KDE)
-            find_package(KF5 COMPONENTS ConfigWidgets CoreAddons TextWidgets XmlGui QUIET)
+            find_package(KF5 COMPONENTS ConfigWidgets CoreAddons Notifications NotifyConfig TextWidgets XmlGui QUIET)
             set_package_properties(KF5 PROPERTIES TYPE REQUIRED
                 URL "http://www.kde.org"
                 DESCRIPTION "KDE Frameworks"
index 04b322b..5c6762d 100644 (file)
@@ -8,9 +8,13 @@ if (BUILD_GUI)
             install(FILES quassel.desktop DESTINATION ${CMAKE_INSTALL_APPDIR})
         endif()
 
-        if (KDE4_FOUND)
+        if (WITH_KDE4)
             install(FILES quassel.notifyrc DESTINATION ${CMAKE_INSTALL_DATADIR}/quassel)
         endif()
+
+        if (WITH_KF5)
+            install(FILES quassel.notifyrc DESTINATION ${CMAKE_INSTALL_KNOTIFY5RCDIR})
+        endif()
     endif()
 
     if (EMBED_DATA)
index f54c00e..ebf128a 100644 (file)
@@ -89,7 +89,8 @@ if (WITH_KDE4)
 endif()
 
 if (WITH_KF5)
-    list(APPEND LIBS KF5::ConfigWidgets KF5::XmlGui)
+    list(APPEND SOURCES knotificationbackend.cpp)
+    list(APPEND LIBS KF5::ConfigWidgets KF5::Notifications KF5::NotifyConfig KF5::XmlGui)
 endif()
 
 if (LIBSNORE_FOUND)
index 41d5638..1b09927 100644 (file)
  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.         *
  ***************************************************************************/
 
-#include <KNotification>
-#include <KNotifyConfigWidget>
+#include "knotificationbackend.h"
+
 #include <QIcon>
 #include <QTextDocument>
 #include <QVBoxLayout>
 
-#include "knotificationbackend.h"
+#ifdef HAVE_KDE4
+#  include <KNotification>
+#  include <KNotifyConfigWidget>
+#else
+#  include <KNotifications/KNotification>
+#  include <KNotifyConfig/KNotifyConfigWidget>
+#endif
 
 #include "client.h"
 #include "mainwin.h"
index 2f21c9e..25abcf9 100644 (file)
@@ -18,8 +18,7 @@
  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.         *
  ***************************************************************************/
 
-#ifndef KNOTIFICATIONBACKEND_H_
-#define KNOTIFICATIONBACKEND_H_
+#pragma once
 
 #include <QPointer>
 
@@ -52,7 +51,7 @@ private:
     void removeNotificationById(uint id);
     void updateToolTip();
 
-    QList<QPair<uint, QPointer<KNotification> > > _notifications;
+    QList<QPair<uint, QPointer<KNotification>>> _notifications;
 };
 
 
@@ -72,6 +71,3 @@ private slots:
 private:
     KNotifyConfigWidget *_widget;
 };
-
-
-#endif
index b64a0d9..7915c23 100644 (file)
@@ -98,7 +98,7 @@
 #include "topicwidget.h"
 #include "verticaldock.h"
 
-#ifndef HAVE_KDE4
+#ifndef HAVE_KDE
 #  ifdef HAVE_PHONON
 #    include "phononnotificationbackend.h"
 #  endif
 #  endif
 #  include "systraynotificationbackend.h"
 #  include "taskbarnotificationbackend.h"
-#else /* HAVE_KDE4 */
+#else /* HAVE_KDE */
 #  include "knotificationbackend.h"
-#endif /* HAVE_KDE4 */
+#endif /* HAVE_KDE */
 
 #ifdef HAVE_SSL
 #  include "sslinfodlg.h"
@@ -218,7 +218,7 @@ void MainWin::init()
     setupTitleSetter();
     setupHotList();
 
-#ifndef HAVE_KDE4
+#ifndef HAVE_KDE
 #  ifdef HAVE_PHONON
     QtUi::registerNotificationBackend(new PhononNotificationBackend(this));
 #  endif
@@ -230,9 +230,9 @@ void MainWin::init()
 
     QtUi::registerNotificationBackend(new TaskbarNotificationBackend(this));
 
-#else /* HAVE_KDE4 */
+#else /* HAVE_KDE */
     QtUi::registerNotificationBackend(new KNotificationBackend(this));
-#endif /* HAVE_KDE4 */
+#endif /* HAVE_KDE */
 
 #ifdef HAVE_INDICATEQT
     QtUi::registerNotificationBackend(new IndicatorNotificationBackend(this));
@@ -546,7 +546,7 @@ void MainWin::setupMenus()
     _viewMenu->addAction(coll->action("LockLayout"));
 
     _settingsMenu = menuBar()->addMenu(tr("&Settings"));
-#ifdef HAVE_KDE4
+#ifdef HAVE_KDE
     _settingsMenu->addAction(KStandardAction::configureNotifications(this, SLOT(showNotificationsDlg()), this));
     _settingsMenu->addAction(KStandardAction::keyBindings(this, SLOT(showShortcutsDlg()), this));
 #else