mirror of https://github.com/KDE/kasts.git
Simplify saving the current Page
This commit is contained in:
parent
89e88afa27
commit
04f44bc078
|
@ -31,8 +31,6 @@ FocusScope {
|
|||
if (AudioManager.entry) {
|
||||
pushPage("QueuePage");
|
||||
pageStack.push("qrc:/EntryPage.qml", {"entry": AudioManager.entry});
|
||||
SettingsManager.lastOpenedPage = "QueuePage";
|
||||
SettingsManager.save();
|
||||
pageStack.get(0).lastEntry = AudioManager.entry.id;
|
||||
var model = pageStack.get(0).queueList.model;
|
||||
for (var i = 0; i < model.rowCount(); i++) {
|
||||
|
@ -50,8 +48,6 @@ FocusScope {
|
|||
if (AudioManager.entry) {
|
||||
pushPage("FeedListPage");
|
||||
pageStack.push("qrc:/FeedDetailsPage.qml", {"feed": AudioManager.entry.feed});
|
||||
SettingsManager.lastOpenedPage = "FeedListPage";
|
||||
SettingsManager.save();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -25,8 +25,6 @@ Kirigami.ScrollablePage {
|
|||
|
||||
function openPodcast() {
|
||||
pushPage("FeedListPage");
|
||||
SettingsManager.lastOpenedPage = "FeedListPage"; // for persistency
|
||||
SettingsManager.save();
|
||||
lastFeed = entry.feed.url;
|
||||
pageStack.push("qrc:/FeedDetailsPage.qml", {"feed": entry.feed});
|
||||
}
|
||||
|
|
|
@ -33,8 +33,6 @@ Kirigami.ScrollablePage {
|
|||
text: i18n("Downloads")
|
||||
onTriggered: {
|
||||
pushPage("DownloadListPage")
|
||||
SettingsManager.lastOpenedPage = "DownloadListPage"; // for persistency
|
||||
SettingsManager.save();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -12,9 +12,9 @@ import org.kde.kirigami 2.19 as Kirigami
|
|||
import org.kde.kasts 1.0
|
||||
|
||||
Kirigami.NavigationTabBar {
|
||||
id: root
|
||||
id: navBar
|
||||
|
||||
property alias toolbarHeight: root.implicitHeight
|
||||
property alias toolbarHeight: navBar.implicitHeight
|
||||
property bool transparentBackground: false
|
||||
|
||||
shadow: false
|
||||
|
@ -23,37 +23,31 @@ Kirigami.NavigationTabBar {
|
|||
Kirigami.Action {
|
||||
icon.name: "view-media-playlist"
|
||||
text: i18n("Queue")
|
||||
checked: "QueuePage" === SettingsManager.lastOpenedPage
|
||||
checked: "QueuePage" === root.currentPage
|
||||
onTriggered: {
|
||||
pushPage("QueuePage");
|
||||
SettingsManager.lastOpenedPage = "QueuePage"; // for persistency
|
||||
SettingsManager.save();
|
||||
}
|
||||
},
|
||||
Kirigami.Action {
|
||||
icon.name: "bookmarks"
|
||||
text: i18n("Subscriptions")
|
||||
checked: "FeedListPage" === SettingsManager.lastOpenedPage
|
||||
checked: "FeedListPage" === root.currentPage
|
||||
onTriggered: {
|
||||
pushPage("FeedListPage");
|
||||
SettingsManager.lastOpenedPage = "FeedListPage"; // for persistency
|
||||
SettingsManager.save();
|
||||
}
|
||||
},
|
||||
Kirigami.Action {
|
||||
icon.name: "rss"
|
||||
text: i18n("Episodes")
|
||||
checked: "EpisodeListPage" === SettingsManager.lastOpenedPage
|
||||
checked: "EpisodeListPage" === root.currentPage
|
||||
onTriggered: {
|
||||
pushPage("EpisodeListPage")
|
||||
SettingsManager.lastOpenedPage = "EpisodeListPage" // for persistency
|
||||
SettingsManager.save();
|
||||
}
|
||||
},
|
||||
Kirigami.Action {
|
||||
icon.name: "settings-configure"
|
||||
text: i18n("Settings")
|
||||
checked: "SettingsPage" === SettingsManager.lastOpenedPage
|
||||
checked: "SettingsPage" === root.currentPage
|
||||
onTriggered: {
|
||||
applicationWindow().pageStack.clear()
|
||||
applicationWindow().pageStack.push("qrc:/SettingsPage.qml", {}, {
|
||||
|
|
|
@ -75,6 +75,7 @@ Kirigami.ApplicationWindow {
|
|||
property var desktopWidth
|
||||
property var desktopHeight
|
||||
property int headerSize: Kirigami.Units.gridUnit * 5
|
||||
property alias lastOpenedPage: root.currentPage
|
||||
}
|
||||
|
||||
function saveWindowLayout() {
|
||||
|
@ -103,8 +104,7 @@ Kirigami.ApplicationWindow {
|
|||
|
||||
Component.onCompleted: {
|
||||
restoreWindowLayout();
|
||||
currentPage = SettingsManager.lastOpenedPage;
|
||||
pageStack.initialPage = getPage(SettingsManager.lastOpenedPage);
|
||||
pageStack.initialPage = getPage(currentPage);
|
||||
|
||||
// Delete played enclosures if set in settings
|
||||
if (SettingsManager.autoDeleteOnPlayed == 2) {
|
||||
|
@ -178,8 +178,6 @@ Kirigami.ApplicationWindow {
|
|||
checked: currentPage == "QueuePage"
|
||||
onClicked: {
|
||||
pushPage("QueuePage")
|
||||
SettingsManager.lastOpenedPage = "QueuePage" // for persistency
|
||||
SettingsManager.save();
|
||||
}
|
||||
}
|
||||
Kirigami.NavigationTabButton {
|
||||
|
@ -190,8 +188,6 @@ Kirigami.ApplicationWindow {
|
|||
checked: currentPage == "DiscoverPage"
|
||||
onClicked: {
|
||||
pushPage("DiscoverPage")
|
||||
SettingsManager.lastOpenedPage = "DiscoverPage" // for persistency
|
||||
SettingsManager.save();
|
||||
}
|
||||
}
|
||||
Kirigami.NavigationTabButton {
|
||||
|
@ -202,8 +198,6 @@ Kirigami.ApplicationWindow {
|
|||
checked: currentPage == "FeedListPage"
|
||||
onClicked: {
|
||||
pushPage("FeedListPage")
|
||||
SettingsManager.lastOpenedPage = "FeedListPage" // for persistency
|
||||
SettingsManager.save();
|
||||
}
|
||||
}
|
||||
Kirigami.NavigationTabButton {
|
||||
|
@ -214,8 +208,6 @@ Kirigami.ApplicationWindow {
|
|||
checked: currentPage == "EpisodeListPage"
|
||||
onClicked: {
|
||||
pushPage("EpisodeListPage")
|
||||
SettingsManager.lastOpenedPage = "EpisodeListPage" // for persistency
|
||||
SettingsManager.save();
|
||||
}
|
||||
}
|
||||
Kirigami.NavigationTabButton {
|
||||
|
@ -226,8 +218,6 @@ Kirigami.ApplicationWindow {
|
|||
checked: currentPage == "DownloadListPage"
|
||||
onClicked: {
|
||||
pushPage("DownloadListPage")
|
||||
SettingsManager.lastOpenedPage = "DownloadListPage" // for persistency
|
||||
SettingsManager.save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -128,10 +128,6 @@
|
|||
</entry>
|
||||
</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="sleepTimerValue" type="Int">
|
||||
<label>The number of seconds/minutes/hours to set the sleep timer to</label>
|
||||
<default>30</default>
|
||||
|
|
Loading…
Reference in New Issue