- make the KCMs services

- use KGenericFactory (the construction code could be cleaned up some more)

svn path=/trunk/KDE/kdebase/workspace/; revision=564554
This commit is contained in:
Matthias Kretz 2006-07-20 13:14:03 +00:00
parent 37150cabc5
commit ec2b5dff3c
9 changed files with 70 additions and 55 deletions

View file

@ -18,8 +18,9 @@ install(TARGETS kcm_kwinoptions DESTINATION ${PLUGIN_INSTALL_DIR} )
########### install files ###############
install( FILES kwinoptions.desktop DESTINATION ${XDG_APPS_DIR} )
install( FILES kwinactions.desktop kwinadvanced.desktop kwinfocus.desktop kwinmoving.desktop kwintranslucency.desktop DESTINATION ${APPLNK_INSTALL_DIR}/.hidden )
install( FILES kwinoptions.desktop kwinactions.desktop kwinadvanced.desktop
kwinfocus.desktop kwinmoving.desktop kwintranslucency.desktop
DESTINATION ${SERVICES_INSTALL_DIR})
kde4_install_icons( ${ICON_INSTALL_DIR} crystalsvg )

View file

@ -1,7 +1,8 @@
[Desktop Entry]
Encoding=UTF-8
Icon=kcmkwm
Type=Application
Type=Service
ServiceTypes=KCModule
Exec=kcmshell kwinactions
DocPath=kcontrol/windowmanagement/index.html#action-actions

View file

@ -1,7 +1,8 @@
[Desktop Entry]
Encoding=UTF-8
Icon=kcmkwm
Type=Application
Type=Service
ServiceTypes=KCModule
Exec=kcmshell kwinadvanced
DocPath=kcontrol/windowmanagement/index.html#action-advanced

View file

@ -1,7 +1,8 @@
[Desktop Entry]
Encoding=UTF-8
Icon=kcmkwm
Type=Application
Type=Service
ServiceTypes=KCModule
Exec=kcmshell kwinfocus
DocPath=kcontrol/windowmanagement/index.html#action-focus

View file

@ -1,7 +1,8 @@
[Desktop Entry]
Encoding=UTF-8
Icon=kcmkwm
Type=Application
Type=Service
ServiceTypes=KCModule
Exec=kcmshell kwinmoving
DocPath=kcontrol/windowmanagement/index.html#action-moving

View file

@ -1,12 +1,14 @@
[Desktop Entry]
Encoding=UTF-8
Icon=kcmkwm
Type=Application
Type=Service
ServiceTypes=KCModule
Exec=kcmshell kwinoptions
DocPath=kcontrol/windowmanagement/index.html
X-KDE-Library=kwinoptions
X-KDE-FactoryName=kwinoptions
X-KDE-ParentApp=kcontrol
Name=Window Behavior
Name[fr]=Comportement des fenêtres
@ -19,4 +21,3 @@ Comment[x-test]=xxConfigure the window behaviorxx
Keywords=focus,placement,window behavior,animation,raise,auto raise,windows,frame,titlebar,doubleclick
Keywords[fr]=focus,gestion du focus,fenêtre,placement des fenêtres,comportement des fenêtres,animation,fenêtres,barre de titre,double clic,souris,boutons de la souris,dessus,dessous,raise,auto raise
Keywords[x-test]=xxfocus,placement,window behavior,animation,raise,auto raise,windows,frame,titlebar,doubleclickxx
Categories=Qt;KDE;X-KDE-settings-desktop;

View file

@ -1,7 +1,8 @@
[Desktop Entry]
Encoding=UTF-8
Icon=kcmkwm
Type=Application
Type=Service
ServiceTypes=KCModule
Exec=kcmshell kwintranslucency
DocPath=kcontrol/windowmanagement/index.html#action-translucency

View file

@ -45,46 +45,51 @@ inline KInstance *inst() {
return _kcmkwm;
}
extern "C"
class KFocusConfigStandalone : public KFocusConfig
{
KDE_EXPORT KCModule *create_kwinfocus(QWidget *parent, const char *name)
{
KConfig *c = new KConfig("kwinrc", false, true);
return new KFocusConfig(true, c, inst(), parent);
}
public:
KFocusConfigStandalone(QWidget* parent, const QStringList &)
: KFocusConfig(true, new KConfig("kwinrc", false, true), inst(), parent)
{}
};
typedef KGenericFactory<KFocusConfigStandalone> KFocusConfigFactory;
K_EXPORT_COMPONENT_FACTORY(kwinfocus, KFocusConfigFactory)
KDE_EXPORT KCModule *create_kwinactions(QWidget *parent, const char *name)
{
return new KActionsOptions( inst(), parent);
}
class KMovingConfigStandalone : public KMovingConfig
{
public:
KMovingConfigStandalone(QWidget* parent, const QStringList &)
: KMovingConfig(true, new KConfig("kwinrc", false, true), inst(), parent)
{}
};
typedef KGenericFactory<KMovingConfigStandalone> KMovingConfigFactory;
K_EXPORT_COMPONENT_FACTORY(kwinmoving, KMovingConfigFactory)
KDE_EXPORT KCModule *create_kwinmoving(QWidget *parent, const char *name)
{
KConfig *c = new KConfig("kwinrc", false, true);
return new KMovingConfig(true, c, inst(), parent);
}
class KAdvancedConfigStandalone : public KAdvancedConfig
{
public:
KAdvancedConfigStandalone(QWidget* parent, const QStringList &)
: KAdvancedConfig(true, new KConfig("kwinrc", false, true), inst(), parent)
{}
};
typedef KGenericFactory<KAdvancedConfigStandalone> KAdvancedConfigFactory;
K_EXPORT_COMPONENT_FACTORY(kwinadvanced, KAdvancedConfigFactory)
KDE_EXPORT KCModule *create_kwinadvanced(QWidget *parent, const char *name)
{
KConfig *c = new KConfig("kwinrc", false, true);
return new KAdvancedConfig(true, c, inst(), parent);
}
KDE_EXPORT KCModule *create_kwintranslucency(QWidget *parent, const char *name)
{
KConfig *c = new KConfig("kwinrc", false, true);
return new KTranslucencyConfig(true, c, inst(), parent);
}
class KTranslucencyConfigStandalone : public KTranslucencyConfig
{
public:
KTranslucencyConfigStandalone(QWidget* parent, const QStringList &)
: KTranslucencyConfig(true, new KConfig("kwinrc", false, true), inst(), parent)
{}
};
typedef KGenericFactory<KTranslucencyConfigStandalone> KTranslucencyConfigFactory;
K_EXPORT_COMPONENT_FACTORY(kwintranslucency, KTranslucencyConfigFactory)
KDE_EXPORT KCModule *create_kwinoptions ( QWidget *parent, const char* name)
{
return new KWinOptions( inst(), parent);
}
}
typedef KGenericFactory<KWinOptions> KWinOptionsFactory;
K_EXPORT_COMPONENT_FACTORY(kwinoptions, KWinOptionsFactory)
KWinOptions::KWinOptions(KInstance *inst, QWidget *parent)
: KCModule(inst, parent)
KWinOptions::KWinOptions(QWidget *parent, const QStringList &)
: KCModule(inst(), parent)
{
mConfig = new KConfig("kwinrc", false, true);
@ -92,37 +97,37 @@ KWinOptions::KWinOptions(KInstance *inst, QWidget *parent)
tab = new QTabWidget(this);
layout->addWidget(tab);
mFocus = new KFocusConfig(false, mConfig, inst, this);
mFocus = new KFocusConfig(false, mConfig, instance(), this);
mFocus->setObjectName("KWin Focus Config");
mFocus->layout()->setMargin( KDialog::marginHint() );
tab->addTab(mFocus, i18n("&Focus"));
connect(mFocus, SIGNAL(changed(bool)), this, SLOT(moduleChanged(bool)));
mTitleBarActions = new KTitleBarActionsConfig(false, mConfig, inst, this);
mTitleBarActions = new KTitleBarActionsConfig(false, mConfig, instance(), this);
mTitleBarActions->setObjectName("KWin TitleBar Actions");
mTitleBarActions->layout()->setMargin( KDialog::marginHint() );
tab->addTab(mTitleBarActions, i18n("&Titlebar Actions"));
connect(mTitleBarActions, SIGNAL(changed(bool)), this, SLOT(moduleChanged(bool)));
mWindowActions = new KWindowActionsConfig(false, mConfig, inst, this);
mWindowActions = new KWindowActionsConfig(false, mConfig, instance(), this);
mWindowActions->setObjectName("KWin Window Actions");
mWindowActions->layout()->setMargin( KDialog::marginHint() );
tab->addTab(mWindowActions, i18n("Window Actio&ns"));
connect(mWindowActions, SIGNAL(changed(bool)), this, SLOT(moduleChanged(bool)));
mMoving = new KMovingConfig(false, mConfig, inst, this);
mMoving = new KMovingConfig(false, mConfig, instance(), this);
mMoving->setObjectName("KWin Moving");
mMoving->layout()->setMargin( KDialog::marginHint() );
tab->addTab(mMoving, i18n("&Moving"));
connect(mMoving, SIGNAL(changed(bool)), this, SLOT(moduleChanged(bool)));
mAdvanced = new KAdvancedConfig(false, mConfig, inst, this);
mAdvanced = new KAdvancedConfig(false, mConfig, instance(), this);
mAdvanced->setObjectName("KWin Advanced");
mAdvanced->layout()->setMargin( KDialog::marginHint() );
tab->addTab(mAdvanced, i18n("Ad&vanced"));
connect(mAdvanced, SIGNAL(changed(bool)), this, SLOT(moduleChanged(bool)));
mTranslucency = new KTranslucencyConfig(false, mConfig, inst, this);
mTranslucency = new KTranslucencyConfig(false, mConfig, instance(), this);
mTranslucency->setObjectName("KWin Translucency");
mTranslucency->layout()->setMargin( KDialog::marginHint() );
tab->addTab(mTranslucency, i18n("&Translucency"));
@ -209,9 +214,11 @@ void KWinOptions::moduleChanged(bool state)
emit KCModule::changed(state);
}
typedef KGenericFactory<KActionsOptions> KActionsOptionsFactory;
K_EXPORT_COMPONENT_FACTORY(kwinactions, KActionsOptionsFactory)
KActionsOptions::KActionsOptions(KInstance *inst, QWidget *parent)
: KCModule(inst, parent)
KActionsOptions::KActionsOptions(QWidget *parent, const QStringList &)
: KCModule(inst(), parent)
{
mConfig = new KConfig("kwinrc", false, true);
@ -219,13 +226,13 @@ KActionsOptions::KActionsOptions(KInstance *inst, QWidget *parent)
tab = new QTabWidget(this);
layout->addWidget(tab);
mTitleBarActions = new KTitleBarActionsConfig(false, mConfig, inst, this);
mTitleBarActions = new KTitleBarActionsConfig(false, mConfig, instance(), this);
mTitleBarActions->setObjectName("KWin TitleBar Actions");
mTitleBarActions->layout()->setMargin( KDialog::marginHint() );
tab->addTab(mTitleBarActions, i18n("&Titlebar Actions"));
connect(mTitleBarActions, SIGNAL(changed(bool)), this, SLOT(moduleChanged(bool)));
mWindowActions = new KWindowActionsConfig(false, mConfig, inst, this);
mWindowActions = new KWindowActionsConfig(false, mConfig, instance(), this);
mWindowActions->setObjectName("KWin Window Actions");
mWindowActions->layout()->setMargin( KDialog::marginHint() );
tab->addTab(mWindowActions, i18n("Window Actio&ns"));

View file

@ -34,6 +34,7 @@ class KTitleBarActionsConfig;
class KWindowActionsConfig;
class KAdvancedConfig;
class KTranslucencyConfig;
class QStringList;
class KWinOptions : public KCModule
{
@ -41,7 +42,7 @@ class KWinOptions : public KCModule
public:
KWinOptions(KInstance *inst, QWidget *parent);
KWinOptions(QWidget *parent, const QStringList &args);
virtual ~KWinOptions();
void load();
@ -75,7 +76,7 @@ class KActionsOptions : public KCModule
public:
KActionsOptions(KInstance *inst, QWidget *parent);
KActionsOptions(QWidget *parent, const QStringList &args);
virtual ~KActionsOptions();
void load();