Make EntryPage close when that entry is deleted from the DownloadListPage

This commit is contained in:
Bart De Vries 2021-06-24 17:13:04 +02:00
parent bcafb26c8c
commit 265b3109cb
4 changed files with 30 additions and 6 deletions

View File

@ -13,9 +13,11 @@ import org.kde.kirigami 2.15 as Kirigami
import org.kde.kasts 1.0
Kirigami.ScrollablePage {
title: i18n("Downloads")
property var lastEntry: ""
property string pageName: "downloadpage"
supportsRefreshing: true
onRefreshingChanged: {
if(refreshing) {

View File

@ -32,10 +32,31 @@ Kirigami.ScrollablePage {
if (!entry.queueStatus) {
// this entry has just been removed from the queue
if (pageStack.depth > 1) {
if (pageStack.get(0).lastEntry) {
if (pageStack.get(0).lastEntry === entry.id) {
// if this EntryPage was open, then close it
pageStack.pop()
if (pageStack.get(0).pageName === "queuepage") {
if (pageStack.get(0).lastEntry) {
if (pageStack.get(0).lastEntry === entry.id) {
// if this EntryPage was open, then close it
pageStack.pop()
}
}
}
}
}
}
}
Connections {
target: entry.enclosure
function onStatusChanged() {
if (entry.enclosure.status === Enclosure.Downloadable) {
// this entry has just been deleted on the downloadpage
if (pageStack.depth > 1) {
if (pageStack.get(0).pageName === "downloadpage") {
if (pageStack.get(0).lastEntry) {
if (pageStack.get(0).lastEntry === entry.id) {
// if this EntryPage was open, then close it
pageStack.pop()
}
}
}
}

View File

@ -175,7 +175,7 @@ Kirigami.SwipeListItem {
entry.read = true;
entry.new = false;
}
if (isQueue) {
if (isQueue || isDownloads) {
lastEntry = entry.id;
}
pageStack.push("qrc:/EntryPage.qml", {"entry": entry})

View File

@ -17,6 +17,7 @@ Kirigami.ScrollablePage {
title: i18n("Queue")
property var lastEntry: ""
property string pageName: "queuepage"
supportsRefreshing: true
onRefreshingChanged: {