From 6357d6372c81812c931291f6e1707651520cc91a Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Wed, 5 Oct 2011 18:41:23 +0300 Subject: [PATCH] RSS: Fix parent article count when removing a child feed --- src/rss/rss_imp.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/rss/rss_imp.cpp b/src/rss/rss_imp.cpp index 6b49ef4b6..8b552bf60 100644 --- a/src/rss/rss_imp.cpp +++ b/src/rss/rss_imp.cpp @@ -249,11 +249,17 @@ void RSSImp::deleteSelectedItems() { listArticles->clear(); } IRssFile *rss_item = m_feedList->getRSSItem(item); + QTreeWidgetItem * parent = item->parent(); // Notify TreeWidget m_feedList->itemAboutToBeRemoved(item); // Actually delete the item rss_item->parent()->removeChild(rss_item->id()); delete item; + // Update parents count + while (parent && parent != m_feedList->invisibleRootItem()) { + updateItemInfos (parent); + parent = parent->parent(); + } } m_rssManager->saveStreamList(); // Update Unread items @@ -549,6 +555,9 @@ void RSSImp::updateItemsInfos(const QList &items) { void RSSImp::updateItemInfos(QTreeWidgetItem *item) { IRssFile *rss_item = m_feedList->getRSSItem(item); + if (!rss_item) + return; + QString name; if(rss_item == m_rssManager) name = tr("Unread");