Commit 6fa8a6b1 authored by Méven Car's avatar Méven Car

KCM component chooser: use the category FileManager to filter filemanager apps

BUG: 423313
FIXED-IN: 5.19.2
parent 70c4eb3a
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
#include "componentchooserfilemanager.h" #include "componentchooserfilemanager.h"
#include <kprocess.h> #include <kprocess.h>
#include <kmimetypetrader.h> #include <kmimetypetrader.h>
#include <KServiceTypeTrader> #include <KApplicationTrader>
#include <kopenwithdialog.h> #include <kopenwithdialog.h>
#include <kconfiggroup.h> #include <kconfiggroup.h>
#include <QStandardPaths> #include <QStandardPaths>
...@@ -78,8 +78,12 @@ void CfgFileManager::load(KConfig *) ...@@ -78,8 +78,12 @@ void CfgFileManager::load(KConfig *)
const KService::Ptr fileManager = KMimeTypeTrader::self()->preferredService(mime); const KService::Ptr fileManager = KMimeTypeTrader::self()->preferredService(mime);
const auto constraint = QStringLiteral("'FileManager' in Categories and 'inode/directory' in ServiceTypes"); const auto fileManagers = KApplicationTrader::query([] (const KService::Ptr &service) {
const KService::List fileManagers = KServiceTypeTrader::self()->query(QStringLiteral("Application"), constraint); if (service->exec().isEmpty()) {
return false;
}
return service->categories().contains("FileManager");
});
for (const KService::Ptr &service : fileManagers) { for (const KService::Ptr &service : fileManagers) {
addItem(QIcon::fromTheme(service->icon()), service->name(), service->storageId()); addItem(QIcon::fromTheme(service->icon()), service->name(), service->storageId());
......
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