# class PluginPage

###

Module | kutils
Namespace | KSettings
Class | PluginPage
Inherits | KCModule

Convenience KCModule for creating a plugins config page.

This class makes it very easy to create a plugins configuration page to your program. All you need to do is create a class that is derived from PluginPage and add the appropriate plugin infos to the KPluginSelector. This is done using the pluginSelector() method:

    typedef KGenericFactory<MyAppPluginConfig, QWidget> MyAppPluginConfigFactory;
    K_EXPORT_COMPONENT_FACTORY( kcm_myapppluginconfig, MyAppPluginConfigFactory( "kcm_myapppluginconfig" ) );

    MyAppPluginConfig( QWidget * parent, const QStringList & args )
    : PluginPage( MyAppPluginConfigFactory.componentData(), parent, args )
    {
    pluginSelector()->addPlugins( KGlobal.mainComponent().componentName(), i18n( "General Plugins" ), "General" );
    pluginSelector()->addPlugins( KGlobal.mainComponent().componentName(), i18n( "Effects" ), "Effects" );
    }

All that remains to be done is to create the appropriate .desktop file

    [Desktop Entry]
    Encoding=UTF-8
    Icon=plugin
    Type=Service
    ServiceTypes=KCModule

    X-KDE-Library=myapppluginconfig
    X-KDE-FactoryName=MyAppPluginConfigFactory
    X-KDE-ParentApp=myapp
    X-KDE-ParentComponents=myapp

    Name=Plugins
    Comment=Select and configure your plugins:

Author Matthias Kretz <kretz@kde.org>

### methods

- PluginPage (componentData, parent, args)

  returns ctor
  KDE 4.1.0 and later only

  Argument | Type | Default
  --- | --- | ---
  componentData | KComponentData |
  parent | QWidget | 0
  args | QVariantList | QVariantList()

  Standard KCModule constructor. Automatically creates the KPluginSelector widget.

- PluginPage (a0, a1, a2)

  returns ctor
  before KDE 4.1.0 only

  Argument | Type | Default
  --- | --- | ---
  a0 | KComponentData |
  a1 | QWidget | 0
  a2 | QVariantList | QVariantList()

- defaults ( )

  returns Nothing

- load ( )

  returns Nothing

  Load the state of the plugins (selected or not) from the KPluginInfo objects. For KParts plugins everything should work automatically. For your own type of plugins you might need to reimplement the KPluginInfo.pluginLoaded() method. If that doesn't fit your needs you can also reimplement this method.

- pluginSelector ( )

  returns KPluginSelector

  Returns a reference to the KPluginSelector.

- save ( )

  returns Nothing

  Save the state of the plugins to KConfig objects