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. 18
      src/feedList.h
  3. 13
      src/rss_imp.cpp
  4. 2
      src/rss_imp.h

3
Changelog

@ -5,7 +5,8 @@
- FEATURE: Save old RSS item to hard disk to remember them on start up - FEATURE: Save old RSS item to hard disk to remember them on start up
- FEATURE: Display free disk space in torrent addition dialog - FEATURE: Display free disk space in torrent addition dialog
- FEATURE: In torrent addition from URL, paste clipboard content if it contains an URL - 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 - FEATURE: If a torrent contains a torrent file, process downloaded torrent file too
- BUGFIX: torrent resume code rewrited - BUGFIX: torrent resume code rewrited
- COSMETIC: Redesigned RSS tab to improve usability - COSMETIC: Redesigned RSS tab to improve usability

18
src/feedList.h

@ -11,6 +11,7 @@
#include "rss.h" #include "rss.h"
class FeedList: public QTreeWidget { class FeedList: public QTreeWidget {
Q_OBJECT
private: private:
RssManager *rssmanager; RssManager *rssmanager;
@ -73,6 +74,9 @@ public:
return current_feed; return current_feed;
} }
signals:
void foldersAltered(QList<QTreeWidgetItem*> folders);
protected slots: protected slots:
void updateCurrentFeed(QTreeWidgetItem* new_item) { void updateCurrentFeed(QTreeWidgetItem* new_item) {
if(getItemType(new_item) == RssFile::STREAM) if(getItemType(new_item) == RssFile::STREAM)
@ -91,20 +95,30 @@ protected:
void dropEvent(QDropEvent *event) { void dropEvent(QDropEvent *event) {
qDebug("dropEvent"); qDebug("dropEvent");
QList<QTreeWidgetItem*> folders_altered;
QTreeWidgetItem *dest_folder_item = itemAt(event->pos()); QTreeWidgetItem *dest_folder_item = itemAt(event->pos());
RssFolder *dest_folder; RssFolder *dest_folder;
if(dest_folder_item) if(dest_folder_item) {
dest_folder = (RssFolder*)getRSSItem(dest_folder_item); dest_folder = (RssFolder*)getRSSItem(dest_folder_item);
else folders_altered << dest_folder_item;
} else {
dest_folder = rssmanager; dest_folder = rssmanager;
}
QList<QTreeWidgetItem *> src_items = selectedItems(); QList<QTreeWidgetItem *> src_items = selectedItems();
foreach(QTreeWidgetItem *src_item, src_items) { 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); RssFile *file = getRSSItem(src_item);
rssmanager->moveFile(file, dest_folder); rssmanager->moveFile(file, dest_folder);
} }
QTreeWidget::dropEvent(event); QTreeWidget::dropEvent(event);
if(dest_folder_item) if(dest_folder_item)
dest_folder_item->setExpanded(true); 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() {
} }
} }
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){ void RSSImp::updateFeedIcon(QString url, QString icon_path){
QTreeWidgetItem *item = listStreams->getTreeItemFromUrl(url); QTreeWidgetItem *item = listStreams->getTreeItemFromUrl(url);
item->setData(0,Qt::DecorationRole, QVariant(QIcon(icon_path))); item->setData(0,Qt::DecorationRole, QVariant(QIcon(icon_path)));
@ -447,6 +458,8 @@ 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(listStreams, SIGNAL(foldersAltered(QList<QTreeWidgetItem*>)), this, SLOT(updateItemsInfos(QList<QTreeWidgetItem*>)));
connect(listNews, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(refreshTextBrowser(QListWidgetItem *))); connect(listNews, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(refreshTextBrowser(QListWidgetItem *)));
connect(listNews, SIGNAL(itemDoubleClicked(QListWidgetItem *)), this, SLOT(downloadTorrent())); connect(listNews, SIGNAL(itemDoubleClicked(QListWidgetItem *)), this, SLOT(downloadTorrent()));

2
src/rss_imp.h

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

Loading…
Cancel
Save