Avoid double "Add to queue" actions on EntryPage

Instead of showing "add to queue" as main action and left action, the main
action will show "delete download", leaving "add to queue" as left
action.
This does mean that "delete download" can be main action or right
action, but this is nevertheless an improvement for now...
This commit is contained in:
Bart De Vries 2021-05-02 15:03:44 +02:00
parent 34c5e5309c
commit fb1516281e
1 changed files with 9 additions and 9 deletions

View File

@ -71,33 +71,33 @@ Kirigami.ScrollablePage {
text: !entry.enclosure ? i18n("Open in Browser") : text: !entry.enclosure ? i18n("Open in Browser") :
entry.enclosure.status === Enclosure.Downloadable ? i18n("Download") : entry.enclosure.status === Enclosure.Downloadable ? i18n("Download") :
entry.enclosure.status === Enclosure.Downloading ? i18n("Cancel download") : entry.enclosure.status === Enclosure.Downloading ? i18n("Cancel download") :
!entry.queueStatus ? i18n("Add to Queue") : !entry.queueStatus ? i18n("Delete download") :
(audio.entry === entry && audio.playbackState === Audio.PlayingState) ? i18n("Pause") : (audio.entry === entry && audio.playbackState === Audio.PlayingState) ? i18n("Pause") :
i18n("Play") i18n("Play")
icon.name: !entry.enclosure ? "globe" : icon.name: !entry.enclosure ? "globe" :
entry.enclosure.status === Enclosure.Downloadable ? "download" : entry.enclosure.status === Enclosure.Downloadable ? "download" :
entry.enclosure.status === Enclosure.Downloading ? "edit-delete-remove" : entry.enclosure.status === Enclosure.Downloading ? "edit-delete-remove" :
!entry.queueStatus ? "media-playlist-append" : !entry.queueStatus ? "delete" :
(audio.entry === entry && audio.playbackState === Audio.PlayingState) ? "media-playback-pause" : (audio.entry === entry && audio.playbackState === Audio.PlayingState) ? "media-playback-pause" :
"media-playback-start" "media-playback-start"
onTriggered: { onTriggered: {
if(!entry.enclosure) Qt.openUrlExternally(entry.link) if(!entry.enclosure) Qt.openUrlExternally(entry.link)
else if(entry.enclosure.status === Enclosure.Downloadable) entry.enclosure.download() else if(entry.enclosure.status === Enclosure.Downloadable) entry.enclosure.download()
else if(entry.enclosure.status === Enclosure.Downloading) entry.enclosure.cancelDownload() else if(entry.enclosure.status === Enclosure.Downloading) entry.enclosure.cancelDownload()
else if(entry.queueStatus) { else if(!entry.queueStatus) {
entry.enclosure.deleteFile()
} else {
if(audio.entry === entry && audio.playbackState === Audio.PlayingState) { if(audio.entry === entry && audio.playbackState === Audio.PlayingState) {
audio.pause() audio.pause()
} else { } else {
audio.entry = entry audio.entry = entry
audio.play() audio.play()
} }
} else {
entry.queueStatus = true
} }
} }
} }
actions.left: Kirigami.Action { actions.left: Kirigami.Action {
text: !entry.queueStatus ? i18n("Add to queue") : i18n("Remove from Queue") text: !entry.queueStatus ? i18n("Add to queue") : i18n("Remove from queue")
icon.name: !entry.queueStatus ? "media-playlist-append" : "list-remove" icon.name: !entry.queueStatus ? "media-playlist-append" : "list-remove"
visible: entry.enclosure || entry.queueStatus visible: entry.enclosure || entry.queueStatus
onTriggered: { onTriggered: {
@ -116,7 +116,7 @@ Kirigami.ScrollablePage {
text: i18n("Delete download") text: i18n("Delete download")
icon.name: "delete" icon.name: "delete"
onTriggered: entry.enclosure.deleteFile() onTriggered: entry.enclosure.deleteFile()
visible: entry.enclosure && entry.enclosure.status === Enclosure.Downloaded visible: entry.enclosure && entry.enclosure.status === Enclosure.Downloaded && entry.queueStatus
} }
contextualActions: [ contextualActions: [
Kirigami.Action { Kirigami.Action {
@ -125,13 +125,13 @@ Kirigami.ScrollablePage {
onTriggered: entry.enclosure.playPosition = 0 onTriggered: entry.enclosure.playPosition = 0
}, },
Kirigami.Action { Kirigami.Action {
text: entry.read ? i18n("Unmark as Played") : i18n("Mark as Played") text: entry.read ? i18n("Mark as unplayed") : i18n("Mark as played")
onTriggered: { onTriggered: {
entry.read = !entry.read entry.read = !entry.read
} }
}, },
Kirigami.Action { Kirigami.Action {
text: entry.new ? i18n("Unmark as New") : i18n("Mark as New") text: entry.new ? i18n("Remove \"new\" label") : i18n("Label as new")
onTriggered: { onTriggered: {
entry.new = !entry.new entry.new = !entry.new
} }