[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: Dynamic creation of XMLGuiClients (plugins)
From:       Andreas Zehender <zehender () kde ! org>
Date:       2003-01-05 10:43:28
[Download RAW message or body]

On Saturday 04 January 2003 22:41, David Faure wrote:
> On Saturday 04 January 2003 21:25, Matthias Kretz wrote:
> > 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() );
>
> Sounds like we should have an updatePlugins() method that compares the
> loaded plugins with the enabled/disabled ones, and adds/removes those that
> need to be added/removed...

No, we don't need a new method. That's exactly what the last 
KParts::Plugin::loadPlugins method does.

I have a configuration dialog where the user can activate and deactivate 
plugins at runtime. I set the pluginname + "Enabled" config values and call 
Plugin::loadPlugins which loads new activated plugins and removes loaded but 
deactivated ones.
But the gui is not updated after new plugins are created.

The problem with
  createGUI( 0 );
  createShellGUI( false );
  createGUI( m_pViewer );
is that I have to access the shell from the part. I can this inside 
KPovModeler, but not if the part is embedded in another application. Plugins 
may be loaded later when a document contains objects which require a plugin.

There has to be another way to trigger an update, maybe directly with 
XMLGuiClient methods, maybe automatically in XMLGuiClient::insertChildClient 
(that's how plugins are added to the part in kparts/plugin.cpp)

Btw: Why is Plugin::pluginInfos protected? There is now way at the moment to 
get a list of installed plugins. I want that new plugins are not loaded by 
default, but without a list of available plugins I can't let the user 
activate them. As workaround I created a new class that inherits from 
KParts::Plugin with a public method which calls the protected method.


-- 
--------------------------------------------------
 Andreas Zehender, Dipl. Ing. (BA)
 Student, 10th semester computer science
 http://www.azweb.de
 az@azweb.de | zehender@kde.org      
--------------------------------------------------

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic