xmlgui, DefineGroup vs. MergeLocal
David Faure
faure at kde.org
Sat Aug 8 17:56:52 BST 2009
On Friday 07 August 2009, Raphael Kubo da Costa wrote:
> 2009/8/7 Andreas Pakulat <apaku at gmx.de>:
> > Hi,
> >
> > I need some input from the xmlgui experts (if there are any :).
> >
> > I've had a discussion with the maintainer of okteta about KDevelop's use
> > of xmlgui's groups. Basically, KDevelop defines its File and other menus
> > by creating various groups in it (like save_merge, new_merge etc.) and
> > then using these groups in its plugins to properly order the menus.
> >
> > The problem is that apparently the groups are not used by any other
> > xmlgui-using app/kpart except kate (which probably does so only because
> > we're integrating it all the time). All other apps/kparts are using the
> > append-attribute for <Action> which appends to one of the MergeLocal
> > define things from ui_standards.xml in kdeui.
> >
> > Unfortunately it seems that xmlgui is incapable of merging the two
> > (we're using append on the DefineGroup but thats not supported as far as
> > I can see), which means all kpart actions of kparts that KDevelop embeds
> > end up at the end of the menu.
> >
> > However the xsd file explicitly says that <Action append=''/> should not
> > be used by kparts, but instead group should be used for merging kparts.
> >
> > Now I'm a bit confused as to wether the .xsd is just the theory and in
> > practice everythings the other way around, or wether there's a bug in
> > xmlgui somewhere or wether I should start and change all xmlgui files in
> > apps/kparts to use groups?
>
> I'm not sure I understood what your problem is. Some time ago I also
> had some problems with menu items being shown at the end in Ark as
> well.
>
> I think the .xsd (as well as the .dtd in the same directory) are
> correct: using <Action append="..." /> in a plugin or part isn't
> supposed to work; instead, you use DefineGroup in your mainwindow's rc
> file with the append attribute set to where you want to put it
> according to ui_standards.rc and then use <Action group="..." /> in
> your plugin/part rc. I recently added some information about this in
> [1] after I got Ark working, everyone's very welcome to correct and
> add any information, as the article still lacks some points.
>
> In the KDevelop thread, someone mentions Konqueror working without
> using groups; my guess is that since konqueror.rc (which is loaded by
> a mainwindow) uses noMerge="1", the default ui_standards.rc entries
> won't be loaded at all. Other actions not defined there are merged
> because of the <Merge /> tag.
I see much confusion in this thread ;)
Please do not confuse the two merging features:
* the merging of the application's xmlgui file with ui_standards.rc,
which uses MergeLocal (in ui_standards.rc) and the append and noMerge attributes
(in the application's xmlgui file)
and
* the merging of xmlguiclients (like parts) into the application
(the xmlguifactory, more precisely),
which uses Merge and DefineGroup (in the host), and the group attribute (in the part).
The reasons for this mess of two-different-kinds-of-merging are historical
-- Kurt was young ;).
I wanted to merge them (hehe) for kde-4, but this didn't happen.
Please note that ui_standards.rc merging is not available for kparts
(this was also on the todo list for kde4, now for kde5; cf the "More long term"
section in the old kdeui/TODO.xmlgui).
Code wise, the ui_standards.rc merging happens in the kxmlguiclient itself,
while the guiclient-added-to-factory merging happens in kxmlguifactory, so they
are indeed completely separated currently.
With all this in mind, well, I can't really answer the above postings more
precisely because I don't know which merging they are really talking about
(a bit of both I suspect...).
The last paragraph in Raphael's email mixes noMerge="1" (a ui_standards.rc feature)
with <Merge/> (a xmlguifactory-merging feature), which is nonsense (yes, despite
what the naming would indicate...)
Hope this helps.
PS: I didn't realize that the dtd got converted to a xsd. But both are still
in svn, which means my documentation fixes to the dtd are missing from the xsd :(
--
David Faure, faure at kde.org, sponsored by Qt Software @ Nokia to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).
More information about the kde-core-devel
mailing list