From 4f53ed33c2f3282d6d01e984138c91776127f7da Mon Sep 17 00:00:00 2001 From: Nicolas Fella Date: Sat, 18 Dec 2021 21:46:54 +0100 Subject: [PATCH] [libtaskmanager] Don't ignore services with NoDisplay=true when searching for appId For KCMs we have .desktop files in /applications but with NoDisplay=true. We still want an appId of kcm_foo to match to the service in /applications/kcm_foo.desktop. The current code however explicitly excludes those, so stop doing that. This also allows to simplify the code from KServiceTypeTrader to KService::serviceByDesktopName This fixes the LauncherUrl for the autostart KCM from file:kcmshell to applications:kcm_autostart.desktop --- libtaskmanager/tasktools.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/libtaskmanager/tasktools.cpp b/libtaskmanager/tasktools.cpp index 42c68959c..b15a81e58 100644 --- a/libtaskmanager/tasktools.cpp +++ b/libtaskmanager/tasktools.cpp @@ -393,9 +393,12 @@ QUrl windowUrlFromMetadata(const QString &appId, quint32 pid, KSharedConfig::Ptr // Try matching appId against DesktopEntryName. if (services.isEmpty()) { - services = KServiceTypeTrader::self()->query( - QStringLiteral("Application"), - QStringLiteral("exist Exec and ('%1' =~ DesktopEntryName) and (not exist NoDisplay or not NoDisplay)").arg(appId)); + KService::Ptr maybeService = KService::serviceByDesktopName(appId); + + if (maybeService) { + services = {maybeService}; + } + sortServicesByMenuId(services, appId); }