emailuis/nmframeworkadapter/src/nmfwamessagecreationoperation.cpp
changeset 43 99bcbff212ad
parent 23 2dc6caa42ec3
equal deleted inserted replaced
42:139d4b7b2938 43:99bcbff212ad
    38         mMailboxId(mailboxId),
    38         mMailboxId(mailboxId),
    39         mMessage(NULL),
    39         mMessage(NULL),
    40         mMailClient(mailClient),
    40         mMailClient(mailClient),
    41         mRequestId(NmNotFoundError)
    41         mRequestId(NmNotFoundError)
    42 {
    42 {
       
    43     NM_FUNCTION;
    43 }
    44 }
    44 
    45 
    45 /*!
    46 /*!
    46     Destructor
    47     Destructor
    47  */
    48  */
    48 NmFwaMessageCreationOperation::~NmFwaMessageCreationOperation()
    49 NmFwaMessageCreationOperation::~NmFwaMessageCreationOperation()
    49 {
    50 {
       
    51     NM_FUNCTION;
       
    52     
    50     doCancelOperation();
    53     doCancelOperation();
    51     delete mMessage;
    54     delete mMessage;
    52     NMLOG("NmFwaMessageCreationOperation::~NmFwaMessageCreationOperation --->");
       
    53 }
    55 }
    54 
    56 
    55 /*!
    57 /*!
    56     Called after base object construction via timer event, runs the async operation.
    58     Called after base object construction via timer event, runs the async operation.
    57     
    59     
    58     \sa NmOperation
    60     \sa NmOperation
    59  */
    61  */
    60 void NmFwaMessageCreationOperation::doRunAsyncOperation()
    62 void NmFwaMessageCreationOperation::doRunAsyncOperation()
    61 {
    63 {
       
    64     NM_FUNCTION;
       
    65     
    62     const TFSMailMsgId mailMsgId(mMailboxId.pluginId32(), mMailboxId.id32());
    66     const TFSMailMsgId mailMsgId(mMailboxId.pluginId32(), mMailboxId.id32());
    63 
    67 
    64     CFSMailBox *mailBox = NULL;
    68     CFSMailBox *mailBox = NULL;
    65     TRAP_IGNORE(mailBox = mMailClient.GetMailBoxByUidL(mailMsgId));
    69     TRAP_IGNORE(mailBox = mMailClient.GetMailBoxByUidL(mailMsgId));
    66 
    70 
   103 /*!
   107 /*!
   104  * Complete the operation
   108  * Complete the operation
   105  */
   109  */
   106 void NmFwaMessageCreationOperation::doCompleteOperation()
   110 void NmFwaMessageCreationOperation::doCompleteOperation()
   107 {
   111 {
       
   112     NM_FUNCTION;
       
   113     
   108     mRequestId = NmNotFoundError;
   114     mRequestId = NmNotFoundError;
   109 }
   115 }
   110 
   116 
   111 /*!
   117 /*!
   112     Cancels the async operation. \sa NmOperation
   118     Cancels the async operation. \sa NmOperation
   113  */
   119  */
   114 void NmFwaMessageCreationOperation::doCancelOperation()
   120 void NmFwaMessageCreationOperation::doCancelOperation()
   115 {
   121 {
       
   122     NM_FUNCTION;
       
   123     
   116     if (mRequestId >= 0) {
   124     if (mRequestId >= 0) {
   117         TRAP_IGNORE(mMailClient.CancelL(mRequestId));
   125         TRAP_IGNORE(mMailClient.CancelL(mRequestId));
   118         mRequestId = NmNotFoundError;
   126         mRequestId = NmNotFoundError;
   119     }
   127     }
   120 }
   128 }
   125     
   133     
   126     \return NmMessage* The new message.
   134     \return NmMessage* The new message.
   127  */
   135  */
   128 NmMessage *NmFwaMessageCreationOperation::getMessage()
   136 NmMessage *NmFwaMessageCreationOperation::getMessage()
   129 {
   137 {
       
   138     NM_FUNCTION;
       
   139     
   130     // Ownership changes
   140     // Ownership changes
   131     NmMessage *ret = mMessage;
   141     NmMessage *ret = mMessage;
   132     mMessage = NULL;
   142     mMessage = NULL;
   133     return ret;
   143     return ret;
   134 }
   144 }
   139     
   149     
   140     \return NmId Id of the new message.
   150     \return NmId Id of the new message.
   141  */
   151  */
   142 NmId NmFwaMessageCreationOperation::getMessageId()
   152 NmId NmFwaMessageCreationOperation::getMessageId()
   143 {
   153 {
       
   154     NM_FUNCTION;
       
   155     
   144     NmId messageId;
   156     NmId messageId;
   145     
   157     
   146     if (mMessage) {
   158     if (mMessage) {
   147         messageId = mMessage->envelope().messageId();
   159         messageId = mMessage->envelope().messageId();
   148     }
   160     }
   157     \param aRequestId Request id of asyncronous operation.
   169     \param aRequestId Request id of asyncronous operation.
   158  */
   170  */
   159 void NmFwaMessageCreationOperation::RequestResponseL(TFSProgress aEvent,
   171 void NmFwaMessageCreationOperation::RequestResponseL(TFSProgress aEvent,
   160                                                      TInt aRequestId)
   172                                                      TInt aRequestId)
   161 {
   173 {
       
   174     NM_FUNCTION;
       
   175     
   162     TFSProgress::TFSProgressStatus status = aEvent.iProgressStatus;
   176     TFSProgress::TFSProgressStatus status = aEvent.iProgressStatus;
   163 
   177 
   164     if (aRequestId == mRequestId) {
   178     if (aRequestId == mRequestId) {
   165         if (status == TFSProgress::EFSStatus_RequestComplete
   179         if (status == TFSProgress::EFSStatus_RequestComplete
   166             && aEvent.iParam) {
   180             && aEvent.iParam) {