emailuis/nmframeworkadapter/src/nmfwamessagepartsfetchingoperation.cpp
changeset 43 99bcbff212ad
parent 40 2c62ef3caffd
child 51 d845db10c0d4
equal deleted inserted replaced
42:139d4b7b2938 43:99bcbff212ad
    32     mMailClient(mailClient), 
    32     mMailClient(mailClient), 
    33     mLastProgressValue(0), 
    33     mLastProgressValue(0), 
    34     mRequestId(0)
    34     mRequestId(0)
    35 
    35 
    36 {
    36 {
       
    37     NM_FUNCTION;
       
    38     
    37     // Take own copy of the message part id list.
    39     // Take own copy of the message part id list.
    38     mMessagePartIds.Reset();
    40     mMessagePartIds.Reset();
    39     for (int i=0; i<messagePartIds.count(); ++i) {
    41     for (int i=0; i<messagePartIds.count(); ++i) {
    40         mMessagePartIds.Append(
    42         mMessagePartIds.Append(
    41             NmConverter::nmIdToMailMsgId(
    43             NmConverter::nmIdToMailMsgId(
    47 /*!
    49 /*!
    48 
    50 
    49  */
    51  */
    50 NmFwaMessagePartsFetchingOperation::~NmFwaMessagePartsFetchingOperation()
    52 NmFwaMessagePartsFetchingOperation::~NmFwaMessagePartsFetchingOperation()
    51 {
    53 {
       
    54     NM_FUNCTION;
       
    55     
    52     doCancelOperation();
    56     doCancelOperation();
    53 }
    57 }
    54 
    58 
    55 /*!
    59 /*!
    56 
    60 
    57  */
    61  */
    58 void NmFwaMessagePartsFetchingOperation::RequestResponseL(TFSProgress aEvent, TInt aRequestId)
    62 void NmFwaMessagePartsFetchingOperation::RequestResponseL(TFSProgress aEvent, TInt aRequestId)
    59 {
    63 {
       
    64     NM_FUNCTION;
       
    65     
    60     if (aRequestId == mRequestId) {
    66     if (aRequestId == mRequestId) {
    61         if (aEvent.iProgressStatus == TFSProgress::EFSStatus_RequestComplete ) {
    67         if (aEvent.iProgressStatus == TFSProgress::EFSStatus_RequestComplete ) {
    62             completeOperation(aEvent.iError);
    68             completeOperation(aEvent.iError);
    63         }
    69         }
    64         else if (aEvent.iProgressStatus == TFSProgress::EFSStatus_RequestCancelled) {
    70         else if (aEvent.iProgressStatus == TFSProgress::EFSStatus_RequestCancelled) {
    84 /*!
    90 /*!
    85 
    91 
    86  */
    92  */
    87 void NmFwaMessagePartsFetchingOperation::doRunAsyncOperation()
    93 void NmFwaMessagePartsFetchingOperation::doRunAsyncOperation()
    88 {
    94 {
       
    95     NM_FUNCTION;
       
    96     
    89     TRAPD(err, doRunAsyncOperationL());
    97     TRAPD(err, doRunAsyncOperationL());
    90     if (err != KErrNone) {
    98     if (err != KErrNone) {
    91         completeOperation(NmGeneralError);
    99         completeOperation(NmGeneralError);
    92     }
   100     }
    93 }
   101 }
    95 /*!
   103 /*!
    96     Leaving version from doRunAsyncOperation
   104     Leaving version from doRunAsyncOperation
    97  */
   105  */
    98 void NmFwaMessagePartsFetchingOperation::doRunAsyncOperationL()
   106 void NmFwaMessagePartsFetchingOperation::doRunAsyncOperationL()
    99 {
   107 {
       
   108     NM_FUNCTION;
       
   109     
   100     if (mMessagePartIds.Count() > 0) {
   110     if (mMessagePartIds.Count() > 0) {
   101         
   111         
   102         const TFSMailMsgId mailboxId(mMailboxId.pluginId32(), mMailboxId.id32());
   112         const TFSMailMsgId mailboxId(mMailboxId.pluginId32(), mMailboxId.id32());
   103         const TFSMailMsgId folderId(mFolderId.pluginId32(), mFolderId.id32());
   113         const TFSMailMsgId folderId(mFolderId.pluginId32(), mFolderId.id32());
   104         const TFSMailMsgId messageId(mMessageId.pluginId32(), mMessageId.id32());
   114         const TFSMailMsgId messageId(mMessageId.pluginId32(), mMessageId.id32());
   131 /*!
   141 /*!
   132  * Complete the operation
   142  * Complete the operation
   133  */
   143  */
   134 void NmFwaMessagePartsFetchingOperation::doCompleteOperation()
   144 void NmFwaMessagePartsFetchingOperation::doCompleteOperation()
   135 {
   145 {
       
   146     NM_FUNCTION;
       
   147     
   136     mRequestId = NmNotFoundError;
   148     mRequestId = NmNotFoundError;
   137 }
   149 }
   138 
   150 
   139 /*!
   151 /*!
   140     Cancels the async operation. \sa NmOperation
   152     Cancels the async operation. \sa NmOperation
   141  */
   153  */
   142 void NmFwaMessagePartsFetchingOperation::doCancelOperation()
   154 void NmFwaMessagePartsFetchingOperation::doCancelOperation()
   143 {
   155 {
       
   156     NM_FUNCTION;
       
   157     
   144     if (mRequestId >= 0) {
   158     if (mRequestId >= 0) {
   145         TRAP_IGNORE(mMailClient.CancelL(mRequestId));
   159         TRAP_IGNORE(mMailClient.CancelL(mRequestId));
   146         mRequestId = NmNotFoundError;
   160         mRequestId = NmNotFoundError;
   147     }
   161     }
   148 }
   162 }