KActionCollection: it's a jungle
Andreas Hartmetz
ahartmetz at gmail.com
Sat Mar 17 23:16:03 GMT 2007
Hi!
In my kdelibs adventures, I met a strange animal called KActionCollection. It
can do some some very useful things and some tricks nobody really wants to
see.
Back to the technical level...
KActionCollection has many functions that can be summarized as "do one thing
to all members of the collection". They are numerous, they clutter the
documentation, and nobody uses them, according to lxr.kde.org.
Some are really amusing, like addDocCollection() whose documentation goes like
that:
"Doc/View model. This lets you add the action collection of a document to a
view's action collection."
The action will be added to a special internal list and will then be treated
like any other action but it won't be returned by any "query my actions"
method, that is, except if you ask for it by name. yeah right.
Therefore, I propose to remove all of these:
* addDocCollection
a)huh?, b) used in one case in KHelpCenter. Can't be that useful.
* setDefaultShortcutContext:
used three times, to set it to the default each time...
* applyDefaultShortcutContext:
a)wtf?, b) unused
* defaultShortcutContext:
then obsolete
* forgetEnabled:
a)wtf?, b)unused.
* *AssociatedWidget(s):
why should a collection ever have this?
I'm unsure about setEnabled/isEnabled... it's hard to find them because the
name occurs so often and I'm still investigating with a massive grep orgy.
Should any of these functions ever be needed, it's trivial to emulate them, in
two lines (dammit!), with a simple foreach().
configIsGlobal() should be renamed to isConfigGlobal, for consistency with
isEnabled() and isEmpty() and because it's a better name anyway.
Regards,
Andreas
More information about the kde-core-devel
mailing list