Port GenericScriptedConfig

KCModule needs a KAboutData as argument and KPluginFactory provides
componentName() as static method.
This commit is contained in:
Martin Gräßlin 2013-07-23 11:30:52 +02:00
parent b800d58a3d
commit d11288293c
3 changed files with 17 additions and 12 deletions

View file

@ -1,4 +1,8 @@
set(kcm_kwin4_genericscripted_SRCS genericscriptedconfig.cpp)
kde4_add_plugin( kcm_kwin4_genericscripted ${kcm_kwin4_genericscripted_SRCS} )
target_link_libraries( kcm_kwin4_genericscripted ${KDE4_KIO_LIBS} ${KDE4_KDEUI_LIBS} ${KDE4_PLASMA_LIBS} ${QT_QTUITOOLS_LIBRARY} )
target_link_libraries( kcm_kwin4_genericscripted
${KDE4Support_LIBRARIES} # KStandardDirs
${KDE4_KDEUI_LIBRARY} #KCModule
KF5::plasma
${Qt5UiTools_LIBRARIES} )
install( TARGETS kcm_kwin4_genericscripted DESTINATION ${PLUGIN_INSTALL_DIR} )

View file

@ -20,6 +20,7 @@
#include "genericscriptedconfig.h"
#include "config-kwin.h"
#include <KDE/KAboutData>
#include <KDE/KStandardDirs>
#include <KDE/KLocalizedString>
#include <Plasma/ConfigLoader>
@ -43,14 +44,14 @@ QObject *GenericScriptedConfigFactory::create(const char *iface, QWidget *parent
Q_UNUSED(iface)
Q_UNUSED(parent)
if (keyword.startsWith(QStringLiteral("kwin4_effect_"))) {
return new ScriptedEffectConfig(componentData(), keyword, parentWidget, args);
return new ScriptedEffectConfig(componentName(), keyword, parentWidget, args);
} else {
return new ScriptingConfig(componentData(), keyword, parentWidget, args);
return new ScriptingConfig(componentName(), keyword, parentWidget, args);
}
}
GenericScriptedConfig::GenericScriptedConfig(const KComponentData &data, const QString &keyword, QWidget *parent, const QVariantList &args)
: KCModule(data, parent, args)
GenericScriptedConfig::GenericScriptedConfig(const QString &componentName, const QString &keyword, QWidget *parent, const QVariantList &args)
: KCModule(KAboutData::pluginData(componentName), parent, args)
, m_packageName(keyword)
{
}
@ -104,8 +105,8 @@ void GenericScriptedConfig::reload()
{
}
ScriptedEffectConfig::ScriptedEffectConfig(const KComponentData &data, const QString &keyword, QWidget *parent, const QVariantList &args)
: GenericScriptedConfig(data, keyword, parent, args)
ScriptedEffectConfig::ScriptedEffectConfig(const QString &componentName, const QString &keyword, QWidget *parent, const QVariantList &args)
: GenericScriptedConfig(componentName, keyword, parent, args)
{
createUi();
}
@ -134,8 +135,8 @@ void ScriptedEffectConfig::reload()
QDBusConnection::sessionBus().send(message);
}
ScriptingConfig::ScriptingConfig(const KComponentData &data, const QString &keyword, QWidget *parent, const QVariantList &args)
: GenericScriptedConfig(data, keyword, parent, args)
ScriptingConfig::ScriptingConfig(const QString &componentName, const QString &keyword, QWidget *parent, const QVariantList &args)
: GenericScriptedConfig(componentName, keyword, parent, args)
{
createUi();
}

View file

@ -42,7 +42,7 @@ class GenericScriptedConfig : public KCModule
Q_OBJECT
public:
GenericScriptedConfig(const KComponentData &data, const QString &keyword, QWidget *parent, const QVariantList &args);
GenericScriptedConfig(const QString &componentName, const QString &keyword, QWidget *parent, const QVariantList &args);
virtual ~GenericScriptedConfig();
public Q_SLOTS:
@ -63,7 +63,7 @@ class ScriptedEffectConfig : public GenericScriptedConfig
{
Q_OBJECT
public:
ScriptedEffectConfig(const KComponentData &data, const QString &keyword, QWidget *parent, const QVariantList &args);
ScriptedEffectConfig(const QString &componentName, const QString &keyword, QWidget *parent, const QVariantList &args);
virtual ~ScriptedEffectConfig();
protected:
virtual QString typeName() const;
@ -75,7 +75,7 @@ class ScriptingConfig : public GenericScriptedConfig
{
Q_OBJECT
public:
ScriptingConfig(const KComponentData &data, const QString &keyword, QWidget *parent, const QVariantList &args);
ScriptingConfig(const QString &componentName, const QString &keyword, QWidget *parent, const QVariantList &args);
virtual ~ScriptingConfig();
protected: