equal
deleted
inserted
replaced
36 mCcAddresses(0), |
36 mCcAddresses(0), |
37 mBccAddresses(0), |
37 mBccAddresses(0), |
38 mAttachmentList(0), |
38 mAttachmentList(0), |
39 mEditorStartMode(NmUiEditorCreateNew) |
39 mEditorStartMode(NmUiEditorCreateNew) |
40 { |
40 { |
|
41 NM_FUNCTION; |
41 } |
42 } |
42 |
43 |
43 /*! |
44 /*! |
44 Class destructor. |
45 Class destructor. |
45 */ |
46 */ |
46 inline ~NmStartParamDataHelper() |
47 inline ~NmStartParamDataHelper() |
47 { |
48 { |
|
49 NM_FUNCTION; |
48 } |
50 } |
49 |
51 |
50 /*! |
52 /*! |
51 Extracts the data from the given QVariant into the class members. |
53 Extracts the data from the given QVariant into the class members. |
52 \param data QVariant containing the data. |
54 \param data QVariant containing the data. |
53 \return True if success, false otherwise. |
55 \return True if success, false otherwise. |
54 */ |
56 */ |
55 inline bool extractData(const QVariant &data) |
57 inline bool extractData(const QVariant &data) |
56 { |
58 { |
|
59 NM_FUNCTION; |
|
60 |
57 bool success = false; |
61 bool success = false; |
58 |
62 |
59 if (data.canConvert(QVariant::Map)) { |
63 if (data.canConvert(QVariant::Map)) { |
60 // The given data may contain a mail subject and recipient lists. |
64 // The given data may contain a mail subject and recipient lists. |
61 QMap<QString, QVariant> map = data.toMap(); |
65 QMap<QString, QVariant> map = data.toMap(); |
66 mAttachmentList = new QStringList(attachmentList); |
70 mAttachmentList = new QStringList(attachmentList); |
67 success = true; |
71 success = true; |
68 } |
72 } |
69 else { |
73 else { |
70 // Data type not supported! |
74 // Data type not supported! |
71 NMLOG(QString("NmStartParamDataHelper::extractData(): Data type %1 not supported!"). |
75 NM_ERROR(1,"NmStartParamDataHelper::extractData(): data type not supported"); |
72 arg(data.type())); |
|
73 } |
76 } |
74 |
77 |
75 // Determine the editor start mode. |
78 // Determine the editor start mode. |
76 if (mToAddresses || mCcAddresses || mBccAddresses) { |
79 if (mToAddresses || mCcAddresses || mBccAddresses) { |
77 mEditorStartMode = NmUiEditorMailto; |
80 mEditorStartMode = NmUiEditorMailto; |
87 Deletes the class members. Must be used if NmUiStartParam does not |
90 Deletes the class members. Must be used if NmUiStartParam does not |
88 take ownership of the members. |
91 take ownership of the members. |
89 */ |
92 */ |
90 inline void deleteData() |
93 inline void deleteData() |
91 { |
94 { |
|
95 NM_FUNCTION; |
|
96 |
92 delete mSubject; |
97 delete mSubject; |
93 mSubject = 0; |
98 mSubject = 0; |
94 |
99 |
95 if (mToAddresses) { |
100 if (mToAddresses) { |
96 qDeleteAll(*mToAddresses); |
101 qDeleteAll(*mToAddresses); |
122 \param map The map to extract the data from. |
127 \param map The map to extract the data from. |
123 \return True if success, false otherwise. |
128 \return True if success, false otherwise. |
124 */ |
129 */ |
125 inline bool processMap(const QMap<QString, QVariant> &map) |
130 inline bool processMap(const QMap<QString, QVariant> &map) |
126 { |
131 { |
|
132 NM_FUNCTION; |
|
133 |
127 QMap<QString, QVariant>::const_iterator i = map.constBegin(); |
134 QMap<QString, QVariant>::const_iterator i = map.constBegin(); |
128 QString key; |
135 QString key; |
129 QVariant value; |
136 QVariant value; |
130 |
137 |
131 while (i != map.constEnd()) { |
138 while (i != map.constEnd()) { |
171 \param list The list where the addresses are appended to. |
178 \param list The list where the addresses are appended to. |
172 */ |
179 */ |
173 inline void addAddressesToList(const QVariant &addresses, |
180 inline void addAddressesToList(const QVariant &addresses, |
174 QList<NmAddress*> **list) |
181 QList<NmAddress*> **list) |
175 { |
182 { |
176 |
183 NM_FUNCTION; |
|
184 |
177 if (!list) { |
185 if (!list) { |
178 // Invalid argument! |
186 // Invalid argument! |
179 return; |
187 return; |
180 } |
188 } |
181 |
189 |
262 /*! |
270 /*! |
263 Class desctructor. |
271 Class desctructor. |
264 */ |
272 */ |
265 NmSendServiceInterface::~NmSendServiceInterface() |
273 NmSendServiceInterface::~NmSendServiceInterface() |
266 { |
274 { |
|
275 NM_FUNCTION; |
|
276 |
267 delete mStartParam; |
277 delete mStartParam; |
268 delete mSelectionDialog; |
278 delete mSelectionDialog; |
269 } |
279 } |
270 |
280 |
271 |
281 |
274 \param mailboxId Where the ID of the selected mailbox is set. |
284 \param mailboxId Where the ID of the selected mailbox is set. |
275 \return True if a mailbox was selected, false otherwise. |
285 \return True if a mailbox was selected, false otherwise. |
276 */ |
286 */ |
277 void NmSendServiceInterface::selectionDialogClosed(NmId &mailboxId) |
287 void NmSendServiceInterface::selectionDialogClosed(NmId &mailboxId) |
278 { |
288 { |
279 NMLOG(QString("NmSendServiceInterface::selectionDialogClosed %1").arg(mailboxId.id())); |
289 NM_FUNCTION; |
|
290 |
280 if (mailboxId.id()) { // mailbox selected |
291 if (mailboxId.id()) { // mailbox selected |
281 launchEditorView(mailboxId); |
292 launchEditorView(mailboxId); |
282 } |
293 } |
283 else { |
294 else { |
284 cancelService(); |
295 cancelService(); |
296 attach. Can also contain a map with key value pairs containing |
307 attach. Can also contain a map with key value pairs containing |
297 subject and recipient data. |
308 subject and recipient data. |
298 */ |
309 */ |
299 void NmSendServiceInterface::send(QVariant data) |
310 void NmSendServiceInterface::send(QVariant data) |
300 { |
311 { |
301 NMLOG("NmSendServiceInterface::send()"); |
312 NM_FUNCTION; |
302 |
313 |
303 #ifndef NM_WINS_ENV |
314 #ifndef NM_WINS_ENV |
|
315 |
|
316 // Make sure that qmail stays background if user presses back in editorview |
|
317 mApplication->updateVisibilityState(); |
|
318 |
304 HbMainWindow *mainWindow = mApplication->mainWindow(); |
319 HbMainWindow *mainWindow = mApplication->mainWindow(); |
305 mCurrentView = mainWindow->currentView(); |
320 mCurrentView = mainWindow->currentView(); |
306 |
321 |
307 // Hide the current view. |
322 // Hide the current view. |
308 if (mCurrentView) { |
323 if (mCurrentView) { |
319 |
334 |
320 mAsyncReqId = setCurrentRequestAsync(); |
335 mAsyncReqId = setCurrentRequestAsync(); |
321 |
336 |
322 if (!validData) { |
337 if (!validData) { |
323 // Failed to extract the data! |
338 // Failed to extract the data! |
324 NMLOG("NmSendServiceInterface::send(): Failed to process the given data!"); |
339 NM_ERROR(1,"NmSendServiceInterface::send(): failed to process the given data"); |
325 cancelService(); |
340 cancelService(); |
326 } |
341 } |
327 else if (count == 0) { |
342 else if (count == 0) { |
328 HbDeviceMessageBox note(hbTrId("txt_mail_dialog_no_mailboxes_defined"), |
343 HbDeviceMessageBox note(hbTrId("txt_mail_dialog_no_mailboxes_defined"), |
329 HbMessageBox::MessageTypeInformation); |
344 HbMessageBox::MessageTypeInformation); |
376 Called when mailbox id is know and editor can be opened |
391 Called when mailbox id is know and editor can be opened |
377 \param mailboxId mailbox using in editor |
392 \param mailboxId mailbox using in editor |
378 */ |
393 */ |
379 void NmSendServiceInterface::launchEditorView(NmId mailboxId) |
394 void NmSendServiceInterface::launchEditorView(NmId mailboxId) |
380 { |
395 { |
381 NMLOG(QString("NmSendServiceInterface::launchEditorView %1").arg(mailboxId.id())); |
396 NM_FUNCTION; |
|
397 NM_COMMENT(QString("NmSendServiceInterface::launchEditorView(): mailboxId=%1").arg(mailboxId.id())); |
|
398 |
382 // Make the previous view visible again. |
399 // Make the previous view visible again. |
383 if (mCurrentView) { |
400 if (mCurrentView) { |
384 mCurrentView->show(); |
401 mCurrentView->show(); |
385 mCurrentView = NULL; |
402 mCurrentView = NULL; |
386 } |
403 } |
394 mAsyncReqId = 0; |
411 mAsyncReqId = 0; |
395 } |
412 } |
396 |
413 |
397 void NmSendServiceInterface::cancelService() |
414 void NmSendServiceInterface::cancelService() |
398 { |
415 { |
399 NMLOG("NmSendServiceInterface::cancelService"); |
416 NM_FUNCTION; |
|
417 |
400 delete mStartParam; |
418 delete mStartParam; |
401 mStartParam = NULL; |
419 mStartParam = NULL; |
402 |
420 |
403 // If the service was started as embedded, do not hide the app. |
421 // If the service was started as embedded, do not hide the app. |
404 if (!XQServiceUtil::isEmbedded()) { |
422 if (!XQServiceUtil::isEmbedded()) { |