emailuis/nmframeworkadapter/src/nmfwastoreenvelopesoperation.cpp
changeset 30 759dc5235cdb
parent 23 2dc6caa42ec3
equal deleted inserted replaced
27:9ba4404ef423 30:759dc5235cdb
    23         CFSMailClient &mailClient) :
    23         CFSMailClient &mailClient) :
    24         mMailboxId(mailboxId),
    24         mMailboxId(mailboxId),
    25         mMailClient(mailClient),
    25         mMailClient(mailClient),
    26         mRequestId(0)
    26         mRequestId(0)
    27 {
    27 {
       
    28     NM_FUNCTION;
       
    29     
    28     mMessages = messages;
    30     mMessages = messages;
    29 }
    31 }
    30 
    32 
    31 NmFwaStoreEnvelopesOperation::~NmFwaStoreEnvelopesOperation()
    33 NmFwaStoreEnvelopesOperation::~NmFwaStoreEnvelopesOperation()
    32 {
    34 {
    33     NMLOG("NmFwaStoreEnvelopesOperation::~NmFwaStoreEnvelopesOperation() <---");
    35     NM_FUNCTION;
       
    36     
    34     mMessages.ResetAndDestroy();
    37     mMessages.ResetAndDestroy();
    35     NMLOG("NmFwaStoreEnvelopesOperation::~NmFwaStoreEnvelopesOperation() --->");
       
    36 }
    38 }
    37 
    39 
    38 void NmFwaStoreEnvelopesOperation::doRunAsyncOperation()
    40 void NmFwaStoreEnvelopesOperation::doRunAsyncOperation()
    39 {
    41 {
    40     NMLOG("NmFwaStoreEnvelopesOperation::doRunAsyncOperation() <---");
    42     NM_FUNCTION;
       
    43     
    41     const TFSMailMsgId mailboxId(mMailboxId.pluginId32(), mMailboxId.id32());
    44     const TFSMailMsgId mailboxId(mMailboxId.pluginId32(), mMailboxId.id32());
    42     CFSMailBox *mailbox(NULL);
    45     CFSMailBox *mailbox(NULL);
    43     TRAP_IGNORE( mailbox = mMailClient.GetMailBoxByUidL(mailboxId) );
    46     TRAP_IGNORE( mailbox = mMailClient.GetMailBoxByUidL(mailboxId) );
    44     // no possibility to leave; no need for CleanupStack
    47     // no possibility to leave; no need for CleanupStack
    45     if ( mailbox && mMessages.Count() ) {
    48     if ( mailbox && mMessages.Count() ) {
    54     // cleanup
    57     // cleanup
    55     if (mailbox) {
    58     if (mailbox) {
    56         delete mailbox;
    59         delete mailbox;
    57         mailbox = NULL;
    60         mailbox = NULL;
    58     }
    61     }
    59     NMLOG("NmFwaStoreEnvelopesOperation::doRunAsyncOperation() --->");
       
    60 }
    62 }
    61 
    63 
    62 void NmFwaStoreEnvelopesOperation::doCancelOperation()
    64 void NmFwaStoreEnvelopesOperation::doCancelOperation()
    63 {
    65 {
    64     NMLOG("NmFwaStoreEnvelopesOperation::doCancelOperation() <---");
    66     NM_FUNCTION;
       
    67     
    65     TRAP_IGNORE(mMailClient.CancelL(mRequestId));
    68     TRAP_IGNORE(mMailClient.CancelL(mRequestId));
    66     NMLOG("NmFwaStoreEnvelopesOperation::doCancelOperation() --->");
       
    67 }
    69 }
    68 
    70 
    69 /**
    71 /**
    70  * asynchronous request response message
    72  * asynchronous request response message
    71  *
    73  *
    72  * @param aEvent plugin event description
    74  * @param aEvent plugin event description
    73  * @param aRequestId request id of asyncronous operation
    75  * @param aRequestId request id of asyncronous operation
    74  */
    76  */
    75 void NmFwaStoreEnvelopesOperation::RequestResponseL(TFSProgress aEvent, TInt aRequestId)
    77 void NmFwaStoreEnvelopesOperation::RequestResponseL(TFSProgress aEvent, TInt aRequestId)
    76 {
    78 {
    77     NMLOG("NmFwaStoreEnvelopesOperation::RequestResponseL() <---");
    79     NM_FUNCTION;
       
    80     
    78     if (aRequestId == mRequestId) {
    81     if (aRequestId == mRequestId) {
    79         if (aEvent.iProgressStatus == TFSProgress::EFSStatus_RequestComplete && aEvent.iParam) {
    82         if (aEvent.iProgressStatus == TFSProgress::EFSStatus_RequestComplete && aEvent.iParam) {
    80             completeOperation(NmNoError);
    83             completeOperation(NmNoError);
    81         }
    84         }
    82         else if (aEvent.iProgressStatus == TFSProgress::EFSStatus_RequestCancelled) {
    85         else if (aEvent.iProgressStatus == TFSProgress::EFSStatus_RequestCancelled) {
    84         }
    87         }
    85         else {
    88         else {
    86             completeOperation(NmGeneralError);
    89             completeOperation(NmGeneralError);
    87         }
    90         }
    88     }
    91     }
    89     NMLOG("NmFwaStoreEnvelopesOperation::RequestResponseL() --->");
       
    90 }
    92 }