kdelibs/kdeui/shortcuts
Ivailo Monev 8e79cf1d5a generic: misc cleanups
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2016-11-03 12:19:19 +00:00
..
kacceleratormanager.cpp generic: make changes required for building against katie 2015-08-11 05:56:07 +03:00
kacceleratormanager.h initial import 2014-11-13 01:04:59 +02:00
kacceleratormanager_private.h generic: misc cleanups 2015-09-05 05:16:46 +00:00
kcheckaccelerators.cpp kdeui: fix build of KCheckAccelerators 2016-08-31 16:41:43 +00:00
kcheckaccelerators.h generic: misc cleanups 2015-09-05 05:16:46 +00:00
kgesture.cpp initial import 2014-11-13 01:04:59 +02:00
kgesture.h initial import 2014-11-13 01:04:59 +02:00
kgesturemap.cpp generic: make changes required for building against katie 2015-08-11 05:56:07 +03:00
kgesturemap.h generic: misc cleanups 2015-09-05 05:16:46 +00:00
kglobalaccel.cpp generic: make changes required for building against katie 2015-08-11 05:56:07 +03:00
kglobalaccel.h generic: misc cleanups 2016-04-16 13:56:36 +00:00
kglobalaccel_p.h generic: misc cleanups 2016-11-03 12:19:19 +00:00
kglobalshortcutinfo.cpp initial import 2014-11-13 01:04:59 +02:00
kglobalshortcutinfo.h generic: misc cleanups 2015-09-05 05:16:46 +00:00
kglobalshortcutinfo_dbus.cpp initial import 2014-11-13 01:04:59 +02:00
kglobalshortcutinfo_p.h initial import 2014-11-13 01:04:59 +02:00
kshortcut.cpp kdeui: drop kde3 shortcuts support 2015-08-26 02:15:26 +03:00
kshortcut.h kdeui: fix a compiler warning when build against Katie 2016-09-30 01:25:00 +00:00
kshortcutschemeshelper.cpp generic: make changes required for building against katie 2015-08-11 05:56:07 +03:00
kshortcutschemeshelper_p.h generic: misc cleanups 2015-09-05 05:16:46 +00:00
kstandardshortcut.cpp this should narrow the about action 2014-11-19 13:32:29 +00:00
kstandardshortcut.h generic: get rid of KMenuBar 2016-03-26 05:13:47 +00:00
org.kde.kglobalaccel.Component.xml updated dbus interfaces 2014-11-18 02:59:03 +00:00
org.kde.KGlobalAccel.xml updated dbus interfaces 2014-11-18 02:59:03 +00:00
README initial import 2014-11-13 01:04:59 +02:00

# Overall summary of global shortcut implementation

## KAction, KGlobalAccel and KdedGlobalAccel

[Basic functionality]
- You call KAction::setGlobalShortcut() to set a shortcut for an action. 
KAction then calls KGlobalAccel which is, among other things, the interface 
to KdedGlobalAccel (communication via DBus). KdedGlobalAccel is a KDED module 
as you might have guessed.
- KdedGlobalAccel then grabs the shortcut key in a platform-specific way and 
makes an entry of the mapping key<->action where actions are identified by 
their main component name and their own name.
- When a key grab triggers, KdedGlobalAccel calls (via DBus) KGlobalAccel 
which tells the action to trigger.

The KdedGlobalAccel is responsible for actually handling the shortcuts,
loading and saving the shortcut keys to kglobalshortcutrc. It doesn't
really know the actions, it just know what KGlobalAccel gave it.

[Conflict resolution]
KdedGlobalAccel has a list of all global shortcuts. If you try to assign a key 
twice, it will tell the appropriate KdedGlobalAccel/KGlobalAccel that the 
corresponding shortcut was changed to an empty one, which goes back to the 
KAction.
When manually assigning shortcuts, the config widget asks 
KGlobalAccel/KdedGlobalAccel for conflicts and presents options to the user 
to fix them.
To prevent all clashes as good as possible, KdedGlobalAccel remembers key<-> 
action mappings even after the corresponding application shuts down.

[More details]
KAction instances talk to the KGlobalAccel singleton to make it aware of global
shortcuts changes via KGlobalAccel::updateGlobalShortcuts() (to define the shortcut)
KGlobalAccel::updateGlobalShortcutsAllowed() (to enable/disable the shortcut)

These two methods do the following:
- Create an action "id" which is a QStringList of two items: the application
component and the action text (this is bound to cause trouble with i18n)

- Convert the KAction shortcuts to a QList<int>

- Pass all this via DBus to the KdedGlobalAccel instance, which lives in the
kded4 process.

KGlobalAccel::updateGlobalShortcutsAllowed(true) sets the "SetPresent" flag when calling
kglobalaccel, which makes kglobalaccel actually grab the key shortcut
(so that the grab is done after the action has been defined, and only if it is enabled).
kglobalaccel must know about inactive global shortcuts too (e.g. those defined in
applications not running at the moment), for conflict resolution.

## kdebase side: keyboard shortcuts KCM

The keyboard shortcuts KCM can be found in kdebase/workspace/kcontrol/keys/

The KCM gets the global shortcut info from the KdedGlobalAccel instance via
DBus. It uses KShortcutsEditor to let the user edit the shortcuts. Since
KShortcutsEditor manipulates KAction instances, the kcm creates "fake" actions.

--

Aurélien Gâteau, 2008.02.01
aurelien.gateau@free.fr
David Faure, 2008.02.05
faure@kde.org