mirror of
https://github.com/martinrotter/rssguard.git
synced 2025-02-04 11:17:31 +01:00
Only updated feeds are now reloaded in the FeedsModel.
This commit is contained in:
parent
e1c3defddc
commit
558b241eb4
@ -203,15 +203,16 @@ QModelIndex FeedsModel::indexForItem(FeedsModelRootItem *item) const {
|
||||
|
||||
void FeedsModel::reloadChangedLayout(QModelIndexList list) {
|
||||
while (!list.isEmpty()) {
|
||||
QModelIndex ix = list.takeLast();
|
||||
QModelIndex indx = list.takeLast();
|
||||
QModelIndex indx_parent = indx.parent();
|
||||
|
||||
// Underlying data are changed.
|
||||
emit dataChanged(index(ix.row(), 0, ix.parent()),
|
||||
index(ix.row(), FDS_MODEL_COUNTS_INDEX, ix.parent()));
|
||||
emit dataChanged(index(indx.row(), 0, indx_parent),
|
||||
index(indx.row(), FDS_MODEL_COUNTS_INDEX, indx_parent));
|
||||
|
||||
if (ix.parent().isValid()) {
|
||||
if (indx_parent.isValid()) {
|
||||
// Make sure that data of parent are changed too.
|
||||
list.append(ix.parent());
|
||||
list.append(indx_parent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -120,8 +120,9 @@ void FeedMessageViewer::onFeedUpdatesProgress(FeedsModelFeed *feed,
|
||||
// Some feed got updated.
|
||||
// TODO: Don't update counts of all feeds here,
|
||||
// it is enough to update counts of update feed.
|
||||
// So use indexForItem method from the model.
|
||||
m_feedsView->updateCountsOfAllFeeds(true);
|
||||
// So use indexForItem method from the model.
|
||||
//m_feedsView->updateCountsOfAllFeeds(true);
|
||||
m_feedsView->updateCountsOfParticularFeed(feed, true);
|
||||
}
|
||||
|
||||
void FeedMessageViewer::onFeedUpdatesFinished() {
|
||||
|
@ -151,6 +151,16 @@ void FeedsView::updateCountsOfAllFeeds(bool update_total_too) {
|
||||
m_sourceModel->reloadWholeLayout();
|
||||
}
|
||||
|
||||
void FeedsView::updateCountsOfParticularFeed(FeedsModelFeed *feed,
|
||||
bool update_total_too) {
|
||||
QModelIndex index = m_sourceModel->indexForItem(feed);
|
||||
|
||||
if (index.isValid()) {
|
||||
feed->updateCounts(update_total_too);
|
||||
m_sourceModel->reloadChangedLayout(QModelIndexList() << index);
|
||||
}
|
||||
}
|
||||
|
||||
void FeedsView::initializeContextMenuCategoriesFeeds() {
|
||||
m_contextMenuCategoriesFeeds = new QMenu(tr("Context menu for feeds"), this);
|
||||
m_contextMenuCategoriesFeeds->addActions(QList<QAction*>() <<
|
||||
|
@ -56,6 +56,8 @@ class FeedsView : public QTreeView {
|
||||
// Reloads counts for all feeds.
|
||||
void updateCountsOfAllFeeds(bool update_total_too = true);
|
||||
|
||||
void updateCountsOfParticularFeed(FeedsModelFeed *feed, bool update_total_too = true);
|
||||
|
||||
protected:
|
||||
// Initializes context menus.
|
||||
void initializeContextMenuCategoriesFeeds();
|
||||
|
Loading…
x
Reference in New Issue
Block a user