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
This commit is contained in:
Alexander Lohnau 2021-08-23 18:37:29 +02:00
parent cd4ef30b21
commit 58c71de952
2 changed files with 8 additions and 4 deletions

View file

@ -625,7 +625,7 @@ static KCModule *findScriptedConfig(const QString &pluginId, QObject *parent)
return nullptr;
}
return factory->create<KCModule>(pluginId, parent);
return factory->create<KCModule>(parent, QVariantList{pluginId});
}
void EffectsModel::requestConfigure(const QModelIndex &index, QWindow *transientParent)

View file

@ -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);
}
}