Browse Source

- Updated number of unread news of RSS folders after a feed is moved from one folder to another

adaptive-webui-19844
Christophe Dumez 15 years ago
parent
commit
f2d2e70967
  1. 3
      Changelog
  2. 20
      src/feedList.h
  3. 13
      src/rss_imp.cpp
  4. 2
      src/rss_imp.h

3
Changelog

@ -5,7 +5,8 @@ @@ -5,7 +5,8 @@
- FEATURE: Save old RSS item to hard disk to remember them on start up
- FEATURE: Display free disk space in torrent addition dialog
- FEATURE: In torrent addition from URL, paste clipboard content if it contains an URL
- FEATURE: RSS Feeds URLs can now be copied to clipboard
- FEATURE: RSS feeds URLs can now be copied to clipboard
- FEATURE: RSS feeds can now be grouped into folders
- FEATURE: If a torrent contains a torrent file, process downloaded torrent file too
- BUGFIX: torrent resume code rewrited
- COSMETIC: Redesigned RSS tab to improve usability

20
src/feedList.h

@ -10,7 +10,8 @@ @@ -10,7 +10,8 @@
#include <QUrl>
#include "rss.h"
class FeedList : public QTreeWidget {
class FeedList: public QTreeWidget {
Q_OBJECT
private:
RssManager *rssmanager;
@ -73,6 +74,9 @@ public: @@ -73,6 +74,9 @@ public:
return current_feed;
}
signals:
void foldersAltered(QList<QTreeWidgetItem*> folders);
protected slots:
void updateCurrentFeed(QTreeWidgetItem* new_item) {
if(getItemType(new_item) == RssFile::STREAM)
@ -91,20 +95,30 @@ protected: @@ -91,20 +95,30 @@ protected:
void dropEvent(QDropEvent *event) {
qDebug("dropEvent");
QList<QTreeWidgetItem*> folders_altered;
QTreeWidgetItem *dest_folder_item = itemAt(event->pos());
RssFolder *dest_folder;
if(dest_folder_item)
if(dest_folder_item) {
dest_folder = (RssFolder*)getRSSItem(dest_folder_item);
else
folders_altered << dest_folder_item;
} else {
dest_folder = rssmanager;
}
QList<QTreeWidgetItem *> src_items = selectedItems();
foreach(QTreeWidgetItem *src_item, src_items) {
QTreeWidgetItem *parent_folder = src_item->parent();
if(parent_folder && !folders_altered.contains(parent_folder))
folders_altered << parent_folder;
// Actually move the file
RssFile *file = getRSSItem(src_item);
rssmanager->moveFile(file, dest_folder);
}
QTreeWidget::dropEvent(event);
if(dest_folder_item)
dest_folder_item->setExpanded(true);
// Emit signal for update
if(!folders_altered.empty())
emit foldersAltered(folders_altered);
}
};

13
src/rss_imp.cpp

@ -396,6 +396,17 @@ void RSSImp::restoreSlidersPosition() { @@ -396,6 +396,17 @@ void RSSImp::restoreSlidersPosition() {
}
}
void RSSImp::updateItemsInfos(QList<QTreeWidgetItem *> items) {
foreach(QTreeWidgetItem* item, items) {
updateItemInfos(item);
}
}
void RSSImp::updateItemInfos(QTreeWidgetItem *item) {
RssFile *rss_item = listStreams->getRSSItem(item);
item->setText(0, rss_item->getName() + QString::fromUtf8(" (") + QString::number(rss_item->getNbUnRead(), 10)+ QString(")"));
}
void RSSImp::updateFeedIcon(QString url, QString icon_path){
QTreeWidgetItem *item = listStreams->getTreeItemFromUrl(url);
item->setData(0,Qt::DecorationRole, QVariant(QIcon(icon_path)));
@ -447,6 +458,8 @@ RSSImp::RSSImp(bittorrent *BTSession) : QWidget(), BTSession(BTSession){ @@ -447,6 +458,8 @@ RSSImp::RSSImp(bittorrent *BTSession) : QWidget(), BTSession(BTSession){
connect(actionDownload_torrent, SIGNAL(triggered()), this, SLOT(downloadTorrent()));
connect(listStreams, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), this, SLOT(refreshNewsList(QTreeWidgetItem*)));
connect(listStreams, SIGNAL(foldersAltered(QList<QTreeWidgetItem*>)), this, SLOT(updateItemsInfos(QList<QTreeWidgetItem*>)));
connect(listNews, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(refreshTextBrowser(QListWidgetItem *)));
connect(listNews, SIGNAL(itemDoubleClicked(QListWidgetItem *)), this, SLOT(downloadTorrent()));

2
src/rss_imp.h

@ -63,6 +63,8 @@ protected slots: @@ -63,6 +63,8 @@ protected slots:
void refreshTextBrowser(QListWidgetItem *);
void updateFeedIcon(QString url, QString icon_path);
void updateFeedInfos(QString url, QString aliasOrUrl, unsigned int nbUnread);
void updateItemsInfos(QList<QTreeWidgetItem*> items);
void updateItemInfos(QTreeWidgetItem *item);
void openNewsUrl();
void downloadTorrent();
void fillFeedsList(QTreeWidgetItem *parent=0, RssFolder *rss_parent=0);

Loading…
Cancel
Save