emailuis/nmframeworkadapter/src/nmfwaremoveattachmentoperation.cpp
changeset 38 b4618f2cf6ac
parent 23 2dc6caa42ec3
child 39 b0b89ca206b5
equal deleted inserted replaced
23:2dc6caa42ec3 38:b4618f2cf6ac
    51 {
    51 {
    52     doCancelOperation();
    52     doCancelOperation();
    53 }
    53 }
    54 
    54 
    55 /*!
    55 /*!
    56     Called after base object construction, runs the
    56     Called after base object construction via timer event, 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);
       
    87     for (int i=0; i<attachments.Count(); ++i) {
    86     for (int i=0; i<attachments.Count(); ++i) {
    88         if (mAttachmentPartId.id() == attachments[i]->GetPartId().GetNmId().id()) {
    87         if (mAttachmentPartId.id() == attachments[i]->GetPartId().GetNmId().id()) {
    89             mRequestId = msg->RemoveChildPartL(attachments[i]->GetPartId(),*this);
    88             mRequestId = msg->RemoveChildPartL(attachments[i]->GetPartId(),*this);
    90             found = true;
       
    91             break;
    89             break;
    92         }
    90         }
    93     }
    91     }
    94     attachments.ResetAndDestroy();   
    92     attachments.ResetAndDestroy();
       
    93     
    95     delete msg;
    94     delete msg;
    96     msg = NULL;
    95     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     }
       
   102 }
    96 }
   103 
    97 
   104 /*!
    98 /*!
   105     Asynchronous request response message.
    99     Asynchronous request response message.
   106     
   100