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 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
|