KXMLGUI - User definable toolbars and actions

Milian Wolff mail at milianw.de
Mon Jun 14 15:21:59 BST 2010


On Monday, 14. June 2010 16:15:54 Milian Wolff wrote:
> Hello!
> 
> I intend to port the Quanta3 feature for user definable toolbars properly
> to KDE4 and thought that this should actually be a KDELibs core feature.
> 
> Would there be anything against adding a "new toolbar" feature to the
> 'ConfigureToolbars' dialog? There _all_ available actions of the
> KActionCollection should be listed, contrary to the toolbars defined by the
> application's UI.rc files.
> 
> Is there anything from the KXMLGUI standpoint that would speak against it?
> David Faure, I get that you are the one who knows the most about it?
> 
> We want such a feature to make it possible for users to have custom actions
> (e.g. to insert snippets, execute scripts, ...) in toolbars.
> 
> Actually the latter is also a part that I don't quite understand on how to
> implement properly using KXMLGUI. To my current understanding, I need to
> register all available actions to KXMLGUI with the ui.rc file beforehand,
> i.e. I cannot do that at runtime. Is that correct? Could that be changed?
> 
> In KDevelop we already have at least one point where we don't use KXMLGUI
> but plain KShortcutWidget & KConfig to assign shortcuts to toolviews
> (there can be an arbitrary amount of those).

PS: I know that adding an action to KActionCollection at runtime "works" and 
makes it show up in the "configure shortcuts" dialog for example. What does 
_not_ work is restoring the shortcut after restarting the application.

Actually the reason for that might be the point in time at which the action 
gets added to the KActionCollection. See e.g.:

http://gitorious.org/kdevelop/kdevplatform/commit/822b3384806b96a25da395faf29eee87c8f66168

If I add the action to the collection inside the ctor (note, this action is 
also in the XML ui.rc), everything works. If I otoh would add the action 
later, after the plugin (which is a KXMLGuiClient) got registered as child to 
the main KXMLGui of the KDevelop MainWindow, it _does not_ work to restore the 
shortcut settings.

Maybe if that would be fixed, I could save a list of actions and restore them 
at will at any point during runtime. with this, at least the "custom action" 
part would be clear to me and only the toolbars need to be discussed.

Bye
-- 
Milian Wolff
mail at milianw.de
http://milianw.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20100614/13fcc1d8/attachment.sig>


More information about the kde-core-devel mailing list