Warning, /plasma/plasma-systemmonitor/src/table/KillDialog.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.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0005  */
0006 
0007 import QtQuick 2.15
0008 import QtQuick.Controls 2.15
0009 import QtQuick.Layouts 1.15
0010 
0011 import org.kde.kirigami 2.8 as Kirigami
0012 
0013 Dialog {
0014     id: dialog
0015 
0016     required property string killButtonText
0017     required property string killButtonIcon
0018     required property string questionText
0019 
0020     property var items: []
0021     property bool doNotAskAgain: false
0022     property alias delegate: list.delegate
0023 
0024     modal: true
0025     parent: Overlay.overlay
0026     focus: true
0027 
0028     x: parent ? Math.round(parent.width / 2 - width / 2) : 0
0029     y: ApplicationWindow.window ? ApplicationWindow.window.pageStack.globalToolBar.height - Kirigami.Units.smallSpacing : 0
0030 
0031     leftPadding: 1 // Allow dialog background border to show
0032     rightPadding: 1 // Allow dialog background border to show
0033     bottomPadding: Kirigami.Units.smallSpacing
0034     topPadding: Kirigami.Units.smallSpacing
0035     bottomInset: -Kirigami.Units.smallSpacing
0036 
0037     contentItem: Rectangle {
0038         Kirigami.Theme.colorSet: Kirigami.Theme.View
0039         color: Kirigami.Theme.backgroundColor
0040         implicitWidth: Kirigami.Units.gridUnit * 25
0041         implicitHeight: Kirigami.Units.gridUnit * 20
0042 
0043         Kirigami.Separator { anchors { left: parent.left; right: parent.right; top: parent.top } }
0044 
0045         ScrollView {
0046             anchors.fill: parent
0047             anchors.topMargin: 1
0048             anchors.bottomMargin: 1
0049 
0050             ListView {
0051                 id: list
0052 
0053                 header: Label {
0054                     id: questionLabel
0055                     padding: Kirigami.Units.gridUnit
0056                     width: parent.width
0057                     text: dialog.questionText
0058                     wrapMode: Text.Wrap
0059                 }
0060 
0061                 model: dialog.items
0062                 currentIndex: -1
0063 
0064                 delegate: Kirigami.AbstractListItem {
0065                     leftPadding: Kirigami.Units.gridUnit
0066                     contentItem: Label { text: modelData; width: parent.width; elide: Text.ElideRight }
0067                     highlighted: false
0068                     hoverEnabled: false
0069                 }
0070             }
0071         }
0072 
0073         Kirigami.Separator { anchors { left: parent.left; right: parent.right; bottom: parent.bottom } }
0074     }
0075 
0076     footer: DialogButtonBox {
0077         id: buttonBox
0078 
0079         contentWidth: availableWidth
0080 
0081         CheckBox {
0082             width: buttonBox.width - acceptButton.width - cancelButton.width - buttonBox.spacing * 2 - buttonBox.leftPadding - buttonBox.rightPadding
0083             anchors.verticalCenter: parent.verticalCenter
0084             contentItem: Label {
0085                 anchors.verticalCenter: parent.verticalCenter
0086                 leftPadding: Kirigami.Units.gridUnit + Kirigami.Units.smallSpacing;
0087                 text: i18ndc("plasma-systemmonitor", "@option:check", "Do not ask again");
0088                 wrapMode: Text.WordWrap
0089             }
0090             DialogButtonBox.buttonRole: DialogButtonBox.ActionRole
0091             onToggled: dialog.doNotAskAgain = checked
0092         }
0093         Button {
0094             id: acceptButton
0095             icon.name: dialog.killButtonIcon
0096             text: dialog.killButtonText
0097             DialogButtonBox.buttonRole: DialogButtonBox.AcceptRole
0098         }
0099         Button {
0100             id: cancelButton
0101             icon.name: "dialog-cancel"
0102             text: i18ndc("plasma-systemmonitor", "@action:button", "Cancel")
0103             DialogButtonBox.buttonRole: DialogButtonBox.RejectRole
0104         }
0105     }
0106 }