Global Shortcuts

David Faure faure at
Mon Mar 17 09:31:47 GMT 2008

On Monday 17 March 2008, Michael Jansen wrote:
> 1. If a component ( see KComponentData ) registers a shortcut for the first
>    time. kdedglobalaccel registers the component as inactive. The component
>    goes on to registers it's global shortcuts but they won't be active. Code
>    wise i see no changes. Everything could happen behind the scene. ( Where do
>    not kxmlgui applications store their shortcuts? Not kxmlgui kparts are
>    impossible? )

KParts is currently based on KXMLGUI.
But KDE applications can either use KXMLGUI or not.
If they don't, shortcuts are saved into a simple KConfig file -- see the
second half of KActionCollection::writeSettings, i.e. the case where parentGUIClient()->xmlFile() is empty.

I don't think it's a good idea to tie together the "global shortcuts" functionality
and XMLGUI. Before kde-4.0 was out there were talks about replacing xmlgui with
something entirely different, and the strong tie between KMainWindow and xmlgui
was a big problem (which has been solved with the KXmlGuiWindow split). The rest
didn't happen, but let's not make that mistake again, I can already foresee 
that the aggressions against xmlgui will start again when kde 5 comes along
[or possibly even before, with the two technologies alongside each other].

If you really don't like "saving all global shortcuts into one config file" (me, I don't have
a problem with that), then make them saved in the application's config file. 
More precisely, into the KComponentData::config() file, so that it works for parts and plugins too.

Yes, normal shortcuts are saved into the xmlgui file (with fallback to kconfig if not xmlgui),
but that's just a way of having to maintain two code paths instead of one. I can't see 
a good reason why we don't just always save shortcuts into kconfig.

David Faure, faure at, sponsored by Trolltech to work on KDE,
Konqueror (, and KOffice (

More information about the kde-core-devel mailing list