Changeset View
Changeset View
Standalone View
Standalone View
src/widgets/kfileitemactions.cpp
Show First 20 Lines • Show All 481 Lines • ▼ Show 20 Line(s) | 456 | { | |||
---|---|---|---|---|---|
482 | 482 | | |||
483 | const QMimeDatabase db; | 483 | const QMimeDatabase db; | ||
484 | const auto jsonPlugins = KPluginLoader::findPlugins(QStringLiteral("kf5/kfileitemaction"), [&db, commonMimeType](const KPluginMetaData& metaData) { | 484 | const auto jsonPlugins = KPluginLoader::findPlugins(QStringLiteral("kf5/kfileitemaction"), [&db, commonMimeType](const KPluginMetaData& metaData) { | ||
485 | if (!metaData.serviceTypes().contains(QLatin1String("KFileItemAction/Plugin"))) { | 485 | if (!metaData.serviceTypes().contains(QLatin1String("KFileItemAction/Plugin"))) { | ||
486 | return false; | 486 | return false; | ||
487 | } | 487 | } | ||
488 | 488 | | |||
489 | auto mimeType = db.mimeTypeForName(commonMimeType); | 489 | auto mimeType = db.mimeTypeForName(commonMimeType); | ||
490 | foreach (const auto& supportedMimeType, metaData.mimeTypes()) { | 490 | const QStringList list = metaData.mimeTypes(); | ||
491 | for (const auto &supportedMimeType : list) { | ||||
491 | if (mimeType.inherits(supportedMimeType)) { | 492 | if (mimeType.inherits(supportedMimeType)) { | ||
492 | return true; | 493 | return true; | ||
493 | } | 494 | } | ||
494 | } | 495 | } | ||
495 | 496 | | |||
496 | return false; | 497 | return false; | ||
497 | }); | 498 | }); | ||
498 | 499 | | |||
499 | foreach (const auto& jsonMetadata, jsonPlugins) { | 500 | for (const auto &jsonMetadata : jsonPlugins) { | ||
500 | // The plugin has been disabled | 501 | // The plugin has been disabled | ||
501 | if (!showGroup.readEntry(jsonMetadata.pluginId(), true)) { | 502 | if (!showGroup.readEntry(jsonMetadata.pluginId(), true)) { | ||
502 | continue; | 503 | continue; | ||
503 | } | 504 | } | ||
504 | 505 | | |||
505 | // The plugin also has a .desktop file and has already been added. | 506 | // The plugin also has a .desktop file and has already been added. | ||
506 | if (addedPlugins.contains(jsonMetadata.pluginId())) { | 507 | if (addedPlugins.contains(jsonMetadata.pluginId())) { | ||
507 | continue; | 508 | continue; | ||
▲ Show 20 Lines • Show All 320 Lines • Show Last 20 Lines |