fixes #1203
This commit is contained in:
parent
76c7dd1703
commit
fa990b2610
@ -211,6 +211,15 @@ void FeedDownloader::updateOneFeed(ServiceRoot* acc,
|
|||||||
Feed* feed,
|
Feed* feed,
|
||||||
const QHash<ServiceRoot::BagOfMessages, QStringList>& stated_messages,
|
const QHash<ServiceRoot::BagOfMessages, QStringList>& stated_messages,
|
||||||
const QHash<QString, QStringList>& tagged_messages) {
|
const QHash<QString, QStringList>& tagged_messages) {
|
||||||
|
feed->setStatus(Feed::Status::Fetching);
|
||||||
|
|
||||||
|
const bool update_feed_list =
|
||||||
|
qApp->settings()->value(GROUP(Feeds), SETTING(Feeds::UpdateFeedListDuringFetching)).toBool();
|
||||||
|
|
||||||
|
if (update_feed_list) {
|
||||||
|
acc->itemChanged({feed});
|
||||||
|
}
|
||||||
|
|
||||||
qlonglong thread_id = qlonglong(QThread::currentThreadId());
|
qlonglong thread_id = qlonglong(QThread::currentThreadId());
|
||||||
|
|
||||||
qDebugNN << LOGSEC_FEEDDOWNLOADER << "Downloading new messages for feed ID" << QUOTE_W_SPACE(feed->customId())
|
qDebugNN << LOGSEC_FEEDDOWNLOADER << "Downloading new messages for feed ID" << QUOTE_W_SPACE(feed->customId())
|
||||||
@ -439,6 +448,10 @@ void FeedDownloader::updateOneFeed(ServiceRoot* acc,
|
|||||||
feed->setStatus(Feed::Status::OtherError, app_ex.message());
|
feed->setStatus(Feed::Status::OtherError, app_ex.message());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (update_feed_list) {
|
||||||
|
acc->itemChanged({feed});
|
||||||
|
}
|
||||||
|
|
||||||
qDebugNN << LOGSEC_FEEDDOWNLOADER << "Made progress in feed updates, total feeds count "
|
qDebugNN << LOGSEC_FEEDDOWNLOADER << "Made progress in feed updates, total feeds count "
|
||||||
<< m_watcherLookup.progressValue() + 1 << "/" << m_feeds.size() << " (id of feed is " << feed->id() << ").";
|
<< m_watcherLookup.progressValue() + 1 << "/" << m_feeds.size() << " (id of feed is " << feed->id() << ").";
|
||||||
}
|
}
|
||||||
|
@ -40,6 +40,7 @@ FeedsModel::FeedsModel(QObject* parent) : QAbstractItemModel(parent), m_rootItem
|
|||||||
<< /*: Feed list header "counts" column tooltip.*/ tr("Counts of unread/all mesages.");
|
<< /*: Feed list header "counts" column tooltip.*/ tr("Counts of unread/all mesages.");
|
||||||
|
|
||||||
setupFonts();
|
setupFonts();
|
||||||
|
setupBehaviorDuringFetching();
|
||||||
}
|
}
|
||||||
|
|
||||||
FeedsModel::~FeedsModel() {
|
FeedsModel::~FeedsModel() {
|
||||||
@ -329,6 +330,14 @@ RootItem* FeedsModel::rootItem() const {
|
|||||||
return m_rootItem;
|
return m_rootItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FeedsModel::setupBehaviorDuringFetching() {
|
||||||
|
m_updateDuringFetching = qApp->settings()->value(GROUP(Feeds), SETTING(Feeds::UpdateFeedListDuringFetching)).toBool();
|
||||||
|
|
||||||
|
if (m_updateDuringFetching) {
|
||||||
|
m_updateItemIcon = qApp->icons()->fromTheme(QSL("view-refresh"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void FeedsModel::reloadChangedLayout(QModelIndexList list) {
|
void FeedsModel::reloadChangedLayout(QModelIndexList list) {
|
||||||
while (!list.isEmpty()) {
|
while (!list.isEmpty()) {
|
||||||
QModelIndex indx = list.takeFirst();
|
QModelIndex indx = list.takeFirst();
|
||||||
@ -345,7 +354,7 @@ void FeedsModel::reloadChangedLayout(QModelIndexList list) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void FeedsModel::reloadChangedItem(RootItem* item) {
|
void FeedsModel::reloadChangedItem(RootItem* item) {
|
||||||
reloadChangedLayout(QModelIndexList() << indexForItem(item));
|
reloadChangedLayout({indexForItem(item)});
|
||||||
}
|
}
|
||||||
|
|
||||||
void FeedsModel::notifyWithCounts() {
|
void FeedsModel::notifyWithCounts() {
|
||||||
@ -544,6 +553,16 @@ QVariant FeedsModel::data(const QModelIndex& index, int role) const {
|
|||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case Qt::ItemDataRole::DecorationRole: {
|
||||||
|
if (index.column() == FDS_MODEL_TITLE_INDEX && m_updateDuringFetching) {
|
||||||
|
RootItem* it = itemForIndex(index);
|
||||||
|
|
||||||
|
if (it->isFetching()) {
|
||||||
|
return m_updateItemIcon;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return itemForIndex(index)->data(index.column(), role);
|
return itemForIndex(index)->data(index.column(), role);
|
||||||
}
|
}
|
||||||
|
@ -78,6 +78,7 @@ class RSSGUARD_DLLSPEC FeedsModel : public QAbstractItemModel {
|
|||||||
// Access to root item.
|
// Access to root item.
|
||||||
RootItem* rootItem() const;
|
RootItem* rootItem() const;
|
||||||
|
|
||||||
|
void setupBehaviorDuringFetching();
|
||||||
void setupFonts();
|
void setupFonts();
|
||||||
void informAboutDatabaseCleanup();
|
void informAboutDatabaseCleanup();
|
||||||
|
|
||||||
@ -149,6 +150,8 @@ class RSSGUARD_DLLSPEC FeedsModel : public QAbstractItemModel {
|
|||||||
void reloadMessageListRequested(bool mark_selected_messages_read);
|
void reloadMessageListRequested(bool mark_selected_messages_read);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
bool m_updateDuringFetching;
|
||||||
|
QIcon m_updateItemIcon;
|
||||||
RootItem* m_rootItem;
|
RootItem* m_rootItem;
|
||||||
QList<QString> m_headerData;
|
QList<QString> m_headerData;
|
||||||
QList<QString> m_tooltipData;
|
QList<QString> m_tooltipData;
|
||||||
|
@ -74,6 +74,7 @@ SettingsFeedsMessages::SettingsFeedsMessages(Settings* settings, QWidget* parent
|
|||||||
connect(m_ui->m_cmbIgnoreContentsChanges, &QCheckBox::toggled, this, &SettingsFeedsMessages::dirtifySettings);
|
connect(m_ui->m_cmbIgnoreContentsChanges, &QCheckBox::toggled, this, &SettingsFeedsMessages::dirtifySettings);
|
||||||
connect(m_ui->m_cbHideCountsIfNoUnread, &QCheckBox::toggled, this, &SettingsFeedsMessages::dirtifySettings);
|
connect(m_ui->m_cbHideCountsIfNoUnread, &QCheckBox::toggled, this, &SettingsFeedsMessages::dirtifySettings);
|
||||||
connect(m_ui->m_checkAutoUpdate, &QCheckBox::toggled, this, &SettingsFeedsMessages::dirtifySettings);
|
connect(m_ui->m_checkAutoUpdate, &QCheckBox::toggled, this, &SettingsFeedsMessages::dirtifySettings);
|
||||||
|
connect(m_ui->m_cbUpdateFeedListDuringFetching, &QCheckBox::toggled, this, &SettingsFeedsMessages::dirtifySettings);
|
||||||
connect(m_ui->m_checkAutoUpdateOnlyUnfocused, &QCheckBox::toggled, this, &SettingsFeedsMessages::dirtifySettings);
|
connect(m_ui->m_checkAutoUpdateOnlyUnfocused, &QCheckBox::toggled, this, &SettingsFeedsMessages::dirtifySettings);
|
||||||
connect(m_ui->m_cmbUnreadIconType,
|
connect(m_ui->m_cmbUnreadIconType,
|
||||||
QOverload<int>::of(&QComboBox::currentIndexChanged),
|
QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||||
@ -247,6 +248,8 @@ void SettingsFeedsMessages::loadSettings() {
|
|||||||
m_ui->m_spinHeightRowsMessages->setValue(settings()->value(GROUP(GUI), SETTING(GUI::HeightRowMessages)).toInt());
|
m_ui->m_spinHeightRowsMessages->setValue(settings()->value(GROUP(GUI), SETTING(GUI::HeightRowMessages)).toInt());
|
||||||
m_ui->m_spinHeightRowsFeeds->setValue(settings()->value(GROUP(GUI), SETTING(GUI::HeightRowFeeds)).toInt());
|
m_ui->m_spinHeightRowsFeeds->setValue(settings()->value(GROUP(GUI), SETTING(GUI::HeightRowFeeds)).toInt());
|
||||||
|
|
||||||
|
m_ui->m_cbUpdateFeedListDuringFetching
|
||||||
|
->setChecked(settings()->value(GROUP(Feeds), SETTING(Feeds::UpdateFeedListDuringFetching)).toBool());
|
||||||
m_ui->m_cbListsRestrictedShortcuts
|
m_ui->m_cbListsRestrictedShortcuts
|
||||||
->setChecked(settings()->value(GROUP(Feeds), SETTING(Feeds::OnlyBasicShortcutsInLists)).toBool());
|
->setChecked(settings()->value(GROUP(Feeds), SETTING(Feeds::OnlyBasicShortcutsInLists)).toBool());
|
||||||
m_ui->m_cbHideCountsIfNoUnread
|
m_ui->m_cbHideCountsIfNoUnread
|
||||||
@ -342,6 +345,9 @@ void SettingsFeedsMessages::saveSettings() {
|
|||||||
settings()->setValue(GROUP(GUI), GUI::HeightRowMessages, m_ui->m_spinHeightRowsMessages->value());
|
settings()->setValue(GROUP(GUI), GUI::HeightRowMessages, m_ui->m_spinHeightRowsMessages->value());
|
||||||
settings()->setValue(GROUP(GUI), GUI::HeightRowFeeds, m_ui->m_spinHeightRowsFeeds->value());
|
settings()->setValue(GROUP(GUI), GUI::HeightRowFeeds, m_ui->m_spinHeightRowsFeeds->value());
|
||||||
|
|
||||||
|
settings()->setValue(GROUP(Feeds),
|
||||||
|
Feeds::UpdateFeedListDuringFetching,
|
||||||
|
m_ui->m_cbUpdateFeedListDuringFetching->isChecked());
|
||||||
settings()->setValue(GROUP(Feeds), Feeds::OnlyBasicShortcutsInLists, m_ui->m_cbListsRestrictedShortcuts->isChecked());
|
settings()->setValue(GROUP(Feeds), Feeds::OnlyBasicShortcutsInLists, m_ui->m_cbListsRestrictedShortcuts->isChecked());
|
||||||
|
|
||||||
settings()->setValue(GROUP(Feeds), Feeds::HideCountsIfNoUnread, m_ui->m_cbHideCountsIfNoUnread->isChecked());
|
settings()->setValue(GROUP(Feeds), Feeds::HideCountsIfNoUnread, m_ui->m_cbHideCountsIfNoUnread->isChecked());
|
||||||
@ -415,6 +421,7 @@ void SettingsFeedsMessages::saveSettings() {
|
|||||||
qApp->mainForm()->tabWidget()->feedMessageViewer()->loadMessageViewerFonts();
|
qApp->mainForm()->tabWidget()->feedMessageViewer()->loadMessageViewerFonts();
|
||||||
|
|
||||||
qApp->feedReader()->updateAutoUpdateStatus();
|
qApp->feedReader()->updateAutoUpdateStatus();
|
||||||
|
qApp->feedReader()->feedsModel()->setupBehaviorDuringFetching();
|
||||||
qApp->feedReader()->feedsModel()->reloadWholeLayout();
|
qApp->feedReader()->feedsModel()->reloadWholeLayout();
|
||||||
|
|
||||||
qApp->feedReader()->messagesModel()->updateDateFormat();
|
qApp->feedReader()->messagesModel()->updateDateFormat();
|
||||||
|
@ -284,20 +284,27 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="0" colspan="2">
|
<item row="6" column="0" colspan="2">
|
||||||
<widget class="QCheckBox" name="m_cbListsRestrictedShortcuts">
|
<widget class="QCheckBox" name="m_cbListsRestrictedShortcuts">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Allow only basic keyboard shortcuts for feed/article list</string>
|
<string>Allow only basic keyboard shortcuts for feed/article list</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="6" column="0" colspan="2">
|
<item row="7" column="0" colspan="2">
|
||||||
<widget class="QCheckBox" name="m_checkShowTooltips">
|
<widget class="QCheckBox" name="m_checkShowTooltips">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Display tooltips for feeds and articles</string>
|
<string>Display tooltips for feeds and articles</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="5" column="0" colspan="2">
|
||||||
|
<widget class="QCheckBox" name="m_cbUpdateFeedListDuringFetching">
|
||||||
|
<property name="text">
|
||||||
|
<string>Update feed list during feed fetching</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="m_tabMessages">
|
<widget class="QWidget" name="m_tabMessages">
|
||||||
@ -673,6 +680,7 @@
|
|||||||
<tabstop>m_btnChangeFeedListFont</tabstop>
|
<tabstop>m_btnChangeFeedListFont</tabstop>
|
||||||
<tabstop>m_cmbCountsFeedList</tabstop>
|
<tabstop>m_cmbCountsFeedList</tabstop>
|
||||||
<tabstop>m_cbHideCountsIfNoUnread</tabstop>
|
<tabstop>m_cbHideCountsIfNoUnread</tabstop>
|
||||||
|
<tabstop>m_cbUpdateFeedListDuringFetching</tabstop>
|
||||||
<tabstop>m_cbListsRestrictedShortcuts</tabstop>
|
<tabstop>m_cbListsRestrictedShortcuts</tabstop>
|
||||||
<tabstop>m_checkShowTooltips</tabstop>
|
<tabstop>m_checkShowTooltips</tabstop>
|
||||||
<tabstop>m_checkRemoveReadMessagesOnExit</tabstop>
|
<tabstop>m_checkRemoveReadMessagesOnExit</tabstop>
|
||||||
@ -697,6 +705,8 @@
|
|||||||
<tabstop>m_tabFeedsMessages</tabstop>
|
<tabstop>m_tabFeedsMessages</tabstop>
|
||||||
<tabstop>m_gbFeedListFont</tabstop>
|
<tabstop>m_gbFeedListFont</tabstop>
|
||||||
<tabstop>m_gbArticleListFont</tabstop>
|
<tabstop>m_gbArticleListFont</tabstop>
|
||||||
|
<tabstop>m_gbAvoidOldArticles</tabstop>
|
||||||
|
<tabstop>m_dtDateTimeToAvoid</tabstop>
|
||||||
</tabstops>
|
</tabstops>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
|
@ -111,6 +111,9 @@ DVALUE(bool) Feeds::ShowTreeBranchesDef = true;
|
|||||||
DKEY Feeds::HideCountsIfNoUnread = "hide_counts_if_no_unread";
|
DKEY Feeds::HideCountsIfNoUnread = "hide_counts_if_no_unread";
|
||||||
DVALUE(bool) Feeds::HideCountsIfNoUnreadDef = false;
|
DVALUE(bool) Feeds::HideCountsIfNoUnreadDef = false;
|
||||||
|
|
||||||
|
DKEY Feeds::UpdateFeedListDuringFetching = "update_feed_list_during_fetching";
|
||||||
|
DVALUE(bool) Feeds::UpdateFeedListDuringFetchingDef = false;
|
||||||
|
|
||||||
DKEY Feeds::AutoExpandOnSelection = "auto_expand_on_selection";
|
DKEY Feeds::AutoExpandOnSelection = "auto_expand_on_selection";
|
||||||
DVALUE(bool) Feeds::AutoExpandOnSelectionDef = false;
|
DVALUE(bool) Feeds::AutoExpandOnSelectionDef = false;
|
||||||
|
|
||||||
|
@ -108,6 +108,9 @@ namespace Feeds {
|
|||||||
KEY HideCountsIfNoUnread;
|
KEY HideCountsIfNoUnread;
|
||||||
VALUE(bool) HideCountsIfNoUnreadDef;
|
VALUE(bool) HideCountsIfNoUnreadDef;
|
||||||
|
|
||||||
|
KEY UpdateFeedListDuringFetching;
|
||||||
|
VALUE(bool) UpdateFeedListDuringFetchingDef;
|
||||||
|
|
||||||
KEY AutoExpandOnSelection;
|
KEY AutoExpandOnSelection;
|
||||||
VALUE(bool) AutoExpandOnSelectionDef;
|
VALUE(bool) AutoExpandOnSelectionDef;
|
||||||
|
|
||||||
|
@ -150,6 +150,10 @@ bool Feed::canBeEdited() const {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Feed::isFetching() const {
|
||||||
|
return m_status == Status::Fetching;
|
||||||
|
}
|
||||||
|
|
||||||
void Feed::setAutoUpdateInterval(int auto_update_interval) {
|
void Feed::setAutoUpdateInterval(int auto_update_interval) {
|
||||||
// If new initial auto-update interval is set, then
|
// If new initial auto-update interval is set, then
|
||||||
// we should reset time that remains to the next auto-update.
|
// we should reset time that remains to the next auto-update.
|
||||||
|
@ -32,7 +32,8 @@ class Feed : public RootItem {
|
|||||||
NetworkError = 2,
|
NetworkError = 2,
|
||||||
AuthError = 3,
|
AuthError = 3,
|
||||||
ParsingError = 4,
|
ParsingError = 4,
|
||||||
OtherError = 5
|
OtherError = 5,
|
||||||
|
Fetching = 6
|
||||||
};
|
};
|
||||||
|
|
||||||
Q_ENUM(Status)
|
Q_ENUM(Status)
|
||||||
@ -51,6 +52,7 @@ class Feed : public RootItem {
|
|||||||
virtual QVariantHash customDatabaseData() const;
|
virtual QVariantHash customDatabaseData() const;
|
||||||
virtual void setCustomDatabaseData(const QVariantHash& data);
|
virtual void setCustomDatabaseData(const QVariantHash& data);
|
||||||
virtual bool canBeEdited() const;
|
virtual bool canBeEdited() const;
|
||||||
|
virtual bool isFetching() const;
|
||||||
virtual QVariant data(int column, int role) const;
|
virtual QVariant data(int column, int role) const;
|
||||||
|
|
||||||
void setCountOfAllMessages(int count_all_messages);
|
void setCountOfAllMessages(int count_all_messages);
|
||||||
|
@ -67,6 +67,10 @@ bool RootItem::deleteItem() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool RootItem::isFetching() const {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool RootItem::markAsReadUnread(ReadStatus status) {
|
bool RootItem::markAsReadUnread(ReadStatus status) {
|
||||||
bool result = true;
|
bool result = true;
|
||||||
|
|
||||||
|
@ -82,6 +82,8 @@ class RSSGUARD_DLLSPEC RootItem : public QObject {
|
|||||||
// Returns result status.
|
// Returns result status.
|
||||||
virtual bool deleteItem();
|
virtual bool deleteItem();
|
||||||
|
|
||||||
|
virtual bool isFetching() const;
|
||||||
|
|
||||||
// Performs all needed steps (DB update, remote server update)
|
// Performs all needed steps (DB update, remote server update)
|
||||||
// to mark this item as read/unread.
|
// to mark this item as read/unread.
|
||||||
virtual bool markAsReadUnread(ReadStatus status);
|
virtual bool markAsReadUnread(ReadStatus status);
|
||||||
|
@ -1296,6 +1296,7 @@ UpdatedArticles ServiceRoot::updateMessages(QList<Message>& messages, Feed* feed
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE: Do not update model items here. We update only once when all feeds are fetched.
|
// NOTE: Do not update model items here. We update only once when all feeds are fetched
|
||||||
|
// or separately in downloader, if user has this enabled.
|
||||||
return updated_messages;
|
return updated_messages;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user