emailuis/nmframeworkadapter/src/nmfwamessagepartfetchingoperation.cpp
branchGCC_SURGE
changeset 55 cdd802add233
parent 30 759dc5235cdb
child 74 6c59112cfd31
equal deleted inserted replaced
28:011f79704660 55:cdd802add233
    33     mMailClient(mailClient), 
    33     mMailClient(mailClient), 
    34     mLastProgressValue(0), 
    34     mLastProgressValue(0), 
    35     mRequestId(0)
    35     mRequestId(0)
    36 
    36 
    37 {
    37 {
    38     
    38     NM_FUNCTION;
    39 }
    39 }
    40 
    40 
    41 /*!
    41 /*!
    42 
    42 
    43  */
    43  */
    44 NmFwaMessagePartFetchingOperation::~NmFwaMessagePartFetchingOperation()
    44 NmFwaMessagePartFetchingOperation::~NmFwaMessagePartFetchingOperation()
    45 {
    45 {
       
    46     NM_FUNCTION;
       
    47     
    46     doCancelOperation();
    48     doCancelOperation();
    47     NMLOG("NmFwaMessagePartFetchingOperation::~NmFwaMessagePartFetchingOperation --->");
       
    48 }
    49 }
    49 
    50 
    50 /*!
    51 /*!
    51 
    52 
    52  */
    53  */
    53 void NmFwaMessagePartFetchingOperation::RequestResponseL(TFSProgress aEvent, TInt aRequestId)
    54 void NmFwaMessagePartFetchingOperation::RequestResponseL(TFSProgress aEvent, TInt aRequestId)
    54 {
    55 {
       
    56     NM_FUNCTION;
       
    57     
    55     if (aRequestId == mRequestId) {
    58     if (aRequestId == mRequestId) {
    56         if (aEvent.iProgressStatus == TFSProgress::EFSStatus_RequestComplete ) {
    59         if (aEvent.iProgressStatus == TFSProgress::EFSStatus_RequestComplete ) {
    57             completeOperation(aEvent.iError);
    60             completeOperation(aEvent.iError);
    58         }
    61         }
    59         else if (aEvent.iProgressStatus == TFSProgress::EFSStatus_RequestCancelled) {
    62         else if (aEvent.iProgressStatus == TFSProgress::EFSStatus_RequestCancelled) {
    79 /*!
    82 /*!
    80 
    83 
    81  */
    84  */
    82 void NmFwaMessagePartFetchingOperation::doRunAsyncOperation()
    85 void NmFwaMessagePartFetchingOperation::doRunAsyncOperation()
    83 {
    86 {
       
    87     NM_FUNCTION;
       
    88     
    84     TRAPD(err, doRunAsyncOperationL());
    89     TRAPD(err, doRunAsyncOperationL());
    85     if (err != KErrNone) {
    90     if (err != KErrNone) {
    86         completeOperation(NmGeneralError);
    91         completeOperation(NmGeneralError);
    87     }
    92     }
    88 }
    93 }
    90 /*!
    95 /*!
    91     Leaving version from doRunAsyncOperation
    96     Leaving version from doRunAsyncOperation
    92  */
    97  */
    93 void NmFwaMessagePartFetchingOperation::doRunAsyncOperationL()
    98 void NmFwaMessagePartFetchingOperation::doRunAsyncOperationL()
    94 {
    99 {
       
   100     NM_FUNCTION;
       
   101     
    95     const TFSMailMsgId mailboxId(mMailboxId.pluginId32(), mMailboxId.id32());
   102     const TFSMailMsgId mailboxId(mMailboxId.pluginId32(), mMailboxId.id32());
    96     const TFSMailMsgId folderId(mFolderId.pluginId32(), mFolderId.id32());
   103     const TFSMailMsgId folderId(mFolderId.pluginId32(), mFolderId.id32());
    97     const TFSMailMsgId messageId(mMessageId.pluginId32(), mMessageId.id32());
   104     const TFSMailMsgId messageId(mMessageId.pluginId32(), mMessageId.id32());
    98     const TFSMailMsgId messagePartId(mMessagePartId.pluginId32(), mMessagePartId.id32());
   105     const TFSMailMsgId messagePartId(mMessagePartId.pluginId32(), mMessagePartId.id32());
    99 
   106 
   117     }
   124     }
   118     CleanupStack::PopAndDestroy(message);
   125     CleanupStack::PopAndDestroy(message);
   119 }
   126 }
   120 
   127 
   121 /*!
   128 /*!
       
   129  * Complete the operation
       
   130  */
       
   131 void NmFwaMessagePartFetchingOperation::doCompleteOperation()
       
   132 {
       
   133     NM_FUNCTION;
       
   134     
       
   135     mRequestId = NmNotFoundError;
       
   136 }
   122 
   137 
       
   138 /*!
       
   139     Cancels the async operation. \sa NmOperation
   123  */
   140  */
   124 void NmFwaMessagePartFetchingOperation::doCancelOperation()
   141 void NmFwaMessagePartFetchingOperation::doCancelOperation()
   125 {
   142 {
   126     TRAP_IGNORE(mMailClient.CancelL(mRequestId));
   143     NM_FUNCTION;
       
   144     
       
   145     if (mRequestId >= 0) {
       
   146         TRAP_IGNORE(mMailClient.CancelL(mRequestId));
       
   147         mRequestId = NmNotFoundError;
       
   148     }
   127 }
   149 }