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
|
2017-08-29 23:58:49 +02:00
|
|
|
import org.kde.plasma.plasmoid 2.0
|
|
|
|
import org.kde.plasma.components 2.0 as PlasmaComponents
|
|
|
|
import org.kde.plasma.core 2.0 as PlasmaCore
|
|
|
|
import org.kde.plasma.extras 2.0 as PlasmaExtras
|
|
|
|
|
|
|
|
Item {
|
|
|
|
property alias view: downloadView
|
|
|
|
anchors.fill: parent
|
2017-09-09 21:40:00 +02:00
|
|
|
|
2017-08-29 23:58:49 +02:00
|
|
|
objectName: "DownloadsPage"
|
|
|
|
|
|
|
|
PlasmaExtras.ScrollArea {
|
|
|
|
anchors.fill: parent
|
|
|
|
|
|
|
|
TopLevelView {
|
|
|
|
id: downloadView
|
|
|
|
model: plasmoid.nativeInterface.downloadModel
|
|
|
|
|
|
|
|
delegate: TopLevelItem {
|
2017-09-07 19:21:37 +02:00
|
|
|
id: item
|
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
|
2017-09-07 19:21:37 +02:00
|
|
|
PlasmaComponents.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
|
|
|
}
|
|
|
|
}
|
|
|
|
PlasmaComponents.ProgressBar {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.fillHeight: true
|
|
|
|
minimumValue: 0
|
|
|
|
maximumValue: 100
|
2017-09-26 15:45:03 +02:00
|
|
|
value: percentage ? percentage : 0
|
2017-09-07 19:21:37 +02:00
|
|
|
}
|
|
|
|
RowLayout {
|
|
|
|
id: toolButtonsLayout
|
|
|
|
spacing: 0
|
|
|
|
|
|
|
|
PlasmaComponents.Label {
|
|
|
|
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
|
2020-04-12 23:16:26 +02:00
|
|
|
icon: "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
|
|
|
|
PlasmaComponents.Label {
|
|
|
|
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
|
|
|
|
}
|
|
|
|
PlasmaComponents.Label {
|
|
|
|
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
|
|
|
|
}
|
|
|
|
}
|
|
|
|
PlasmaComponents.ProgressBar {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.preferredHeight: 8
|
|
|
|
Layout.topMargin: 0
|
|
|
|
minimumValue: 0
|
|
|
|
maximumValue: 100
|
|
|
|
value: percentage
|
|
|
|
}
|
|
|
|
}
|
2017-09-12 00:00:16 +02:00
|
|
|
TinyButton {
|
2020-04-12 23:16:26 +02:00
|
|
|
icon: "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
|
|
|
|
|
|
|
|
PlasmaComponents.MenuItem {
|
|
|
|
id: openItem
|
|
|
|
text: qsTr('Open in file browser')
|
|
|
|
icon: "folder"
|
|
|
|
onClicked: downloadView.clickCurrentItemButton("openButton")
|
|
|
|
}
|
|
|
|
}
|
2017-08-29 23:58:49 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|