This commit is contained in:
Jonathan Rainville 2020-10-22 16:04:15 -04:00 committed by Iuri Matias
parent ce0d717717
commit 98730fa177
2 changed files with 15 additions and 4 deletions

View File

@ -30,8 +30,11 @@ Rectangle {
orientation: ListView.Horizontal
model: downloadModel
height: currentItem ? currentItem.height : 0
// This makes it show the newest on the right
layoutDirection: Qt.RightToLeft
spacing: Style.current.smallPadding
width: parent.width
anchors.left: parent.left
width: childrenRect.width
interactive: false
delegate: Component {
DownloadElement {

View File

@ -12,6 +12,8 @@ Rectangle {
}
property bool isCanceled: false
property bool hovered: false
// use this to place the newest downloads first
property int reversedIndex: listView.count - 1 - index
id: root
width: 272
@ -24,6 +26,10 @@ Rectangle {
Qt.openUrlExternally(`file://${downloadDirectory}/${downloadFileName}`)
removeDownloadFromModel(index)
}
// TODO check if this works in Windows and Mac
function openDirectory() {
Qt.openUrlExternally("file://" + downloadDirectory)
}
MouseArea {
anchors.fill: parent
@ -36,7 +42,10 @@ Rectangle {
root.hovered = false
}
onClicked: {
openFile()
if (downloadComplete) {
return openFile()
}
openDirectory()
}
}
@ -137,8 +146,7 @@ Rectangle {
icon.width: 13
icon.height: 9
text: qsTr("Show in folder")
// TODO check if this works in Windows and Mac
onTriggered: Qt.openUrlExternally("file://" + downloadDirectory)
onTriggered: openDirectory()
}
Action {
enabled: !downloadComplete && !!downloadModel.downloads[index] && !downloadModel.downloads[index].isPaused