Make application remember the last opened main page

This commit is contained in:
Bart De Vries 2021-04-10 09:32:19 +02:00
parent fbaf084a37
commit 218b86807e
2 changed files with 18 additions and 3 deletions

View File

@ -20,7 +20,9 @@ Kirigami.ApplicationWindow {
title: "Alligator" title: "Alligator"
pageStack.initialPage: feedList pageStack.initialPage: SettingsManager.lastOpenedPage === "FeedListPage" ? feedList
: SettingsManager.lastOpenedPage === "QueuePage" ? queueList
: feedList
globalDrawer: Kirigami.GlobalDrawer { globalDrawer: Kirigami.GlobalDrawer {
isMenu: true isMenu: true
@ -29,14 +31,16 @@ Kirigami.ApplicationWindow {
text: i18n("Queue") text: i18n("Queue")
iconName: "source-playlist" iconName: "source-playlist"
onTriggered: { onTriggered: {
SettingsManager.lastOpenedPage = "QueuePage" // for persistency
pageStack.clear() pageStack.clear()
pageStack.push(queuelist) pageStack.push(queueList)
} }
}, },
Kirigami.Action { Kirigami.Action {
text: i18n("Subscriptions") text: i18n("Subscriptions")
iconName: "rss" iconName: "rss"
onTriggered: { onTriggered: {
SettingsManager.lastOpenedPage = "FeedListPage" // for persistency
pageStack.clear() pageStack.clear()
pageStack.push(feedList) pageStack.push(feedList)
} }
@ -72,7 +76,7 @@ Kirigami.ApplicationWindow {
} }
QueuePage { QueuePage {
id: queuelist id: queueList
} }
Audio { Audio {
@ -81,6 +85,7 @@ Kirigami.ApplicationWindow {
property var entry property var entry
property bool playerOpen: false property bool playerOpen: false
onEntryChanged: SettingsManager.lastPlayingEntry = entry.id
source: entry ? (entry.enclosure ? "file://" + entry.enclosure.path : "") : "" source: entry ? (entry.enclosure ? "file://" + entry.enclosure.path : "") : ""
//source: entry.enclosure.url //source: entry.enclosure.url
onError: console.debug(errorString) onError: console.debug(errorString)

View File

@ -38,4 +38,14 @@
<default>0</default> <default>0</default>
</entry> </entry>
</group> </group>
<group name="Persistency">
<entry name="lastOpenedPage" type="String">
<label>The top-level page that was open at shutdown</label>
<default>FeedListPage</default>
</entry>
<entry name="lastPlayingEntry" type="String">
<label>The entry that was being played at shutdown</label>
<default>none</default>
</entry>
</group>
</kcfg> </kcfg>