Make refreshing consistent on FeedListPage and EntryListPage

This commit is contained in:
Tobias Fella 2020-05-31 22:47:42 +02:00
parent 6fd81f52e9
commit 4d5684b0d0
3 changed files with 25 additions and 14 deletions

View File

@ -57,7 +57,7 @@ public:
void setAuthors(QVector<Author *> authors);
void setRefreshing(bool refreshing);
void refresh();
Q_INVOKABLE void refresh();
void remove();
Q_SIGNALS:

View File

@ -32,8 +32,13 @@ Kirigami.ScrollablePage {
property var feed
title: feed.name
supportsRefreshing: true
//property bool all: feed
onRefreshingChanged:
if(refreshing) {
feed.refresh()
refreshing = false
}
contextualActions: [
Kirigami.Action {
@ -46,7 +51,8 @@ Kirigami.ScrollablePage {
actions.main: Kirigami.Action {
iconName: "view-refresh"
text: i18n("Refresh Feed")
onTriggered: Fetcher.fetch(page.feed.url)
onTriggered: page.refreshing = true
visible: !Kirigami.Settings.isMobile
}
Kirigami.PlaceholderMessage {
@ -70,10 +76,22 @@ Kirigami.ScrollablePage {
width: parent.width
height: root.height * 0.2
visible: !all
Kirigami.Icon {
source: Fetcher.image(page.feed.image)
Item {
id: icon
width: height
height: parent.height
Kirigami.Icon {
source: Fetcher.image(page.feed.image)
width: height
height: parent.height
visible: !busy.visible
}
Controls.BusyIndicator {
id: busy
width: height
height: parent.height
visible: page.feed.refreshing
}
}
Kirigami.Heading {
text: page.feed.name

View File

@ -34,21 +34,15 @@ Kirigami.ScrollablePage {
supportsRefreshing: true
onRefreshingChanged:
if(refreshing) {
timer.running = true
Fetcher.fetchAll()
refreshing = false
}
Timer {
id: timer
interval: 1000
onTriggered: refreshing = false
}
contextualActions: [
Kirigami.Action {
text: i18n("Refresh all feeds")
iconName: "view-refresh"
onTriggered: Fetcher.fetchAll()
onTriggered: refreshing = true
visible: !Kirigami.Settings.isMobile
}
]
@ -139,7 +133,6 @@ Kirigami.ScrollablePage {
visible: model.feed.refreshing
}
}
Controls.Label {
text: model.feed.name
height: parent.height