[kde-doc-english] [juk] /: Notify the user that JuK is docked on startup.

Michael Pyne mpyne at kde.org
Sun Oct 6 22:52:51 UTC 2013


Git commit 61e5fc8d9b437f9ec8efa507ea69de6e3a37e517 by Michael Pyne, on behalf of Shubham Chaudhary.
Committed on 06/10/2013 at 22:32.
Pushed by mpyne into branch 'master'.

Notify the user that JuK is docked on startup.

We show a simple notification if the user starts up JuK and it is set to
dock in the systray on startup (as otherwise the user may wonder why it
didn't open up). Although a "Do not show again" checkbox is not possible
with KNotification, it is possible to remove this additional
notification by going to "Application and System Notifications" in
System Settings to manage "Juk music player" application notifications.

We do *not* show a notification if a session is being restored to avoid
noise, however JuK will show the main window if the user tries to start
it up again after it's already running, so this should be OK.

Thanks to Shubham Chaudhary for the bugfix (you're been marked as the
patch author), and Michael for reporting the bug.

This bugfix adds new strings so it cannot be backported. It will show up
first in KDE SC 4.12.

BUG:316832
FIXED-IN:4.12
GUI:

M  +5    -0    juk.notifyrc
M  +7    -1    main.cpp

http://commits.kde.org/juk/61e5fc8d9b437f9ec8efa507ea69de6e3a37e517

diff --git a/juk.notifyrc b/juk.notifyrc
index cf4df1b..bfabb66 100644
--- a/juk.notifyrc
+++ b/juk.notifyrc
@@ -287,3 +287,8 @@ Comment[x-test]=xxA requested cover has failed to downloadxx
 Comment[zh_CN]=请求的封面下载失败
 Comment[zh_TW]=要求的封面無法成功下載
 Action=Popup
+
+[Event/dock_mode]
+Name=JuK running in dock mode
+Comment=Use context menu in system tray to restore.
+Action=Popup
diff --git a/main.cpp b/main.cpp
index d542403..78eb75d 100644
--- a/main.cpp
+++ b/main.cpp
@@ -21,6 +21,7 @@
 #include <klocale.h>
 #include <kglobal.h>
 #include <kconfiggroup.h>
+#include <knotification.h>
 
 #include "juk.h"
 
@@ -98,8 +99,13 @@ int main(int argc, char *argv[])
         juk->restore(1, false /* don't show */);
 
     KConfigGroup config(KGlobal::config(), "Settings");
-    if(!config.readEntry("StartDocked", false))
+    if(!config.readEntry("StartDocked", false)) {
         juk->show();
+    }
+    else if(!a.isSessionRestored()) {
+        QString message = i18n("JuK running in docked mode\nUse context menu in system tray to restore.");
+        KNotification::event("dock_mode","JuK Docked", message);
+    }
 
     return a.exec();
 }


More information about the kde-doc-english mailing list