diff --git a/src/feed.h b/src/feed.h index 29a73b77..6afca280 100644 --- a/src/feed.h +++ b/src/feed.h @@ -57,7 +57,7 @@ public: void setAuthors(QVector authors); void setRefreshing(bool refreshing); - void refresh(); + Q_INVOKABLE void refresh(); void remove(); Q_SIGNALS: diff --git a/src/qml/EntryListPage.qml b/src/qml/EntryListPage.qml index 8923ed2b..f190ce6e 100644 --- a/src/qml/EntryListPage.qml +++ b/src/qml/EntryListPage.qml @@ -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 diff --git a/src/qml/FeedListPage.qml b/src/qml/FeedListPage.qml index d501fd68..6a88fc33 100644 --- a/src/qml/FeedListPage.qml +++ b/src/qml/FeedListPage.qml @@ -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