DefineGroups getting lost after switching KParts

Thomas Friedrichsmeier thomas.friedrichsmeier at ruhr-uni-bochum.de
Fri Jun 25 12:47:26 BST 2010


Hi,

as a short introductory summary:
- This is a regression between KDE 4.3 and 4.4.
- I did not figure out, exactly under which circumstances it occurs, and in 
fact my attempts at producing a minimal testcase all failed.
- I can pinpoint the problem to a sub-portion of commit #912265 by David 
Faure, and thus I can provide a patch that fixes this problem, but causes 
failures in kxmlgui_unittest, instead.

The long version:
- Problem description -
In RKWard we have a host of different KParts, many of which contain child 
clients. The main window's ui.rc sets up some <DefineGroup>s, and some of the 
KParts make use of these groups. Up until KDE 4.3.4, this worked fine, actions 
appeared where they were supposed to. It still works fine in KDE 4.4 as long as 
there has only been exactly one call to 
KParts::MainWindow::createGUI(KParts::Part*), i.e. there has not been any 
switching between active parts. As soon as a part is switched, the actions are 
placed as though the <DefineGroups> did not exist.

I do not know, whether the <DefineGroups> have really been purged, somehow, but 
the visible effect suggests that exactly this has happened.

When forcing a full rebuild of the GUI using code like this:

	KXMLGUIFactory* fact = factory ();
	QList<KXMLGUIClient*> clients = fact->clients ();
	for (int i = clients.size () - 1; i >= 0; --i) {
		fact->removeClient (clients[i]);
	}
	for (int i = 0; i < clients.size (); ++i) {
		fact->addClient (clients[i]);
	}

all actions are once again placed correctly, up and until the active part is 
switched.

- Reproducing the problem -
As mentioned above, I have not managed to create a testcase. For testing with 
RKWard, click on the "Script File" tool button. Notice how Edit->Paste Special 
is all the way at the bottom of the Edit-menu (KParts have already been 
switched during startup). Select Windows->Detach. Edit->Paste Special is now 
placed correctly (as near to the regular Paste action as I could place it). To 
play with variants inside the main window, modify rkward.cpp->partChanged() to 
e.g. query you before switching parts.

- The patch -
I have no idea, why this is related to the problem. But the attached patch (a 
partial revert of 912265) fixes the problem, at the cost of failing 
KXmlGui_UnitTest::testUiStandardsMerging .

- Now what? -
Frankly, I don't understand all that merging code, and I have no idea, on how 
to debug this. I will gladly provide more info or try to debug this further, 
if you can give me some pointers on how to proceed.

Regards
Thomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: definegroups_vanishing.diff
Type: text/x-patch
Size: 1401 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20100625/0958b80b/attachment.bin>
-------------- 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/20100625/0958b80b/attachment.sig>


More information about the kde-core-devel mailing list