Browse Source

- UpdateSelectedItems() now sets loading.png icon for all feeds included in selected folders

adaptive-webui-19844
Christophe Dumez 15 years ago
parent
commit
46c6c4fc9a
  1. 14
      src/feedList.h
  2. 20
      src/rss_imp.cpp
  3. 2
      src/rss_imp.h

14
src/feedList.h

@ -50,6 +50,20 @@ public: @@ -50,6 +50,20 @@ public:
return feeds_items.values();
}
QList<QTreeWidgetItem*> getAllFeedItems(QTreeWidgetItem* folder) {
QList<QTreeWidgetItem*> feeds;
int nbChildren = folder->childCount();
for(int i=0; i<nbChildren; ++i) {
QTreeWidgetItem *item = folder->child(i);
if(getItemType(item) == RssFile::STREAM) {
feeds << item;
} else {
feeds.append(getAllFeedItems(item));
}
}
return feeds;
}
RssFile* getRSSItem(QTreeWidgetItem *item) {
return mapping[item];
}

20
src/rss_imp.cpp

@ -252,15 +252,21 @@ void RSSImp::renameFiles() { @@ -252,15 +252,21 @@ void RSSImp::renameFiles() {
}
//right-click on stream : refresh it
void RSSImp::refreshSelectedStreams() {
void RSSImp::refreshSelectedItems() {
QList<QTreeWidgetItem*> selectedItems = listStreams->selectedItems();
QTreeWidgetItem* item;
foreach(item, selectedItems){
foreach(QTreeWidgetItem* item, selectedItems){
RssFile* file = listStreams->getRSSItem(item);
file->refresh();
// FIXME: Should recursively set icons for feeds in a folder
if(file->getType() == RssFile::STREAM)
// Update icons
if(file->getType() == RssFile::STREAM) {
item->setData(0,Qt::DecorationRole, QVariant(QIcon(":/Icons/loading.png")));
} else {
// Update feeds in the folder
foreach(QTreeWidgetItem *feed, listStreams->getAllFeedItems(item)) {
feed->setData(0,Qt::DecorationRole, QVariant(QIcon(":/Icons/loading.png")));
}
}
// Actually refresh
file->refresh();
}
}
@ -452,7 +458,7 @@ RSSImp::RSSImp(bittorrent *BTSession) : QWidget(), BTSession(BTSession){ @@ -452,7 +458,7 @@ RSSImp::RSSImp(bittorrent *BTSession) : QWidget(), BTSession(BTSession){
// Feeds list actions
connect(actionDelete, SIGNAL(triggered()), this, SLOT(deleteSelectedItems()));
connect(actionRename, SIGNAL(triggered()), this, SLOT(renameFiles()));
connect(actionUpdate, SIGNAL(triggered()), this, SLOT(refreshSelectedStreams()));
connect(actionUpdate, SIGNAL(triggered()), this, SLOT(refreshSelectedItems()));
connect(actionNew_folder, SIGNAL(triggered()), this, SLOT(askNewFolder()));
connect(actionNew_subscription, SIGNAL(triggered()), this, SLOT(on_newFeedButton_clicked()));
connect(actionUpdate_all_feeds, SIGNAL(triggered()), this, SLOT(on_updateAllButton_clicked()));

2
src/rss_imp.h

@ -57,7 +57,7 @@ protected slots: @@ -57,7 +57,7 @@ protected slots:
void displayRSSListMenu(const QPoint&);
void displayItemsListMenu(const QPoint&);
void renameFiles();
void refreshSelectedStreams();
void refreshSelectedItems();
void copySelectedFeedsURL();
void refreshNewsList(QTreeWidgetItem* item);
void refreshTextBrowser(QListWidgetItem *);

Loading…
Cancel
Save