[amarok] src: Remove "Configure Amarok" item from the systray menu.

Mark Kretschmann kretschmann at kde.org
Mon Jun 17 18:21:06 UTC 2013


Git commit 8490f7c2b470834e19a1a7f7bad7113c1e7dd5ef by Mark Kretschmann.
Committed on 17/06/2013 at 20:16.
Pushed by markey into branch 'master'.

Remove "Configure Amarok" item from the systray menu.

In a recent discussion on IRC, we agreed that having the configure
item in the tray menu does not really make sense (at least not for
Amarok). It was unclear though if it could be removed at all.

So now I found out how to remove it.

CCMAIL: amarok-devel at kde.org

M  +8    -5    src/TrayIcon.cpp

http://commits.kde.org/amarok/8490f7c2b470834e19a1a7f7bad7113c1e7dd5ef

diff --git a/src/TrayIcon.cpp b/src/TrayIcon.cpp
index d924644..5262595 100644
--- a/src/TrayIcon.cpp
+++ b/src/TrayIcon.cpp
@@ -57,6 +57,10 @@ Amarok::TrayIcon::TrayIcon( QObject *parent )
 
     setStatus( KStatusNotifierItem::Active );
 
+    // Remove the "Configure Amarok..." action, as it makes no sense in the tray menu
+    const QString preferences = KStandardAction::name( KStandardAction::Preferences );
+    contextMenu()->removeAction( ac->action( preferences ) );
+
     PERF_LOG( "Before adding actions" );
 
 #ifdef Q_WS_MAC
@@ -70,6 +74,9 @@ Amarok::TrayIcon::TrayIcon( QObject *parent )
     contextMenu()->addAction( ac->action( "play_pause" ) );
     contextMenu()->addAction( ac->action( "stop"       ) );
     contextMenu()->addAction( ac->action( "next"       ) );
+
+    contextMenu()->addSeparator();
+
     contextMenu()->setObjectName( "TrayIconContextMenu" );
 
     PERF_LOG( "Initializing system tray icon" );
@@ -287,19 +294,15 @@ Amarok::TrayIcon::updateMenu()
     if( m_extraActions.count() > 0 ||
         contextMenu()->actions().last() != actionCollection()->action( "file_quit" ) )
     {
-        KActionCollection const *ac = Amarok::actionCollection();
-        QAction *preferenceAction = ac->action( KStandardAction::name( KStandardAction::Preferences ) );
-        // remove the 3 bottom items, so we can push them to the bottom again
+        // remove the 2 bottom items, so we can push them to the bottom again
         contextMenu()->removeAction( actionCollection()->action( "file_quit" ) );
         contextMenu()->removeAction( actionCollection()->action( "minimizeRestore" ) );
-        contextMenu()->removeAction( preferenceAction );
 
         foreach( QAction* action, m_extraActions )
             contextMenu()->addAction( action );
 
         m_separator = contextMenu()->addSeparator();
         // readd
-        contextMenu()->addAction( preferenceAction );
         contextMenu()->addAction( actionCollection()->action( "minimizeRestore" ) );
         contextMenu()->addAction( actionCollection()->action( "file_quit" ) );
     }


More information about the Amarok-devel mailing list