Commit d8e46779 authored by Kai Uwe Broulik's avatar Kai Uwe Broulik 🍇

[KSysGuardProcessList] Port away from KRun

Instead use ApplicationLauncherJob with KDialogJobUiDelegate

Differential Revision: https://phabricator.kde.org/D28849
parent 5559e2ed
......@@ -43,7 +43,7 @@ set_package_properties(Qt5WebChannel PROPERTIES
PURPOSE "Used by the HTML-based GUI ksysguard library"
)
find_package(KF5 REQUIRED COMPONENTS CoreAddons Config I18n WindowSystem Completion Auth WidgetsAddons IconThemes ConfigWidgets Service GlobalAccel KIO)
find_package(KF5 REQUIRED COMPONENTS CoreAddons Config I18n JobWidgets WindowSystem Completion Auth WidgetsAddons IconThemes ConfigWidgets Service GlobalAccel KIO)
find_package(KF5 OPTIONAL_COMPONENTS Plasma)
set_package_properties(KF5Plasma PROPERTIES
URL "https://cgit.kde.org/plasma-framework.git/"
......
......@@ -44,9 +44,10 @@ target_link_libraries(processui
KF5::ConfigWidgets
KF5::WidgetsAddons
KF5::IconThemes
KF5::JobWidgets
KF5::GlobalAccel
KF5::Service
KF5::KIOWidgets
KF5::KIOGui
)
target_include_directories(processui
PUBLIC
......
......@@ -54,11 +54,12 @@
#include <KAuth>
#include <KAuthAction>
#include <KAuthActionReply>
#include <KDialogJobUiDelegate>
#include <KIO/ApplicationLauncherJob>
#include <klocalizedstring.h>
#include <kmessagebox.h>
#include <KWindowSystem>
#include <KService>
#include <KRun>
#include <KGlobalAccel>
#include "ReniceDlg.h"
......@@ -410,8 +411,10 @@ KSysGuardProcessList::KSysGuardProcessList(QWidget* parent, const QString &hostN
kService->name(), this);
connect(action, &QAction::triggered, this,
[kService](bool) {
KRun::runService(*kService, { }, nullptr);
[this, kService](bool) {
auto *job = new KIO::ApplicationLauncherJob(kService);
job->setUiDelegate(new KDialogJobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, window()));
job->start();
});
d->mToolsMenu->addAction(action);
}
......@@ -445,8 +448,13 @@ KSysGuardProcessList::KSysGuardProcessList(QWidget* parent, const QString &hostN
const auto runCommandShortcutList = KGlobalAccel::self()->globalShortcut(QStringLiteral("krunner"), QStringLiteral("run command"));
runCommandAction->setShortcuts(runCommandShortcutList);
runCommandAction->setIcon(QIcon::fromTheme(QStringLiteral("system-run")));
connect(runCommandAction, &QAction::triggered, this, [](){
KRun::runCommand(QStringLiteral("krunner"), nullptr);
connect(runCommandAction, &QAction::triggered, this, [this](){
KService::Ptr service = KService::serviceByDesktopName(QStringLiteral("krunner"));
if (service) {
auto *job = new KIO::ApplicationLauncherJob(service);
job->setUiDelegate(new KDialogJobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, window()));
job->start();
}
});
d->mToolsMenu->addAction(runCommandAction);
......
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