Commit 795406e2 authored by Alexander Lohnau's avatar Alexander Lohnau 💬
Browse files

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.
parent e447b882
Pipeline #117167 passed with stage
in 5 minutes and 43 seconds
......@@ -14,13 +14,14 @@
#include "global.h"
#include <KDesktopFile>
#include <KDesktopFileActions>
#include <KFileUtils>
#include <KLocalizedString>
#include <KMessageBox>
#include <KNS3/Button>
#include <KPluginMetaData>
#include <KService>
#include <KServiceTypeTrader>
#include <KDesktopFileActions>
#include <kio_version.h>
......@@ -272,9 +273,13 @@ void ContextMenuSettingsPage::loadServices()
const KConfigGroup showGroup ="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<KServiceAction> serviceActions = KDesktopFileActions::userDefinedServices(KService(file), true);
const KDesktopFile desktopFile(file);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment