From 795406e21b31abd4d4b7bd6d22090cf7b5cac045 Mon Sep 17 00:00:00 2001 From: Alexander Lohnau Date: Sun, 2 Jan 2022 10:04:52 +0100 Subject: [PATCH] Load service menus for settings from new file location This is a replacement for the KServiceTypeTrader loading. Because third parties still use the KServiceTypeTrader file location, we need to support both for the time being. --- .../contextmenu/contextmenusettingspage.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/settings/contextmenu/contextmenusettingspage.cpp b/src/settings/contextmenu/contextmenusettingspage.cpp index a4e8225e2..cec1f9649 100644 --- a/src/settings/contextmenu/contextmenusettingspage.cpp +++ b/src/settings/contextmenu/contextmenusettingspage.cpp @@ -14,13 +14,14 @@ #include "global.h" #include +#include +#include #include #include #include #include #include #include -#include #include @@ -272,9 +273,13 @@ void ContextMenuSettingsPage::loadServices() const KConfigGroup showGroup = config.group("Show"); // Load generic services - const KService::List entries = KServiceTypeTrader::self()->query(QStringLiteral("KonqPopupMenu/Plugin")); - for (const KService::Ptr &service : entries) { - const QString file = QStandardPaths::locate(QStandardPaths::GenericDataLocation, "kservices5/" % service->entryPath()); + const auto locations = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QStringLiteral("kio/servicemenus"), QStandardPaths::LocateDirectory); + QStringList files = KFileUtils::findAllUniqueFiles(locations); + const KService::List services = KServiceTypeTrader::self()->query(QStringLiteral("KonqPopupMenu/Plugin")); + for (const KService::Ptr &service : services) { + files << QStandardPaths::locate(QStandardPaths::GenericDataLocation, "kservices5/" % service->entryPath()); + } + for (const auto &file : qAsConst(files)) { const QList serviceActions = KDesktopFileActions::userDefinedServices(KService(file), true); const KDesktopFile desktopFile(file); -- 2.47.3