From 8f9bf0fe36546d152b860f0c5fd8d00c23dcb648 Mon Sep 17 00:00:00 2001 From: Alexander Lohnau Date: Sat, 24 Apr 2021 11:17:20 +0200 Subject: [PATCH] Put code for desktop file plugin loading in KIO version check Loading plugins by their desktop files was deprecated in https://invent.kde.org/frameworks/kio/-/merge_requests/416. Task: https://phabricator.kde.org/T12250 --- src/settings/contextmenu/contextmenusettingspage.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/settings/contextmenu/contextmenusettingspage.cpp b/src/settings/contextmenu/contextmenusettingspage.cpp index 8631b0ceb2..18b16083b0 100644 --- a/src/settings/contextmenu/contextmenusettingspage.cpp +++ b/src/settings/contextmenu/contextmenusettingspage.cpp @@ -21,6 +21,8 @@ #include #include +#include + #include #include #include @@ -272,7 +274,8 @@ void ContextMenuSettingsPage::loadServices() } } - // Load service plugins that implement the KFileItemActionPlugin interface + // Load service plugins, this is deprecated in KIO 5.82 +#if KIO_VERSION < QT_VERSION_CHECK(6, 0, 0) const KService::List pluginServices = KServiceTypeTrader::self()->query(QStringLiteral("KFileItemAction/Plugin")); for (const KService::Ptr &service : pluginServices) { const QString desktopEntryName = service->desktopEntryName(); @@ -281,11 +284,10 @@ void ContextMenuSettingsPage::loadServices() addRow(service->icon(), service->name(), desktopEntryName, checked); } } +#endif // Load JSON-based plugins that implement the KFileItemActionPlugin interface - const auto jsonPlugins = KPluginLoader::findPlugins(QStringLiteral("kf5/kfileitemaction"), [](const KPluginMetaData& metaData) { - return metaData.serviceTypes().contains(QLatin1String("KFileItemAction/Plugin")); - }); + const auto jsonPlugins = KPluginLoader::findPlugins(QStringLiteral("kf5/kfileitemaction")); for (const auto &jsonMetadata : jsonPlugins) { const QString desktopEntryName = jsonMetadata.pluginId();