- FEATURE: Added 'Mark all as read' function for RSS feeds

This commit is contained in:
Christophe Dumez 2007-09-09 11:31:51 +00:00
parent 563055e891
commit 07dc182053
5 changed files with 119 additions and 38 deletions

2
TODO
View file

@ -61,7 +61,6 @@
- valgrind --tool=memcheck --leak-check=full src/qbittorrent (Looks ok)
- 128m 29m 16m S 4.8 2.9 0:02.28 qbittorrent
* beta 7
- Add "Mark all as read" feature for RSS
- update doc for plugins (and add screenies)
- update doc for options
- Review torrent content selection
@ -104,6 +103,7 @@ beta6->beta7 changelog:
- FEATURE: Added an option to set the max number of uploads per torrent
- FEATURE: Added an option to automatically delete torrents when they reach a given ratio (>= 1.0)
- FEATURE: Added an option to display current transfer speeds in title bar
- FEATURE: Added "Mark all as read" function for RSS feeds
- BUGFIX: In torrent content, it is now easier to filter all torrents using right click menu
- BUGFIX: Updated man page / README / INSTALL
- BUGFIX: Paused torrents could be displayed as connected for a sec after checking

View file

@ -242,6 +242,14 @@ class RssStream : public QObject{
return listItem.size();
}
void markAllAsRead() {
RssItem *item;
foreach(item, listItem){
if(!item->isRead())
item->setRead();
}
}
unsigned int getNbUnRead() const{
unsigned int nbUnread=0;
RssItem *item;

View file

@ -13,28 +13,55 @@
<string>Search</string>
</property>
<layout class="QVBoxLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<property name="leftMargin" >
<number>9</number>
</property>
<property name="topMargin" >
<number>9</number>
</property>
<property name="rightMargin" >
<number>9</number>
</property>
<property name="bottomMargin" >
<number>9</number>
</property>
<item>
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<property name="leftMargin" >
<number>0</number>
</property>
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property>
<item>
<layout class="QVBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<property name="leftMargin" >
<number>0</number>
</property>
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property>
<item>
<widget class="QTreeWidget" name="listStreams" >
<property name="contextMenuPolicy" >
@ -60,12 +87,21 @@
</item>
<item>
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<property name="leftMargin" >
<number>0</number>
</property>
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property>
<item>
<spacer>
<property name="orientation" >
@ -87,18 +123,18 @@
<height>32</height>
</size>
</property>
<property name="iconSize" >
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="toolTip" >
<string>Delete selected streams</string>
</property>
<property name="text" >
<string/>
</property>
<property name="iconSize" >
<size>
<width>32</width>
<height>32</height>
</size>
</property>
</widget>
</item>
<item>
@ -109,18 +145,18 @@
<height>32</height>
</size>
</property>
<property name="iconSize" >
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="toolTip" >
<string>Refresh RSS streams</string>
</property>
<property name="text" >
<string/>
</property>
<property name="iconSize" >
<size>
<width>32</width>
<height>32</height>
</size>
</property>
</widget>
</item>
<item>
@ -131,18 +167,18 @@
<height>32</height>
</size>
</property>
<property name="iconSize" >
<size>
<width>55</width>
<height>32</height>
</size>
</property>
<property name="toolTip" >
<string>Add a new RSS stream</string>
</property>
<property name="text" >
<string/>
</property>
<property name="iconSize" >
<size>
<width>55</width>
<height>32</height>
</size>
</property>
</widget>
</item>
<item>
@ -164,12 +200,21 @@
</item>
<item>
<layout class="QVBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<property name="leftMargin" >
<number>0</number>
</property>
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property>
<item>
<widget class="QLabel" name="news_lbl" >
<property name="font" >
@ -198,12 +243,21 @@
</item>
<item>
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<property name="leftMargin" >
<number>0</number>
</property>
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property>
</layout>
</item>
</layout>
@ -236,6 +290,11 @@
<string>Refresh all streams</string>
</property>
</action>
<action name="actionMark_all_as_read" >
<property name="text" >
<string>Mark all as read</string>
</property>
</action>
</widget>
<resources/>
<connections/>

View file

@ -35,6 +35,7 @@
QTreeWidgetItem* item = listStreams->itemAt(pos);
QList<QTreeWidgetItem*> selectedItems = listStreams->selectedItems();
if(item != 0) {
myFinishedListMenu.addAction(actionMark_all_as_read);
myFinishedListMenu.addAction(actionDelete);
if(selectedItems.size() == 1)
myFinishedListMenu.addAction(actionRename);
@ -118,13 +119,24 @@
}
}
void RSSImp::on_actionMark_all_as_read_triggered() {
QList<QTreeWidgetItem*> selectedItems = listStreams->selectedItems();
QTreeWidgetItem* item;
foreach(item, selectedItems){
QString url = item->text(1);
RssStream *feed = rssmanager->getFeed(url);
feed->markAllAsRead();
item->setData(0, Qt::DisplayRole, stream->getAliasOrUrl()+ QString::fromUtf8(" (0)"));
}
}
//right-click somewhere, refresh all the streams
void RSSImp::refreshAllStreams() {
textBrowser->clear();
listNews->clear();
unsigned int nbFeeds = listStreams->topLevelItemCount();
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")));
rssmanager->refreshAll();
updateLastRefreshedTimeForStreams();
}
@ -253,6 +265,7 @@
addStream_button->setIcon(QIcon(QString::fromUtf8(":/Icons/subscribe.png")));
delStream_button->setIcon(QIcon(QString::fromUtf8(":/Icons/unsubscribe.png")));
refreshAll_button->setIcon(QIcon(QString::fromUtf8(":/Icons/refresh.png")));
actionMark_all_as_read->setIcon(QIcon(QString::fromUtf8(":/Icons/button_ok.png")));
// icons of right-click menu
actionDelete->setIcon(QIcon(QString::fromUtf8(":/Icons/unsubscribe16.png")));
actionRename->setIcon(QIcon(QString::fromUtf8(":/Icons/log.png")));

View file

@ -57,6 +57,7 @@ class RSSImp : public QWidget, public Ui::RSS{
void selectFirstFeed();
void selectFirstNews();
void updateFeedNbNews(QString url);
void on_actionMark_all_as_read_triggered();
public:
RSSImp();