Fix determining of scripted effect config from KPluginSelector
In the KPluginSelector we don't have the possibility to set the args for each KCM. Because of that we use the metadata of the KPluginFactory as a fallback to read the plugin keyword, which specifies the KCM we want to display. This requires kcmutils 54b196a9bad88732debe0b49111af4755268f09f, which landed in the last release. BUG: 445667
This commit is contained in:
parent
16d473a326
commit
468acd0cbe
1 changed files with 11 additions and 2 deletions
|
@ -30,9 +30,18 @@ QObject *GenericScriptedConfigFactory::create(const char *iface, QWidget *parent
|
||||||
Q_UNUSED(iface)
|
Q_UNUSED(iface)
|
||||||
Q_UNUSED(parent)
|
Q_UNUSED(parent)
|
||||||
Q_UNUSED(keyword)
|
Q_UNUSED(keyword)
|
||||||
Q_ASSERT(!args.isEmpty());
|
|
||||||
|
|
||||||
const QString pluginId = args.first().toString();
|
// the plugin id is in the args when created by desktop effects kcm or EffectsModel in general
|
||||||
|
QString pluginId = args.isEmpty() ? QString() : args.first().toString();
|
||||||
|
|
||||||
|
// If we do not get the id of the effect we want to load from the args, we have to check our metadata.
|
||||||
|
// This can be the case if the factory gets loaded from a KPluginSelector
|
||||||
|
// the plugin id is in plugin factory metadata when created by scripts kcm
|
||||||
|
// (because it uses kpluginselector, which doesn't pass the plugin id as the first arg),
|
||||||
|
// can be dropped once the scripts kcm is ported to qtquick (because then we could pass the plugin id via the args)
|
||||||
|
if (pluginId.isEmpty()) {
|
||||||
|
pluginId = metaData().pluginId();
|
||||||
|
}
|
||||||
if (pluginId.startsWith(QLatin1String("kwin4_effect_"))) {
|
if (pluginId.startsWith(QLatin1String("kwin4_effect_"))) {
|
||||||
return new ScriptedEffectConfig(pluginId, parentWidget, args);
|
return new ScriptedEffectConfig(pluginId, parentWidget, args);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue