port to KPluginFactory

svn path=/trunk/KDE/kdebase/workspace/; revision=705777
This commit is contained in:
Matthias Kretz 2007-08-28 14:58:52 +00:00
parent ee20630e52
commit 78bec90fbe
10 changed files with 41 additions and 52 deletions

View file

@ -7,7 +7,6 @@ ServiceTypes=KCModule
DocPath=kcontrol/kwineffects/index.html
X-KDE-Library=kcm_kwineffects
X-KDE-FactoryName=kcm_kwineffects
X-KDE-ParentApp=kcontrol
X-KDE-System-Settings-Parent-Category=window-behaviour

View file

@ -10,7 +10,6 @@ License. See the file "COPYING" for the exact licensing terms.
#include "main.h"
#include <kgenericfactory.h>
#include <kaboutdata.h>
#include <kconfig.h>
#include <kdebug.h>
@ -19,22 +18,23 @@ License. See the file "COPYING" for the exact licensing terms.
#include <kplugininfo.h>
#include <kservice.h>
#include <ksettings/dispatcher.h>
#include <KPluginFactory>
#include <KPluginLoader>
#include <QtDBus/QtDBus>
#include <QBoxLayout>
typedef KGenericFactory<KWin::KWinEffectsConfig> KWinEffectsConfigFactory;
K_EXPORT_COMPONENT_FACTORY( kcm_kwineffects, KWinEffectsConfigFactory("kcmkwineffects"))
K_PLUGIN_FACTORY(KWinEffectsConfigFactory,
registerPlugin<KWin::KWinEffectsConfig>();
)
K_EXPORT_PLUGIN(KWinEffectsConfigFactory("kcmkwineffects"))
namespace KWin
{
KWinEffectsConfig::KWinEffectsConfig(QWidget *parent, const QStringList &)
KWinEffectsConfig::KWinEffectsConfig(QWidget *parent, const QVariantList &)
: KCModule( KWinEffectsConfigFactory::componentData(), parent),
mKWinConfig(KSharedConfig::openConfig("kwinrc"))
{

View file

@ -12,9 +12,7 @@ License. See the file "COPYING" for the exact licensing terms.
#ifndef __MAIN_H__
#define __MAIN_H__
#define KDE3_SUPPORT
#include <kcmodule.h>
#undef KDE3_SUPPORT
#include <ksharedconfig.h>
#include <QHash>
@ -29,7 +27,7 @@ class KWinEffectsConfig : public KCModule
{
Q_OBJECT
public:
KWinEffectsConfig(QWidget *parent, const QStringList &args);
KWinEffectsConfig(QWidget *parent, const QVariantList &args);
virtual ~KWinEffectsConfig();
virtual QString quickHelp() const;

View file

@ -7,7 +7,7 @@ Exec=kcmshell kwinactions
DocPath=kcontrol/windowmanagement/index.html#action-actions
X-KDE-Library=kcm_kwinoptions
X-KDE-FactoryName=kwinactions
X-KDE-PluginKeyword=kwinactions
Name=Actions
Name[af]=Aksies

View file

@ -7,7 +7,7 @@ Exec=kcmshell kwinadvanced
DocPath=kcontrol/windowmanagement/index.html#action-advanced
X-KDE-Library=kcm_kwinoptions
X-KDE-FactoryName=kwinadvanced
X-KDE-PluginKeyword=kwinadvanced
Name=Advanced
Name[af]=Gevorderde

View file

@ -7,7 +7,7 @@ Exec=kcmshell kwinfocus
DocPath=kcontrol/windowmanagement/index.html#action-focus
X-KDE-Library=kcm_kwinoptions
X-KDE-FactoryName=kwinfocus
X-KDE-PluginKeyword=kwinfocus
Name=Focus
Name[af]=Fokus

View file

@ -7,7 +7,7 @@ Exec=kcmshell kwinmoving
DocPath=kcontrol/windowmanagement/index.html#action-moving
X-KDE-Library=kcm_kwinoptions
X-KDE-FactoryName=kwinmoving
X-KDE-PluginKeyword=kwinmoving
Name=Moving
Name[af]=Beweeg

View file

@ -7,7 +7,7 @@ ServiceTypes=KCModule
DocPath=kcontrol/windowmanagement/index.html
X-KDE-Library=kcm_kwinoptions
X-KDE-FactoryName=kwinoptions
X-KDE-PluginKeyword=kwinoptions
X-KDE-ParentApp=kcontrol
X-KDE-System-Settings-Parent-Category=window-behaviour

View file

@ -27,58 +27,46 @@
#include <kglobal.h>
#include <klocale.h>
#include <kconfig.h>
#include <kgenericfactory.h>
#include <kaboutdata.h>
#include <kdialog.h>
#include <KPluginFactory>
#include <KPluginLoader>
#include "mouse.h"
#include "windows.h"
#include "main.h"
static KComponentData *_kcmkwm = 0;
inline KComponentData inst() {
if (!_kcmkwm) {
_kcmkwm = new KComponentData("kcmkwm");
}
return *_kcmkwm;
}
K_PLUGIN_FACTORY_DECLARATION(KWinOptionsFactory)
class KFocusConfigStandalone : public KFocusConfig
{
Q_OBJECT
public:
KFocusConfigStandalone(QWidget* parent, const QStringList &)
: KFocusConfig(true, new KConfig("kwinrc"), inst(), parent)
KFocusConfigStandalone(QWidget* parent, const QVariantList &)
: KFocusConfig(true, new KConfig("kwinrc"), KWinOptionsFactory::componentData(), parent)
{}
};
typedef KGenericFactory<KFocusConfigStandalone> KFocusConfigFactory;
K_EXPORT_COMPONENT_FACTORY(kwinfocus, KFocusConfigFactory)
class KMovingConfigStandalone : public KMovingConfig
{
Q_OBJECT
public:
KMovingConfigStandalone(QWidget* parent, const QStringList &)
: KMovingConfig(true, new KConfig("kwinrc"), inst(), parent)
KMovingConfigStandalone(QWidget* parent, const QVariantList &)
: KMovingConfig(true, new KConfig("kwinrc"), KWinOptionsFactory::componentData(), parent)
{}
};
typedef KGenericFactory<KMovingConfigStandalone> KMovingConfigFactory;
K_EXPORT_COMPONENT_FACTORY(kwinmoving, KMovingConfigFactory)
class KAdvancedConfigStandalone : public KAdvancedConfig
{
Q_OBJECT
public:
KAdvancedConfigStandalone(QWidget* parent, const QStringList &)
: KAdvancedConfig(true, new KConfig("kwinrc"), inst(), parent)
KAdvancedConfigStandalone(QWidget* parent, const QVariantList &)
: KAdvancedConfig(true, new KConfig("kwinrc"), KWinOptionsFactory::componentData(), parent)
{}
};
typedef KGenericFactory<KAdvancedConfigStandalone> KAdvancedConfigFactory;
K_EXPORT_COMPONENT_FACTORY(kwinadvanced, KAdvancedConfigFactory)
typedef KGenericFactory<KWinOptions> KWinOptionsFactory;
K_EXPORT_COMPONENT_FACTORY(kwinoptions, KWinOptionsFactory)
KWinOptions::KWinOptions(QWidget *parent, const QStringList &)
: KCModule(inst(), parent)
KWinOptions::KWinOptions(QWidget *parent, const QVariantList &)
: KCModule(KWinOptionsFactory::componentData(), parent)
{
mConfig = new KConfig( "kwinrc", KConfig::IncludeGlobals );
@ -195,11 +183,8 @@ void KWinOptions::moduleChanged(bool state)
emit KCModule::changed(state);
}
typedef KGenericFactory<KActionsOptions> KActionsOptionsFactory;
K_EXPORT_COMPONENT_FACTORY(kwinactions, KActionsOptionsFactory)
KActionsOptions::KActionsOptions(QWidget *parent, const QStringList &)
: KCModule(inst(), parent)
KActionsOptions::KActionsOptions(QWidget *parent, const QVariantList &)
: KCModule(KWinOptionsFactory::componentData(), parent)
{
mConfig = new KConfig( "kwinrc", KConfig::IncludeGlobals );
@ -260,4 +245,14 @@ void KActionsOptions::moduleChanged(bool state)
emit KCModule::changed(state);
}
K_PLUGIN_FACTORY_DEFINITION(KWinOptionsFactory,
registerPlugin<KActionsOptions>("kwinactions");
registerPlugin<KFocusConfigStandalone>("kwinfocus");
registerPlugin<KMovingConfigStandalone>("kwinmoving");
registerPlugin<KAdvancedConfigStandalone>("kwinadvanced");
registerPlugin<KWinOptions>("kwinoptions");
)
K_EXPORT_PLUGIN(KWinOptionsFactory("kcmkwm"))
#include "main.moc"
#include "moc_main.cpp"

View file

@ -26,16 +26,13 @@
#define __MAIN_H__
#include <QTabWidget>
#define KDE3_SUPPORT
#include <kcmodule.h>
#undef KDE3_SUPPORT
class KConfig;
class KFocusConfig;
class KTitleBarActionsConfig;
class KWindowActionsConfig;
class KAdvancedConfig;
class QStringList;
class KWinOptions : public KCModule
{
@ -43,7 +40,7 @@ class KWinOptions : public KCModule
public:
KWinOptions(QWidget *parent, const QStringList &args);
KWinOptions(QWidget *parent, const QVariantList &args);
virtual ~KWinOptions();
void load();
@ -76,7 +73,7 @@ class KActionsOptions : public KCModule
public:
KActionsOptions(QWidget *parent, const QStringList &args);
KActionsOptions(QWidget *parent, const QVariantList &args);
virtual ~KActionsOptions();
void load();