diff --git a/clients/oxygen/config/oxygenconfig.cpp b/clients/oxygen/config/oxygenconfig.cpp index 390612ea8e..877f1a65ea 100644 --- a/clients/oxygen/config/oxygenconfig.cpp +++ b/clients/oxygen/config/oxygenconfig.cpp @@ -28,7 +28,6 @@ ////////////////////////////////////////////////////////////////////////////// #include "oxygenconfig.h" -#include "oxygenconfig.moc" #include "oxygenanimationconfigwidget.h" #include "oxygenconfiguration.h" @@ -41,19 +40,21 @@ #include #include +#include //_______________________________________________________________________ -extern "C" -{ - KDE_EXPORT QObject* allocate_config( KConfig* conf, QWidget* parent ) - { return ( new Oxygen::Config( conf, parent ) ); } -} + +K_PLUGIN_FACTORY(OxygenConfigPlugin, registerPlugin(QString(), &Oxygen::Config::create); ) namespace Oxygen { + QObject *Config::create(QWidget *parentWidget, QObject *, const QList &) + { + return new Config(parentWidget); + } //_______________________________________________________________________ - Config::Config( KConfig*, QWidget* parent ): + Config::Config(QWidget* parent ): QObject( parent ) { @@ -174,3 +175,5 @@ namespace Oxygen } } + +#include "oxygenconfig.moc" diff --git a/clients/oxygen/config/oxygenconfig.h b/clients/oxygen/config/oxygenconfig.h index c8500c705f..72c511150e 100644 --- a/clients/oxygen/config/oxygenconfig.h +++ b/clients/oxygen/config/oxygenconfig.h @@ -50,11 +50,13 @@ namespace Oxygen { public: //! constructor - Config( KConfig* conf, QWidget* parent ); + Config( QWidget* parent ); //! destructor ~Config(); + static QObject *create(QWidget *parentWidget, QObject *parent, const QList &arguments); + Q_SIGNALS: //! emmited whenever configuration is changed diff --git a/kcmkwin/kwindecoration/configdialog.cpp b/kcmkwin/kwindecoration/configdialog.cpp index 9ad7737d5d..fd607a6d01 100644 --- a/kcmkwin/kwindecoration/configdialog.cpp +++ b/kcmkwin/kwindecoration/configdialog.cpp @@ -22,10 +22,11 @@ along with this program. If not, see . #include #include -#include #include #include #include +#include +#include #include #include @@ -88,23 +89,20 @@ KWinDecorationConfigDialog::KWinDecorationConfigDialog(QString deco, const QList connect(m_buttons, SIGNAL(accepted()), SLOT(accept())); connect(m_buttons, SIGNAL(rejected()), SLOT(reject())); - KLibrary library(styleToConfigLib(deco)); - if (library.load()) { - KLibrary::void_function_ptr alloc_ptr = library.resolveFunction("allocate_config"); - if (alloc_ptr != nullptr) { - allocatePlugin = (QObject * (*)(KConfigGroup & conf, QWidget * parent))alloc_ptr; - KConfigGroup config(m_kwinConfig, "Style"); - m_pluginConfigWidget = new QWidget(this); - m_pluginConfigWidget->setLayout(new QVBoxLayout); - m_pluginObject = (QObject*)(allocatePlugin(config, m_pluginConfigWidget)); + KPluginLoader loader(styleToConfigLib(deco)); + KPluginFactory *factory = loader.factory(); + if (factory) { + m_pluginConfigWidget = new QWidget(this); + m_pluginConfigWidget->setLayout(new QVBoxLayout); + m_pluginObject = factory->create(m_pluginConfigWidget, m_pluginConfigWidget, QString(), + QVariantList() << QStringLiteral("kwinrc") << QStringLiteral("Style")); - // connect required signals and slots together... - connect(this, SIGNAL(accepted()), this, SLOT(slotAccepted())); - connect(m_pluginObject, SIGNAL(changed()), this, SLOT(slotSelectionChanged())); - connect(this, SIGNAL(pluginSave(KConfigGroup&)), m_pluginObject, SLOT(save(KConfigGroup&))); - connect(m_buttons->button(QDialogButtonBox::RestoreDefaults), SIGNAL(clicked(bool)), m_pluginObject, SLOT(defaults())); - connect(m_buttons->button(QDialogButtonBox::RestoreDefaults), SIGNAL(clicked(bool)), SLOT(slotDefault())); - } + // connect required signals and slots together... + connect(this, SIGNAL(accepted()), this, SLOT(slotAccepted())); + connect(m_pluginObject, SIGNAL(changed()), this, SLOT(slotSelectionChanged())); + connect(this, SIGNAL(pluginSave(KConfigGroup&)), m_pluginObject, SLOT(save(KConfigGroup&))); + connect(m_buttons->button(QDialogButtonBox::RestoreDefaults), SIGNAL(clicked(bool)), m_pluginObject, SLOT(defaults())); + connect(m_buttons->button(QDialogButtonBox::RestoreDefaults), SIGNAL(clicked(bool)), SLOT(slotDefault())); } if (m_pluginConfigWidget) {