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 id: episodeListDelegate
GenericEntryDelegate { GenericEntryDelegate {
listView: episodeList listView: episodeList
isDownloads: episodeType == EpisodeModel.Downloaded || episodeType == EpisodeModel.Downloading
} }
} }
ListView { ListView {

View File

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