KXMLGUI - User definable toolbars and actions
Thomas Friedrichsmeier
thomas.friedrichsmeier at ruhr-uni-bochum.de
Mon Jun 14 17:59:05 BST 2010
Hi,
if I understand you correctly, these are actually two issues. The first is
adding actions to an actioncollection at runtime. One solution - although
perhaps not a terribly elegant solution - is this:
- Create a dedicated KXMLGUIClient to keep these and no other actions.
- Create/modify the ui.rc for this client at runtime, adding an <Action>-tag
for each action. Be sure to increase the version number on each revision.
- You will need to remove / re-add the client from / to the factory() after
any modifications.
Note that you can also work without a ui.rc-file (using setDOMDocument()), but
then you need to make sure that the KActionCollection saves its settings to
the config (KActionCollection::write/readSettings()).
The second issue is combining actions from several different KXMLGUIClients
into a single toolbar. This is already possible, if the toolbars of all
clients have the same name. Unfortunately, the KEditToolBarWidget will still
list the actions of each client, separately, instead of breaking them down by
toolbar name. But I think this is an isuse of making the KEditToolBarWidget-
GUI smarter, not something that would require changing any details of kxmlgui
itself.
Being able, as a user, to define a new custom toolbar, and to add actions from
any active client to it, would be a logical next step. I believe, what would
be needed (besides the GUI to configure this), is to keep track in the local
ui.rc file, whether a toolbar was pre-defined, or user-defined. This is to be
able to purge user-defined toolbars from clients/parts, when they become empty.
Regards
Thomas
-------------- 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/c5d81bc9/attachment.sig>
More information about the kde-core-devel
mailing list