SVN commit 891012 by osterfeld: improve prev/next unread article behavior when a filter is set Not exactly 138935 (which is fixed since 4.1) but similar BUG:138935 M +12 -4 articlelistview.cpp M +4 -3 articlelistview.h M +3 -8 mainwidget.cpp --- branches/KDE/4.1/kdepim/akregator/src/articlelistview.cpp #891011:891012 @@ -437,12 +437,15 @@ selectIndex( newIdx ); } -void ArticleListView::slotNextUnreadArticle() +bool ArticleListView::selectNextUnreadArticle() { if (!model()) - return; + return false; const int rowCount = model()->rowCount(); + if ( rowCount == 0 ) + return false; + const int startRow = qMin( rowCount - 1, ( currentIndex().isValid() ? currentIndex().row() + 1 : 0 ) ); int i = startRow; @@ -461,6 +464,7 @@ { selectIndex( model()->index( i, 0 ) ); } + return foundUnread; } void ArticleListView::selectIndex( const QModelIndex& idx ) @@ -476,12 +480,15 @@ } } -void ArticleListView::slotPreviousUnreadArticle() +bool ArticleListView::selectPreviousUnreadArticle() { if ( !model() ) - return; + return false; const int rowCount = model()->rowCount(); + if ( rowCount == 0 ) + return false; + const int startRow = qMax( 0, ( currentIndex().isValid() ? currentIndex().row() : rowCount ) - 1 ); int i = startRow; @@ -500,6 +507,7 @@ { selectIndex( model()->index( i, 0 ) ); } + return foundUnread; } --- branches/KDE/4.1/kdepim/akregator/src/articlelistview.h #891011:891012 @@ -121,6 +121,10 @@ void saveHeaderSettings(); + bool selectPreviousUnreadArticle(); + + bool selectNextUnreadArticle(); + protected: void mousePressEvent( QMouseEvent *ev ); @@ -135,10 +139,7 @@ void slotNextArticle(); - void slotPreviousUnreadArticle(); - void slotNextUnreadArticle(); - private: void loadHeaderSettings(); --- branches/KDE/4.1/kdepim/akregator/src/mainwidget.cpp #891011:891012 @@ -756,10 +756,8 @@ m_feedListView->slotNextUnreadFeed(); return; } - TreeNode* sel = m_selectionController->selectedSubscription(); - if (sel && sel->unread() > 0) - m_articleListView->slotNextUnreadArticle(); - else + + if (!m_articleListView->selectNextUnreadArticle()) m_feedListView->slotNextUnreadFeed(); } @@ -770,10 +768,7 @@ m_feedListView->slotPrevUnreadFeed(); return; } - TreeNode* sel = m_selectionController->selectedSubscription(); - if (sel && sel->unread() > 0) - m_articleListView->slotPreviousUnreadArticle(); - else + if (!m_articleListView->selectPreviousUnreadArticle()) m_feedListView->slotPrevUnreadFeed(); }