kdelibs/kdeui/shortcuts
Ivailo Monev 5a3d2fbac3 kdeui: use I18N_NOOP2_NOSTRIP() macro instead of redefining I18N_NOOP2()
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2022-10-02 00:12:37 +03:00
..
kacceleratormanager.cpp generic: remove Qt support leftovers [ci reset] 2022-05-12 04:13:26 +03:00
kacceleratormanager.h generic: namespaced Qt4/Katie build fixes 2017-08-04 09:24:39 +00:00
kacceleratormanager_private.h generic: namespaced Qt4/Katie build fixes 2017-08-04 09:24:39 +00:00
kcheckaccelerators.cpp generic: replace obsolete Qt::MidButton with Qt::MiddleButton 2019-05-07 17:16:57 +00:00
kcheckaccelerators.h generic: namespaced Qt4/Katie build fixes 2017-08-04 09:24:39 +00:00
kglobalaccel.cpp kdeui: move the default value for KGlobalAccelPrivate::getComponent() argument to the method declaration 2022-09-30 01:25:48 +03:00
kglobalaccel.h generic: namespaced Qt4/Katie build fixes 2017-08-04 09:24:39 +00:00
kglobalaccel_p.h kdeui: move the default value for KGlobalAccelPrivate::getComponent() argument to the method declaration 2022-09-30 01:25:48 +03:00
kglobalshortcutinfo.cpp kdeui: call QObject constructor in the default KGlobalShortcutInfo constructor 2022-09-27 10:48:29 +03:00
kglobalshortcutinfo.h kdeui: effectively revert c689f83d30 2022-09-27 11:13:25 +03:00
kglobalshortcutinfo_dbus.cpp kdeui: optimize KGlobalShortcutInfo assignment operator 2022-09-27 10:29:07 +03:00
kglobalshortcutinfo_p.h kdeui: optimize KGlobalShortcutInfo assignment operator 2022-09-27 10:29:07 +03:00
kshortcut.cpp kdeui: drop kde3 shortcuts support 2015-08-26 02:15:26 +03:00
kshortcut.h generic: namespaced Qt4/Katie build fixes 2017-08-04 09:24:39 +00:00
kshortcutschemeshelper.cpp generic: make changes required for building against katie 2015-08-11 05:56:07 +03:00
kshortcutschemeshelper_p.h kdeui: remove declaration of non-existing KShortcutSchemesHelper::saveShortcutScheme() method 2022-09-27 10:57:59 +03:00
kstandardshortcut.cpp kdeui: use I18N_NOOP2_NOSTRIP() macro instead of redefining I18N_NOOP2() 2022-10-02 00:12:37 +03: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 kdeui: org.kde.KGlobalAccel D-Bus interface file update 2022-09-26 18:58:06 +03: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