From be240f72abf4068f9a910d96d6b1b9d566055f07 Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Fri, 6 Nov 2009 18:29:32 +0000 Subject: [PATCH] - Mark news feed articles as read even if they are visited with keyboard arrows --- src/rss.cpp | 1 - src/rss_imp.cpp | 9 ++++++--- src/rss_imp.h | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/rss.cpp b/src/rss.cpp index c13e0bf63..56e90f284 100644 --- a/src/rss.cpp +++ b/src/rss.cpp @@ -591,7 +591,6 @@ short RssStream::readDoc(const QDomDocument& doc) { } } } - } else { delete item; } diff --git a/src/rss_imp.cpp b/src/rss_imp.cpp index 814325085..1c633b6a7 100644 --- a/src/rss_imp.cpp +++ b/src/rss_imp.cpp @@ -460,8 +460,11 @@ void RSSImp::refreshNewsList(QTreeWidgetItem* item) { } // display a news -void RSSImp::refreshTextBrowser(QTreeWidgetItem *item) { - if(!item || item == previous_news) return; +void RSSImp::refreshTextBrowser() { + QList selection = listNews->selectedItems(); + if(selection.empty()) return; + QTreeWidgetItem *item = selection.first(); + if(item == previous_news) return; // Stop displaying previous news if necessary if(listStreams->currentFeed() == listStreams->getUnreadItem()) { if(previous_news) { @@ -596,7 +599,7 @@ RSSImp::RSSImp(bittorrent *BTSession) : QWidget(), BTSession(BTSession){ connect(listStreams, SIGNAL(foldersAltered(QList)), this, SLOT(updateItemsInfos(QList))); connect(listStreams, SIGNAL(overwriteAttempt(QString)), this, SLOT(displayOverwriteError(QString))); - connect(listNews, SIGNAL(itemClicked(QTreeWidgetItem*, int)), this, SLOT(refreshTextBrowser(QTreeWidgetItem *))); + connect(listNews, SIGNAL(itemSelectionChanged()), this, SLOT(refreshTextBrowser())); connect(listNews, SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int)), this, SLOT(downloadTorrent())); // Refresh all feeds diff --git a/src/rss_imp.h b/src/rss_imp.h index c1fb246a0..f128e7350 100644 --- a/src/rss_imp.h +++ b/src/rss_imp.h @@ -63,7 +63,7 @@ protected slots: void refreshSelectedItems(); void copySelectedFeedsURL(); void refreshNewsList(QTreeWidgetItem* item); - void refreshTextBrowser(QTreeWidgetItem *); + void refreshTextBrowser(); void updateFeedIcon(QString url, QString icon_path); void updateFeedInfos(QString url, QString aliasOrUrl, unsigned int nbUnread); void updateItemsInfos(QList items);