Dynamic creation of XMLGuiClients (plugins)

Matthias Kretz kretz at kde.org
Sat Jan 4 20:25:26 GMT 2003


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

This is what KView does for loading and merging:

KConfigGroup cfgGroup( config, "KParts Plugins" );

for( QValueList<KPluginSelectorPrivate::PluginInfo>::Iterator it = 
d->pluginInfos.begin(); it != d->pluginInfos.end(); ++
it )
  cfgGroup.writeEntry( ( *it ).pluginname + "Enabled", ( *it ).item->isOn() );

createGUI( 0 );
createShellGUI( false );
createGUI( m_pViewer );

Works, but I guess nobody thinks of that... (without reading KParts code that 
is).

the createShellGUI( false ) call basically makes the createGUI( m_pViewer ) 
method call KParts::PartBase::loadPlugins( QObject *parent, KXMLGUIClient 
*parentGUIClient, KInstance *instance ) which is protected.

Ah, don't forget to set the PluginLoadingMode in your KParts::MainWindow: 
setPluginLoadingMode( LoadPluginsIfEnabled );

Dunno if there's a better way, but I guess if there isn't there should be ;-)

On Saturday 04 January 2003 20:54, Andreas Zehender wrote:
> Hi!
>
> I want to dynamical activate and deactivate plugins at runtime. If a plugin
> is loaded at program start, the menu items are created. If the plugin is
> loaded later at runtime, the plugins menu items are not created.
>
> I load the plugins with the KParts::Plugin::loadPlugins( QObject*,
> KXMLGUIClient*, KInstance*, bool ) method, the parent object and parent xml
> gui client is a KParts::Part.
>
> What is the most efficient way to trigger an update of the xml gui when a
> XMLGuiClient is added?
>
> I need merging with the DefineGroup tag for the plugins actions. Does
> merging work at runtime?
>
> Andreas
>
> PS: With KDE 3.1, not HEAD

- -- 
C'ya
        Matthias
________________________________________________________
Matthias Kretz (Germany)                          <><
http://Vir.homeip.net/
MatthiasKretz at gmx.net, kretz at kde.org,
Matthias.Kretz at urz.uni-heidelberg.de
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.0 (GNU/Linux)

iD8DBQE+F0M8yg4WnCj6OIoRAmcUAJ9NiNFaSbMcFyXMwjf/UW1NZ0VGxQCg3KAD
CxJ3Albh8Og9NemcGrYkRF8=
=HWEU
-----END PGP SIGNATURE-----





More information about the kde-core-devel mailing list