mirror of https://github.com/KDE/kasts.git
Make EntryPage close when that entry is deleted from the DownloadListPage
This commit is contained in:
parent
bcafb26c8c
commit
265b3109cb
|
@ -13,9 +13,11 @@ import org.kde.kirigami 2.15 as Kirigami
|
||||||
import org.kde.kasts 1.0
|
import org.kde.kasts 1.0
|
||||||
|
|
||||||
Kirigami.ScrollablePage {
|
Kirigami.ScrollablePage {
|
||||||
|
|
||||||
title: i18n("Downloads")
|
title: i18n("Downloads")
|
||||||
|
|
||||||
|
property var lastEntry: ""
|
||||||
|
property string pageName: "downloadpage"
|
||||||
|
|
||||||
supportsRefreshing: true
|
supportsRefreshing: true
|
||||||
onRefreshingChanged: {
|
onRefreshingChanged: {
|
||||||
if(refreshing) {
|
if(refreshing) {
|
||||||
|
|
|
@ -32,6 +32,7 @@ Kirigami.ScrollablePage {
|
||||||
if (!entry.queueStatus) {
|
if (!entry.queueStatus) {
|
||||||
// this entry has just been removed from the queue
|
// this entry has just been removed from the queue
|
||||||
if (pageStack.depth > 1) {
|
if (pageStack.depth > 1) {
|
||||||
|
if (pageStack.get(0).pageName === "queuepage") {
|
||||||
if (pageStack.get(0).lastEntry) {
|
if (pageStack.get(0).lastEntry) {
|
||||||
if (pageStack.get(0).lastEntry === entry.id) {
|
if (pageStack.get(0).lastEntry === entry.id) {
|
||||||
// if this EntryPage was open, then close it
|
// if this EntryPage was open, then close it
|
||||||
|
@ -42,6 +43,26 @@ Kirigami.ScrollablePage {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
GenericHeader {
|
GenericHeader {
|
||||||
|
|
|
@ -175,7 +175,7 @@ Kirigami.SwipeListItem {
|
||||||
entry.read = true;
|
entry.read = true;
|
||||||
entry.new = false;
|
entry.new = false;
|
||||||
}
|
}
|
||||||
if (isQueue) {
|
if (isQueue || isDownloads) {
|
||||||
lastEntry = entry.id;
|
lastEntry = entry.id;
|
||||||
}
|
}
|
||||||
pageStack.push("qrc:/EntryPage.qml", {"entry": entry})
|
pageStack.push("qrc:/EntryPage.qml", {"entry": entry})
|
||||||
|
|
|
@ -17,6 +17,7 @@ Kirigami.ScrollablePage {
|
||||||
title: i18n("Queue")
|
title: i18n("Queue")
|
||||||
|
|
||||||
property var lastEntry: ""
|
property var lastEntry: ""
|
||||||
|
property string pageName: "queuepage"
|
||||||
|
|
||||||
supportsRefreshing: true
|
supportsRefreshing: true
|
||||||
onRefreshingChanged: {
|
onRefreshingChanged: {
|
||||||
|
|
Loading…
Reference in New Issue