Different "strategy" for global shortcuts

Mark markg85 at gmail.com
Tue May 29 07:55:37 UTC 2012


The following was a conversation between David and me. Sending it to the
list since it belongs there.

On Monday 28 May 2012 17:43:47 Mark wrote:
> Hi David,
>
> I've been thinking a bit more about KAction to figure out a way to get rid
> of it completely (along with KShortcut). I think i found that solution.

OK. Not sure why you're emailing in private rather on k-f-d though...

> For starters, the setDefaults/restoreDefaults has to go in QAction. I
> mailed Rick about this to see if such a patch for Qt would be accepted.

The naming would be setDefaultShortcut() or setDefaultShortcuts(), surely :)
If it doesn't say "shortcuts" it gets confusing...

> Lets for the sake of this mail assume that it does get accepted and ends
up
> in Qt 5.1.

OK.

> Then all that's left in KAction is global shortcuts.

Well there's actually more stuff (like gesture support, but it seems this
was
never finished, so we could indeed kill that and wait for it to be in Qt).
There's KAuth support, not idea how this works or how it could be done
differently.

We should submit setHelpText() to QAction for convenience.

> So why do we even have global shortcuts in there? Can't we just use
> shortcut editor as "register" for global shortcuts?

The editor isn't always running ;)

> That probably means that you get a global sortcut registration function in
> code. So something like this:
> KSomething::registerGlobalShortcut("name", shortcut); <-- is obviously
> wrong but you get the idea.

Yeah, this seems to be the obvious way to move the functionality out of
KAction. Feel free to work on a proof of concept in the frameworks branch,
the
only way to see if this would work out, is to try it, IMHO.

>  (KConfig? KGlobal? K..?)

Not those, for sure. KConfig doesn't know QtWidgets, KGlobal is on the way
out.
This should be a new namespace or class, for modularity. Something like
KGlobalShortcutRegister or what not. Or maybe new code in the existing
KGlobalAccel.
Problems to solve will include storing data for each action (I'd recommend
dynamic properties for this too), and ensuring that changing the default
shortcut as a user, updates the global shortcut.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20120529/b3d03d3c/attachment.html>


More information about the Kde-frameworks-devel mailing list