Automatically Generated Keyboard Accelerators (replacing kaccelgen.h)

David Faure faure at kde.org
Thu Jun 12 18:48:56 BST 2008


On Tuesday 10 June 2008, Chusslove Illich wrote:
> Regardless, I'm more worried by the fact that lxr.kde.org reports KAccelGen
> to be used only in one place, in Konqueror, and that whatever *really*
> assigns accelerators (Qt?) completely ignores non-Latin characters, thus
> leaving e.g. my Cyrillic menu items unaccelerated.

Yes!! This is a very important issue that has been overlooked completely in this thread.
Mark, I'm very happy that you want to improve kaccelgen.h, but I don't think that's the
code you wanted to touch in the first place, if you were aiming at better default
accelerators in KDE.
KAccelGen is indeed very little used, it was added for apps which want to generate
accelerators from a list of dynamic strings, before the much more general idea of
all accelerators in all widgets being handled automatically by KDE was implemented: 
that's what KAcceleratorManager does (kdelibs/kdeui/shortcuts/kacceleratormanager.cpp).

One solution would be to port KAcceleratorManager to KAccelGen, to benefit from this
improved logic, if that makes sense. However I see that KAcceleratorManager uses
the additional notion of weight, to give priority to some widgets over others,
e.g. in case you run out of accelerators (or in case of conflicts, I guess? I don't know
this code).

Another solution would be to get rid of KAccelGen (which doesn't make sense from an
API point of view -- apps don't need to do anything to get accels, with KAcceleratorManager,
so the public API of KAccelGen is useless), and improve KAcceleratorManager's algorithm.


==> I think this shows that compiling kdelibs and testing your changes is essential;
one can't just change code and unit test it and calculate its performance, it's very
important to check that the code ends up doing what we wanted it to do, which
includes among other things that the code must be called in the first place!

-- 
David Faure, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).




More information about the kde-core-devel mailing list