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") title: i18n("Downloads")
padding: 0 padding: 0
actions.main: Kirigami.Action {
iconName: "view-refresh"
text: i18n("Refresh All Podcasts")
visible: !Kirigami.Settings.isMobile
onTriggered: Fetcher.fetchAll()
}
header: Loader { header: Loader {
id: headerLoader id: headerLoader
active: !Kirigami.Settings.isMobile active: !Kirigami.Settings.isMobile
@ -57,9 +64,16 @@ Kirigami.Page {
} }
} }
Controls.SwipeView { contentItem: Controls.SwipeView {
id: 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 currentIndex: Kirigami.Settings.isMobile ? footerLoader.item.currentIndex : headerLoader.item.currentIndex
EpisodeListPage { EpisodeListPage {

View File

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

View File

@ -19,6 +19,13 @@ Kirigami.Page {
title: i18n("Episode List") title: i18n("Episode List")
padding: 0 padding: 0
actions.main: Kirigami.Action {
iconName: "view-refresh"
text: i18n("Refresh All Podcasts")
visible: !Kirigami.Settings.isMobile
onTriggered: Fetcher.fetchAll()
}
header: Loader { header: Loader {
id: headerLoader id: headerLoader
active: !Kirigami.Settings.isMobile active: !Kirigami.Settings.isMobile
@ -52,9 +59,16 @@ Kirigami.Page {
} }
} }
Controls.SwipeView { contentItem: Controls.SwipeView {
id: 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 currentIndex: Kirigami.Settings.isMobile ? footerLoader.item.currentIndex : headerLoader.item.currentIndex
EpisodeListPage { EpisodeListPage {