KGlobalAccel Problems

Vishesh Handa me at vhanda.in
Thu Jun 19 17:26:45 UTC 2014


Hey guys

I've been looking into kglobalaccel in order to fix some problems that I
was having. I seems to have opened a can of worms.

Background Information: KGlobalAccel has 2 kinds of shortcuts - Active
Shortcuts and Default Shortcuts. Active Shortcuts are the ones currently in
use, whereas the default ones are just the ones which an application
recommends that should be the default. Setting this default shortcut just
results in it being written to a configuration file.

In the KDE4 days you would set a global shortcut via
KShortcut::setGlobalShortcut(KShortcut, flags). The flags over here were by
(Default | Active), so most of the applications would just set it as both
the default and the active one. Everything was nice and simple.

Now, stuff that has changed -
1. The API has an explicit setDefaultShortcut and setShortcut command. This
is bad because setting the deafult shortcut does not set the active one and
vice versa. This means applications need to call both. No application
currently does this.

2. We allow multiple global shortcuts per application - This is awesome,
cause it is super useful, but it also results in -
* The KCM only showing one shortcut. And when you change that shortcut,
then all the others are cleared.
*  Having different lists of default and normal shortcuts results in the
KCM flaking out and not showing the active shortcut properly. I've been
trying to diagnose this, but haven't been successful. I'll try again
tomorrow.

How do we go about fixing this? Options -

a.) Set the active shortcut whenever you set the default shortcut. This is
a good compromise, but it also means that any successive call to
setShortcut(..) will not do anything cause the shortcut has already been
set.

Certain application such as KRunner which set one default shortcut, and
multiple active shortcuts would break, and need to be fixed. (Which is
fine, it's just what happens).

We should probably also add some documentation regarding this.

b.) Let stuff remain the way it is and add extra documentation. This would
mean we would need to update every app using KGlobalAccel and make them set
both the default and the active shortcut.

c.) Introduce the concept of flags in setShortcut where the default is
active + default. This would make it similar to how it was in kdelibs4. The
whole active + default thing is still confusing though and we would need
better documentation.

---

Fixing (2) - I like having multiple default shortcuts available, so I
suppose we need to update the KCM? This means fixing up KShortcutEditor
from kxmlgui. The code there is a little ambiguous, so I'm not looking
forward to that. Also, not sure how it would look visually.

Other minor Issues -

KXmlGui - KShortcutEditor seems to have some fixmes for KDE5. Do we want to
do fix those? Perhaps someone should go through all the frameworks and make
these changes or remove the comments?


-- 
Vishesh Handa
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20140619/509ff53d/attachment.html>


More information about the Kde-frameworks-devel mailing list