drop ksysguard dependency for kf5>=5.62

--following plasma updates for tasktools in order
to drop the ksysguard dependency which is also
costly
pull/9/head
Michail Vourlakos 5 years ago
parent 0a78fc01b8
commit 6849a4906d

@ -19,8 +19,6 @@ set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED NO_MODULE COMPONENTS DBus Gui Qml Quick)
find_package(KF5 REQUIRED COMPONENTS SysGuard)
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS
Activities Archive CoreAddons GuiAddons Crash DBusAddons Declarative GlobalAccel I18n
IconThemes NewStuff Notifications Plasma PlasmaQuick Wayland WindowSystem XmlGui)
@ -53,6 +51,10 @@ string(REGEX REPLACE "\\." "" KF5_VERSION_MINOR ${KF5_VERSION_MINOR})
message(STATUS "KF5 VERSION : ${KF5_VERSION}")
message(STATUS "KF5 VERSION MINOR : ${KF5_VERSION_MINOR}")
if(${KF5_VERSION_MINOR} LESS "62")
find_package(KF5 REQUIRED COMPONENTS SysGuard)
endif()
include(ECMQMLModules)
ecm_find_qmlmodule(QtQuick 2.7)
ecm_find_qmlmodule(QtQuick.Layouts 1.3)

@ -52,7 +52,7 @@ Minimum requirements:
KF5GlobalAccel >= 5.38.0
KF5Crash >= 5.38.0
KSysGuard
KSysGuard [reguired only for kf5<=5.61]
For X11 support:
KF5WindowSystem >= 5.38.0

@ -32,29 +32,55 @@ add_executable(latte-dock ${lattedock-app_SRCS})
include(FakeTarget.cmake)
target_link_libraries(latte-dock
Qt5::DBus
Qt5::Quick
Qt5::Qml
KF5::Activities
KF5::Archive
KF5::CoreAddons
KF5::Crash
KF5::DBusAddons
KF5::Declarative
KF5::GuiAddons
KF5::GlobalAccel
KF5::I18n
KF5::IconThemes
KF5::Notifications
KF5::NewStuff
KF5::QuickAddons
KF5::Plasma
KF5::PlasmaQuick
KF5::ProcessCore
KF5::WaylandClient
KF5::XmlGui
)
if(${KF5_VERSION_MINOR} LESS "62")
target_link_libraries(latte-dock
Qt5::DBus
Qt5::Quick
Qt5::Qml
KF5::Activities
KF5::Archive
KF5::CoreAddons
KF5::Crash
KF5::DBusAddons
KF5::Declarative
KF5::GuiAddons
KF5::GlobalAccel
KF5::I18n
KF5::IconThemes
KF5::Notifications
KF5::NewStuff
KF5::QuickAddons
KF5::Plasma
KF5::PlasmaQuick
KF5::ProcessCore
KF5::WaylandClient
KF5::XmlGui
)
else()
target_link_libraries(latte-dock
Qt5::DBus
Qt5::Quick
Qt5::Qml
KF5::Activities
KF5::Archive
KF5::CoreAddons
KF5::Crash
KF5::DBusAddons
KF5::Declarative
KF5::GuiAddons
KF5::GlobalAccel
KF5::I18n
KF5::IconThemes
KF5::Notifications
KF5::NewStuff
KF5::QuickAddons
KF5::Plasma
KF5::PlasmaQuick
KF5::WaylandClient
KF5::XmlGui
)
endif()
if(HAVE_X11)
target_link_libraries(latte-dock

@ -16,23 +16,24 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************/
#include "tasktools.h"
#include <config-latte.h>
#include <KActivities/ResourceInstance>
#include <KConfigGroup>
#include <KDesktopFile>
#include <kemailsettings.h>
//#include <KFileItem>
#include <KMimeTypeTrader>
//#include <KRun>
#include <KServiceTypeTrader>
#include <KSharedConfig>
#include <KStartupInfo>
#include <KWindowSystem>
#include <processcore/processes.h>
#include <processcore/process.h>
#include <config-latte.h>
#if KF5_VERSION_MINOR >= 62
#include <KProcessList>
#else
#include <processcore/processes.h>
#include <processcore/process.h>
#endif
#include <QDir>
#include <QGuiApplication>
@ -503,17 +504,30 @@ KService::List servicesFromPid(quint32 pid, KSharedConfig::Ptr rulesConfig)
return KService::List();
}
#if KF5_VERSION_MINOR >= 62
auto proc = KProcessList::processInfo(pid);
if (!proc.isValid()) {
return KService::List();
}
const QString cmdLine = proc.command();
#else
KSysGuard::Processes procs;
procs.updateOrAddProcess(pid);
KSysGuard::Process *proc = procs.getProcess(pid);
const QString &cmdLine = proc ? proc->command().simplified() : QString(); // proc->command has a trailing space???
#endif
if (cmdLine.isEmpty()) {
return KService::List();
}
#if KF5_VERSION_MINOR >= 63
return servicesFromCmdLine(cmdLine, proc.name(), rulesConfig);
#else
return servicesFromCmdLine(cmdLine, proc->name(), rulesConfig);
#endif
}
KService::List servicesFromCmdLine(const QString &_cmdLine, const QString &processName,

Loading…
Cancel
Save