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 orientation: ListView.Horizontal
model: downloadModel model: downloadModel
height: currentItem ? currentItem.height : 0 height: currentItem ? currentItem.height : 0
// This makes it show the newest on the right
layoutDirection: Qt.RightToLeft
spacing: Style.current.smallPadding spacing: Style.current.smallPadding
width: parent.width anchors.left: parent.left
width: childrenRect.width
interactive: false interactive: false
delegate: Component { delegate: Component {
DownloadElement { DownloadElement {

View File

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