emailuis/nmframeworkadapter/src/nmfwaremoveattachmentoperation.cpp
changeset 39 b0b89ca206b5
parent 38 b4618f2cf6ac
child 43 99bcbff212ad
equal deleted inserted replaced
38:b4618f2cf6ac 39:b0b89ca206b5
    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