diff -r 578830873419 -r ecc8def7944a emailuis/nmframeworkadapter/src/nmfwaaddattachmentsoperation.cpp --- a/emailuis/nmframeworkadapter/src/nmfwaaddattachmentsoperation.cpp Fri Apr 16 14:51:52 2010 +0300 +++ b/emailuis/nmframeworkadapter/src/nmfwaaddattachmentsoperation.cpp Mon May 03 12:23:15 2010 +0300 @@ -52,30 +52,38 @@ */ NmFwaAddAttachmentsOperation::~NmFwaAddAttachmentsOperation() { + doCancelOperation(); mFileList.clear(); mRequestIds.clear(); - doCancelOperation(); } /*! - Slot, called after base object construction via timer event, runs the + Called after base object construction via timer event, runs the async operation. \sa NmOperation */ -void NmFwaAddAttachmentsOperation::runAsyncOperation() +void NmFwaAddAttachmentsOperation::doRunAsyncOperation() +{ + TRAPD(err, doRunAsyncOperationL()); + if (err != KErrNone) { + completeOperation(NmGeneralError); + } +} + +/*! + Leaving version of doRunAsyncOperationL + */ +void NmFwaAddAttachmentsOperation::doRunAsyncOperationL() { CFSMailMessage *msg = NULL; - - TRAPD(err, msg = CFSMailMessage::NewL(mMessage)); + msg = CFSMailMessage::NewL(mMessage); - if (err == KErrNone) { - // Go through the attachment list and add those into mail message one by one. - for (int i=0; iAddNewAttachmentL(*fileName, *this))); - CleanupStack::PopAndDestroy(fileName); - } + // Go through the attachment list and add those into mail message one by one. + for (int i=0; iAddNewAttachmentL(*fileName, *this)); + CleanupStack::PopAndDestroy(fileName); } delete msg; msg = NULL; @@ -129,12 +137,18 @@ mFileList.removeAt(i); } else if (status == TFSProgress::EFSStatus_RequestCancelled) { + completeOperationPart(mFileList.at(i), + NULL, + NmCancelError); mFileList.clear(); mRequestIds.clear(); operationCancelled(); err = NmCancelError; } else { + completeOperationPart(mFileList.at(i), + NULL, + NmGeneralError); mFileList.clear(); mRequestIds.clear(); err = NmGeneralError; @@ -147,3 +161,16 @@ completeOperation(err); } } + +/*! + Cancels the async operation. \sa NmOperation + */ +void NmFwaAddAttachmentsOperation::doCancelOperation() +{ + for (int i=0;i= 0) { + TInt reqId = static_cast(mRequestIds[i]); + TRAP_IGNORE(mMailClient.CancelL(reqId)); + } + } +}