Fix X-Plasma-Drop* types

They are supposed to be lists. This fixes dropping folders on desktops to create a FolderView.
Dropping trash:/ also offers to create a trash applet again.

BUG: 374418

Differential Revision: https://phabricator.kde.org/D3902
This commit is contained in:
Kai Uwe Broulik 2017-01-03 09:31:21 +01:00
parent 39adcec588
commit a0f3d2429d
2 changed files with 5 additions and 5 deletions

View File

@ -538,7 +538,7 @@ KPluginInfo::List PluginLoader::listAppletInfoForMimeType(const QString &mimeTyp
{
auto filter = [&mimeType](const KPluginMetaData &md) -> bool
{
return md.value(QStringLiteral("X-Plasma-DropMimeTypes")).contains(mimeType);
return KPluginMetaData::readStringList(md.rawData(), QStringLiteral("X-Plasma-DropMimeTypes")).contains(mimeType);
};
return KPluginInfo::fromMetaData(KPackage::PackageLoader::self()->findPackages(QStringLiteral("Plasma/Applet"), QString(), filter).toVector());
}
@ -554,7 +554,7 @@ KPluginInfo::List PluginLoader::listAppletInfoForUrl(const QUrl &url)
auto filter = [&parentApp](const KPluginMetaData &md) -> bool
{
const QString pa = md.value(QStringLiteral("X-KDE-ParentApp"));
return (pa.isEmpty() || pa == parentApp) && !md.value(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());
@ -668,8 +668,8 @@ KPluginInfo::List PluginLoader::listContainmentsForMimeType(const QString &mimeT
{
auto filter = [&mimeType](const KPluginMetaData &md) -> bool
{
return md.value(QStringLiteral("X-KDE-ServiceTypes")).contains(QLatin1String("Plasma/Containment"))
&& md.value(QStringLiteral("X-Plasma-DropMimeTypes")).contains(mimeType);
return md.serviceTypes().contains(QLatin1String("Plasma/Containment"))
&& KPluginMetaData::readStringList(md.rawData(), QStringLiteral("X-Plasma-DropMimeTypes")).contains(mimeType);
};
return KPluginInfo::fromMetaData(KPackage::PackageLoader::self()->findPackages(QStringLiteral("Plasma/Applet"), QString(), filter).toVector());

View File

@ -75,7 +75,7 @@ KPluginInfo::List WallpaperInterface::listWallpaperInfoForMimetype(const QString
if (!formFactor.isEmpty() && !md.value(QStringLiteral("X-Plasma-FormFactors")).contains(formFactor)) {
return false;
}
return md.value(QStringLiteral("X-Plasma-DropMimeTypes")).contains(mimetype);
return KPluginMetaData::readStringList(md.rawData(), QStringLiteral("X-Plasma-DropMimeTypes")).contains(mimetype);
};
return KPluginInfo::fromMetaData(KPackage::PackageLoader::self()->findPackages(QStringLiteral("Plasma/Wallpaper"), QString(), filter).toVector());
}