GUI for changing sets of shortcuts in an app?

Jonas Bähr jonas.baehr at web.de
Thu Aug 31 12:07:52 BST 2006


Am 31.08.2006 um 11:03 schrieb Boudewijn Rempt:

> On Wednesday 30 August 2006 22:42, Jonas Bähr wrote:
>
>> In Krusader we have the ability to export and import keyboard  
>> shortcuts for
>> some time now (our uses requested Midnight- and Total-Commander  
>> themes).
>> Unfortunately the syncToConfig method is not documented and seems  
>> to work
>> only one-way so we missed it and wrote our own implementation. Since
>> thisone could only handle one shortcut per action, I'm currently  
>> rewriting
>> it, so this Mail came just im time ;-) I'll see if I can make use  
>> of it.
>> Once I've finished it, are you interested in the code for the KDE3  
>> branch
>> of Krita? It's a subclass of KKeyDialog with two buttons for  
>> import and
>> export.
>
> Krita 1.6 is now in feature freeze and _should_ be the last version  
> of Krita
> for KDE3. However, if this feature isn't going to be generic for  
> all KDE
> apps, I certainly am interested in your code for Krita (and perhaps  
> other
> KOffice apps.)

I've got a basically working version ready:
http://krusader.cvs.sourceforge.net/krusader/krusader_kde3/krusader/ 
Dialogs/krkeydialog.cpp?revision=1.3&view=markup
(it also includes a fallback to our legacy format)

Unfortunately KKeyDialog doesn't expose enough of its internals, so  
there are some problems left:
-) The widget where KDialogBase places it's buttons is not accessable  
directly so I had to use some ugly parent()/static_cast-hacks to get it.
-) The export-button works on the already assigned Shortcuts only (so  
you're actually exporting the currently used shortcuts, which are may  
not the same you see in the Dialog once you changed them without  
pressing OK). This issue can't be worked around since KKeyChooserItem  
is declared in kkeydialog.cpp, not in .h.
The import however only affects the dialog and is only applied with OK

Currently all shortcuts are exported. Maybe I'll add support to  
export only actions with a specific group (we also use KActions for  
Bookmakrs and UserActions) or only the one that differs from the  
default. I'll keep you informed about that directly.

bye,
Jonas





More information about the kde-core-devel mailing list