From ae27b79dd9cd12d435a814dcaec51008db00c222 Mon Sep 17 00:00:00 2001 From: Martin Rotter Date: Fri, 1 Apr 2016 07:18:44 +0200 Subject: [PATCH] Fixed nots call. --- src/gui/notifications/notification.cpp | 2 ++ src/gui/notifications/notification.h | 2 ++ src/miscellaneous/application.cpp | 7 +++++++ 3 files changed, 11 insertions(+) diff --git a/src/gui/notifications/notification.cpp b/src/gui/notifications/notification.cpp index c79752c62..d1b0209e2 100755 --- a/src/gui/notifications/notification.cpp +++ b/src/gui/notifications/notification.cpp @@ -60,9 +60,11 @@ Notification::~Notification() { qDebug("Destroying Notification instance."); } +#if defined(Q_OS_LINUX) bool Notification::areDBusNotificationsEnabled() { return qApp->settings()->value(GROUP(GUI), SETTING(GUI::UseFancyNotifications)).toBool(); } +#endif bool Notification::areNotificationsEnabled() { return qApp->settings()->value(GROUP(GUI), SETTING(GUI::EnableNotifications)).toBool(); diff --git a/src/gui/notifications/notification.h b/src/gui/notifications/notification.h index 31ccad05a..7ff71f206 100755 --- a/src/gui/notifications/notification.h +++ b/src/gui/notifications/notification.h @@ -36,7 +36,9 @@ class Notification : public QObject { explicit Notification(QObject *parent = 0); virtual ~Notification(); +#if defined(Q_OS_LINUX) static bool areDBusNotificationsEnabled(); +#endif static bool areNotificationsEnabled(); public slots: diff --git a/src/miscellaneous/application.cpp b/src/miscellaneous/application.cpp index 98dd4c525..4345e886d 100755 --- a/src/miscellaneous/application.cpp +++ b/src/miscellaneous/application.cpp @@ -219,6 +219,7 @@ void Application::showGuiMessage(const QString &title, const QString &message, bool show_at_least_msgbox, const QIcon &custom_icon, QObject *invokation_target, const char *invokation_slot) { if (Notification::areNotificationsEnabled()) { +#if defined(Q_OS_LINUX) if (Notification::areDBusNotificationsEnabled()) { // Show OSD instead if tray icon bubble, depending on settings. if (custom_icon.isNull()) { @@ -234,6 +235,12 @@ void Application::showGuiMessage(const QString &title, const QString &message, trayIcon()->showMessage(title, message, message_type, TRAY_ICON_BUBBLE_TIMEOUT, invokation_target, invokation_slot); return; } +#else + if (SystemTrayIcon::isSystemTrayActivated()) { + trayIcon()->showMessage(title, message, message_type, TRAY_ICON_BUBBLE_TIMEOUT, invokation_target, invokation_slot); + return; + } +#endif } if (show_at_least_msgbox) {