Warning, /plasma/libksysguard/tests/process/test_process.qml is written in an unsupported language. File is not indexed.
0001 /*
0002 SPDX-FileCopyrightText: 2020 Arjen Hiemstra <ahiemstra@heimr.nl>
0003
0004 SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006
0007 import QtQuick
0008 import QtQuick.Controls
0009 import QtQuick.Layouts
0010
0011 import org.kde.ksysguard.process as Process
0012
0013 Pane {
0014 width: 400
0015 height: 400
0016
0017 ColumnLayout {
0018 anchors.fill: parent
0019
0020 TextField {
0021 id: input
0022 Layout.fillWidth: true
0023 placeholderText: "PID"
0024 }
0025
0026 ComboBox {
0027 id: signalCombo
0028
0029 Layout.fillWidth: true
0030
0031 textRole: "key"
0032
0033 model: [
0034 { key: "Stop", value: Process.ProcessController.StopSignal },
0035 { key: "Continue", value: Process.ProcessController.ContinueSignal },
0036 { key: "Hangup", value: Process.ProcessController.HangupSignal },
0037 { key: "Interrupt", value: Process.ProcessController.InterruptSignal },
0038 { key: "Terminate", value: Process.ProcessController.TerminateSignal },
0039 { key: "Kill", value: Process.ProcessController.KillSignal },
0040 { key: "User 1", value: Process.ProcessController.User1Signal },
0041 { key: "User 2", value: Process.ProcessController.User2Signal }
0042 ]
0043 }
0044
0045 Button {
0046 Layout.fillWidth: true
0047 text: "Send Signal"
0048 onClicked: {
0049 var signalToSend = signalCombo.model[signalCombo.currentIndex]
0050 print("Sending", signalToSend.key, "(%1)".arg(signalToSend.value), "to PID", parseInt(input.text))
0051 var result = controller.sendSignal([parseInt(input.text)], signalToSend.value);
0052 print("Result:", result)
0053 resultLabel.text = controller.resultToString(result)
0054 }
0055 }
0056
0057 Label {
0058 id: resultLabel
0059 Layout.fillWidth: true
0060 }
0061 }
0062
0063 Process.ProcessController {
0064 id: controller
0065 }
0066 }