From 26187ecc2eaafadba5fc5818ead8dceca4b3c737 Mon Sep 17 00:00:00 2001 From: Till Adam Date: Sat, 9 Jul 2005 20:07:57 +0000 Subject: [PATCH] Backport of: Improve the sent mail folder logic and the readOnly protection to first try the folder specified in the mail, then if there was none, or it's not usable, try the identity one, and if that also fails, the system one. svn path=/branches/kdepim/proko2/kdepim/; revision=433147 --- kmsender.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/kmsender.cpp b/kmsender.cpp index 266e713c8..a098fc483 100644 --- a/kmsender.cpp +++ b/kmsender.cpp @@ -290,24 +290,28 @@ void KMSender::doSendMsg() if ( !mCurrentMsg->fcc().isEmpty() ) { sentFolder = kmkernel->folderMgr()->findIdString( mCurrentMsg->fcc() ); - if ( sentFolder == 0 || sentFolder->isReadOnly() ) + if ( sentFolder == 0 ) // This is *NOT* supposed to be imapSentFolder! sentFolder = kmkernel->dimapFolderMgr()->findIdString( mCurrentMsg->fcc() ); - if ( sentFolder == 0 || sentFolder->isReadOnly() ) + if ( sentFolder == 0 ) imapSentFolder = kmkernel->imapFolderMgr()->findIdString( mCurrentMsg->fcc() ); } - else if ( !id.fcc().isEmpty() ) + // No, or no usable sentFolder, and no, or no usable imapSentFolder, + // let's try the on in the identity + if ( ( sentFolder == 0 || sentFolder->isReadOnly() ) + && ( imapSentFolder == 0 || imapSentFolder->isReadOnly() ) + && !id.fcc().isEmpty() ) { sentFolder = kmkernel->folderMgr()->findIdString( id.fcc() ); - if ( sentFolder == 0 || sentFolder->isReadOnly() ) + if ( sentFolder == 0 ) // This is *NOT* supposed to be imapSentFolder! sentFolder = kmkernel->dimapFolderMgr()->findIdString( id.fcc() ); - if ( sentFolder == 0 || sentFolder->isReadOnly() ) + if ( sentFolder == 0 ) imapSentFolder = kmkernel->imapFolderMgr()->findIdString( id.fcc() ); } - if (imapSentFolder + if (imapSentFolder && ( imapSentFolder->noContent() || imapSentFolder->isReadOnly() ) ) imapSentFolder = 0;