Read KPluginMetada's property X-Plasma-ComponentTypes as a stringlist

plasma-scriptengine.desktop defines the property "X-Plasma-
ComponentTypes" as Type=QStringList. When reading it using
KPluginMetaData::value(..) it expects a QString back. This
used to work but regressed in kcoreaddons in commit
cfd18cf09b559a050fd6a2680ad4e71eeb950383.Making it read the
property as a stringlist works and is correct and also fixes
Plasma startup.

REVIEW: 126320
This commit is contained in:
Martin Klapetek 2015-12-14 09:04:06 -05:00
parent 9b48e3d010
commit 54602237fd

View File

@ -64,9 +64,9 @@ QStringList knownLanguages(Types::ComponentTypes types)
const QVector<KPluginMetaData> plugins = KPluginLoader::findPlugins(QStringLiteral("plasma/scriptengines"));
for (auto plugin : plugins) {
const QString componentTypes = plugin.value(QStringLiteral("X-Plasma-ComponentTypes"));
if (((types & Types::AppletComponent) && componentTypes == QLatin1String("Applet"))
||((types & Types::DataEngineComponent) && componentTypes == QLatin1String("DataEngine"))) {
const QStringList componentTypes = KPluginMetaData::readStringList(plugins.first().rawData(), QStringLiteral("X-Plasma-ComponentTypes"));
if (((types & Types::AppletComponent) && !componentTypes.contains(QLatin1String("Applet")))
||((types & Types::DataEngineComponent) && !componentTypes.contains(QLatin1String("DataEngine")))) {
languages << plugin.value(QStringLiteral("X-Plasma-API"));
}
}
@ -86,9 +86,9 @@ ScriptEngine *loadEngine(const QString &language, Types::ComponentType type, QOb
QVector<KPluginMetaData> plugins = KPluginLoader::findPlugins(QStringLiteral("plasma/scriptengines"), filter);
if (plugins.count()) {
const QString componentTypes = plugins.first().value(QStringLiteral("X-Plasma-ComponentTypes"));
if (((type & Types::AppletComponent) && componentTypes != QLatin1String("Applet"))
|| ((type & Types::DataEngineComponent) && componentTypes != QLatin1String("DataEngine"))) {
const QStringList componentTypes = KPluginMetaData::readStringList(plugins.first().rawData(), QStringLiteral("X-Plasma-ComponentTypes"));
if (((type & Types::AppletComponent) && !componentTypes.contains(QLatin1String("Applet")))
|| ((type & Types::DataEngineComponent) && !componentTypes.contains(QLatin1String("DataEngine")))) {
return 0;
}
KPluginInfo::List lst = KPluginInfo::fromMetaData(plugins);