[patch] Shortcut schemes for any KDE application (specifically for KDevelop, plugins and Kate Part)

Alexander Dymo dymo at ukrpost.ua
Sun Mar 2 19:32:45 UTC 2008


Hey,
I think I know how we can escape from our shortcuts ghetto. The solution is 
quite simple - we need to ship shortcut schemes for kate part (and other 
parts we embed) by ourselves.

To do that, I've implemented the shortcuts schemes support in xmlgui (see 
patch) and shortcuts dialog in kdelibs. You can apply the patch, recompile 
kdelibs and restart kdevelop (patch is BC) to try that. Please try and tell 
me your opinion.

shortcut_scheme.patch - patch for two-week-old kdelibs
new_shortcut_scheme.patch - patch for today's kdelibs


What this patch does:

1) It allows applications to load shortcuts from xml files named
<component name><scheme name>shortcuts.rc

See, for example, attached kdevelopemacsshortcuts.rc file. If you copy it 
to .kde4/share/apps/kdevelop (or global dir), KDevelop shortcuts dialog will 
recognize the "emacs" scheme and will allow to switch to it.


2) It allows individual xmlgui clients to specify their own schemes using 
similar xml files.

For example, you can have .kde4/share/apps/katepart/katepartemacsshortcuts.rc 
file with emacs shortcuts scheme for kate part.


3) It saves user-configured shortcuts separately for each scheme

For example, the user can have custom shortcuts for emacs scheme and for 
default scheme (in .kde4/share/apps/kdevelop/kdevelopui.rc)
 <ActionProperties>
  <Action shortcut="Ctrl+W" name="file_close" />
 </ActionProperties>
 <ActionProperties scheme="emacs" >
  <Action shortcut="Ctrl+X,K" name="file_close" />
 </ActionProperties>


4) It has GUI to add new shortcut schemes, delete them and export (note, 
delete doesn't work now);

Just launch shortcuts dialog and see the "details" button.


What we can do with shortcuts schemes:

1) we can create a scheme for known kate part shortcuts and ship it. If the 
user selects our scheme and then updates kate part, unknown actions (no in 
the scheme) will have no shortcuts at all so clashes should not exist.

2) we can ship our own shortcuts scheme without clashes and possibly an emacs 
shortcut scheme (or let the users create it)

PS: I'm not a fan of emacs shortcuts :) They are just used as an example of 
what can be done. 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: shortcut_scheme.patch
Type: text/x-diff
Size: 23995 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20080302/7ca1e1d1/attachment.bin>
-------------- next part --------------
<kpartgui>
    <ActionProperties>
        <Action shortcut="Ctrl+X, Ctrl+C" name="file_quit" />
    </ActionProperties>
</kpartgui>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: new_shortcut_scheme.patch
Type: text/x-diff
Size: 24410 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20080302/7ca1e1d1/attachment-0001.bin>


More information about the KDevelop-devel mailing list