From d14aca8cd861bc2d926add2d8ecbf6e5ab7de07f Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Thu, 15 Aug 2019 16:01:59 +0100 Subject: [PATCH] [libnotificationmanager] Port to lighter KProcessList Summary: KSysGuard fetches everything you could possibly need from a process. If we just need a name of a process, we can use the new KProcessList API in KCoreAddons. Reviewers: #plasma, broulik Reviewed By: #plasma, broulik Subscribers: broulik, plasma-devel Tags: #plasma Differential Revision: https://phabricator.kde.org/D22327 --- libnotificationmanager/CMakeLists.txt | 1 - libnotificationmanager/utils.cpp | 12 ++++-------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/libnotificationmanager/CMakeLists.txt b/libnotificationmanager/CMakeLists.txt index 3419c39de..4fe4ef4b9 100644 --- a/libnotificationmanager/CMakeLists.txt +++ b/libnotificationmanager/CMakeLists.txt @@ -79,7 +79,6 @@ target_link_libraries(notificationmanager KF5::IconThemes KF5::KIOFileWidgets KF5::Plasma - KF5::ProcessCore KF5::Screen KF5::Service ) diff --git a/libnotificationmanager/utils.cpp b/libnotificationmanager/utils.cpp index ef811f881..6d6280cf5 100644 --- a/libnotificationmanager/utils.cpp +++ b/libnotificationmanager/utils.cpp @@ -30,23 +30,19 @@ #include -#include -#include +#include using namespace NotificationManager; QString Utils::processNameFromPid(uint pid) { - KSysGuard::Processes procs; - procs.updateOrAddProcess(pid); + auto processInfo = KProcessList::processInfo(pid); - KSysGuard::Process *proc = procs.getProcess(pid); - - if (!proc) { + if (!processInfo.isValid()) { return QString(); } - return proc->name(); + return processInfo.name(); } QString Utils::desktopEntryFromPid(uint pid)