@ -63,22 +63,22 @@ enum ArticleRoles {
@@ -63,22 +63,22 @@ enum ArticleRoles {
// display a right-click menu
void RSSImp : : displayRSSListMenu ( const QPoint & pos ) {
if ( ! listStreams - > indexAt ( pos ) . isValid ( ) ) {
if ( ! m_feedList - > indexAt ( pos ) . isValid ( ) ) {
// No item under the mouse, clear selection
listStreams - > clearSelection ( ) ;
m_feedList - > clearSelection ( ) ;
}
QMenu myRSSListMenu ( this ) ;
QList < QTreeWidgetItem * > selectedItems = listStreams - > selectedItems ( ) ;
QList < QTreeWidgetItem * > selectedItems = m_feedList - > selectedItems ( ) ;
if ( selectedItems . size ( ) > 0 ) {
myRSSListMenu . addAction ( actionUpdate ) ;
myRSSListMenu . addAction ( actionMark_items_read ) ;
myRSSListMenu . addSeparator ( ) ;
if ( selectedItems . size ( ) = = 1 ) {
if ( listStreams - > getRSSItem ( selectedItems . first ( ) ) ! = rssm anager) {
if ( m_feedList - > getRSSItem ( selectedItems . first ( ) ) ! = m_rssM anager) {
myRSSListMenu . addAction ( actionRename ) ;
myRSSListMenu . addAction ( actionDelete ) ;
myRSSListMenu . addSeparator ( ) ;
if ( listStreams - > getItemType ( selectedItems . first ( ) ) = = RssFile : : FOLDER ) {
if ( m_feedList - > getItemType ( selectedItems . first ( ) ) = = I RssFile: : FOLDER ) {
myRSSListMenu . addAction ( actionNew_folder ) ;
} else {
myRSSListMenu . addAction ( actionManage_cookies ) ;
@ -86,7 +86,7 @@ void RSSImp::displayRSSListMenu(const QPoint& pos){
@@ -86,7 +86,7 @@ void RSSImp::displayRSSListMenu(const QPoint& pos){
}
}
myRSSListMenu . addAction ( actionNew_subscription ) ;
if ( listStreams - > getItemType ( selectedItems . first ( ) ) = = RssFile : : FEED ) {
if ( m_feedList - > getItemType ( selectedItems . first ( ) ) = = I RssFile: : FEED ) {
myRSSListMenu . addSeparator ( ) ;
myRSSListMenu . addAction ( actionCopy_feed_URL ) ;
}
@ -107,7 +107,7 @@ void RSSImp::displayItemsListMenu(const QPoint&){
@@ -107,7 +107,7 @@ void RSSImp::displayItemsListMenu(const QPoint&){
foreach ( const QListWidgetItem * item , selectedItems ) {
qDebug ( " text(3) URL: %s " , qPrintable ( item - > data ( Article : : FeedUrlRole ) . toString ( ) ) ) ;
qDebug ( " text(2) TITLE: %s " , qPrintable ( item - > data ( Article : : TitleRole ) . toString ( ) ) ) ;
if ( listStreams - > getRSSItemFromUrl ( item - > data ( Article : : FeedUrlRole ) . toString ( ) )
if ( m_feedList - > getRSSItemFromUrl ( item - > data ( Article : : FeedUrlRole ) . toString ( ) )
- > getItem ( item - > data ( Article : : IdRole ) . toString ( ) ) . hasAttachment ( ) ) {
has_attachment = true ;
break ;
@ -121,9 +121,9 @@ void RSSImp::displayItemsListMenu(const QPoint&){
@@ -121,9 +121,9 @@ void RSSImp::displayItemsListMenu(const QPoint&){
}
void RSSImp : : on_actionManage_cookies_triggered ( ) {
Q_ASSERT ( ! listStreams - > selectedItems ( ) . empty ( ) ) ;
Q_ASSERT ( ! m_feedList - > selectedItems ( ) . empty ( ) ) ;
// Get feed hostname
QString feed_url = listStreams - > getItemID ( listStreams - > selectedItems ( ) . first ( ) ) ;
QString feed_url = m_feedList - > getItemID ( m_feedList - > selectedItems ( ) . first ( ) ) ;
QString feed_hostname = QUrl : : fromEncoded ( feed_url . toLocal8Bit ( ) ) . host ( ) ;
qDebug ( " RSS Feed hostname is: %s " , qPrintable ( feed_hostname ) ) ;
Q_ASSERT ( ! feed_hostname . isEmpty ( ) ) ;
@ -138,12 +138,12 @@ void RSSImp::on_actionManage_cookies_triggered() {
@@ -138,12 +138,12 @@ void RSSImp::on_actionManage_cookies_triggered() {
void RSSImp : : askNewFolder ( ) {
QTreeWidgetItem * parent_item = 0 ;
RssFolder * rss_parent ;
if ( listStreams - > selectedItems ( ) . size ( ) > 0 ) {
parent_item = listStreams - > selectedItems ( ) . at ( 0 ) ;
rss_parent = ( RssFolder * ) listStreams - > getRSSItem ( parent_item ) ;
Q_ASSERT ( rss_parent - > type ( ) = = RssFile : : FOLDER ) ;
if ( m_feedList - > selectedItems ( ) . size ( ) > 0 ) {
parent_item = m_feedList - > selectedItems ( ) . at ( 0 ) ;
rss_parent = dynamic_cast < RssFolder * > ( m_feedList - > getRSSItem ( parent_item ) ) ;
Q_ASSERT ( rss_parent - > type ( ) = = I RssFile: : FOLDER ) ;
} else {
rss_parent = rssm anager;
rss_parent = m_rssM anager;
}
bool ok ;
QString new_name = QInputDialog : : getText ( this , tr ( " Please choose a folder name " ) , tr ( " Folder name: " ) , QLineEdit : : Normal , tr ( " New folder " ) , & ok ) ;
@ -153,20 +153,20 @@ void RSSImp::askNewFolder() {
@@ -153,20 +153,20 @@ void RSSImp::askNewFolder() {
if ( parent_item )
folder_item = new QTreeWidgetItem ( parent_item ) ;
else
folder_item = new QTreeWidgetItem ( listStreams ) ;
folder_item = new QTreeWidgetItem ( m_feedList ) ;
// Notify TreeWidget
listStreams - > itemAdded ( folder_item , new_folder ) ;
m_feedList - > itemAdded ( folder_item , new_folder ) ;
// Set Text
folder_item - > setText ( 0 , new_folder - > displayName ( ) + QString : : fromUtf8 ( " (0) " ) ) ;
folder_item - > setData ( 0 , Qt : : DecorationRole , QVariant ( IconProvider : : instance ( ) - > getIcon ( " inode-directory " ) ) ) ;
// Expand parent folder to display new folder
if ( parent_item )
parent_item - > setExpanded ( true ) ;
rssm anager- > saveStreamList ( ) ;
m_rssM anager- > saveStreamList ( ) ;
}
}
void RSSImp : : displayOverwriteError ( QString filename ) {
void RSSImp : : displayOverwriteError ( const QString & filename ) {
QMessageBox : : warning ( this , tr ( " Overwrite attempt " ) ,
tr ( " You cannot overwrite %1 item. " , " You cannot overwrite myFolder item. " ) . arg ( filename ) ,
QMessageBox : : Ok ) ;
@ -176,22 +176,22 @@ void RSSImp::displayOverwriteError(QString filename) {
@@ -176,22 +176,22 @@ void RSSImp::displayOverwriteError(QString filename) {
void RSSImp : : on_newFeedButton_clicked ( ) {
// Determine parent folder for new feed
QTreeWidgetItem * parent_item = 0 ;
QList < QTreeWidgetItem * > selected_items = listStreams - > selectedItems ( ) ;
QList < QTreeWidgetItem * > selected_items = m_feedList - > selectedItems ( ) ;
if ( ! selected_items . empty ( ) ) {
parent_item = selected_items . first ( ) ;
// Consider the case where the user clicked on Unread item
if ( parent_item = = listStreams - > get UnreadItem( ) ) {
if ( parent_item = = m_feedList - > sticky UnreadItem( ) ) {
parent_item = 0 ;
} else {
if ( listStreams - > getItemType ( parent_item ) ! = RssFile : : FOLDER )
if ( m_feedList - > getItemType ( parent_item ) ! = I RssFile: : FOLDER )
parent_item = parent_item - > parent ( ) ;
}
}
RssFolder * rss_parent ;
if ( parent_item ) {
rss_parent = ( RssFolder * ) listStreams - > getRSSItem ( parent_item ) ;
rss_parent = ( RssFolder * ) m_feedList - > getRSSItem ( parent_item ) ;
} else {
rss_parent = rssm anager;
rss_parent = m_rssM anager;
}
// Ask for feed URL
bool ok ;
@ -204,7 +204,7 @@ void RSSImp::on_newFeedButton_clicked() {
@@ -204,7 +204,7 @@ void RSSImp::on_newFeedButton_clicked() {
if ( ok ) {
newUrl = newUrl . trimmed ( ) ;
if ( ! newUrl . isEmpty ( ) ) {
if ( listStreams - > hasFeed ( newUrl ) ) {
if ( m_feedList - > hasFeed ( newUrl ) ) {
QMessageBox : : warning ( this , tr ( " qBittorrent " ) ,
tr ( " This rss feed is already in the list. " ) ,
QMessageBox : : Ok ) ;
@ -216,21 +216,21 @@ void RSSImp::on_newFeedButton_clicked() {
@@ -216,21 +216,21 @@ void RSSImp::on_newFeedButton_clicked() {
if ( parent_item )
item = new QTreeWidgetItem ( parent_item ) ;
else
item = new QTreeWidgetItem ( listStreams ) ;
item = new QTreeWidgetItem ( m_feedList ) ;
// Notify TreeWidget
listStreams - > itemAdded ( item , stream ) ;
m_feedList - > itemAdded ( item , stream ) ;
// Set text
item - > setText ( 0 , stream - > displayName ( ) + QString : : fromUtf8 ( " (0) " ) ) ;
item - > setData ( 0 , Qt : : DecorationRole , QVariant ( QIcon ( " :/Icons/loading.png " ) ) ) ;
stream - > refresh ( ) ;
rssm anager- > saveStreamList ( ) ;
m_rssM anager- > saveStreamList ( ) ;
}
}
}
// delete a stream by a button
void RSSImp : : deleteSelectedItems ( ) {
QList < QTreeWidgetItem * > selectedItems = listStreams - > selectedItems ( ) ;
QList < QTreeWidgetItem * > selectedItems = m_feedList - > selectedItems ( ) ;
if ( selectedItems . size ( ) = = 0 ) return ;
int ret ;
if ( selectedItems . size ( ) > 1 )
@ -243,21 +243,21 @@ void RSSImp::deleteSelectedItems() {
@@ -243,21 +243,21 @@ void RSSImp::deleteSelectedItems() {
QString ( ) , 0 , 1 ) ;
if ( ! ret ) {
foreach ( QTreeWidgetItem * item , selectedItems ) {
if ( listStreams - > currentFeed ( ) = = item ) {
if ( m_feedList - > currentFeed ( ) = = item ) {
textBrowser - > clear ( ) ;
m_currentArticle = 0 ;
listArticles - > clear ( ) ;
}
RssFile * rss_item = listStreams - > getRSSItem ( item ) ;
I RssFile * rss_item = m_feedList - > getRSSItem ( item ) ;
// Notify TreeWidget
listStreams - > itemAboutToBeRemoved ( item ) ;
m_feedList - > itemAboutToBeRemoved ( item ) ;
// Actually delete the item
rss_item - > parent ( ) - > removeChild ( rss_item - > id ( ) ) ;
delete item ;
}
rssm anager- > saveStreamList ( ) ;
m_rssM anager- > saveStreamList ( ) ;
// Update Unread items
updateItemInfos ( listStreams - > get UnreadItem( ) ) ;
updateItemInfos ( m_feedList - > sticky UnreadItem( ) ) ;
}
}
@ -274,14 +274,14 @@ void RSSImp::loadFoldersOpenState() {
@@ -274,14 +274,14 @@ void RSSImp::loadFoldersOpenState() {
if ( parent )
nbChildren = parent - > childCount ( ) ;
else
nbChildren = listStreams - > topLevelItemCount ( ) ;
nbChildren = m_feedList - > topLevelItemCount ( ) ;
for ( int i = 0 ; i < nbChildren ; + + i ) {
QTreeWidgetItem * child ;
if ( parent )
child = parent - > child ( i ) ;
else
child = listStreams - > topLevelItem ( i ) ;
if ( listStreams - > getRSSItem ( child ) - > id ( ) = = name ) {
child = m_feedList - > topLevelItem ( i ) ;
if ( m_feedList - > getRSSItem ( child ) - > id ( ) = = name ) {
parent = child ;
parent - > setExpanded ( true ) ;
qDebug ( " expanding folder %s " , qPrintable ( name ) ) ;
@ -294,9 +294,9 @@ void RSSImp::loadFoldersOpenState() {
@@ -294,9 +294,9 @@ void RSSImp::loadFoldersOpenState() {
void RSSImp : : saveFoldersOpenState ( ) {
QStringList open_folders ;
QList < QTreeWidgetItem * > items = listStreams - > getAllOpenFolders ( ) ;
QList < QTreeWidgetItem * > items = m_feedList - > getAllOpenFolders ( ) ;
foreach ( QTreeWidgetItem * item , items ) {
QString path = listStreams - > getItemPath ( item ) . join ( " \\ " ) ;
QString path = m_feedList - > getItemPath ( item ) . join ( " \\ " ) ;
qDebug ( " saving open folder: %s " , qPrintable ( path ) ) ;
open_folders < < path ;
}
@ -308,16 +308,16 @@ void RSSImp::saveFoldersOpenState() {
@@ -308,16 +308,16 @@ void RSSImp::saveFoldersOpenState() {
// refresh all streams by a button
void RSSImp : : on_updateAllButton_clicked ( ) {
foreach ( QTreeWidgetItem * item , listStreams - > getAllFeedItems ( ) ) {
foreach ( QTreeWidgetItem * item , m_feedList - > getAllFeedItems ( ) ) {
item - > setData ( 0 , Qt : : DecorationRole , QVariant ( QIcon ( " :/Icons/loading.png " ) ) ) ;
}
rssm anager- > refresh ( ) ;
m_rssM anager- > refresh ( ) ;
}
void RSSImp : : downloadTorrent ( ) {
QList < QListWidgetItem * > selected_items = listArticles - > selectedItems ( ) ;
foreach ( const QListWidgetItem * item , selected_items ) {
const RssArticle article = listStreams - > getRSSItemFromUrl ( item - > data ( Article : : FeedUrlRole ) . toString ( ) )
const RssArticle article = m_feedList - > getRSSItemFromUrl ( item - > data ( Article : : FeedUrlRole ) . toString ( ) )
- > getItem ( item - > data ( Article : : IdRole ) . toString ( ) ) ;
if ( article . hasAttachment ( ) ) {
QBtSession : : instance ( ) - > downloadFromUrl ( article . torrentUrl ( ) ) ;
@ -331,7 +331,7 @@ void RSSImp::downloadTorrent() {
@@ -331,7 +331,7 @@ void RSSImp::downloadTorrent() {
void RSSImp : : openNewsUrl ( ) {
QList < QListWidgetItem * > selected_items = listArticles - > selectedItems ( ) ;
foreach ( const QListWidgetItem * item , selected_items ) {
const RssArticle news = listStreams - > getRSSItemFromUrl ( item - > data ( Article : : FeedUrlRole ) . toString ( ) )
const RssArticle news = m_feedList - > getRSSItemFromUrl ( item - > data ( Article : : FeedUrlRole ) . toString ( ) )
- > getItem ( item - > data ( Article : : IdRole ) . toString ( ) ) ;
const QString link = news . link ( ) ;
if ( ! link . isEmpty ( ) )
@ -341,14 +341,14 @@ void RSSImp::openNewsUrl() {
@@ -341,14 +341,14 @@ void RSSImp::openNewsUrl() {
//right-click on stream : give it an alias
void RSSImp : : renameFiles ( ) {
QList < QTreeWidgetItem * > selectedItems = listStreams - > selectedItems ( ) ;
QList < QTreeWidgetItem * > selectedItems = m_feedList - > selectedItems ( ) ;
Q_ASSERT ( selectedItems . size ( ) = = 1 ) ;
QTreeWidgetItem * item = selectedItems . at ( 0 ) ;
RssFile * rss_item = listStreams - > getRSSItem ( item ) ;
I RssFile * rss_item = m_feedList - > getRSSItem ( item ) ;
bool ok ;
QString newName ;
do {
newName = QInputDialog : : getText ( this , tr ( " Please choose a new name for this RSS feed " ) , tr ( " New feed name: " ) , QLineEdit : : Normal , listStreams - > getRSSItem ( item ) - > displayName ( ) , & ok ) ;
newName = QInputDialog : : getText ( this , tr ( " Please choose a new name for this RSS feed " ) , tr ( " New feed name: " ) , QLineEdit : : Normal , m_feedList - > getRSSItem ( item ) - > displayName ( ) , & ok ) ;
// Check if name is already taken
if ( ok ) {
if ( rss_item - > parent ( ) - > hasChild ( newName ) ) {
@ -367,22 +367,22 @@ void RSSImp::renameFiles() {
@@ -367,22 +367,22 @@ void RSSImp::renameFiles() {
//right-click on stream : refresh it
void RSSImp : : refreshSelectedItems ( ) {
QList < QTreeWidgetItem * > selectedItems = listStreams - > selectedItems ( ) ;
QList < QTreeWidgetItem * > selectedItems = m_feedList - > selectedItems ( ) ;
foreach ( QTreeWidgetItem * item , selectedItems ) {
RssFile * file = listStreams - > getRSSItem ( item ) ;
I RssFile* file = m_feedList - > getRSSItem ( item ) ;
// Update icons
if ( item = = listStreams - > get UnreadItem( ) ) {
foreach ( QTreeWidgetItem * feed , listStreams - > getAllFeedItems ( ) ) {
if ( item = = m_feedList - > sticky UnreadItem( ) ) {
foreach ( QTreeWidgetItem * feed , m_feedList - > getAllFeedItems ( ) ) {
feed - > setData ( 0 , Qt : : DecorationRole , QVariant ( QIcon ( " :/Icons/loading.png " ) ) ) ;
}
file - > refresh ( ) ;
break ;
} else {
if ( file - > type ( ) = = RssFile : : FEED ) {
if ( file - > type ( ) = = I RssFile: : FEED ) {
item - > setData ( 0 , Qt : : DecorationRole , QVariant ( QIcon ( " :/Icons/loading.png " ) ) ) ;
} else {
// Update feeds in the folder
foreach ( QTreeWidgetItem * feed , listStreams - > getAllFeedItems ( item ) ) {
foreach ( QTreeWidgetItem * feed , m_feedList - > getAllFeedItems ( item ) ) {
feed - > setData ( 0 , Qt : : DecorationRole , QVariant ( QIcon ( " :/Icons/loading.png " ) ) ) ;
}
}
@ -394,45 +394,45 @@ void RSSImp::refreshSelectedItems() {
@@ -394,45 +394,45 @@ void RSSImp::refreshSelectedItems() {
void RSSImp : : copySelectedFeedsURL ( ) {
QStringList URLs ;
QList < QTreeWidgetItem * > selectedItems = listStreams - > selectedItems ( ) ;
QList < QTreeWidgetItem * > selectedItems = m_feedList - > selectedItems ( ) ;
QTreeWidgetItem * item ;
foreach ( item , selectedItems ) {
if ( listStreams - > getItemType ( item ) = = RssFile : : FEED )
URLs < < listStreams - > getItemID ( item ) ;
if ( m_feedList - > getItemType ( item ) = = I RssFile: : FEED )
URLs < < m_feedList - > getItemID ( item ) ;
}
qApp - > clipboard ( ) - > setText ( URLs . join ( " \n " ) ) ;
}
void RSSImp : : on_markReadButton_clicked ( ) {
QList < QTreeWidgetItem * > selectedItems = listStreams - > selectedItems ( ) ;
QList < QTreeWidgetItem * > selectedItems = m_feedList - > selectedItems ( ) ;
QTreeWidgetItem * item ;
foreach ( item , selectedItems ) {
RssFile * rss_item = listStreams - > getRSSItem ( item ) ;
I RssFile * rss_item = m_feedList - > getRSSItem ( item ) ;
rss_item - > markAsRead ( ) ;
updateItemInfos ( item ) ;
}
if ( selectedItems . size ( ) )
refreshNewsList ( listStreams - > currentItem ( ) ) ;
refreshArticleList ( m_feedList - > currentItem ( ) ) ;
}
void RSSImp : : fillFeedsList ( QTreeWidgetItem * parent , RssFolder * rss_parent ) {
QList < RssFile * > children ;
QList < I RssFile* > children ;
if ( parent ) {
children = rss_parent - > getContent ( ) ;
} else {
children = rssm anager- > getContent ( ) ;
children = m_rssM anager- > getContent ( ) ;
}
foreach ( RssFile * rss_child , children ) {
foreach ( I RssFile* rss_child , children ) {
QTreeWidgetItem * item ;
if ( ! parent )
item = new QTreeWidgetItem ( listStreams ) ;
item = new QTreeWidgetItem ( m_feedList ) ;
else
item = new QTreeWidgetItem ( parent ) ;
item - > setData ( 0 , Qt : : DisplayRole , QVariant ( rss_child - > displayName ( ) + QString : : fromUtf8 ( " ( " ) + QString : : number ( rss_child - > unreadCount ( ) , 10 ) + QString ( " ) " ) ) ) ;
// Notify TreeWidget of item addition
listStreams - > itemAdded ( item , rss_child ) ;
m_feedList - > itemAdded ( item , rss_child ) ;
// Set Icon
if ( rss_child - > type ( ) = = RssFile : : FEED ) {
if ( rss_child - > type ( ) = = I RssFile: : FEED ) {
item - > setData ( 0 , Qt : : DecorationRole , QVariant ( QIcon ( QString : : fromUtf8 ( " :/Icons/loading.png " ) ) ) ) ;
} else {
item - > setData ( 0 , Qt : : DecorationRole , QVariant ( IconProvider : : instance ( ) - > getIcon ( " inode-directory " ) ) ) ;
@ -443,18 +443,18 @@ void RSSImp::fillFeedsList(QTreeWidgetItem *parent, RssFolder *rss_parent) {
@@ -443,18 +443,18 @@ void RSSImp::fillFeedsList(QTreeWidgetItem *parent, RssFolder *rss_parent) {
}
// fills the newsList
void RSSImp : : refreshNews List ( QTreeWidgetItem * item ) {
void RSSImp : : refreshArticle List ( QTreeWidgetItem * item ) {
if ( ! item ) {
listArticles - > clear ( ) ;
return ;
}
RssFile * rss_item = listStreams - > getRSSItem ( item ) ;
I RssFile * rss_item = m_feedList - > getRSSItem ( item ) ;
if ( ! rss_item ) return ;
qDebug ( " Getting the list of news " ) ;
QList < RssArticle > news ;
if ( rss_item = = rssm anager)
if ( rss_item = = m_rssM anager)
news = RssManager : : sortNewsList ( rss_item - > unreadArticleList ( ) ) ;
else if ( rss_item )
news = RssManager : : sortNewsList ( rss_item - > articleList ( ) ) ;
@ -489,7 +489,7 @@ void RSSImp::refreshTextBrowser() {
@@ -489,7 +489,7 @@ void RSSImp::refreshTextBrowser() {
Q_ASSERT ( item ) ;
if ( item = = m_currentArticle ) return ;
// Stop displaying previous news if necessary
if ( listStreams - > currentFeed ( ) = = listStreams - > get UnreadItem( ) ) {
if ( m_feedList - > currentFeed ( ) = = m_feedList - > sticky UnreadItem( ) ) {
if ( m_currentArticle ) {
disconnect ( listArticles , SIGNAL ( itemSelectionChanged ( ) ) , this , SLOT ( refreshTextBrowser ( ) ) ) ;
listArticles - > removeItemWidget ( m_currentArticle ) ;
@ -499,7 +499,7 @@ void RSSImp::refreshTextBrowser() {
@@ -499,7 +499,7 @@ void RSSImp::refreshTextBrowser() {
}
m_currentArticle = item ;
}
RssFeed * stream = listStreams - > getRSSItemFromUrl ( item - > data ( Article : : FeedUrlRole ) . toString ( ) ) ;
RssFeed * stream = m_feedList - > getRSSItemFromUrl ( item - > data ( Article : : FeedUrlRole ) . toString ( ) ) ;
RssArticle article = stream - > getItem ( item - > data ( Article : : IdRole ) . toString ( ) ) ;
QString html ;
html + = " <div style='border: 2px solid red; margin-left: 5px; margin-right: 5px; margin-bottom: 5px;'> " ;
@ -517,8 +517,8 @@ void RSSImp::refreshTextBrowser() {
@@ -517,8 +517,8 @@ void RSSImp::refreshTextBrowser() {
item - > setData ( Article : : ColorRole , QVariant ( QColor ( " grey " ) ) ) ;
item - > setData ( Article : : IconRole , QVariant ( QIcon ( " :/Icons/sphere.png " ) ) ) ;
// Decrement feed nb unread news
updateItemInfos ( listStreams - > get UnreadItem( ) ) ;
updateItemInfos ( listStreams - > getTreeItemFromUrl ( item - > data ( Article : : FeedUrlRole ) . toString ( ) ) ) ;
updateItemInfos ( m_feedList - > sticky UnreadItem( ) ) ;
updateItemInfos ( m_feedList - > getTreeItemFromUrl ( item - > data ( Article : : FeedUrlRole ) . toString ( ) ) ) ;
}
void RSSImp : : saveSlidersPosition ( ) {
@ -541,16 +541,16 @@ void RSSImp::restoreSlidersPosition() {
@@ -541,16 +541,16 @@ void RSSImp::restoreSlidersPosition() {
}
}
void RSSImp : : updateItemsInfos ( QList < QTreeWidgetItem * > items ) {
void RSSImp : : updateItemsInfos ( const QList < QTreeWidgetItem * > & items ) {
foreach ( QTreeWidgetItem * item , items ) {
updateItemInfos ( item ) ;
}
}
void RSSImp : : updateItemInfos ( QTreeWidgetItem * item ) {
RssFile * rss_item = listStreams - > getRSSItem ( item ) ;
I RssFile * rss_item = m_feedList - > getRSSItem ( item ) ;
QString name ;
if ( rss_item = = rssm anager)
if ( rss_item = = m_rssM anager)
name = tr ( " Unread " ) ;
else
name = rss_item - > displayName ( ) ;
@ -560,15 +560,15 @@ void RSSImp::updateItemInfos(QTreeWidgetItem *item) {
@@ -560,15 +560,15 @@ void RSSImp::updateItemInfos(QTreeWidgetItem *item) {
updateItemInfos ( item - > parent ( ) ) ;
}
void RSSImp : : updateFeedIcon ( QString url , QString icon_path ) {
QTreeWidgetItem * item = listStreams - > getTreeItemFromUrl ( url ) ;
void RSSImp : : updateFeedIcon ( const QString & url , const QString & icon_path ) {
QTreeWidgetItem * item = m_feedList - > getTreeItemFromUrl ( url ) ;
item - > setData ( 0 , Qt : : DecorationRole , QVariant ( QIcon ( icon_path ) ) ) ;
}
void RSSImp : : updateFeedInfos ( QString url , QString display_name , unsigned int nbUnread ) {
void RSSImp : : updateFeedInfos ( const QString & url , const QString & display_name , u int nbUnread ) {
qDebug ( ) < < Q_FUNC_INFO < < display_name ;
QTreeWidgetItem * item = listStreams - > getTreeItemFromUrl ( url ) ;
RssFeed * stream = ( RssFeed * ) listStreams - > getRSSItem ( item ) ;
QTreeWidgetItem * item = m_feedList - > getTreeItemFromUrl ( url ) ;
RssFeed * stream = ( RssFeed * ) m_feedList - > getRSSItem ( item ) ;
item - > setText ( 0 , display_name + QString : : fromUtf8 ( " ( " ) + QString : : number ( nbUnread , 10 ) + QString ( " ) " ) ) ;
if ( ! stream - > isLoading ( ) )
item - > setData ( 0 , Qt : : DecorationRole , QVariant ( QIcon ( stream - > icon ( ) ) ) ) ;
@ -576,20 +576,20 @@ void RSSImp::updateFeedInfos(QString url, QString display_name, unsigned int nbU
@@ -576,20 +576,20 @@ void RSSImp::updateFeedInfos(QString url, QString display_name, unsigned int nbU
if ( item - > parent ( ) )
updateItemInfos ( item - > parent ( ) ) ;
// Update Unread item
updateItemInfos ( listStreams - > get UnreadItem( ) ) ;
updateItemInfos ( m_feedList - > sticky UnreadItem( ) ) ;
// If the feed is selected, update the displayed news
if ( listStreams - > currentItem ( ) = = item ) {
refreshNews List ( item ) ;
if ( m_feedList - > currentItem ( ) = = item ) {
refreshArticle List ( item ) ;
} else {
// Update unread items
if ( listStreams - > currentItem ( ) = = listStreams - > get UnreadItem( ) ) {
refreshNewsList ( listStreams - > get UnreadItem ( ) ) ;
if ( m_feedList - > currentItem ( ) = = m_feedList - > sticky UnreadItem( ) ) {
refreshArticleList ( m_feedList - > sticky UnreadItem ( ) ) ;
}
}
}
void RSSImp : : updateRefreshInterval ( unsigned int val ) {
rssm anager- > updateRefreshInterval ( val ) ;
void RSSImp : : updateRefreshInterval ( u int val ) {
m_rssM anager- > updateRefreshInterval ( val ) ;
}
RSSImp : : RSSImp ( QWidget * parent ) : QWidget ( parent ) {
@ -612,22 +612,22 @@ RSSImp::RSSImp(QWidget *parent) : QWidget(parent) {
@@ -612,22 +612,22 @@ RSSImp::RSSImp(QWidget *parent) : QWidget(parent) {
rssDownloaderBtn - > setIcon ( IconProvider : : instance ( ) - > getIcon ( " download " ) ) ;
settingsButton - > setIcon ( IconProvider : : instance ( ) - > getIcon ( " preferences-system " ) ) ;
rssm anager = RssManager : : instance ( ) ;
m_rssM anager = RssManager : : instance ( ) ;
listStreams = new FeedListWidget ( splitter_h , rssm anager) ;
splitter_h - > insertWidget ( 0 , listStreams ) ;
m_feedList = new FeedListWidget ( splitter_h , m_rssM anager) ;
splitter_h - > insertWidget ( 0 , m_feedList ) ;
listArticles - > setSelectionBehavior ( QAbstractItemView : : SelectItems ) ;
listArticles - > setSelectionMode ( QAbstractItemView : : SingleSelection ) ;
rssm anager- > loadStreamList ( ) ;
m_rssM anager- > loadStreamList ( ) ;
fillFeedsList ( ) ;
refreshNewsList ( listStreams - > currentItem ( ) ) ;
refreshArticleList ( m_feedList - > currentItem ( ) ) ;
loadFoldersOpenState ( ) ;
connect ( rssm anager, SIGNAL ( feedInfosChanged ( QString , QString , unsigned int ) ) , this , SLOT ( updateFeedInfos ( QString , QString , unsigned int ) ) ) ;
connect ( rssm anager, SIGNAL ( feedIconChanged ( QString , QString ) ) , this , SLOT ( updateFeedIcon ( QString , QString ) ) ) ;
connect ( m_rssM anager, SIGNAL ( feedInfosChanged ( QString , QString , unsigned int ) ) , this , SLOT ( updateFeedInfos ( QString , QString , unsigned int ) ) ) ;
connect ( m_rssM anager, SIGNAL ( feedIconChanged ( QString , QString ) ) , this , SLOT ( updateFeedIcon ( QString , QString ) ) ) ;
connect ( listStreams , SIGNAL ( customContextMenuRequested ( const QPoint & ) ) , this , SLOT ( displayRSSListMenu ( const QPoint & ) ) ) ;
connect ( m_feedList , SIGNAL ( customContextMenuRequested ( const QPoint & ) ) , this , SLOT ( displayRSSListMenu ( const QPoint & ) ) ) ;
connect ( listArticles , SIGNAL ( customContextMenuRequested ( const QPoint & ) ) , this , SLOT ( displayItemsListMenu ( const QPoint & ) ) ) ;
// Feeds list actions
@ -643,15 +643,15 @@ RSSImp::RSSImp(QWidget *parent) : QWidget(parent) {
@@ -643,15 +643,15 @@ RSSImp::RSSImp(QWidget *parent) : QWidget(parent) {
connect ( actionOpen_news_URL , SIGNAL ( triggered ( ) ) , this , SLOT ( openNewsUrl ( ) ) ) ;
connect ( actionDownload_torrent , SIGNAL ( triggered ( ) ) , this , SLOT ( downloadTorrent ( ) ) ) ;
connect ( listStreams , SIGNAL ( currentItemChanged ( QTreeWidgetItem * , QTreeWidgetItem * ) ) , this , SLOT ( refreshNews List ( QTreeWidgetItem * ) ) ) ;
connect ( listStreams , SIGNAL ( foldersAltered ( QList < QTreeWidgetItem * > ) ) , this , SLOT ( updateItemsInfos ( QList < QTreeWidgetItem * > ) ) ) ;
connect ( listStreams , SIGNAL ( overwriteAttempt ( QString ) ) , this , SLOT ( displayOverwriteError ( QString ) ) ) ;
connect ( m_feedList , SIGNAL ( currentItemChanged ( QTreeWidgetItem * , QTreeWidgetItem * ) ) , this , SLOT ( refreshArticle List ( QTreeWidgetItem * ) ) ) ;
connect ( m_feedList , SIGNAL ( foldersAltered ( QList < QTreeWidgetItem * > ) ) , this , SLOT ( updateItemsInfos ( QList < QTreeWidgetItem * > ) ) ) ;
connect ( m_feedList , SIGNAL ( overwriteAttempt ( QString ) ) , this , SLOT ( displayOverwriteError ( QString ) ) ) ;
connect ( listArticles , SIGNAL ( itemSelectionChanged ( ) ) , this , SLOT ( refreshTextBrowser ( ) ) ) ;
connect ( listArticles , SIGNAL ( itemDoubleClicked ( QListWidgetItem * , int ) ) , this , SLOT ( downloadTorrent ( ) ) ) ;
// Refresh all feeds
rssm anager- > refresh ( ) ;
m_rssM anager- > refresh ( ) ;
// Restore sliders position
restoreSlidersPosition ( ) ;
// Bind saveSliders slots
@ -664,7 +664,7 @@ RSSImp::RSSImp(QWidget *parent) : QWidget(parent) {
@@ -664,7 +664,7 @@ RSSImp::RSSImp(QWidget *parent) : QWidget(parent) {
RSSImp : : ~ RSSImp ( ) {
qDebug ( " Deleting RSSImp... " ) ;
saveFoldersOpenState ( ) ;
delete listStreams ;
delete m_feedList ;
RssManager : : drop ( ) ;
qDebug ( " RSSImp deleted " ) ;
}