use KPluginMetaData::readStringList()

Summary:
replace the last remaining place in pluginloader
where a string list was read as a normal string

Change-Id: I66e7f563745466e31cfb23492fdb081806b1e406

Test Plan:
related to D3902
dropping of files on containment still works

Reviewers: broulik, #plasma, davidedmundson

Reviewed By: #plasma, davidedmundson

Subscribers: plasma-devel, #frameworks

Tags: #plasma, #frameworks

Differential Revision: https://phabricator.kde.org/D3936
This commit is contained in:
Marco Martin 2017-01-03 16:46:02 +01:00
parent c6132f87c4
commit 94edfa149f

View File

@ -556,19 +556,19 @@ KPluginInfo::List PluginLoader::listAppletInfoForUrl(const QUrl &url)
const QString pa = md.value(QStringLiteral("X-KDE-ParentApp")); const QString pa = md.value(QStringLiteral("X-KDE-ParentApp"));
return (pa.isEmpty() || pa == parentApp) && !KPluginMetaData::readStringList(md.rawData(), QStringLiteral("X-Plasma-DropUrlPatterns")).isEmpty(); return (pa.isEmpty() || pa == parentApp) && !KPluginMetaData::readStringList(md.rawData(), QStringLiteral("X-Plasma-DropUrlPatterns")).isEmpty();
}; };
KPluginInfo::List allApplets = KPluginInfo::fromMetaData(KPackage::PackageLoader::self()->findPackages(QStringLiteral("Plasma/Applet"), QString(), filter).toVector()); QList<KPluginMetaData> allApplets = KPackage::PackageLoader::self()->findPackages(QStringLiteral("Plasma/Applet"), QString(), filter);
KPluginInfo::List filtered; KPluginInfo::List filtered;
foreach (const KPluginInfo &info, allApplets) { foreach (const KPluginMetaData &md, allApplets) {
QStringList urlPatterns = info.property(QStringLiteral("X-Plasma-DropUrlPatterns")).toStringList(); QStringList urlPatterns = KPluginMetaData::readStringList(md.rawData(), QStringLiteral("X-Plasma-DropUrlPatterns"));
foreach (const QString &glob, urlPatterns) { foreach (const QString &glob, urlPatterns) {
QRegExp rx(glob); QRegExp rx(glob);
rx.setPatternSyntax(QRegExp::Wildcard); rx.setPatternSyntax(QRegExp::Wildcard);
if (rx.exactMatch(url.toString())) { if (rx.exactMatch(url.toString())) {
#ifndef NDEBUG #ifndef NDEBUG
// qCDebug(LOG_PLASMA) << info.name() << "matches" << glob << url; // qCDebug(LOG_PLASMA) << md.name() << "matches" << glob << url;
#endif #endif
filtered << info; filtered << KPluginInfo::fromMetaData(md);
} }
} }
} }