Use KMenu for the kdenotification plugin if ENABLE_KNOTIFICATIONS isn't enabled

This commit is contained in:
codestation
2015-02-21 00:32:26 -04:30
parent be0f4b9b20
commit 99e8ca1002
5 changed files with 3 additions and 18 deletions

View File

@@ -10,6 +10,7 @@ INCLUDEPATH += src/
greaterThan(QT_MAJOR_VERSION, 4): ENABLE_KNOTIFICATIONS { greaterThan(QT_MAJOR_VERSION, 4): ENABLE_KNOTIFICATIONS {
message("Enabling KDE5 notifications") message("Enabling KDE5 notifications")
QT += KNotifications QT += KNotifications
DEFINES += ENABLE_KNOTIFICATIONS=1
} else { } else {
LIBS += -lkdeui LIBS += -lkdeui
} }

View File

@@ -156,15 +156,9 @@ void MainWidget::connectSignals()
void MainWidget::setTrayTooltip(QString message) void MainWidget::setTrayTooltip(QString message)
{ {
#ifndef ENABLE_KDE_NOTIFIER
if(trayIcon) { if(trayIcon) {
trayIcon->setToolTip(message); trayIcon->setToolTip(message);
} }
#else
if(notifierItem) {
notifierItem->setToolTipSubTitle(message);
}
#endif
} }
void MainWidget::openManager() void MainWidget::openManager()

View File

@@ -30,9 +30,6 @@
#include <QWidget> #include <QWidget>
#include <QSystemTrayIcon> #include <QSystemTrayIcon>
#ifdef ENABLE_KDE_NOTIFIER
#include "kdenotifier.h"
#endif
#ifdef Q_OS_LINUX #ifdef Q_OS_LINUX
#include <QDBusConnection> #include <QDBusConnection>

View File

@@ -18,7 +18,7 @@
*/ */
#include "kdenotifiertray.h" #include "kdenotifiertray.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) #ifndef ENABLE_KNOTIFICATIONS
#include <kmenu.h> #include <kmenu.h>
#else #else
#include <QMenu> #include <QMenu>
@@ -45,7 +45,7 @@ void KDENotifierTray::init()
connect(about_qt, SIGNAL(triggered()), this, SIGNAL(showAboutQt())); connect(about_qt, SIGNAL(triggered()), this, SIGNAL(showAboutQt()));
connect(quit, SIGNAL(triggered()), this, SIGNAL(stopServer())); connect(quit, SIGNAL(triggered()), this, SIGNAL(stopServer()));
#if QT_VERSION < 0x050000 #ifndef ENABLE_KNOTIFICATIONS
KMenu *tray_icon_menu = new KMenu(this); KMenu *tray_icon_menu = new KMenu(this);
#else #else
QMenu *tray_icon_menu = new QMenu(this); QMenu *tray_icon_menu = new QMenu(this);

View File

@@ -47,14 +47,7 @@ private:
QAction *about; QAction *about;
QAction *about_qt; QAction *about_qt;
#ifndef ENABLE_KDE_NOTIFIER
QSystemTrayIcon *m_tray_icon; QSystemTrayIcon *m_tray_icon;
#else
KDENotifier *m_notifier_item;
#endif
public slots:
}; };
#endif // QTRAYICON_H #endif // QTRAYICON_H