[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/work/akonadi-ports/kdepim/kmail
From: Laurent Montel <montel () kde ! org>
Date: 2009-11-05 14:09:24
Message-ID: 1257430164.830267.25984.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 1045231 by mlaurent:
Start to implement search previous unread folder
M +20 -8 foldertreeview.cpp
M +2 -1 foldertreeview.h
--- branches/work/akonadi-ports/kdepim/kmail/foldertreeview.cpp #1045230:1045231
@@ -96,7 +96,7 @@
QModelIndex current = selectNextFolder( currentIndex() );
while ( current.isValid() ) {
QModelIndex nextIndex;
- if ( isUnreadFolder( current,nextIndex ) ) {
+ if ( isUnreadFolder( current,nextIndex,FolderTreeView::Next ) ) {
selectModelIndex( current );
return;
}
@@ -107,7 +107,7 @@
kDebug()<<" current :"<<current;
while ( current.isValid() ) {
QModelIndex nextIndex;
- if ( isUnreadFolder( current,nextIndex ) ) {
+ if ( isUnreadFolder( current,nextIndex, FolderTreeView::Next ) ) {
selectModelIndex( current );
return;
}
@@ -115,12 +115,17 @@
}
}
-bool FolderTreeView::isUnreadFolder( const QModelIndex & current, QModelIndex \
&nextIndex ) +bool FolderTreeView::isUnreadFolder( const QModelIndex & current, \
QModelIndex &index, FolderTreeView::Move move ) {
if ( current.isValid() ) {
- nextIndex = selectNextFolder( current );
- if ( nextIndex.isValid() ) {
- Akonadi::Collection collection = nextIndex.model()->data( current, \
Akonadi::EntityTreeModel::CollectionRole ).value<Akonadi::Collection>(); +
+ if ( move == FolderTreeView::Next )
+ index = selectNextFolder( current );
+ else if ( move == FolderTreeView::Previous )
+ index = indexAbove( current );
+
+ if ( index.isValid() ) {
+ Akonadi::Collection collection = index.model()->data( current, \
Akonadi::EntityTreeModel::CollectionRole ).value<Akonadi::Collection>(); if ( \
collection.isValid() ) { if ( collection.statistics().unreadCount()>0 ) {
return true;
@@ -134,10 +139,17 @@
void FolderTreeView::selectPrevUnreadFolder()
{
kDebug()<<" Need to implement FolderTreeView::selectPrevUnreadFolder()";
- QModelIndex current = currentIndex();
- if ( current.isValid() ) {
+ QModelIndex current = indexAbove( currentIndex() );
+ while ( current.isValid() ) {
+ QModelIndex nextIndex;
+ if ( isUnreadFolder( current,nextIndex,FolderTreeView::Previous ) ) {
+ selectModelIndex( current );
+ return;
+ }
+ current = nextIndex;
}
+ //TODO start at the end.
}
Akonadi::Collection FolderTreeView::currentFolder()
--- branches/work/akonadi-ports/kdepim/kmail/foldertreeview.h #1045230:1045231
@@ -37,10 +37,11 @@
Akonadi::Collection currentFolder();
protected:
+ enum Move { Next = 0, Previous = 1};
void init();
void selectModelIndex( const QModelIndex & );
QModelIndex selectNextFolder( const QModelIndex & current );
- bool isUnreadFolder( const QModelIndex & current, QModelIndex &nextIndex );
+ bool isUnreadFolder( const QModelIndex & current, QModelIndex \
&nextIndex,FolderTreeView::Move move);
public slots:
void slotFocusNextFolder();
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic