Multiple main window support, and action-collections

Alexander Dymo alexander.dymo at gmail.com
Sun Jul 26 23:29:17 UTC 2009


> > Another possible but not very nice option would be creating multiple
> > instances of a plugin and binding them to the mainwindow....
>
> I though of that as well. But that could really be quite messy.
>
> So now I'm about to commit something like the function above. It allows
> creating a set of actions and setting an xml file.
>
> If required, a different function can be overloaded, which allows creating
> a custom per-window KXMLGuiClient.

I'd say we need two functions in a plugin:
	//this would return action collection without a parent, and then will be
	//reparented to a mainwindow by mainwindow itself
	KActionCollection &IPlugin::guiActions()
	QString IPlugin::xmlGuiFile()
and a function in MainWindowPrivate to create KXMLGUIClient instance based on 
this information.

One question would be ownership. I'd say that xmlguiclient should be owned by 
a mainwindow, but should also be destroyed on plugin deletion.

Another problem would be the simultaneous editing of xmlfiles from several 
mainwindows. Say, if you have a plugin with action "foo" and assign a shortcut 
from mainwindow 1. Will mainwindow 2 see this shortcut? Will it reset the 
shortcut after editing them with configuration dialog?

/me wonders whether there're more problems possible...





More information about the KDevelop-devel mailing list