Move code to send signals and set priority of processes to a dedicated object
ClosedPublic

Authored by ahiemstra on Aug 29 2019, 1:27 PM.

Details

Summary

This pulls the code out of KSysGuardProcessList and introduces it in a
new class called ProcessController. This should help make that code more
reusable and allow it to eventually be exposed to QML.

Test Plan

Start ksysguard, try to send signals to processes and set priorities, including
root-owned processes. Everything should still work.

Diff Detail

Repository
R111 KSysguard Library
Branch
processcontroller
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 15816
Build 15834: arc lint + arc unit
ahiemstra created this revision.Aug 29 2019, 1:27 PM
Restricted Application added a project: Plasma. · View Herald TranscriptAug 29 2019, 1:27 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
ahiemstra requested review of this revision.Aug 29 2019, 1:27 PM

++

Looks nice and simplifies this old mega class

processcore/process_controller.h
89

Eww, it would be better if we could make this a qwindow, but I see you're limited by current KAuth

processui/ksysguardprocesslist.cpp
1316

If we're invoking this from QML any call that spawns an event loop has the potential to crash.

box = new KMessageBox()
box->setAttribute(DeleteOnClose);
box->show();

would probably help

ahiemstra added inline comments.Aug 29 2019, 5:11 PM
processcore/process_controller.h
89

Agreed. I did look at what would be needed to do that, but the entire widget thing is embedded pretty deeply in KAuth. Luckily, for QML we can probably just leave this out. We won't get window modality, but that's the only drawback. I added this mostly so we don't have any regressions in the current UI.

processui/ksysguardprocesslist.cpp
1316

That's why the ProcessController does not have this code - my intention was to have the UI bits handled completely by QML, so you end up creating an instance of ProcessController, then just call sendSignal or whatever and get a result back, then QML can handle that result. This code is the ProcessList widget that we shouldn't be using in QML anyway.

davidedmundson accepted this revision.Aug 30 2019, 10:19 AM
This revision is now accepted and ready to land.Aug 30 2019, 10:19 AM
This revision was automatically updated to reflect the committed changes.