Move feed update action to header on desktop

The refresh buttons currently show up as main action buttons at the
bottom on desktop since they are placed inside SwipeViews/tabs.  Move
these actions to the hierarchical parent ScrollablePages so they end up
in the header bar.
This commit is contained in:
Bart De Vries 2021-05-31 10:40:05 +02:00
parent ef2df0ef11
commit eec54d3095
3 changed files with 33 additions and 5 deletions

View File

@ -19,6 +19,13 @@ Kirigami.Page {
title: i18n("Downloads")
padding: 0
actions.main: Kirigami.Action {
iconName: "view-refresh"
text: i18n("Refresh All Podcasts")
visible: !Kirigami.Settings.isMobile
onTriggered: Fetcher.fetchAll()
}
header: Loader {
id: headerLoader
active: !Kirigami.Settings.isMobile
@ -57,9 +64,16 @@ Kirigami.Page {
}
}
Controls.SwipeView {
contentItem: Controls.SwipeView {
id: swipeView
anchors.fill: parent
anchors {
top: page.header.bottom
right: page.right
left: page.left
bottom: page.footer.top
}
currentIndex: Kirigami.Settings.isMobile ? footerLoader.item.currentIndex : headerLoader.item.currentIndex
EpisodeListPage {

View File

@ -30,7 +30,7 @@ Kirigami.ScrollablePage {
iconName: "view-refresh"
text: i18n("Refresh All Podcasts")
onTriggered: refreshing = true
visible: !Kirigami.Settings.isMobile || episodeList.count === 0
visible: Kirigami.Settings.isMobile && episodeList.count === 0
}
Kirigami.PlaceholderMessage {

View File

@ -19,6 +19,13 @@ Kirigami.Page {
title: i18n("Episode List")
padding: 0
actions.main: Kirigami.Action {
iconName: "view-refresh"
text: i18n("Refresh All Podcasts")
visible: !Kirigami.Settings.isMobile
onTriggered: Fetcher.fetchAll()
}
header: Loader {
id: headerLoader
active: !Kirigami.Settings.isMobile
@ -52,9 +59,16 @@ Kirigami.Page {
}
}
Controls.SwipeView {
contentItem: Controls.SwipeView {
id: swipeView
anchors.fill: parent
anchors {
top: page.header.bottom
right: page.right
left: page.left
bottom: page.footer.top
}
currentIndex: Kirigami.Settings.isMobile ? footerLoader.item.currentIndex : headerLoader.item.currentIndex
EpisodeListPage {