diff --git a/favoritefolderview.cpp b/favoritefolderview.cpp index 848c45b08..a04af6fc7 100644 --- a/favoritefolderview.cpp +++ b/favoritefolderview.cpp @@ -500,7 +500,7 @@ void FavoriteFolderView::checkMail() imap->getAndCheckFolder(); } else if ( fti->folder()->folderType() == KMFolderTypeCachedImap ) { KMFolderCachedImap* f = static_cast( fti->folder()->storage() ); - f->account()->processNewMailSingleFolder( fti->folder() ); + f->account()->processNewMailInFolder( fti->folder() ); } } } diff --git a/imapaccountbase.cpp b/imapaccountbase.cpp index 12e86232c..1d0933170 100644 --- a/imapaccountbase.cpp +++ b/imapaccountbase.cpp @@ -1017,12 +1017,12 @@ namespace KMail { } //----------------------------------------------------------------------------- - void ImapAccountBase::processNewMailSingleFolder(KMFolder* folder) + void ImapAccountBase::processNewMailInFolder( KMFolder* folder, FolderListType type /*= Single*/ ) { if ( mFoldersQueuedForChecking.contains( folder ) ) return; - mFoldersQueuedForChecking.append(folder); - mCheckingSingleFolder = true; + mFoldersQueuedForChecking.append( folder ); + mCheckingSingleFolder = ( type == Single ); if ( checkingMail() ) { disconnect( this, SIGNAL( finishedCheck( bool, CheckStatus ) ), diff --git a/imapaccountbase.h b/imapaccountbase.h index 57147330f..a2e6f0a11 100644 --- a/imapaccountbase.h +++ b/imapaccountbase.h @@ -252,9 +252,10 @@ namespace KMail { virtual void cancelMailCheck(); /** - * Init a new-mail-check for a single folder + * Init a new-mail-check for a single folder, and optionally its subfolders. */ - void processNewMailSingleFolder(KMFolder* folder); + enum FolderListType { Single, Recursive }; + void processNewMailInFolder( KMFolder* folder, FolderListType type = Single ); /** * Return true if we are processing a mailcheck for a single folder diff --git a/kmacctcachedimap.cpp b/kmacctcachedimap.cpp index 3411a0e2a..a08c2565c 100644 --- a/kmacctcachedimap.cpp +++ b/kmacctcachedimap.cpp @@ -221,7 +221,7 @@ void KMAcctCachedImap::processNewMail( bool /*interactive*/ ) // Only check mail if the folder really exists, it might have been removed by the sync in // the meantime. if ( f ) { - processNewMail( static_cast( f->storage() ), false ); + processNewMail( static_cast( f->storage() ), !checkingSingleFolder() ); } } } @@ -366,8 +366,8 @@ void KMAcctCachedImap::invalidateIMAPFolders( KMFolderCachedImap* folder ) QStringList strList; QValueList > folderList; kmkernel->dimapFolderMgr()->createFolderList( &strList, &folderList, - folder->folder()->child(), QString::null, - false ); + folder->folder()->child(), QString::null, + false ); QValueList >::Iterator it; mCountLastUnread = 0; mUnreadBeforeCheck.clear(); @@ -379,13 +379,12 @@ void KMAcctCachedImap::invalidateIMAPFolders( KMFolderCachedImap* folder ) // This invalidates the folder completely cfolder->setUidValidity("INVALID"); cfolder->writeUidCache(); - processNewMailSingleFolder( f ); } } folder->setUidValidity("INVALID"); folder->writeUidCache(); - processNewMailSingleFolder( folder->folder() ); + processNewMailInFolder( folder->folder(), Recursive ); } //----------------------------------------------------------------------------- diff --git a/kmailicalifaceimpl.cpp b/kmailicalifaceimpl.cpp index 497c9c253..38b349564 100644 --- a/kmailicalifaceimpl.cpp +++ b/kmailicalifaceimpl.cpp @@ -757,7 +757,7 @@ bool KMailICalIfaceImpl::triggerSync( const QString& contentsType ) imap->getAndCheckFolder(); } else if ( f->folderType() == KMFolderTypeCachedImap ) { KMFolderCachedImap* cached = static_cast( f->storage() ); - cached->account()->processNewMailSingleFolder( f ); + cached->account()->processNewMailInFolder( f ); } } return true; @@ -2335,7 +2335,7 @@ void KMailICalIfaceImpl::syncFolder(KMFolder * folder) const else return; } - dimapFolder->account()->processNewMailSingleFolder( folder ); + dimapFolder->account()->processNewMailInFolder( folder ); } #include "kmailicalifaceimpl.moc" diff --git a/kmfolderimap.cpp b/kmfolderimap.cpp index 4d59902c5..309a69b76 100644 --- a/kmfolderimap.cpp +++ b/kmfolderimap.cpp @@ -1189,7 +1189,7 @@ void KMFolderImap::getAndCheckFolder(bool force) return getFolder(force); if ( account() ) - account()->processNewMailSingleFolder( folder() ); + account()->processNewMailInFolder( folder() ); if (force) { // force an update mCheckFlags = true; diff --git a/kmmainwidget.cpp b/kmmainwidget.cpp index 1b5ad0439..fb5c8c243 100644 --- a/kmmainwidget.cpp +++ b/kmmainwidget.cpp @@ -1304,7 +1304,7 @@ void KMMainWidget::slotRefreshFolder() imap->getAndCheckFolder(); } else if ( mFolder->folderType() == KMFolderTypeCachedImap ) { KMFolderCachedImap* f = static_cast( mFolder->storage() ); - f->account()->processNewMailSingleFolder( mFolder ); + f->account()->processNewMailInFolder( mFolder ); } } }