emailuis/nmframeworkadapter/src/nmfwaremoveattachmentoperation.cpp
changeset 43 99bcbff212ad
parent 39 b0b89ca206b5
child 76 38bf5461e270
equal deleted inserted replaced
42:139d4b7b2938 43:99bcbff212ad
    38     const NmId &attachmentPartId,
    38     const NmId &attachmentPartId,
    39     CFSMailClient &mailClient) :
    39     CFSMailClient &mailClient) :
    40         mMessage(message),
    40         mMessage(message),
    41         mMailClient(mailClient)
    41         mMailClient(mailClient)
    42 {
    42 {
       
    43     NM_FUNCTION;
       
    44     
    43     // Take a copy because original will be deleted during the operation
    45     // Take a copy because original will be deleted during the operation
    44     mAttachmentPartId.setId(attachmentPartId.id());
    46     mAttachmentPartId.setId(attachmentPartId.id());
    45 }
    47 }
    46 
    48 
    47 /*!
    49 /*!
    48     Destructor
    50     Destructor
    49  */
    51  */
    50 NmFwaRemoveAttachmentOperation::~NmFwaRemoveAttachmentOperation()
    52 NmFwaRemoveAttachmentOperation::~NmFwaRemoveAttachmentOperation()
    51 {
    53 {
       
    54     NM_FUNCTION;
       
    55     
    52     doCancelOperation();
    56     doCancelOperation();
    53 }
    57 }
    54 
    58 
    55 /*!
    59 /*!
    56     Called after base object construction, runs the
    60     Called after base object construction, runs the
    58     
    62     
    59     \sa NmOperation
    63     \sa NmOperation
    60  */
    64  */
    61 void NmFwaRemoveAttachmentOperation::doRunAsyncOperation()
    65 void NmFwaRemoveAttachmentOperation::doRunAsyncOperation()
    62 {
    66 {
       
    67     NM_FUNCTION;
       
    68     
    63     TRAPD(err, doRunAsyncOperationL());
    69     TRAPD(err, doRunAsyncOperationL());
    64     if (err != KErrNone) {
    70     if (err != KErrNone) {
    65         completeOperation(NmGeneralError);
    71         completeOperation(NmGeneralError);
    66     }
    72     }
    67 }
    73 }
    70     Leaving function for async operation
    76     Leaving function for async operation
    71     \sa NmOperation
    77     \sa NmOperation
    72  */
    78  */
    73 void NmFwaRemoveAttachmentOperation::doRunAsyncOperationL()
    79 void NmFwaRemoveAttachmentOperation::doRunAsyncOperationL()
    74 {
    80 {
       
    81     NM_FUNCTION;
       
    82     
    75     CFSMailMessage *msg = NULL;
    83     CFSMailMessage *msg = NULL;
    76 
    84 
    77     msg = CFSMailMessage::NewL(mMessage);
    85     msg = CFSMailMessage::NewL(mMessage);
    78     
    86     
    79     // Get attachment list from the message
    87     // Get attachment list from the message
   108     \param aRequestId Request id of asyncronous operation.
   116     \param aRequestId Request id of asyncronous operation.
   109  */
   117  */
   110 void NmFwaRemoveAttachmentOperation::RequestResponseL(TFSProgress aEvent,
   118 void NmFwaRemoveAttachmentOperation::RequestResponseL(TFSProgress aEvent,
   111                                                       TInt aRequestId)
   119                                                       TInt aRequestId)
   112 {
   120 {
       
   121     NM_FUNCTION;
       
   122     
   113     if (aRequestId == mRequestId) {
   123     if (aRequestId == mRequestId) {
   114         TFSProgress::TFSProgressStatus status = aEvent.iProgressStatus;
   124         TFSProgress::TFSProgressStatus status = aEvent.iProgressStatus;
   115         if (status == TFSProgress::EFSStatus_RequestComplete) {
   125         if (status == TFSProgress::EFSStatus_RequestComplete) {
   116             // Request completed. Let's check the result
   126             // Request completed. Let's check the result
   117             switch (aEvent.iError) {
   127             switch (aEvent.iError) {
   141 /*!
   151 /*!
   142     Cancels the async operation. \sa NmOperation
   152     Cancels the async operation. \sa NmOperation
   143  */
   153  */
   144 void NmFwaRemoveAttachmentOperation::doCancelOperation()
   154 void NmFwaRemoveAttachmentOperation::doCancelOperation()
   145 {
   155 {
       
   156     NM_FUNCTION;
       
   157     
   146     if (mRequestId >= 0) {
   158     if (mRequestId >= 0) {
   147         TRAP_IGNORE(mMailClient.CancelL(mRequestId));
   159         TRAP_IGNORE(mMailClient.CancelL(mRequestId));
   148         mRequestId = KErrNotFound;
   160         mRequestId = KErrNotFound;
   149     }
   161     }
   150 }
   162 }