equal
deleted
inserted
replaced
41 mMessage(message), |
41 mMessage(message), |
42 mMailClient(mailClient), |
42 mMailClient(mailClient), |
43 mRequestId(NmNotFoundError), |
43 mRequestId(NmNotFoundError), |
44 mSaved(false) |
44 mSaved(false) |
45 { |
45 { |
|
46 NM_FUNCTION; |
|
47 |
46 mMailClient.IncReferenceCount(); |
48 mMailClient.IncReferenceCount(); |
47 } |
49 } |
48 |
50 |
49 /*! |
51 /*! |
50 Destructor |
52 Destructor |
51 */ |
53 */ |
52 NmFwaMessageSendingOperation::~NmFwaMessageSendingOperation() |
54 NmFwaMessageSendingOperation::~NmFwaMessageSendingOperation() |
53 { |
55 { |
|
56 NM_FUNCTION; |
|
57 |
54 if (mSaveOperation && mSaveOperation->isRunning()) { |
58 if (mSaveOperation && mSaveOperation->isRunning()) { |
55 mSaveOperation->cancelOperation(); |
59 mSaveOperation->cancelOperation(); |
56 } |
60 } |
57 doCancelOperation(); |
61 doCancelOperation(); |
58 mMailClient.Close(); // decrease ref count |
62 mMailClient.Close(); // decrease ref count |
59 delete mMessage; |
63 delete mMessage; |
60 NMLOG("NmFwaMessageSendingOperation::~NmFwaMessageSendingOperation --->"); |
|
61 } |
64 } |
62 |
65 |
63 /*! |
66 /*! |
64 returns pointer to message, ownership is not transferred |
67 returns pointer to message, ownership is not transferred |
65 */ |
68 */ |
66 const NmMessage *NmFwaMessageSendingOperation::getMessage() const |
69 const NmMessage *NmFwaMessageSendingOperation::getMessage() const |
67 { |
70 { |
|
71 NM_FUNCTION; |
|
72 |
68 return mMessage; |
73 return mMessage; |
69 } |
74 } |
70 |
75 |
71 /*! |
76 /*! |
72 Called after base object construction via timer event, runs the |
77 Called after base object construction via timer event, runs the |
74 |
79 |
75 \sa NmOperation |
80 \sa NmOperation |
76 */ |
81 */ |
77 void NmFwaMessageSendingOperation::doRunAsyncOperation() |
82 void NmFwaMessageSendingOperation::doRunAsyncOperation() |
78 { |
83 { |
|
84 NM_FUNCTION; |
|
85 |
79 int err = NmNoError; |
86 int err = NmNoError; |
80 |
87 |
81 if (mSaved) { |
88 if (mSaved) { |
82 TRAPD(trapped, err = sendMessageL()); |
89 TRAPD(trapped, err = sendMessageL()); |
83 |
90 |
101 /*! |
108 /*! |
102 |
109 |
103 */ |
110 */ |
104 void NmFwaMessageSendingOperation::doCompleteOperation() |
111 void NmFwaMessageSendingOperation::doCompleteOperation() |
105 { |
112 { |
|
113 NM_FUNCTION; |
|
114 |
106 mRequestId = NmNotFoundError; |
115 mRequestId = NmNotFoundError; |
107 } |
116 } |
108 |
117 |
109 /*! |
118 /*! |
110 |
119 |
111 */ |
120 */ |
112 void NmFwaMessageSendingOperation::doCancelOperation() |
121 void NmFwaMessageSendingOperation::doCancelOperation() |
113 { |
122 { |
|
123 NM_FUNCTION; |
|
124 |
114 if (mRequestId >= 0) { |
125 if (mRequestId >= 0) { |
115 TRAP_IGNORE(mMailClient.CancelL(mRequestId)); |
126 TRAP_IGNORE(mMailClient.CancelL(mRequestId)); |
116 mRequestId = NmNotFoundError; |
127 mRequestId = NmNotFoundError; |
117 } |
128 } |
118 if (mSaveOperation && mSaveOperation->isRunning()) { |
129 if (mSaveOperation && mSaveOperation->isRunning()) { |
127 \param aRequestId Request id of asyncronous operation. |
138 \param aRequestId Request id of asyncronous operation. |
128 */ |
139 */ |
129 void NmFwaMessageSendingOperation::RequestResponseL(TFSProgress aEvent, |
140 void NmFwaMessageSendingOperation::RequestResponseL(TFSProgress aEvent, |
130 TInt aRequestId) |
141 TInt aRequestId) |
131 { |
142 { |
|
143 NM_FUNCTION; |
|
144 |
132 TFSProgress::TFSProgressStatus status = aEvent.iProgressStatus; |
145 TFSProgress::TFSProgressStatus status = aEvent.iProgressStatus; |
133 |
146 |
134 if (aRequestId == mRequestId) { |
147 if (aRequestId == mRequestId) { |
135 if (status == TFSProgress::EFSStatus_RequestComplete) { |
148 if (status == TFSProgress::EFSStatus_RequestComplete) { |
136 completeOperation(NmNoError); |
149 completeOperation(NmNoError); |
147 /*! |
160 /*! |
148 Handle completed store message operation |
161 Handle completed store message operation |
149 */ |
162 */ |
150 void NmFwaMessageSendingOperation::handleCompletedSaveOperation(int error) |
163 void NmFwaMessageSendingOperation::handleCompletedSaveOperation(int error) |
151 { |
164 { |
|
165 NM_FUNCTION; |
|
166 |
152 if (error == NmNoError) { |
167 if (error == NmNoError) { |
153 mSaved = true; |
168 mSaved = true; |
154 doRunAsyncOperation(); |
169 doRunAsyncOperation(); |
155 } |
170 } |
156 else { |
171 else { |
161 /*! |
176 /*! |
162 Saves a message with its subparts (into message store). |
177 Saves a message with its subparts (into message store). |
163 */ |
178 */ |
164 int NmFwaMessageSendingOperation::saveMessageWithSubparts() |
179 int NmFwaMessageSendingOperation::saveMessageWithSubparts() |
165 { |
180 { |
|
181 NM_FUNCTION; |
|
182 |
166 int ret = NmNotFoundError; |
183 int ret = NmNotFoundError; |
167 if (mMessage) { |
184 if (mMessage) { |
168 if (mSaveOperation && mSaveOperation->isRunning()) { |
185 if (mSaveOperation && mSaveOperation->isRunning()) { |
169 mSaveOperation->cancelOperation(); |
186 mSaveOperation->cancelOperation(); |
170 } |
187 } |
187 /*! |
204 /*! |
188 Sends the message. |
205 Sends the message. |
189 */ |
206 */ |
190 int NmFwaMessageSendingOperation::sendMessageL() |
207 int NmFwaMessageSendingOperation::sendMessageL() |
191 { |
208 { |
192 NMLOG("NmFwaMessageSendingOperation::sendMessageL"); |
209 NM_FUNCTION; |
|
210 |
193 int ret = NmNotFoundError; |
211 int ret = NmNotFoundError; |
194 |
212 |
195 if (mMessage) { |
213 if (mMessage) { |
196 TFSMailMsgId mailboxId = NmConverter::nmIdToMailMsgId(mMessage->envelope().mailboxId()); |
214 TFSMailMsgId mailboxId = NmConverter::nmIdToMailMsgId(mMessage->envelope().mailboxId()); |
197 CFSMailBox *currentMailbox( NULL ); |
215 CFSMailBox *currentMailbox( NULL ); |