Changeset View
Changeset View
Standalone View
Standalone View
processui/ksysguardprocesslist.cpp
Show First 20 Lines • Show All 48 Lines • ▼ Show 20 Line(s) | |||||
49 | #include <QIcon> | 49 | #include <QIcon> | ||
50 | #include <QPainterPath> | 50 | #include <QPainterPath> | ||
51 | 51 | | |||
52 | #include <signal.h> //For SIGTERM | 52 | #include <signal.h> //For SIGTERM | ||
53 | 53 | | |||
54 | #include <KAuth> | 54 | #include <KAuth> | ||
55 | #include <KAuthAction> | 55 | #include <KAuthAction> | ||
56 | #include <KAuthActionReply> | 56 | #include <KAuthActionReply> | ||
57 | #include <KDialogJobUiDelegate> | ||||
58 | #include <KIO/ApplicationLauncherJob> | ||||
57 | #include <klocalizedstring.h> | 59 | #include <klocalizedstring.h> | ||
58 | #include <kmessagebox.h> | 60 | #include <kmessagebox.h> | ||
59 | #include <KWindowSystem> | 61 | #include <KWindowSystem> | ||
60 | #include <KService> | 62 | #include <KService> | ||
61 | #include <KRun> | | |||
62 | #include <KGlobalAccel> | 63 | #include <KGlobalAccel> | ||
63 | 64 | | |||
64 | #include "ReniceDlg.h" | 65 | #include "ReniceDlg.h" | ||
65 | #include "ui_ProcessWidgetUI.h" | 66 | #include "ui_ProcessWidgetUI.h" | ||
66 | #include "scripting.h" | 67 | #include "scripting.h" | ||
67 | #include "process_controller.h" | 68 | #include "process_controller.h" | ||
68 | #include "process_attribute.h" | 69 | #include "process_attribute.h" | ||
69 | 70 | | |||
▲ Show 20 Lines • Show All 335 Lines • ▼ Show 20 Line(s) | 316 | #endif | |||
405 | auto addByDesktopName = [this](const QString& desktopName) | 406 | auto addByDesktopName = [this](const QString& desktopName) | ||
406 | { | 407 | { | ||
407 | auto kService = KService::serviceByDesktopName(desktopName); | 408 | auto kService = KService::serviceByDesktopName(desktopName); | ||
408 | if (kService) { | 409 | if (kService) { | ||
409 | auto action = new QAction(QIcon::fromTheme(kService->icon()), | 410 | auto action = new QAction(QIcon::fromTheme(kService->icon()), | ||
410 | kService->name(), this); | 411 | kService->name(), this); | ||
411 | 412 | | |||
412 | connect(action, &QAction::triggered, this, | 413 | connect(action, &QAction::triggered, this, | ||
413 | [kService](bool) { | 414 | [this, kService](bool) { | ||
414 | KRun::runService(*kService, { }, nullptr); | 415 | auto *job = new KIO::ApplicationLauncherJob(kService); | ||
416 | job->setUiDelegate(new KDialogJobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, window())); | ||||
417 | job->start(); | ||||
415 | }); | 418 | }); | ||
416 | d->mToolsMenu->addAction(action); | 419 | d->mToolsMenu->addAction(action); | ||
417 | } | 420 | } | ||
418 | }; | 421 | }; | ||
419 | 422 | | |||
420 | addByDesktopName(QStringLiteral("org.kde.konsole")); | 423 | addByDesktopName(QStringLiteral("org.kde.konsole")); | ||
421 | 424 | | |||
422 | const QString ksysguardDesktopName = QStringLiteral("org.kde.ksysguard"); | 425 | const QString ksysguardDesktopName = QStringLiteral("org.kde.ksysguard"); | ||
Show All 17 Lines | |||||
440 | // auto list = KGlobalAccel::getGlobalShortcutsByKey(QKeySequence(QStringLiteral("Alt+Space"))); | 443 | // auto list = KGlobalAccel::getGlobalShortcutsByKey(QKeySequence(QStringLiteral("Alt+Space"))); | ||
441 | // foreach (auto item, list) { | 444 | // foreach (auto item, list) { | ||
442 | // qDebug() << item.componentUniqueName() << item.uniqueName(); | 445 | // qDebug() << item.componentUniqueName() << item.uniqueName(); | ||
443 | // //prints: 'krunner', 'run command' | 446 | // //prints: 'krunner', 'run command' | ||
444 | // } | 447 | // } | ||
445 | const auto runCommandShortcutList = KGlobalAccel::self()->globalShortcut(QStringLiteral("krunner"), QStringLiteral("run command")); | 448 | const auto runCommandShortcutList = KGlobalAccel::self()->globalShortcut(QStringLiteral("krunner"), QStringLiteral("run command")); | ||
446 | runCommandAction->setShortcuts(runCommandShortcutList); | 449 | runCommandAction->setShortcuts(runCommandShortcutList); | ||
447 | runCommandAction->setIcon(QIcon::fromTheme(QStringLiteral("system-run"))); | 450 | runCommandAction->setIcon(QIcon::fromTheme(QStringLiteral("system-run"))); | ||
448 | connect(runCommandAction, &QAction::triggered, this, [](){ | 451 | connect(runCommandAction, &QAction::triggered, this, [this](){ | ||
449 | KRun::runCommand(QStringLiteral("krunner"), nullptr); | 452 | KService::Ptr service = KService::serviceByDesktopName(QStringLiteral("krunner")); | ||
453 | if (service) { | ||||
454 | auto *job = new KIO::ApplicationLauncherJob(service); | ||||
455 | job->setUiDelegate(new KDialogJobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, window())); | ||||
456 | job->start(); | ||||
457 | } | ||||
450 | }); | 458 | }); | ||
451 | d->mToolsMenu->addAction(runCommandAction); | 459 | d->mToolsMenu->addAction(runCommandAction); | ||
452 | 460 | | |||
453 | // Add the xkill functionality... | 461 | // Add the xkill functionality... | ||
454 | auto killWindowAction = new QAction(QIcon::fromTheme(QStringLiteral("document-close")), | 462 | auto killWindowAction = new QAction(QIcon::fromTheme(QStringLiteral("document-close")), | ||
455 | i18nc("@action:inmenu", "Kill a Window"), this); | 463 | i18nc("@action:inmenu", "Kill a Window"), this); | ||
456 | // Find shortcut of xkill functionality which is defined in KWin | 464 | // Find shortcut of xkill functionality which is defined in KWin | ||
457 | const auto killWindowShortcutList = KGlobalAccel::self()->globalShortcut(QStringLiteral("kwin"), QStringLiteral("Kill Window")); | 465 | const auto killWindowShortcutList = KGlobalAccel::self()->globalShortcut(QStringLiteral("kwin"), QStringLiteral("Kill Window")); | ||
▲ Show 20 Lines • Show All 991 Lines • Show Last 20 Lines |