Warning, /plasma/discover/discover/qml/ProgressView.qml is written in an unsupported language. File is not indexed.
0001 import QtQuick 2.1 0002 import QtQuick.Controls 2.1 0003 import QtQuick.Layouts 1.1 0004 import org.kde.discover 2.0 0005 import org.kde.kirigami 2.14 as Kirigami 0006 import "navigation.js" as Navigation 0007 0008 Kirigami.AbstractListItem { 0009 id: listItem 0010 0011 contentItem: ColumnLayout { 0012 Label { 0013 id: label 0014 Layout.fillWidth: true 0015 Layout.leftMargin: Kirigami.Units.iconSizes.smallMedium + (LayoutMirroring.enabled ? listItem.rightPadding : listItem.leftPadding) 0016 Layout.rightMargin: Layout.leftMargin 0017 text: TransactionModel.count ? i18n("Tasks (%1%)", TransactionModel.progress) : i18n("Tasks") 0018 } 0019 ProgressBar { 0020 Layout.fillWidth: true 0021 value: TransactionModel.progress/100 0022 } 0023 } 0024 visible: TransactionModel.count > 0 0025 0026 property Kirigami.OverlaySheet sheetObject: null 0027 onClicked: { 0028 if (!sheetObject) 0029 sheetObject = sheet.createObject() 0030 0031 if (!sheetObject.sheetOpen) 0032 sheetObject.open() 0033 } 0034 0035 readonly property var v3: Component { 0036 id: sheet 0037 Kirigami.OverlaySheet { 0038 parent: applicationWindow().overlay 0039 0040 title: i18n("Tasks") 0041 0042 onSheetOpenChanged: { 0043 if (!sheetOpen) { 0044 sheetObject.destroy(100) 0045 } 0046 } 0047 0048 contentItem: ListView { 0049 id: tasksView 0050 spacing: 0 0051 implicitWidth: Kirigami.Units.gridUnit * 30 0052 0053 Component { 0054 id: listenerComp 0055 TransactionListener {} 0056 } 0057 model: TransactionModel 0058 0059 Connections { 0060 target: TransactionModel 0061 function onRowsRemoved() { 0062 if (TransactionModel.count === 0) { 0063 sheetObject.close(); 0064 } 0065 } 0066 } 0067 0068 delegate: Kirigami.AbstractListItem { 0069 id: del 0070 width: tasksView.width 0071 0072 // Don't need a highlight or hover effects as it can make the 0073 // progress bar a bit hard to see 0074 highlighted: false 0075 activeBackgroundColor: "transparent" 0076 activeTextColor: Kirigami.Theme.textColor 0077 separatorVisible: false 0078 hoverEnabled: false 0079 0080 readonly property QtObject listener: listenerComp.createObject(del, (model.transaction.resource ? {resource: model.transaction.resource} : {transaction: model.transaction})) 0081 0082 contentItem: ColumnLayout { 0083 0084 RowLayout { 0085 Layout.fillWidth: true 0086 0087 Kirigami.Icon { 0088 Layout.fillHeight: true 0089 Layout.minimumWidth: height 0090 source: model.transaction.icon 0091 } 0092 0093 Label { 0094 Layout.alignment: Qt.AlignVCenter 0095 Layout.fillWidth: true 0096 elide: Text.ElideRight 0097 text: listener.isActive && model.transaction.remainingTime>0 ? i18nc("TransactioName - TransactionStatus: speed, remaining time", "%1 - %2: %3, %4 remaining", model.transaction.name, listener.statusText, model.transaction.downloadSpeedString, model.transaction.remainingTime) : 0098 listener.isActive && model.transaction.downloadSpeed>0 ? i18nc("TransactioName - TransactionStatus: speed", "%1 - %2: %3", model.transaction.name, listener.statusText, model.transaction.downloadSpeedString) : 0099 listener.isActive ? i18nc("TransactioName - TransactionStatus", "%1 - %2", model.transaction.name, listener.statusText) 0100 : model.transaction.name 0101 } 0102 ToolButton { 0103 icon.name: "dialog-cancel" 0104 text: i18n("Cancel") 0105 visible: listener.isCancellable 0106 onClicked: listener.cancel() 0107 } 0108 ToolButton { 0109 icon.name: "system-run" 0110 visible: model.application !== undefined && model.application.isInstalled && !listener.isActive && model.application.canExecute 0111 onClicked: { 0112 model.application.invokeApplication() 0113 model.remove(index) 0114 } 0115 } 0116 } 0117 ProgressBar { 0118 Layout.fillWidth: true 0119 visible: listener.isActive 0120 value: listener.progress / 100 0121 } 0122 } 0123 } 0124 } 0125 } 0126 } 0127 }