Fwd: Global Shortcuts

Michael Jansen kde at michael-jansen.biz
Thu Feb 28 14:32:34 GMT 2008

Mmmhhhh. should have gone here too.

----------  Forwarded Message  ----------

Subject: Global Shortcuts
Date: Thursday 28 February 2008
From: Michael Jansen <kde at michael-jansen.biz>
To: ahartmetz at gmail.com


I would like to discuss a change i just mad and its implications..

KAction has a property globalShortcutAllowed that controls whether a shortcut 
is global or local to the application. The current behaviour is to set this pr
operty implicit to true if the globalShortcut Property is set.

That surprised me. I would have expected to get a failure. I expected to first 
configure the action as global before setting a global shortcut.

I have just commited a change allowing to set the globalShortcut from an kxmlg
ui file ( don't know the correct name ). That looks like this
 <Action shortcut="Ctrl+o" globalShortcut="Meta+o" name="MyAction">

I think that this feature is useful and should stay. I believe it's a must. 
KConfig has to be adapted too. For saving into xml and normal files. Else glob
al shortcuts will never be part of the configuration of a application. In cont
rast to normal shortcuts. Opinions?

But if we keep the change its current form it is possible for an user to make 
each and every action a global action. A programmer has no way to prevent that

There are two ways to fix that:

1. Change KAction. A program has to explicitly set an action to global. if glo
balShortcutAllowed is not true setting an globalShortcut does not work/give an 

2. Change kxmlguifactory.cpp. Check globalShortcutAllowed and only then set th
e shortcut.

I would prefer 1 because i think it's safer against programming errors. But ke
ep in mind that all application with global shortcuts have to be changed in th
at case.


PS. I know i have to change the dtd and schema for kxmlgui. Anything else? Dok

Michael Jansen


Michael Jansen
Available for contract work ( Development / Configuration Management )

More information about the kde-core-devel mailing list