Clean up legacy configmodule querying

In KWin we are allowed to break compat and here all first party consumers
have already been ported for quite a while.

Also the querying is very inefficient, because for every plugin where the
X-KDE-ConfigModule property is not defined all available KCMs have to be opened and
their metadata parsed.

This way we also get rid of the deprecation warning for KPluginMetaData::readStringList.
This commit is contained in:
Alexander Lohnau 2021-12-25 11:25:30 +01:00
parent 32f9ba0caf
commit f2dd50e1f9

View file

@ -357,23 +357,6 @@ void EffectsModel::loadPluginEffects(const KConfigGroup &kwinConfig)
effect.kind = Kind::Binary;
effect.configModule = pluginEffect.value(QStringLiteral("X-KDE-ConfigModule"));
// Compatibility with plugins that don't have ConfigModule in their metadata
// TODO KF6 remove
if (effect.configModule.isEmpty()) {
auto filter = [pluginEffect](const KPluginMetaData &md) -> bool
{
const QStringList parentComponents = KPluginMetaData::readStringList(md.rawData(), QStringLiteral("X-KDE-ParentComponents"));
return parentComponents.contains(pluginEffect.pluginId());
};
const QVector<KPluginMetaData> plugins = KPluginMetaData::findPlugins(QStringLiteral("kwin/effects/configs/"), filter);
if (!plugins.isEmpty()) {
effect.configModule = plugins.first().pluginId();
}
}
for (int i = 0; i < pluginEffect.authors().count(); ++i) {
effect.authorName.append(pluginEffect.authors().at(i).name());
effect.authorEmail.append(pluginEffect.authors().at(i).emailAddress());