Ability to update only items with custom auto-update interval. #88
This commit is contained in:
parent
f6b7ad6d71
commit
8a42fd43e5
@ -165,6 +165,7 @@ QList<QAction*> FormMain::allActions() const {
|
||||
actions << m_ui->m_actionDeleteSelectedMessages;
|
||||
actions << m_ui->m_actionUpdateAllItems;
|
||||
actions << m_ui->m_actionUpdateSelectedItems;
|
||||
actions << m_ui->m_actionUpdateSelectedItemsWithCustomTimers;
|
||||
actions << m_ui->m_actionStopRunningItemsUpdate;
|
||||
actions << m_ui->m_actionEditSelectedItem;
|
||||
actions << m_ui->m_actionCopyUrlSelectedFeed;
|
||||
@ -421,6 +422,7 @@ void FormMain::updateFeedButtonsAvailability() {
|
||||
m_ui->m_actionMarkSelectedItemsAsRead->setEnabled(anything_selected);
|
||||
m_ui->m_actionMarkSelectedItemsAsUnread->setEnabled(anything_selected);
|
||||
m_ui->m_actionUpdateAllItems->setEnabled(!critical_action_running);
|
||||
m_ui->m_actionUpdateSelectedItemsWithCustomTimers->setEnabled(!critical_action_running);
|
||||
m_ui->m_actionUpdateSelectedItems->setEnabled(!critical_action_running && (feed_selected || category_selected || service_selected));
|
||||
m_ui->m_actionViewSelectedItemsNewspaperMode->setEnabled(anything_selected);
|
||||
m_ui->m_actionExpandCollapseItem->setEnabled(anything_selected);
|
||||
@ -494,6 +496,7 @@ void FormMain::setupIcons() {
|
||||
m_ui->m_actionStopRunningItemsUpdate->setIcon(icon_theme_factory->fromTheme(QSL("process-stop")));
|
||||
m_ui->m_actionUpdateAllItems->setIcon(icon_theme_factory->fromTheme(QSL("view-refresh")));
|
||||
m_ui->m_actionUpdateSelectedItems->setIcon(icon_theme_factory->fromTheme(QSL("view-refresh")));
|
||||
m_ui->m_actionUpdateSelectedItemsWithCustomTimers->setIcon(icon_theme_factory->fromTheme(QSL("view-refresh")));
|
||||
m_ui->m_actionClearSelectedItems->setIcon(icon_theme_factory->fromTheme(QSL("mail-mark-junk")));
|
||||
m_ui->m_actionClearAllItems->setIcon(icon_theme_factory->fromTheme(QSL("mail-mark-junk")));
|
||||
m_ui->m_actionDeleteSelectedItem->setIcon(icon_theme_factory->fromTheme(QSL("list-remove")));
|
||||
@ -719,6 +722,8 @@ void FormMain::createConnections() {
|
||||
&QAction::triggered, tabWidget()->feedMessageViewer()->feedsView(), &FeedsView::updateSelectedItems);
|
||||
connect(m_ui->m_actionUpdateAllItems,
|
||||
&QAction::triggered, qApp->feedReader(), &FeedReader::updateAllFeeds);
|
||||
connect(m_ui->m_actionUpdateSelectedItemsWithCustomTimers,
|
||||
&QAction::triggered, qApp->feedReader(), &FeedReader::updateManuallyIntervaledFeeds);
|
||||
connect(m_ui->m_actionStopRunningItemsUpdate,
|
||||
&QAction::triggered, qApp->feedReader(), &FeedReader::stopRunningFeedUpdate);
|
||||
connect(m_ui->m_actionCopyUrlSelectedFeed,
|
||||
|
@ -107,6 +107,7 @@
|
||||
</widget>
|
||||
<addaction name="m_actionUpdateAllItems"/>
|
||||
<addaction name="m_actionUpdateSelectedItems"/>
|
||||
<addaction name="m_actionUpdateSelectedItemsWithCustomTimers"/>
|
||||
<addaction name="m_actionStopRunningItemsUpdate"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="m_menuAddItem"/>
|
||||
@ -775,6 +776,11 @@
|
||||
<string>&Show tree branches</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="m_actionUpdateSelectedItemsWithCustomTimers">
|
||||
<property name="text">
|
||||
<string>Update items with custom &timers</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
|
@ -201,6 +201,10 @@ void FeedReader::updateAllFeeds() {
|
||||
updateFeeds(m_feedsModel->rootItem()->getSubTreeFeeds());
|
||||
}
|
||||
|
||||
void FeedReader::updateManuallyIntervaledFeeds() {
|
||||
updateFeeds(m_feedsModel->rootItem()->getSubTreeManuallyIntervaledFeeds());
|
||||
}
|
||||
|
||||
void FeedReader::stopRunningFeedUpdate() {
|
||||
if (m_feedDownloader != nullptr) {
|
||||
m_feedDownloader->stopRunningUpdate();
|
||||
|
@ -62,6 +62,7 @@ class RSSGUARD_DLLSPEC FeedReader : public QObject {
|
||||
|
||||
public slots:
|
||||
void updateAllFeeds();
|
||||
void updateManuallyIntervaledFeeds();
|
||||
void stopRunningFeedUpdate();
|
||||
void quit();
|
||||
|
||||
|
@ -356,6 +356,27 @@ QList<Feed*> RootItem::getSubTreeFeeds() const {
|
||||
return children;
|
||||
}
|
||||
|
||||
QList<Feed*> RootItem::getSubTreeManuallyIntervaledFeeds() 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::SpecificAutoUpdate) {
|
||||
children.append(active_item->toFeed());
|
||||
}
|
||||
|
||||
traversable_items.append(active_item->childItems());
|
||||
}
|
||||
|
||||
return children;
|
||||
}
|
||||
|
||||
ServiceRoot* RootItem::getParentServiceRoot() const {
|
||||
const RootItem* working_parent = this;
|
||||
|
||||
|
@ -161,6 +161,7 @@ class RSSGUARD_DLLSPEC RootItem : public QObject {
|
||||
// Returns list of feeds complemented by their own string CUSTOM ID.
|
||||
QHash<QString, Feed*> getHashedSubTreeFeeds() const;
|
||||
QList<Feed*> getSubTreeFeeds() const;
|
||||
QList<Feed*> getSubTreeManuallyIntervaledFeeds() const;
|
||||
|
||||
// Returns the service root node which is direct or indirect parent of current item.
|
||||
ServiceRoot* getParentServiceRoot() const;
|
||||
|
Loading…
x
Reference in New Issue
Block a user