Fixed nots call.

This commit is contained in:
Martin Rotter 2016-04-01 07:18:44 +02:00
parent cd6ec970fa
commit ae27b79dd9
3 changed files with 11 additions and 0 deletions

View File

@ -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();

View File

@ -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:

View File

@ -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) {