emailuis/nmframeworkadapter/src/nmfwaremoveattachmentoperation.cpp
changeset 23 2dc6caa42ec3
parent 20 ecc8def7944a
child 30 759dc5235cdb
child 38 b4618f2cf6ac
equal deleted inserted replaced
20:ecc8def7944a 23:2dc6caa42ec3
    51 {
    51 {
    52     doCancelOperation();
    52     doCancelOperation();
    53 }
    53 }
    54 
    54 
    55 /*!
    55 /*!
    56     Called after base object construction via timer event, runs the
    56     Called after base object construction, runs the
    57     async operation.
    57     async operation.
    58     
    58     
    59     \sa NmOperation
    59     \sa NmOperation
    60  */
    60  */
    61 void NmFwaRemoveAttachmentOperation::doRunAsyncOperation()
    61 void NmFwaRemoveAttachmentOperation::doRunAsyncOperation()
    81     attachments.Reset();
    81     attachments.Reset();
    82     msg->AttachmentListL(attachments);
    82     msg->AttachmentListL(attachments);
    83         
    83         
    84     // Search through all attachments from message and remove attachment
    84     // Search through all attachments from message and remove attachment
    85     // if message part match.
    85     // if message part match.
       
    86     bool found(false);
    86     for (int i=0; i<attachments.Count(); ++i) {
    87     for (int i=0; i<attachments.Count(); ++i) {
    87         if (mAttachmentPartId.id() == attachments[i]->GetPartId().GetNmId().id()) {
    88         if (mAttachmentPartId.id() == attachments[i]->GetPartId().GetNmId().id()) {
    88             mRequestId = msg->RemoveChildPartL(attachments[i]->GetPartId(),*this);
    89             mRequestId = msg->RemoveChildPartL(attachments[i]->GetPartId(),*this);
       
    90             found = true;
    89             break;
    91             break;
    90         }
    92         }
    91     }
    93     }
    92     attachments.ResetAndDestroy();
    94     attachments.ResetAndDestroy();   
    93     
       
    94     delete msg;
    95     delete msg;
    95     msg = NULL;
    96     msg = NULL;
       
    97     // if attachment is not found, request to plugin is not made
       
    98     // and the operation should be completed here
       
    99     if (!found) {
       
   100         completeOperation(NmNotFoundError);
       
   101     }
    96 }
   102 }
    97 
   103 
    98 /*!
   104 /*!
    99     Asynchronous request response message.
   105     Asynchronous request response message.
   100     
   106     
   119                 default:
   125                 default:
   120                     completeOperation(NmGeneralError);
   126                     completeOperation(NmGeneralError);
   121             }
   127             }
   122         }
   128         }
   123         else if (status == TFSProgress::EFSStatus_RequestCancelled) {
   129         else if (status == TFSProgress::EFSStatus_RequestCancelled) {
   124             operationCancelled();
       
   125             completeOperation(NmCancelError);
   130             completeOperation(NmCancelError);
   126         }
   131         }
   127         else {
   132         else {
   128             completeOperation(NmGeneralError);
   133             completeOperation(NmGeneralError);
   129         }
   134         }