[kcm/common] Port EffectsModel away from KPluginMetaData::metaDataFileName

It's gone in KF6

It's only used to obtain the install location of the package and resolve files relative to that

Use QStandardPaths to locate those files directly
This commit is contained in:
Nicolas Fella 2023-02-21 14:17:35 +01:00 committed by Vlad Zahorodnii
parent 2de5236e3f
commit a1639da6e5

View file

@ -312,10 +312,8 @@ void EffectsModel::loadJavascriptEffects(const KConfigGroup &kwinConfig)
const QString pluginKeyword = plugin.value(QStringLiteral("X-KDE-PluginKeyword"));
if (!pluginKeyword.isEmpty()) {
QDir package(QFileInfo(plugin.metaDataFileName()).dir());
package.cd(QStringLiteral("contents"));
const QString xmlFile = package.filePath(QStringLiteral("config/main.xml"));
const QString uiFile = package.filePath(QStringLiteral("ui/config.ui"));
const QString xmlFile = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QLatin1String("kwin/effects/") + plugin.pluginId() + QLatin1String("/contents/config/main.xml"));
const QString uiFile = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QLatin1String("kwin/effects/") + plugin.pluginId() + QLatin1String("/contents/ui/config.ui"));
effect.configurable = QFileInfo::exists(xmlFile) && QFileInfo::exists(uiFile);
} else {
effect.configurable = false;