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