xmlgui, DefineGroup vs. MergeLocal

David Faure faure at kde.org
Thu Oct 29 23:16:39 GMT 2009


On Thursday 22 October 2009, Andreas Pakulat wrote:
> > > One thing I did notice though: Katepartui.rc has this:
> > >
> > > <Action name="edit_find" group="edit_find_merge" />
> > >
> > > Isn't this superflous as edit_find is already defined in
> > > ui_standards.rc?
> >
> > It uses noMerge="1" so ui_standards.rc doesn't apply there.
> 
> This stuff makes my head dizzy :) But is that intended?

... that it makes your head dizzy? Not really :-)

> i.e. is it a normal case for a plugin to not use the actions from 
ui_standards? 

Oh wait, I said nonsense. noMerge is for "ui_standards merging",
which only happens in the mainwindow, not in the part.
noMerge="1" in a part has no effect. No wonder we both get dizzy if people 
write nonsensical xml files :-P

So, back to your initial question, let me give the actual answer now ;)
<Action> tags are completely removed if the Action with that name doesn't
exist in the collection. (kxmlguiclient.cpp:349)
So once you create the mainwindow's GUI, all the stuff from ui_standards
which talks about actions that the mainwindow doesn't have, is FORGOTTEN.
Hence the famous TODO "use ui_standards for parts". As I mentionned before,
ui_standards is not used for parts currently (more generally, the guifactory
has no clue about it); it's a feature of setXML() on the (main) guiclient 
only. I know, confusing. Historical. Hard to change at this point. You know 
the story ;)

So. katepart uses the right way to put a part's actions into the right place 
in the host: using the group attribute.

-- 
David Faure, faure at kde.org, http://www.davidfaure.fr
Sponsored by Nokia to work on KDE, incl. Konqueror (http://www.konqueror.org).




More information about the kde-core-devel mailing list