Warning, /graphics/krita/libs/widgetutils/xmlgui/README is written in an unsupported language. File is not indexed.

0001 TODO: read through this seven year old document and see if any of it applies to Krita.
0002 
0003 Thank you! :)
0004 
0005 
0006 
0007 
0008 
0009 # Overall summary of global shortcut implementation
0010 
0011 ## KAction, KGlobalAccel and KdedGlobalAccel
0012 
0013 [Basic functionality]
0014 - You call KAction::setGlobalShortcut() to set a shortcut for an action. 
0015 KAction then calls KGlobalAccel which is, among other things, the interface 
0016 to KdedGlobalAccel (communication via DBus). KdedGlobalAccel is a KDED module 
0017 as you might have guessed.
0018 - KdedGlobalAccel then grabs the shortcut key in a platform-specific way and 
0019 makes an entry of the mapping key<->action where actions are identified by 
0020 their main component name and their own name.
0021 - When a key grab triggers, KdedGlobalAccel calls (via DBus) KGlobalAccel 
0022 which tells the action to trigger.
0023 
0024 The KdedGlobalAccel is responsible for actually handling the shortcuts,
0025 loading and saving the shortcut keys to kglobalshortcutrc. It doesn't
0026 really know the actions, it just know what KGlobalAccel gave it.
0027 
0028 [Conflict resolution]
0029 KdedGlobalAccel has a list of all global shortcuts. If you try to assign a key 
0030 twice, it will tell the appropriate KdedGlobalAccel/KGlobalAccel that the 
0031 corresponding shortcut was changed to an empty one, which goes back to the 
0032 KAction.
0033 When manually assigning shortcuts, the config widget asks 
0034 KGlobalAccel/KdedGlobalAccel for conflicts and presents options to the user 
0035 to fix them.
0036 To prevent all clashes as good as possible, KdedGlobalAccel remembers key<-> 
0037 action mappings even after the corresponding application shuts down.
0038 
0039 [More details]
0040 KAction instances talk to the KGlobalAccel singleton to make it aware of global
0041 shortcuts changes via KGlobalAccel::updateGlobalShortcuts() (to define the shortcut)
0042 KGlobalAccel::updateGlobalShortcutsAllowed() (to enable/disable the shortcut)
0043 
0044 These two methods do the following:
0045 - Create an action "id" which is a QStringList of two items: the application
0046 component and the action text (this is bound to cause trouble with i18n)
0047 
0048 - Convert the KAction shortcuts to a QList<int>
0049 
0050 - Pass all this via DBus to the KdedGlobalAccel instance, which lives in the
0051 kded4 process.
0052 
0053 KGlobalAccel::updateGlobalShortcutsAllowed(true) sets the "SetPresent" flag when calling
0054 kglobalaccel, which makes kglobalaccel actually grab the key shortcut
0055 (so that the grab is done after the action has been defined, and only if it is enabled).
0056 kglobalaccel must know about inactive global shortcuts too (e.g. those defined in
0057 applications not running at the moment), for conflict resolution.
0058 
0059 ## kdebase side: keyboard shortcuts KCM
0060 
0061 The keyboard shortcuts KCM can be found in kdebase/workspace/kcontrol/keys/
0062 
0063 The KCM gets the global shortcut info from the KdedGlobalAccel instance via
0064 DBus. It uses KShortcutsEditor to let the user edit the shortcuts. Since
0065 KShortcutsEditor manipulates KAction instances, the kcm creates "fake" actions.
0066 
0067 --
0068 
0069 Aurélien Gâteau, 2008.02.01
0070 aurelien.gateau@free.fr
0071 David Faure, 2008.02.05
0072 faure@kde.org