From 58c71de952c76fd479b1e1c0ae6228d8ef2051e3 Mon Sep 17 00:00:00 2001 From: Alexander Lohnau Date: Mon, 23 Aug 2021 18:37:29 +0200 Subject: [PATCH] GenericScriptedConfigFactory::create: Do not use plugin keyword to identify which KCM should be loaded We can just put the parameter in the variant list. Because the method is virtual, the keyword parameter must exist in the method definition. Task: https://phabricator.kde.org/T14744 --- src/kcmkwin/common/effectsmodel.cpp | 2 +- src/scripting/genericscriptedconfig.cpp | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/kcmkwin/common/effectsmodel.cpp b/src/kcmkwin/common/effectsmodel.cpp index c93198c557..4952f3d905 100644 --- a/src/kcmkwin/common/effectsmodel.cpp +++ b/src/kcmkwin/common/effectsmodel.cpp @@ -625,7 +625,7 @@ static KCModule *findScriptedConfig(const QString &pluginId, QObject *parent) return nullptr; } - return factory->create(pluginId, parent); + return factory->create(parent, QVariantList{pluginId}); } void EffectsModel::requestConfigure(const QModelIndex &index, QWindow *transientParent) diff --git a/src/scripting/genericscriptedconfig.cpp b/src/scripting/genericscriptedconfig.cpp index 2fdc480d6e..0be341631b 100644 --- a/src/scripting/genericscriptedconfig.cpp +++ b/src/scripting/genericscriptedconfig.cpp @@ -29,10 +29,14 @@ QObject *GenericScriptedConfigFactory::create(const char *iface, QWidget *parent { Q_UNUSED(iface) Q_UNUSED(parent) - if (keyword.startsWith(QLatin1String("kwin4_effect_"))) { - return new ScriptedEffectConfig(keyword, parentWidget, args); + Q_UNUSED(keyword) + Q_ASSERT(!args.isEmpty()); + + const QString pluginId = args.first().toString(); + if (pluginId.startsWith(QLatin1String("kwin4_effect_"))) { + return new ScriptedEffectConfig(pluginId, parentWidget, args); } else { - return new ScriptingConfig(keyword, parentWidget, args); + return new ScriptingConfig(pluginId, parentWidget, args); } }