diff options
author | Benjamin Jemlich <pcgod@users.sourceforge.net> | 2012-08-08 01:09:11 +0400 |
---|---|---|
committer | Benjamin Jemlich <pcgod@users.sourceforge.net> | 2012-08-08 01:09:11 +0400 |
commit | f5bac3d130cf90961a753f432ff9655c240a7b03 (patch) | |
tree | 89385567731b8d4dd431ddf9e18314160f9cb615 | |
parent | 7a0f358fbf211586f4680784b009662db8317200 (diff) |
Log: Fix compile and logic error for ballon messages
-rw-r--r-- | src/mumble/Log.cpp | 3 | ||||
-rw-r--r-- | src/mumble/Log_unix.cpp | 90 |
2 files changed, 46 insertions, 47 deletions
diff --git a/src/mumble/Log.cpp b/src/mumble/Log.cpp index 9069a3717..875d246dc 100644 --- a/src/mumble/Log.cpp +++ b/src/mumble/Log.cpp @@ -465,7 +465,8 @@ void Log::log(MsgType mt, const QString &console, const QString &terse, bool own return; // Message notification with balloon tooltips - postNotification(mt, console, plain); + if ((flags & Settings::LogBalloon) && !(g.mw->isActiveWindow() && g.mw->qdwLog->isVisible())) + postNotification(mt, console, plain); // Don't make any noise if we are self deafened if (g.s.bDeaf) diff --git a/src/mumble/Log_unix.cpp b/src/mumble/Log_unix.cpp index dd959146c..58595ca8c 100644 --- a/src/mumble/Log_unix.cpp +++ b/src/mumble/Log_unix.cpp @@ -38,60 +38,58 @@ void Log::postNotification(MsgType mt, const QString &console, const QString &plain) { // Message notification with balloon tooltips - if ((flags & Settings::LogBalloon) && !(g.mw->isActiveWindow() && g.mw->qdwLog->isVisible())) { - QString qsIcon; - switch (mt) { - case DebugInfo: - case CriticalError: - qsIcon=QLatin1String("gtk-dialog-error"); - break; - case Warning: - qsIcon=QLatin1String("gtk-dialog-warning"); - break; - case TextMessage: - qsIcon=QLatin1String("gtk-edit"); - break; - default: - qsIcon=QLatin1String("gtk-dialog-info"); - break; - } + QString qsIcon; + switch (mt) { + case DebugInfo: + case CriticalError: + qsIcon=QLatin1String("gtk-dialog-error"); + break; + case Warning: + qsIcon=QLatin1String("gtk-dialog-warning"); + break; + case TextMessage: + qsIcon=QLatin1String("gtk-edit"); + break; + default: + qsIcon=QLatin1String("gtk-dialog-info"); + break; + } #ifdef USE_DBUS - QDBusMessage response; - QVariantMap hints; - hints.insert(QLatin1String("desktop-entry"), QLatin1String("mumble")); + QDBusMessage response; + QVariantMap hints; + hints.insert(QLatin1String("desktop-entry"), QLatin1String("mumble")); - { - QDBusInterface kde(QLatin1String("org.kde.VisualNotifications"), QLatin1String("/VisualNotifications"), QLatin1String("org.kde.VisualNotifications")); - if (kde.isValid()) { - QList<QVariant> args; - args.append(QLatin1String("mumble")); - args.append(uiLastId); - args.append(QString()); - args.append(QLatin1String("mumble")); - args.append(msgName(mt)); - args.append(console); - args.append(QStringList()); - args.append(hints); - args.append(5000); + { + QDBusInterface kde(QLatin1String("org.kde.VisualNotifications"), QLatin1String("/VisualNotifications"), QLatin1String("org.kde.VisualNotifications")); + if (kde.isValid()) { + QList<QVariant> args; + args.append(QLatin1String("mumble")); + args.append(uiLastId); + args.append(QString()); + args.append(QLatin1String("mumble")); + args.append(msgName(mt)); + args.append(console); + args.append(QStringList()); + args.append(hints); + args.append(5000); - response = kde.callWithArgumentList(QDBus::AutoDetect, QLatin1String("Notify"), args); - } + response = kde.callWithArgumentList(QDBus::AutoDetect, QLatin1String("Notify"), args); } + } - if (response.type()!=QDBusMessage::ReplyMessage || response.arguments().at(0).toUInt()==0) { - QDBusInterface gnome(QLatin1String("org.freedesktop.Notifications"), QLatin1String("/org/freedesktop/Notifications"), QLatin1String("org.freedesktop.Notifications")); - if (gnome.isValid()) - response = gnome.call(QLatin1String("Notify"), QLatin1String("Mumble"), uiLastId, qsIcon, msgName(mt), console, QStringList(), hints, -1); - } + if (response.type()!=QDBusMessage::ReplyMessage || response.arguments().at(0).toUInt()==0) { + QDBusInterface gnome(QLatin1String("org.freedesktop.Notifications"), QLatin1String("/org/freedesktop/Notifications"), QLatin1String("org.freedesktop.Notifications")); + if (gnome.isValid()) + response = gnome.call(QLatin1String("Notify"), QLatin1String("Mumble"), uiLastId, qsIcon, msgName(mt), console, QStringList(), hints, -1); + } - if (response.type()==QDBusMessage::ReplyMessage && response.arguments().count() == 1) { - uiLastId = response.arguments().at(0).toUInt(); - } else { + if (response.type()==QDBusMessage::ReplyMessage && response.arguments().count() == 1) { + uiLastId = response.arguments().at(0).toUInt(); + } else { #else - if (true) { + if (true) { #endif - postQtNotification(mt, plain); - } + postQtNotification(mt, plain); } }
\ No newline at end of file |