Changeset View
Changeset View
Standalone View
Standalone View
libtaskmanager/tasktools.cpp
Show All 26 Lines | |||||
27 | #include <kemailsettings.h> | 27 | #include <kemailsettings.h> | ||
28 | #include <KFileItem> | 28 | #include <KFileItem> | ||
29 | #include <KMimeTypeTrader> | 29 | #include <KMimeTypeTrader> | ||
30 | #include <KRun> | 30 | #include <KRun> | ||
31 | #include <KServiceTypeTrader> | 31 | #include <KServiceTypeTrader> | ||
32 | #include <KSharedConfig> | 32 | #include <KSharedConfig> | ||
33 | #include <KStartupInfo> | 33 | #include <KStartupInfo> | ||
34 | #include <KWindowSystem> | 34 | #include <KWindowSystem> | ||
35 | 35 | #include <KProcessList> | |||
36 | #include <processcore/processes.h> | | |||
37 | #include <processcore/process.h> | | |||
38 | 36 | | |||
39 | #include <config-X11.h> | 37 | #include <config-X11.h> | ||
40 | 38 | | |||
41 | #include <QDir> | 39 | #include <QDir> | ||
42 | #include <QGuiApplication> | 40 | #include <QGuiApplication> | ||
43 | #include <QRegularExpression> | 41 | #include <QRegularExpression> | ||
44 | #include <QScreen> | 42 | #include <QScreen> | ||
45 | #include <QUrlQuery> | 43 | #include <QUrlQuery> | ||
▲ Show 20 Lines • Show All 454 Lines • ▼ Show 20 Line(s) | 497 | { | |||
500 | if (pid == 0) { | 498 | if (pid == 0) { | ||
501 | return KService::List(); | 499 | return KService::List(); | ||
502 | } | 500 | } | ||
503 | 501 | | |||
504 | if (!rulesConfig) { | 502 | if (!rulesConfig) { | ||
505 | return KService::List(); | 503 | return KService::List(); | ||
506 | } | 504 | } | ||
507 | 505 | | |||
508 | KSysGuard::Processes procs; | 506 | auto proc = KProcessList::processInfo(pid); | ||
509 | procs.updateOrAddProcess(pid); | 507 | if (!proc.isValid()) { | ||
508 | return KService::List(); | ||||
509 | } | ||||
510 | 510 | | |||
511 | KSysGuard::Process *proc = procs.getProcess(pid); | 511 | const QString cmdLine = proc.command(); | ||
512 | const QString &cmdLine = proc ? proc->command().simplified() : QString(); // proc->command has a trailing space??? | | |||
513 | 512 | | |||
514 | if (cmdLine.isEmpty()) { | 513 | if (cmdLine.isEmpty()) { | ||
515 | return KService::List(); | 514 | return KService::List(); | ||
516 | } | 515 | } | ||
517 | 516 | | |||
518 | return servicesFromCmdLine(cmdLine, proc->name(), rulesConfig); | 517 | return servicesFromCmdLine(cmdLine, proc.name(), rulesConfig); | ||
519 | } | 518 | } | ||
520 | 519 | | |||
521 | KService::List servicesFromCmdLine(const QString &_cmdLine, const QString &processName, | 520 | KService::List servicesFromCmdLine(const QString &_cmdLine, const QString &processName, | ||
522 | KSharedConfig::Ptr rulesConfig) | 521 | KSharedConfig::Ptr rulesConfig) | ||
523 | { | 522 | { | ||
524 | QString cmdLine = _cmdLine; | 523 | QString cmdLine = _cmdLine; | ||
525 | KService::List services; | 524 | KService::List services; | ||
526 | 525 | | |||
▲ Show 20 Lines • Show All 282 Lines • Show Last 20 Lines |