Warning, /system/kup/plasmoid/contents/ui/FullRepresentation.qml is written in an unsupported language. File is not indexed.

0001 // SPDX-FileCopyrightText: 2020 Simon Persson <simon.persson@mykolab.com>
0002 //
0003 // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0004 
0005 import QtQuick 2.2
0006 import QtQuick.Layouts 1.1
0007 
0008 import org.kde.plasma.core 2.0 as PlasmaCore
0009 import org.kde.plasma.components 3.0 as PlasmaComponents
0010 import org.kde.plasma.extras 2.0 as PlasmaExtras
0011 import org.kde.kirigami 2.15 as Kirigami
0012 
0013 PlasmaComponents.Page {
0014         Layout.minimumWidth: Kirigami.Units.gridUnit * 12
0015         Layout.minimumHeight: Kirigami.Units.gridUnit * 12
0016 
0017         header: PlasmaExtras.PlasmoidHeading {
0018                 visible: !(plasmoid.containmentDisplayHints &
0019                                                         PlasmaCore.Types.ContainmentDrawsPlasmoidHeading)
0020 
0021                 RowLayout {
0022                         anchors.fill: parent
0023 
0024                         Item {
0025                                 Layout.fillWidth: true
0026                         }
0027 
0028                         PlasmaComponents.ToolButton {
0029                                         icon.name: "view-refresh"
0030                                         onClicked: plasmoid.action("reloadKup").trigger()
0031 
0032                                         PlasmaComponents.ToolTip {
0033                                                         text: plasmoid.action("reloadKup").text
0034                                         }
0035                         }
0036 
0037                         PlasmaComponents.ToolButton {
0038                                         icon.name: "configure"
0039                                         onClicked: plasmoid.action("configure").trigger()
0040 
0041                                         PlasmaComponents.ToolTip {
0042                                                         text: plasmoid.action("configure").text
0043                                         }
0044                         }
0045                 }
0046         }
0047 
0048         Item {
0049                 anchors.fill: parent
0050                 anchors.topMargin: Kirigami.Units.smallSpacing * 2
0051                 focus: true
0052 
0053                 PlasmaExtras.Heading {
0054                         width: parent.width
0055                         level: 3
0056                         opacity: 0.6
0057                         text: getCommonStatus("no plan reason", "")
0058                         visible: planCount == 0
0059                 }
0060 
0061                 ColumnLayout {
0062                         anchors.fill: parent
0063 
0064                         PlasmaComponents.ScrollView {
0065                                 Layout.fillWidth: true
0066                                 Layout.fillHeight: true
0067 
0068                                 ListView {
0069                                         model: planCount
0070                                         delegate: planDelegate
0071                                         boundsBehavior: Flickable.StopAtBounds
0072                                 }
0073                         }
0074                 }
0075 
0076                 Component {
0077                         id: planDelegate
0078 
0079                         Column {
0080                                 width: parent.width
0081                                 spacing: theme.defaultFont.pointSize
0082                                 RowLayout {
0083                                         width: parent.width
0084                                         Column {
0085                                                 Layout.fillWidth: true
0086                                                 PlasmaExtras.Heading {
0087                                                         level: 3
0088                                                         text: getPlanStatus(index, "description")
0089                                                 }
0090                                                 PlasmaExtras.Heading {
0091                                                         level: 4
0092                                                         text: getPlanStatus(index, "status heading")
0093                                                 }
0094                                                 PlasmaComponents.Label {
0095                                                         text: getPlanStatus(index, "status details")
0096                                                 }
0097                                         }
0098                                         Kirigami.Icon {
0099                                                 source: getPlanStatus(index, "icon name")
0100                                                 Layout.alignment: Qt.AlignRight | Qt.AlignTop
0101                                                 Layout.preferredWidth: Kirigami.Units.iconSizes.huge
0102                                                 Layout.preferredHeight: Kirigami.Units.iconSizes.huge
0103                                         }
0104 
0105                                 }
0106                                 Flow {
0107                                         width: parent.width
0108                                         spacing: theme.defaultFont.pointSize
0109                                         PlasmaComponents.Button {
0110                                                 text: i18nd("kup", "Save new backup")
0111                                                 visible: getPlanStatus(index, "destination available") &&
0112                                                                         !getPlanStatus(index, "busy")
0113                                                 onClicked: startOperation(index, "save backup")
0114                                         }
0115                                         PlasmaComponents.Button {
0116                                                 text: i18nd("kup", "Prune old backups")
0117                                                 visible: getPlanStatus(index, "bup type") && getPlanStatus(index, "destination available")
0118                                                 onClicked: startOperation(index, "remove backups")
0119                                         }
0120                                         PlasmaComponents.Button {
0121                                                 text: i18nd("kup", "Show files")
0122                                                 visible: getPlanStatus(index, "destination available")
0123                                                 onClicked: startOperation(index, "show backup files")
0124                                         }
0125                                         PlasmaComponents.Button {
0126                                                 text: i18nd("kup", "Show log file")
0127                                                 visible: getPlanStatus(index, "log file exists")
0128                                                 onClicked: startOperation(index, "show log file")
0129                                         }
0130                                 }
0131                         }
0132                 }
0133         }
0134 
0135         function getPlanStatus(planNumber, key){
0136                 return backupPlans.data["plan " + planNumber.toString()][key];
0137         }
0138 
0139         function startOperation(i, name) {
0140                 var service = backupPlans.serviceForSource(i.toString());
0141                 var operation = service.operationDescription(name);
0142                 service.startOperationCall(operation);
0143         }
0144 }