]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Put code for desktop file plugin loading in KIO version check
authorAlexander Lohnau <alexander.lohnau@gmx.de>
Sat, 24 Apr 2021 09:17:20 +0000 (11:17 +0200)
committerAlexander Lohnau <alexander.lohnau@gmx.de>
Mon, 10 May 2021 05:32:20 +0000 (07:32 +0200)
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

index 8631b0ceb2c051f105de12cf18462e603ff668b1..18b16083b075296a9e893b6f2f130c5b652335c6 100644 (file)
@@ -21,6 +21,8 @@
 #include <KServiceTypeTrader>
 #include <KDesktopFileActions>
 
+#include <kio_version.h>
+
 #include <QGridLayout>
 #include <QLabel>
 #include <QListWidget>
@@ -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();