emailuis/nmframeworkadapter/src/nmfwaremoveattachmentoperation.cpp
changeset 23 2dc6caa42ec3
parent 20 ecc8def7944a
child 30 759dc5235cdb
child 38 b4618f2cf6ac
--- a/emailuis/nmframeworkadapter/src/nmfwaremoveattachmentoperation.cpp	Mon May 03 12:23:15 2010 +0300
+++ b/emailuis/nmframeworkadapter/src/nmfwaremoveattachmentoperation.cpp	Fri May 14 15:41:10 2010 +0300
@@ -53,7 +53,7 @@
 }
 
 /*!
-    Called after base object construction via timer event, runs the
+    Called after base object construction, runs the
     async operation.
     
     \sa NmOperation
@@ -83,16 +83,22 @@
         
     // Search through all attachments from message and remove attachment
     // if message part match.
+    bool found(false);
     for (int i=0; i<attachments.Count(); ++i) {
         if (mAttachmentPartId.id() == attachments[i]->GetPartId().GetNmId().id()) {
             mRequestId = msg->RemoveChildPartL(attachments[i]->GetPartId(),*this);
+            found = true;
             break;
         }
     }
-    attachments.ResetAndDestroy();
-    
+    attachments.ResetAndDestroy();   
     delete msg;
     msg = NULL;
+    // if attachment is not found, request to plugin is not made
+    // and the operation should be completed here
+    if (!found) {
+        completeOperation(NmNotFoundError);
+    }
 }
 
 /*!
@@ -121,7 +127,6 @@
             }
         }
         else if (status == TFSProgress::EFSStatus_RequestCancelled) {
-            operationCancelled();
             completeOperation(NmCancelError);
         }
         else {