2017-08-29 23:58:49 +02:00
|
|
|
import QtQuick 2.3
|
|
|
|
import QtQuick.Layouts 1.1
|
2017-09-07 19:21:37 +02:00
|
|
|
import QtQml.Models 2.2
|
2020-11-27 19:09:47 +01:00
|
|
|
import org.kde.plasma.components 2.0 as PlasmaComponents // for Menu and MenuItem
|
|
|
|
import org.kde.plasma.components 3.0 as PlasmaComponents3
|
2017-08-29 23:58:49 +02:00
|
|
|
import org.kde.plasma.core 2.0 as PlasmaCore
|
|
|
|
|
|
|
|
Item {
|
|
|
|
property alias view: downloadView
|
|
|
|
objectName: "DownloadsPage"
|
|
|
|
|
2022-05-05 20:51:53 +02:00
|
|
|
PlasmaComponents3.ScrollView {
|
2017-08-29 23:58:49 +02:00
|
|
|
anchors.fill: parent
|
|
|
|
|
2022-05-09 23:14:22 +02:00
|
|
|
// HACK: workaround for https://bugreports.qt.io/browse/QTBUG-83890
|
|
|
|
PlasmaComponents3.ScrollBar.horizontal.policy: PlasmaComponents3.ScrollBar.AlwaysOff
|
|
|
|
|
|
|
|
contentItem: TopLevelView {
|
2017-08-29 23:58:49 +02:00
|
|
|
id: downloadView
|
|
|
|
model: plasmoid.nativeInterface.downloadModel
|
|
|
|
|
|
|
|
delegate: TopLevelItem {
|
2017-09-07 19:21:37 +02:00
|
|
|
id: item
|
2022-09-01 22:32:17 +02:00
|
|
|
width: downloadView.effectiveWidth()
|
2020-10-07 21:34:37 +02:00
|
|
|
readonly property string downloadName: name
|
2017-09-26 23:46:20 +02:00
|
|
|
property alias openButton: openButton
|
2017-09-07 19:21:37 +02:00
|
|
|
|
|
|
|
ColumnLayout {
|
|
|
|
width: parent.width
|
|
|
|
spacing: 0
|
|
|
|
|
|
|
|
RowLayout {
|
|
|
|
id: itemSummary
|
2017-10-01 21:22:37 +02:00
|
|
|
Layout.fillWidth: true
|
2017-09-07 19:21:37 +02:00
|
|
|
|
|
|
|
RowLayout {
|
2017-09-09 21:40:00 +02:00
|
|
|
spacing: units.smallSpacing
|
2020-11-27 19:09:47 +01:00
|
|
|
PlasmaComponents3.Label {
|
2018-06-30 17:45:03 +02:00
|
|
|
Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft
|
2017-09-07 19:21:37 +02:00
|
|
|
elide: Text.ElideRight
|
2017-09-26 15:45:03 +02:00
|
|
|
text: name ? name : "?"
|
2017-09-07 19:21:37 +02:00
|
|
|
}
|
|
|
|
}
|
2020-11-27 19:09:47 +01:00
|
|
|
PlasmaComponents3.ProgressBar {
|
2017-09-07 19:21:37 +02:00
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.fillHeight: true
|
2020-11-27 19:09:47 +01:00
|
|
|
from: 0.0
|
|
|
|
to: 100.0
|
|
|
|
value: percentage ? percentage : 0.0
|
2017-09-07 19:21:37 +02:00
|
|
|
}
|
|
|
|
RowLayout {
|
|
|
|
id: toolButtonsLayout
|
|
|
|
spacing: 0
|
|
|
|
|
2020-11-27 19:09:47 +01:00
|
|
|
PlasmaComponents3.Label {
|
2017-09-07 19:21:37 +02:00
|
|
|
height: implicitHeight
|
2017-09-26 15:45:03 +02:00
|
|
|
text: progressLabel ? progressLabel : ""
|
2018-06-30 17:45:03 +02:00
|
|
|
Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft
|
2017-09-07 19:21:37 +02:00
|
|
|
}
|
|
|
|
Item {
|
|
|
|
width: 3
|
|
|
|
}
|
2017-09-12 00:00:16 +02:00
|
|
|
TinyButton {
|
2017-10-01 21:21:10 +02:00
|
|
|
id: openButton
|
2022-02-05 21:31:53 +01:00
|
|
|
icon.source: plasmoid.nativeInterface.faUrl + "folder"
|
2017-09-07 19:21:37 +02:00
|
|
|
tooltip: qsTr("Open in file browser")
|
2017-09-26 15:45:03 +02:00
|
|
|
enabled: path !== undefined
|
2017-09-07 19:21:37 +02:00
|
|
|
onClicked: {
|
|
|
|
Qt.openUrlExternally(path)
|
|
|
|
plasmoid.expanded = false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2017-08-29 23:58:49 +02:00
|
|
|
}
|
2017-09-07 19:21:37 +02:00
|
|
|
|
|
|
|
DetailView {
|
|
|
|
id: detailsView
|
|
|
|
visible: item.expanded
|
2017-10-01 21:22:37 +02:00
|
|
|
Layout.fillWidth: true
|
2017-09-07 19:21:37 +02:00
|
|
|
|
|
|
|
model: DelegateModel {
|
|
|
|
model: plasmoid.nativeInterface.downloadModel
|
|
|
|
rootIndex: detailsView.model.modelIndex(index)
|
|
|
|
delegate: RowLayout {
|
2019-03-19 23:05:31 +01:00
|
|
|
width: detailsView.width
|
2017-09-07 19:21:37 +02:00
|
|
|
|
|
|
|
PlasmaCore.IconItem {
|
2017-09-09 21:40:00 +02:00
|
|
|
Layout.preferredWidth: units.iconSizes.medium
|
|
|
|
Layout.preferredHeight: units.iconSizes.medium
|
2018-06-30 17:45:03 +02:00
|
|
|
Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft
|
2017-09-07 19:21:37 +02:00
|
|
|
source: fileIcon
|
|
|
|
}
|
|
|
|
ColumnLayout {
|
|
|
|
spacing: 0
|
|
|
|
Layout.fillWidth: true
|
|
|
|
RowLayout {
|
2017-09-09 21:40:00 +02:00
|
|
|
spacing: units.smallSpacing
|
2017-09-07 19:21:37 +02:00
|
|
|
Layout.fillWidth: true
|
2020-11-27 19:09:47 +01:00
|
|
|
PlasmaComponents3.Label {
|
2017-09-07 19:21:37 +02:00
|
|
|
Layout.fillWidth: true
|
|
|
|
text: name
|
2017-09-09 21:40:00 +02:00
|
|
|
font.pointSize: theme.defaultFont.pointSize * 0.8
|
2017-09-07 19:21:37 +02:00
|
|
|
elide: Text.ElideRight
|
|
|
|
}
|
2020-11-27 19:09:47 +01:00
|
|
|
PlasmaComponents3.Label {
|
2017-09-07 19:21:37 +02:00
|
|
|
text: progressLabel
|
2017-09-09 21:40:00 +02:00
|
|
|
font.pointSize: theme.defaultFont.pointSize * 0.8
|
2017-09-07 19:21:37 +02:00
|
|
|
elide: Text.ElideRight
|
|
|
|
}
|
|
|
|
}
|
2020-11-27 19:09:47 +01:00
|
|
|
PlasmaComponents3.ProgressBar {
|
2017-09-07 19:21:37 +02:00
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.preferredHeight: 8
|
|
|
|
Layout.topMargin: 0
|
2020-11-27 19:09:47 +01:00
|
|
|
from: 0.0
|
|
|
|
to: 100.0
|
2017-09-07 19:21:37 +02:00
|
|
|
value: percentage
|
|
|
|
}
|
|
|
|
}
|
2017-09-12 00:00:16 +02:00
|
|
|
TinyButton {
|
2022-02-05 21:31:53 +01:00
|
|
|
icon.source: plasmoid.nativeInterface.faUrl + "folder"
|
2017-09-07 19:21:37 +02:00
|
|
|
tooltip: qsTr("Open in file browser")
|
|
|
|
onClicked: {
|
2017-10-03 16:58:16 +02:00
|
|
|
Qt.openUrlExternally(path + "/..")
|
2017-09-07 19:21:37 +02:00
|
|
|
plasmoid.expanded = false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2017-08-29 23:58:49 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2018-03-26 22:56:55 +02:00
|
|
|
|
|
|
|
PlasmaComponents.Menu {
|
|
|
|
id: contextMenu
|
|
|
|
|
2020-10-07 21:34:37 +02:00
|
|
|
PlasmaComponents.MenuItem {
|
|
|
|
text: qsTr("Copy label/ID")
|
|
|
|
icon: "edit-copy"
|
|
|
|
onClicked: downloadView.copyCurrentItemData("downloadName")
|
|
|
|
}
|
|
|
|
PlasmaComponents.MenuItem {
|
|
|
|
separator: true
|
|
|
|
}
|
2018-03-26 22:56:55 +02:00
|
|
|
PlasmaComponents.MenuItem {
|
|
|
|
id: openItem
|
2020-10-07 21:34:37 +02:00
|
|
|
text: qsTr("Open in file browser")
|
2018-03-26 22:56:55 +02:00
|
|
|
icon: "folder"
|
|
|
|
onClicked: downloadView.clickCurrentItemButton("openButton")
|
|
|
|
}
|
|
|
|
}
|
2017-08-29 23:58:49 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|