This commit is contained in:
Martin Rotter 2021-06-28 08:17:59 +02:00
parent 868d75b182
commit 591c345d07
3 changed files with 25 additions and 1 deletions

View File

@ -43,7 +43,9 @@ FeedReader::FeedReader(QObject* parent)
<< "Requesting update for all feeds on application startup."; << "Requesting update for all feeds on application startup.";
QTimer::singleShot(qApp->settings()->value(GROUP(Feeds), SETTING(Feeds::FeedsUpdateStartupDelay)).toDouble() * 1000, QTimer::singleShot(qApp->settings()->value(GROUP(Feeds), SETTING(Feeds::FeedsUpdateStartupDelay)).toDouble() * 1000,
this, this,
&FeedReader::updateAllFeeds); [this]() {
updateFeeds(m_feedsModel->rootItem()->getSubAutoFetchingEnabledFeeds());
});
} }
} }

View File

@ -421,6 +421,27 @@ QList<Feed*> RootItem::getSubTreeManuallyIntervaledFeeds() const {
return children; return children;
} }
QList<Feed*> RootItem::getSubAutoFetchingEnabledFeeds() const {
QList<Feed*> children;
QList<RootItem*> traversable_items;
traversable_items.append(const_cast<RootItem* const>(this));
// Iterate all nested items.
while (!traversable_items.isEmpty()) {
RootItem* active_item = traversable_items.takeFirst();
if (active_item->kind() == RootItem::Kind::Feed &&
active_item->toFeed()->autoUpdateType() != Feed::AutoUpdateType::DontAutoUpdate) {
children.append(active_item->toFeed());
}
traversable_items.append(active_item->childItems());
}
return children;
}
ServiceRoot* RootItem::getParentServiceRoot() const { ServiceRoot* RootItem::getParentServiceRoot() const {
const RootItem* working_parent = this; const RootItem* working_parent = this;

View File

@ -144,6 +144,7 @@ class RSSGUARD_DLLSPEC RootItem : public QObject {
QHash<QString, Feed*> getHashedSubTreeFeeds() const; QHash<QString, Feed*> getHashedSubTreeFeeds() const;
QList<Feed*> getSubTreeFeeds() const; QList<Feed*> getSubTreeFeeds() const;
QList<Feed*> getSubTreeManuallyIntervaledFeeds() const; QList<Feed*> getSubTreeManuallyIntervaledFeeds() const;
QList<Feed*> getSubAutoFetchingEnabledFeeds() const;
// Returns the service root node which is direct or indirect parent of current item. // Returns the service root node which is direct or indirect parent of current item.
ServiceRoot* getParentServiceRoot() const; ServiceRoot* getParentServiceRoot() const;