Patch for global shortcuts on Windows

Casper van Donderen casper.vandonderen at gmail.com
Sat Aug 8 14:36:06 CEST 2009


There has been a bug report this week about multimediakeys in
KDE/Amarok ( https://bugs.kde.org/show_bug.cgi?id=202747 )
Because of this I have been looking into the shortcuts on Windows.

it appears that MS locked all combinations with the plus and minus
keys to OS functions (even though not used, ctrl+alt+minus is to zoom
out using the screen magnifier, I never use that but still I cannot
use the combo in Amarok)

So for now I made a patch to switch to using Meta+<up/down> for volume changes:

diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp
index d451cb9..7339ded 100644
--- a/src/MainWindow.cpp
+++ b/src/MainWindow.cpp
@@ -694,13 +694,21 @@ MainWindow::createActions()

     action = new KAction( i18n( "Increase Volume" ), this );
     ac->addAction( "increaseVolume", action );
+    #ifndef Q_WS_WIN
     action->setGlobalShortcut( KShortcut( Qt::META + Qt::Key_Plus ) );
+    #else Q_WS_WIN
+    action->setGlobalShortcut( KShortcut( Qt::META + Qt::Key_Up ) );
+    #endif Q_WS_WIN
     action->setShortcut( Qt::Key_Plus );
     connect( action, SIGNAL( triggered() ), ec, SLOT( increaseVolume() ) );

     action = new KAction( i18n( "Decrease Volume" ), this );
     ac->addAction( "decreaseVolume", action );
+    #ifndef Q_WS_WIN
     action->setGlobalShortcut( KShortcut( Qt::META + Qt::Key_Minus ) );
+    #else Q_WS_WIN
+    action->setGlobalShortcut( KShortcut( Qt::META + Qt::Key_Down ) );
+    #endif Q_WS_WIN
     action->setShortcut( Qt::Key_Minus );
     connect( action, SIGNAL( triggered() ), ec, SLOT( decreaseVolume() ) );


I will try to get a keyboard with multimedia keys this week to check
if the multimediakeys are forwarded to Qt or not, maybe those are also
OS-locked.

Casper

P.S.: I'm not on this list, so please CC when problems arise.


More information about the Amarok-devel mailing list