34 #include "ringbc.h" |
34 #include "ringbc.h" |
35 #include "unidatamodelloader.h" |
35 #include "unidatamodelloader.h" |
36 #include "unidatamodelplugininterface.h" |
36 #include "unidatamodelplugininterface.h" |
37 |
37 |
38 // LOCALIZATION |
38 // LOCALIZATION |
39 #define LOC_BUTTON_DELETE hbTrId("txt_common_button_delete") |
|
40 #define LOC_BUTTON_CANCEL hbTrId("txt_common_button_cancel") |
|
41 #define LOC_DELETE_MESSAGE hbTrId("txt_messaging_dialog_delete_message") |
39 #define LOC_DELETE_MESSAGE hbTrId("txt_messaging_dialog_delete_message") |
42 #define LOC_DLG_SAVE_RINGTONE hbTrId("txt_conversations_dialog_save_ringing_tone") |
40 #define LOC_DLG_SAVE_RINGTONE hbTrId("txt_conversations_dialog_save_ringing_tone") |
43 #define LOC_BUTTON_SAVE hbTrId("txt_common_menu_save") |
|
44 |
41 |
45 //---------------------------------------------------------------------------- |
42 //---------------------------------------------------------------------------- |
46 // MsgViewInterface::MsgViewInterface |
43 // MsgViewInterface::MsgViewInterface |
47 // @see header |
44 // @see header |
48 //---------------------------------------------------------------------------- |
45 //---------------------------------------------------------------------------- |
213 |
210 |
214 //---------------------------------------------------------------------------- |
211 //---------------------------------------------------------------------------- |
215 // MsgServiceViewManager::send |
212 // MsgServiceViewManager::send |
216 // @see header |
213 // @see header |
217 //---------------------------------------------------------------------------- |
214 //---------------------------------------------------------------------------- |
|
215 void MsgServiceViewManager::send(const QVariantMap addressList, |
|
216 const QString bodyText) |
|
217 { |
|
218 QStringList phoneNumList = addressList.keys(); |
|
219 |
|
220 ConvergedMessageAddressList addrList; |
|
221 |
|
222 int count = phoneNumList.count(); |
|
223 for( int i = 0; i < count; ++ i ) |
|
224 { |
|
225 QString phNum = phoneNumList[i]; |
|
226 ConvergedMessageAddress* address = new ConvergedMessageAddress(phNum, |
|
227 addressList.value(phNum).toString()); |
|
228 addrList.append(address); |
|
229 } |
|
230 |
|
231 ConvergedMessage message; |
|
232 message.addToRecipients(addrList); |
|
233 message.setBodyText(bodyText); |
|
234 |
|
235 QVariantList param; |
|
236 QByteArray dataArray; |
|
237 QDataStream messageStream(&dataArray, |
|
238 QIODevice::WriteOnly | QIODevice::Append); |
|
239 message.serialize(messageStream); |
|
240 param << dataArray; |
|
241 |
|
242 // switch to editor |
|
243 switchToUniEditor(param); |
|
244 |
|
245 XQServiceUtil::toBackground(false); |
|
246 } |
|
247 |
|
248 //---------------------------------------------------------------------------- |
|
249 // MsgServiceViewManager::send |
|
250 // @see header |
|
251 //---------------------------------------------------------------------------- |
218 void MsgServiceViewManager::send(QVariant data) |
252 void MsgServiceViewManager::send(QVariant data) |
219 { |
253 { |
220 ConvergedMessage message; |
254 ConvergedMessage message; |
221 ConvergedMessageAttachmentList attachmentList; |
255 ConvergedMessageAttachmentList attachmentList; |
222 // handle multiple files from sendUI |
256 // handle multiple files from sendUI |
330 } |
364 } |
331 default: |
365 default: |
332 { |
366 { |
333 // for un supported message show delete option |
367 // for un supported message show delete option |
334 HbMessageBox::question(LOC_DELETE_MESSAGE, |
368 HbMessageBox::question(LOC_DELETE_MESSAGE, |
335 this,SLOT(onDialogDeleteMsg(HbAction*)), |
369 this,SLOT(onDialogDeleteMsg(HbAction*)), |
336 LOC_BUTTON_DELETE, |
370 HbMessageBox::Delete | HbMessageBox::Cancel); |
337 LOC_BUTTON_CANCEL); |
|
338 break; |
371 break; |
339 } |
372 } |
340 } |
373 } |
341 } |
374 } |
342 |
375 |
343 // ---------------------------------------------------------------------------- |
376 // ---------------------------------------------------------------------------- |
344 // MsgServiceViewManager::handleSmsMmsMsg |
377 // MsgServiceViewManager::handleSmsMmsMsg |
345 // @see header |
378 // @see header |
346 // ---------------------------------------------------------------------------- |
379 // ---------------------------------------------------------------------------- |
347 void MsgServiceViewManager::handleSmsMmsMsg(int msgId) |
380 void MsgServiceViewManager::handleSmsMmsMsg(int msgId,int msgType) |
348 { |
381 { |
349 if (!mUniViewer) { |
382 if(mStoreHandler->isDraftMessage(msgId)) |
350 mUniViewer = new UnifiedViewer(msgId); |
383 { |
351 mUniViewer->setNavigationAction(mBackAction); |
384 ConvergedMessageId convergedMsgId = ConvergedMessageId(msgId); |
352 mMainWindow->addView(mUniViewer); |
385 ConvergedMessage message; |
353 connect(mUniViewer, SIGNAL(switchView(const QVariantList&)), this, |
386 message.setMessageType((ConvergedMessage::MessageType) msgType); |
354 SLOT(switchView(const QVariantList&))); |
387 message.setMessageId(convergedMsgId); |
355 } |
388 |
356 mUniViewer->populateContent(msgId, true, 1); |
389 // Launch uni-editor view |
357 |
390 QByteArray dataArray; |
358 mMainWindow->setCurrentView(mUniViewer); |
391 QDataStream messageStream(&dataArray, QIODevice::WriteOnly | QIODevice::Append); |
359 |
392 message.serialize(messageStream); |
360 // set current view as viewer |
393 |
361 mCurrentView = MsgBaseView::UNIVIEWER; |
394 QVariantList params; |
362 } |
395 params << MsgBaseView::UNIEDITOR; // target view |
|
396 params << MsgBaseView::SERVICE; // source view |
|
397 |
|
398 params << dataArray; |
|
399 |
|
400 // except first 2 parameters pass other parameters |
|
401 QVariantList editorData; |
|
402 for(int a = 2; a < params.length(); ++a) |
|
403 { |
|
404 editorData << params.at(a); |
|
405 } |
|
406 // construct |
|
407 if (!mUniEditor) { |
|
408 mUniEditor = new MsgUnifiedEditorView(); |
|
409 mMainWindow->addView(mUniEditor); |
|
410 mUniEditor->setNavigationAction(mBackAction); |
|
411 connect(mUniEditor, SIGNAL(switchView(const QVariantList&)), this, |
|
412 SLOT(switchView(const QVariantList&))); |
|
413 } |
|
414 |
|
415 // check if additional data for unieditor's consumption is available |
|
416 mUniEditor->openDraftsMessage(editorData); |
|
417 |
|
418 mMainWindow->setCurrentView(mUniEditor); |
|
419 mCurrentView = MsgBaseView::UNIEDITOR; |
|
420 } |
|
421 else |
|
422 { |
|
423 if (!mUniViewer) { |
|
424 mUniViewer = new UnifiedViewer(msgId); |
|
425 mUniViewer->setNavigationAction(mBackAction); |
|
426 mMainWindow->addView(mUniViewer); |
|
427 connect(mUniViewer, SIGNAL(switchView(const QVariantList&)), this, |
|
428 SLOT(switchView(const QVariantList&))); |
|
429 } |
|
430 mUniViewer->populateContent(msgId, true, 1); |
|
431 |
|
432 mMainWindow->setCurrentView(mUniViewer); |
|
433 |
|
434 // set current view as viewer |
|
435 mCurrentView = MsgBaseView::UNIVIEWER; |
|
436 } |
|
437 } |
363 |
438 |
364 // ---------------------------------------------------------------------------- |
439 // ---------------------------------------------------------------------------- |
365 // MsgServiceViewManager::handleRingtoneMsg |
440 // MsgServiceViewManager::handleRingtoneMsg |
366 // @see header |
441 // @see header |
367 // ---------------------------------------------------------------------------- |
442 // ---------------------------------------------------------------------------- |
368 void MsgServiceViewManager::handleRingtoneMsg(int msgId) |
443 void MsgServiceViewManager::handleRingtoneMsg(int msgId) |
369 { |
444 { |
370 mMessageId = msgId; |
445 mMessageId = msgId; |
371 HbMessageBox::question(LOC_DLG_SAVE_RINGTONE, this, |
446 HbMessageBox::question(LOC_DLG_SAVE_RINGTONE, this, |
372 SLOT(onDialogSaveTone(HbAction*)), LOC_BUTTON_SAVE, LOC_BUTTON_CANCEL); |
447 SLOT(onDialogSaveTone(HbAction*)), |
|
448 HbMessageBox::Save | HbMessageBox::Cancel); |
373 } |
449 } |
374 |
450 |
375 // ---------------------------------------------------------------------------- |
451 // ---------------------------------------------------------------------------- |
376 // MsgServiceViewManager::handleProvisoningMsg |
452 // MsgServiceViewManager::handleProvisoningMsg |
377 // @see header |
453 // @see header |