Adapt actions specifically for Downloads page

This commit is contained in:
Bart De Vries 2021-04-20 09:55:16 +02:00
parent 7ebfebe01e
commit 0f957841b3
2 changed files with 12 additions and 4 deletions

View File

@ -43,6 +43,7 @@ Kirigami.ScrollablePage {
id: episodeListDelegate
GenericEntryDelegate {
listView: episodeList
isDownloads: episodeType == EpisodeModel.Downloaded || episodeType == EpisodeModel.Downloading
}
}
ListView {

View File

@ -18,6 +18,7 @@ Kirigami.SwipeListItem {
alwaysVisibleActions: true
property bool isQueue: false
property bool isDownloads: false
property var listView: ""
contentItem: RowLayout {
@ -155,7 +156,7 @@ Kirigami.SwipeListItem {
entry.queueStatus = true;
entry.enclosure.download();
}
visible: entry.enclosure && entry.enclosure.status === Enclosure.Downloadable
visible: !isDownloads && entry.enclosure && entry.enclosure.status === Enclosure.Downloadable
},
Kirigami.Action {
text: i18n("Cancel download")
@ -163,16 +164,22 @@ Kirigami.SwipeListItem {
onTriggered: entry.enclosure.cancelDownload()
visible: entry.enclosure && entry.enclosure.status === Enclosure.Downloading
},
Kirigami.Action {
text: i18n("Delete download")
icon.name: "delete"
onTriggered: entry.enclosure.deleteFile()
visible: isDownloads && entry.enclosure && entry.enclosure.status === Enclosure.Downloaded
},
Kirigami.Action {
text: i18n("Add to queue")
icon.name: "media-playlist-append"
visible: !entry.queueStatus && entry.enclosure && entry.enclosure.status === Enclosure.Downloaded
visible: !isDownloads && !entry.queueStatus && entry.enclosure && entry.enclosure.status === Enclosure.Downloaded
onTriggered: entry.queueStatus = true
},
Kirigami.Action {
text: i18n("Play")
icon.name: "media-playback-start"
visible: entry.queueStatus && entry.enclosure && entry.enclosure.status === Enclosure.Downloaded && (audio.entry !== entry || audio.playbackState !== Audio.PlayingState)
visible: !isDownloads && entry.queueStatus && entry.enclosure && entry.enclosure.status === Enclosure.Downloaded && (audio.entry !== entry || audio.playbackState !== Audio.PlayingState)
onTriggered: {
audio.entry = entry
audio.play()
@ -181,7 +188,7 @@ Kirigami.SwipeListItem {
Kirigami.Action {
text: i18n("Pause")
icon.name: "media-playback-pause"
visible: entry.queueStatus && entry.enclosure && entry.enclosure.status === Enclosure.Downloaded && audio.entry === entry && audio.playbackState === Audio.PlayingState
visible: !isDownloads && entry.queueStatus && entry.enclosure && entry.enclosure.status === Enclosure.Downloaded && audio.entry === entry && audio.playbackState === Audio.PlayingState
onTriggered: audio.pause()
}
]