Warning, /plasma/plasma-systemmonitor/src/page/LoadPresetDialog.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.14 0008 import QtQuick.Controls 2.14 0009 import QtQuick.Layouts 1.14 0010 0011 import org.kde.kirigami 2.12 as Kirigami 0012 0013 Dialog { 0014 id: dialog 0015 0016 property QtObject controller 0017 0018 readonly property string selectedTitle: presetList.currentItem ? presetList.currentItem.title : "" 0019 readonly property string selectedFace: presetList.currentItem ? presetList.currentItem.chartFace : "" 0020 readonly property string selectedPreset: presetList.currentItem ? presetList.currentItem.preset : "" 0021 0022 title: i18nc("@title:window", "Load Preset") 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 0041 implicitWidth: Kirigami.Units.gridUnit * 20 0042 implicitHeight: Kirigami.Units.gridUnit * 30 0043 0044 ColumnLayout { 0045 anchors.fill: parent 0046 0047 Kirigami.Separator { Layout.fillWidth: true } 0048 0049 ScrollView { 0050 Layout.fillWidth: true 0051 Layout.fillHeight: true 0052 0053 ListView { 0054 id: presetList 0055 0056 currentIndex: -1 0057 0058 model: dialog.controller.availablePresetsModel 0059 delegate: Kirigami.SwipeListItem { 0060 highlighted: ListView.isCurrentItem 0061 0062 property string title: model.display 0063 property string chartFace: model.config && model.config.chartFace !== undefined ? model.config.chartFace : "" 0064 property string preset: model.pluginId 0065 0066 contentItem: Label { 0067 Layout.fillWidth: true 0068 text: model.display 0069 } 0070 actions: Kirigami.Action { 0071 icon.name: "delete" 0072 visible: model.writable 0073 onTriggered: dialog.controller.uninstallPreset(model.pluginId); 0074 } 0075 onClicked: { 0076 presetList.currentIndex = index 0077 } 0078 } 0079 } 0080 } 0081 0082 Kirigami.Separator { Layout.fillWidth: true } 0083 } 0084 } 0085 0086 footer: DialogButtonBox { 0087 Button { 0088 DialogButtonBox.buttonRole: DialogButtonBox.AcceptRole 0089 text: i18nc("@action:button", "Load") 0090 icon.name: "document-open" 0091 enabled: presetList.currentIndex != -1 0092 } 0093 Button { 0094 DialogButtonBox.buttonRole: DialogButtonBox.RejectRole 0095 text: i18nc("@action:button", "Cancel") 0096 icon.name: "dialog-cancel" 0097 } 0098 } 0099 }