RFC: API and code changes to KShortcut and KAction

Andreas Hartmetz ahartmetz at gmail.com
Fri Nov 24 04:36:52 GMT 2006


After getting confused by KShortcut, KAction and their documentation
that leaves many semantic things unclear, I went ahead and improved
them. I post my changes here so you can comment. If there are no
substantial problems I will commit on monday.
Outline of changes:
-KShortcut gets a "primary" and an "alternate" shortcut instead of a
list of arbitrary length that was being used in bizarre ways and
actually never with more than two shortcuts.
-KShortcut gets explicit constructors; many lines of code need to
change to comply but don't worry - I already have these changes
sitting in my working copy.
-KShortcut: comparison operators were dropped - a) not really needed
anywhere and b) I see no sensible way to compare "almost unordered"
lists. Comparison operators are needed for QMap but at the one place
where QMap<KShortcut, x> was used a QHash was better anyway.
-KShortcut - removed stupid "init" functions
-KAction: rename "Custom" shortcuts to "Active" shortcuts because that
is what they are. Please think before you name.
-KAction: docs get a section to explain "local vs. global" and "active
vs. default"
-KStdAction: ordered (by id) array of shortcuts for constant access
time in the case of acces by id. Somewhat dangerous if people don't
read the warnings I have put there and change the array.
-many, many changes to make KShortcut users work again

Diff anyone? Unfortunately it will be very large. I am pretty sure
that nobody would find problems at a glance so it would only be useful
to someone who knows the code in question  and is willing to invest
some time. It compiles and Works For Me(TM)...

In the future I plant to add mouse gesture support to KAction. I have
working prototype; the most important issue is how to configure mouse
gestures in the shortcut configuration dialog. I need input from the
usability people there.

OK, I'm pretty sure that I forgot something important. I will write
follow-ups to cover the things I forgot...


More information about the kde-core-devel mailing list