Browse Source

- Some more RSS polishing

adaptive-webui-19844
Christophe Dumez 15 years ago
parent
commit
2b0e05b453
  1. 11
      src/rss_imp.cpp

11
src/rss_imp.cpp

@ -154,8 +154,6 @@ void RSSImp::refreshSelectedStreams() {
QTreeWidgetItem* item; QTreeWidgetItem* item;
foreach(item, selectedItems){ foreach(item, selectedItems){
QString url = item->text(1); QString url = item->text(1);
textBrowser->clear();
listNews->clear();
rssmanager->refresh(url); rssmanager->refresh(url);
item->setData(0,Qt::DecorationRole, QVariant(QIcon(":/Icons/loading.png"))); item->setData(0,Qt::DecorationRole, QVariant(QIcon(":/Icons/loading.png")));
} }
@ -177,8 +175,6 @@ void RSSImp::showFeedDownloader() {
} }
void RSSImp::on_actionMark_all_as_read_triggered() { void RSSImp::on_actionMark_all_as_read_triggered() {
textBrowser->clear();
listNews->clear();
QList<QTreeWidgetItem*> selectedItems = listStreams->selectedItems(); QList<QTreeWidgetItem*> selectedItems = listStreams->selectedItems();
QTreeWidgetItem* item; QTreeWidgetItem* item;
foreach(item, selectedItems){ foreach(item, selectedItems){
@ -193,8 +189,6 @@ void RSSImp::on_actionMark_all_as_read_triggered() {
//right-click somewhere, refresh all the streams //right-click somewhere, refresh all the streams
void RSSImp::refreshAllStreams() { void RSSImp::refreshAllStreams() {
textBrowser->clear();
listNews->clear();
unsigned int nbFeeds = listStreams->topLevelItemCount(); unsigned int nbFeeds = listStreams->topLevelItemCount();
for(unsigned int i=0; i<nbFeeds; ++i) for(unsigned int i=0; i<nbFeeds; ++i)
listStreams->topLevelItem(i)->setData(0,Qt::DecorationRole, QVariant(QIcon(":/Icons/loading.png"))); listStreams->topLevelItem(i)->setData(0,Qt::DecorationRole, QVariant(QIcon(":/Icons/loading.png")));
@ -268,6 +262,7 @@ void RSSImp::refreshNewsList(QTreeWidgetItem* item) {
qDebug("Getting the list of news"); qDebug("Getting the list of news");
QList<RssItem*> news = stream->getNewsList(); QList<RssItem*> news = stream->getNewsList();
// Clear the list first // Clear the list first
textBrowser->clear();
listNews->clear(); listNews->clear();
qDebug("Got the list of news"); qDebug("Got the list of news");
foreach(RssItem* article, news){ foreach(RssItem* article, news){
@ -287,6 +282,7 @@ void RSSImp::refreshNewsList(QTreeWidgetItem* item) {
// display a news // display a news
void RSSImp::refreshTextBrowser(QListWidgetItem *item) { void RSSImp::refreshTextBrowser(QListWidgetItem *item) {
if(!item) return;
RssItem* article = rssmanager->getFeed(selectedFeedUrl)->getItem(listNews->row(item)); RssItem* article = rssmanager->getFeed(selectedFeedUrl)->getItem(listNews->row(item));
QString html; QString html;
html += "<div style='border: 2px solid red; margin-left: 5px; margin-right: 5px; margin-bottom: 5px;'>"; html += "<div style='border: 2px solid red; margin-left: 5px; margin-right: 5px; margin-bottom: 5px;'>";
@ -400,7 +396,7 @@ RSSImp::RSSImp(bittorrent *BTSession) : QWidget(), BTSession(BTSession){
connect(actionDownload_torrent, SIGNAL(triggered()), this, SLOT(downloadTorrent())); connect(actionDownload_torrent, SIGNAL(triggered()), this, SLOT(downloadTorrent()));
connect(listStreams, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), this, SLOT(refreshNewsList(QTreeWidgetItem*))); connect(listStreams, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), this, SLOT(refreshNewsList(QTreeWidgetItem*)));
connect(listNews, SIGNAL(itemClicked(QListWidgetItem *)), this, SLOT(refreshTextBrowser(QListWidgetItem *))); connect(listNews, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)), this, SLOT(refreshTextBrowser(QListWidgetItem *)));
connect(listNews, SIGNAL(itemDoubleClicked(QListWidgetItem *)), this, SLOT(downloadTorrent())); connect(listNews, SIGNAL(itemDoubleClicked(QListWidgetItem *)), this, SLOT(downloadTorrent()));
refreshTimeTimer = new QTimer(this); refreshTimeTimer = new QTimer(this);
connect(refreshTimeTimer, SIGNAL(timeout()), this, SLOT(updateLastRefreshedTimeForStreams())); connect(refreshTimeTimer, SIGNAL(timeout()), this, SLOT(updateLastRefreshedTimeForStreams()));
@ -427,7 +423,6 @@ void RSSImp::selectFirstFeed(){
void RSSImp::selectFirstNews(){ void RSSImp::selectFirstNews(){
if(listNews->count()){ if(listNews->count()){
listNews->setCurrentRow(0); listNews->setCurrentRow(0);
refreshTextBrowser(listNews->currentItem());
} }
} }

Loading…
Cancel
Save