22 #include <HbAction> |
22 #include <HbAction> |
23 #include <xqserviceutil.h> |
23 #include <xqserviceutil.h> |
24 #include <QSqlQuery> |
24 #include <QSqlQuery> |
25 #include <QSqlError> |
25 #include <QSqlError> |
26 #include <HbApplication> |
26 #include <HbApplication> |
27 #include <HbNotificationDialog> |
27 #include <xqappmgr.h> |
|
28 #include <HbMessageBox.h> |
28 |
29 |
29 #include "conversationsengine.h" |
30 #include "conversationsengine.h" |
30 #include "msglistview.h" |
31 #include "msglistview.h" |
31 #include "msgunieditorview.h" |
32 #include "msgunieditorview.h" |
32 #include "msgconversationbaseview.h" |
33 #include "msgconversationbaseview.h" |
33 #include "unifiedviewer.h" |
34 #include "unifiedviewer.h" |
34 #include "draftslistview.h" |
35 #include "draftslistview.h" |
35 #include "msgsettingsview.h" |
36 #include "msgsettingsview.h" |
36 #include "convergedmessageid.h" |
37 #include "convergedmessageid.h" |
|
38 #include "ringbc.h" |
|
39 #include "unidatamodelloader.h" |
|
40 #include "unidatamodelplugininterface.h" |
37 |
41 |
38 // LOCALIZATION |
42 // LOCALIZATION |
39 #define LOC_SAVED_TO_DRAFTS ("Saved to Drafts") |
43 #define LOC_BUTTON_DELETE hbTrId("txt_common_button_delete") |
|
44 #define LOC_BUTTON_CANCEL hbTrId("txt_common_button_cancel") |
|
45 #define LOC_DELETE_MESSAGE hbTrId("txt_messaging_dialog_delete_message") |
40 |
46 |
41 const qint64 NULL_CONVERSATIONID = -1; |
47 const qint64 NULL_CONVERSATIONID = -1; |
42 |
48 |
43 MsgViewManager::MsgViewManager(bool serviceRequest, HbMainWindow* mainWindow, QObject* parent) : |
49 MsgViewManager::MsgViewManager(bool serviceRequest, HbMainWindow* mainWindow, QObject* parent) : |
44 QObject(parent), mMainWindow(mainWindow), mUniEditor(0), mListView(0), mConversationView(0), |
50 QObject(parent), mMainWindow(mainWindow), mUniEditor(0), mListView(0), mConversationView(0), |
45 mUniViewer(0), mDraftsListView(0), mSettingsView(0), mBackAction(0), mServiceRequest( |
51 mUniViewer(0), mDraftsListView(0), mSettingsView(0), mBackAction(0), mServiceRequest( |
46 serviceRequest), mConversationId(-1) |
52 serviceRequest), mConversationId(-1), mViewServiceRequest(false) |
47 { |
53 { |
48 //creating back action. |
54 //creating back action. |
49 mBackAction = new HbAction(Hb::BackAction, this); |
55 mBackAction = new HbAction(Hb::BackAction, this); |
50 connect(mBackAction, SIGNAL(triggered()), this, SLOT(onBackAction())); |
56 connect(mBackAction, SIGNAL(triggered()), this, SLOT(onBackAction())); |
51 |
57 |
79 } |
91 } |
80 |
92 |
81 case MsgBaseView::CV: |
93 case MsgBaseView::CV: |
82 { |
94 { |
83 //Save content to drafts before switching to clv |
95 //Save content to drafts before switching to clv |
84 bool result = mConversationView->saveContentToDrafts(); |
96 mConversationView->saveContentToDrafts(); |
85 |
97 |
86 //marking messages as red in CV. |
98 //marking messages as red in CV. |
87 mConversationView->markMessagesAsRead(); |
99 mConversationView->markMessagesAsRead(); |
88 |
100 |
89 //clearing content of cv. |
101 //clearing content of cv. |
90 mConversationView->clearContent(); |
102 mConversationView->clearContent(); |
|
103 |
|
104 // if service request for veiwer the just switch to univiewer. |
|
105 if (mViewServiceRequest) { |
|
106 mCurrentView = MsgBaseView::UNIVIEWER; |
|
107 mMainWindow->setCurrentView(mUniViewer); |
|
108 break; |
|
109 } |
91 |
110 |
92 if (mServiceRequest) { |
111 if (mServiceRequest) { |
93 completeServiceRequest(); |
112 completeServiceRequest(); |
94 } |
113 } |
95 else { |
114 else { |
96 //switch to clv. |
115 //switch to clv. |
97 QVariantList param; |
116 QVariantList param; |
98 param << MsgBaseView::CLV; |
117 param << MsgBaseView::CLV; |
99 param << MsgBaseView::CV; |
118 param << MsgBaseView::CV; |
100 switchView(param); |
119 switchView(param); |
101 if (result) { |
|
102 HbNotificationDialog::launchDialog(LOC_SAVED_TO_DRAFTS); |
|
103 } |
|
104 } |
120 } |
105 |
121 |
106 break; |
122 break; |
107 } |
123 } |
108 |
124 |
123 } |
139 } |
124 |
140 |
125 case MsgBaseView::UNIEDITOR: |
141 case MsgBaseView::UNIEDITOR: |
126 { |
142 { |
127 //Save content to drafts before switching to clv |
143 //Save content to drafts before switching to clv |
128 bool result = mUniEditor->saveContentToDrafts(); |
144 mUniEditor->saveContentToDrafts(); |
|
145 |
|
146 // if service request for veiwer the just switch to univiewer. |
|
147 if (mViewServiceRequest) { |
|
148 mCurrentView = MsgBaseView::UNIVIEWER; |
|
149 mMainWindow->setCurrentView(mUniViewer); |
|
150 break; |
|
151 } |
|
152 |
|
153 //Now UE can be launched from viewer and on its back |
|
154 //we need to clear viewer |
|
155 if (mUniViewer) { |
|
156 mMainWindow->removeView(mUniViewer); |
|
157 delete mUniViewer; |
|
158 mUniViewer = NULL; |
|
159 } |
129 |
160 |
130 //switch to clv. |
161 //switch to clv. |
131 if (mServiceRequest) { |
162 if (mServiceRequest) { |
132 completeServiceRequest(); |
163 completeServiceRequest(); |
133 } |
164 } |
135 //switch to clv. |
166 //switch to clv. |
136 QVariantList param; |
167 QVariantList param; |
137 param << MsgBaseView::CLV; |
168 param << MsgBaseView::CLV; |
138 param << MsgBaseView::UNIEDITOR; |
169 param << MsgBaseView::UNIEDITOR; |
139 switchView(param); |
170 switchView(param); |
140 if (result) { |
|
141 HbNotificationDialog::launchDialog(LOC_SAVED_TO_DRAFTS); |
|
142 } |
|
143 } |
171 } |
144 |
172 |
145 break; |
173 break; |
146 } |
174 } |
147 |
175 |
148 case MsgBaseView::UNIVIEWER: |
176 case MsgBaseView::UNIVIEWER: |
149 { |
177 { |
150 //swich to cv. |
178 // if its launched via service request quit the app |
|
179 if (mViewServiceRequest) { |
|
180 HbApplication::quit(); |
|
181 } |
|
182 else { |
|
183 QVariantList param; |
|
184 param << MsgBaseView::CV; |
|
185 param << MsgBaseView::UNIVIEWER; |
|
186 param << mConversationId; |
|
187 switchView(param); |
|
188 |
|
189 delete mUniViewer; |
|
190 mUniViewer = NULL; |
|
191 } |
|
192 break; |
|
193 } |
|
194 case MsgBaseView::MSGSETTINGS: |
|
195 { |
151 QVariantList param; |
196 QVariantList param; |
152 param << MsgBaseView::CV; |
197 param << MsgBaseView::DEFAULT; |
153 param << MsgBaseView::UNIVIEWER; |
198 param << MsgBaseView::MSGSETTINGS; |
154 param << mConversationId; |
|
155 switchView(param); |
199 switchView(param); |
156 |
200 break; |
157 mUniViewer->clearContent(); |
201 } |
158 |
|
159 break; |
|
160 } |
|
161 |
|
162 default: |
202 default: |
163 { |
203 { |
164 break; |
204 break; |
165 } |
205 } |
166 } |
206 } |
243 } |
283 } |
244 switchView(param); |
284 switchView(param); |
245 XQServiceUtil::toBackground(false); |
285 XQServiceUtil::toBackground(false); |
246 } |
286 } |
247 |
287 |
|
288 void MsgViewManager::send(const QString phoneNumber, const QString alias, const QString bodyText) |
|
289 { |
|
290 ConvergedMessage message; |
|
291 ConvergedMessageAddress address; |
|
292 address.setAddress(phoneNumber); |
|
293 address.setAlias(alias); |
|
294 message.addToRecipient(address); |
|
295 message.setBodyText(bodyText); |
|
296 |
|
297 QVariantList param; |
|
298 QByteArray dataArray; |
|
299 QDataStream messageStream(&dataArray, QIODevice::WriteOnly | QIODevice::Append); |
|
300 message.serialize(messageStream); |
|
301 |
|
302 param << MsgBaseView::UNIEDITOR; |
|
303 param << MsgBaseView::SERVICE; |
|
304 param << dataArray; |
|
305 |
|
306 switchView(param); |
|
307 XQServiceUtil::toBackground(false); |
|
308 } |
|
309 |
248 void MsgViewManager::setServiceRequest(bool request) |
310 void MsgViewManager::setServiceRequest(bool request) |
249 { |
311 { |
250 mServiceRequest = request; |
312 mServiceRequest = request; |
251 mViewAtServiceRequest = mCurrentView; |
313 mViewAtServiceRequest = mCurrentView; |
252 } |
314 } |
299 |
361 |
300 void MsgViewManager::send(QVariant data) |
362 void MsgViewManager::send(QVariant data) |
301 { |
363 { |
302 ConvergedMessage message; |
364 ConvergedMessage message; |
303 ConvergedMessageAttachmentList attachmentList; |
365 ConvergedMessageAttachmentList attachmentList; |
304 QString path = data.toString(); |
366 // handle multiple files from sendUI |
305 ConvergedMessageAttachment *attachment = new ConvergedMessageAttachment(path); |
367 // e.g. contacts can send multiple vcards |
306 |
368 QStringList receivedFiles = data.toStringList(); |
307 attachmentList.append(attachment); |
369 int recFileCount = receivedFiles.count(); |
|
370 for (int i = 0; i < recFileCount; i++) { |
|
371 ConvergedMessageAttachment *attachment = |
|
372 new ConvergedMessageAttachment(receivedFiles.at(i)); |
|
373 attachmentList.append(attachment); |
|
374 } |
308 message.addAttachments(attachmentList); |
375 message.addAttachments(attachmentList); |
309 |
376 |
310 QByteArray dataArray; |
377 QByteArray dataArray; |
311 QDataStream messageStream(&dataArray, QIODevice::WriteOnly | QIODevice::Append); |
378 QDataStream messageStream(&dataArray, QIODevice::WriteOnly | QIODevice::Append); |
312 message.serialize(messageStream); |
379 message.serialize(messageStream); |
358 { |
425 { |
359 //switch to CLV. |
426 //switch to CLV. |
360 mCurrentView = MsgBaseView::CLV; |
427 mCurrentView = MsgBaseView::CLV; |
361 mPreviousView = data.at(1).toInt(); |
428 mPreviousView = data.at(1).toInt(); |
362 |
429 |
363 //delete uni editor. |
430 // delete case from viewer service |
364 if (mUniEditor) { |
431 if (mViewServiceRequest && (mPreviousView == MsgBaseView::UNIVIEWER)) { |
365 mMainWindow->removeView(mUniEditor); |
432 // quit the application |
366 delete mUniEditor; |
433 HbApplication::quit(); |
367 mUniEditor = NULL; |
434 } |
368 } |
435 |
369 //remove the settings view from main window |
436 //remove the settings view from main window |
370 if (mSettingsView) { |
437 if (mSettingsView) { |
371 mMainWindow->removeView(mSettingsView); |
438 mMainWindow->removeView(mSettingsView); |
372 mSettingsView->setNavigationAction(mBackAction); |
439 mSettingsView->setNavigationAction(mBackAction); |
373 connect(mBackAction, SIGNAL(triggered()), this, SLOT(onBackAction()), Qt::UniqueConnection); |
440 connect(mBackAction, SIGNAL(triggered()), this, SLOT(onBackAction()), Qt::UniqueConnection); |
381 mListView = new MsgListView(); |
448 mListView = new MsgListView(); |
382 mListView->setNavigationAction(mBackAction); |
449 mListView->setNavigationAction(mBackAction); |
383 connect(mListView, SIGNAL(switchView(const QVariantList&)), this, |
450 connect(mListView, SIGNAL(switchView(const QVariantList&)), this, |
384 SLOT(switchView(const QVariantList&))); |
451 SLOT(switchView(const QVariantList&))); |
385 mMainWindow->addView(mListView); |
452 mMainWindow->addView(mListView); |
386 mListView->activateView(); |
453 } |
387 } |
|
388 mMainWindow->setCurrentView(mListView); |
|
389 } |
|
390 |
|
391 void MsgViewManager::switchToCv(const QVariantList& data) |
|
392 { |
|
393 //switch to CV. |
|
394 mCurrentView = MsgBaseView::CV; |
|
395 mPreviousView = data.at(1).toInt(); |
|
396 |
454 |
397 //delete uni editor. |
455 //delete uni editor. |
398 if (mUniEditor) { |
456 if (mUniEditor) { |
399 mMainWindow->removeView(mUniEditor); |
457 mMainWindow->removeView(mUniEditor); |
400 delete mUniEditor; |
458 delete mUniEditor; |
401 mUniEditor = NULL; |
459 mUniEditor = NULL; |
|
460 } |
|
461 |
|
462 if (mUniViewer) { |
|
463 mMainWindow->removeView(mUniViewer); |
|
464 delete mUniViewer; |
|
465 mUniViewer = NULL; |
|
466 } |
|
467 |
|
468 mMainWindow->setCurrentView(mListView); |
|
469 } |
|
470 |
|
471 void MsgViewManager::switchToCv(const QVariantList& data) |
|
472 { |
|
473 //switch to CV. |
|
474 mCurrentView = MsgBaseView::CV; |
|
475 mPreviousView = data.at(1).toInt(); |
|
476 |
|
477 // delete case from viewer service |
|
478 if (mViewServiceRequest && (mPreviousView == MsgBaseView::UNIVIEWER)) { |
|
479 // quit the application |
|
480 HbApplication::quit(); |
|
481 } |
|
482 |
|
483 //delete uni editor. |
|
484 if (mUniEditor) { |
|
485 mMainWindow->removeView(mUniEditor); |
|
486 delete mUniEditor; |
|
487 mUniEditor = NULL; |
|
488 } |
|
489 |
|
490 if (mUniViewer) { |
|
491 mMainWindow->removeView(mUniViewer); |
|
492 delete mUniViewer; |
|
493 mUniViewer = NULL; |
402 } |
494 } |
403 |
495 |
404 QVariant var = data.at(2); |
496 QVariant var = data.at(2); |
405 qint64 conversationId; |
497 qint64 conversationId; |
406 if (var.type() == QVariant::String) { |
498 if (var.type() == QVariant::String) { |
489 mUniEditor->setNavigationAction(mBackAction); |
592 mUniEditor->setNavigationAction(mBackAction); |
490 connect(mUniEditor, SIGNAL(switchView(const QVariantList&)), this, |
593 connect(mUniEditor, SIGNAL(switchView(const QVariantList&)), this, |
491 SLOT(switchView(const QVariantList&))); |
594 SLOT(switchView(const QVariantList&))); |
492 } |
595 } |
493 |
596 |
|
597 // check if additional data for unieditor's consumption is available |
494 if (data.length() > 2) { |
598 if (data.length() > 2) { |
495 QByteArray dataArray = data.at(2).toByteArray(); |
599 QVariantList editorData; |
496 ConvergedMessage *message = new ConvergedMessage; |
600 // i=2 because view manager consumed first two args |
497 QDataStream stream(&dataArray, QIODevice::ReadOnly); |
601 for (int i = 2; i < data.length(); i++) { |
498 message->deserialize(stream); |
602 editorData << data.at(i); |
499 |
603 } |
500 if (data.length() > 3) { |
604 |
501 mUniEditor->populateContent(*message, data.at(3).toInt()); |
605 if (MsgBaseView::DLV == mPreviousView) { |
|
606 mUniEditor->openDraftsMessage(editorData); |
502 } |
607 } |
503 else { |
608 else { |
504 if (MsgBaseView::DLV == mPreviousView) { |
609 mUniEditor->populateContent(editorData); |
505 mUniEditor->openDraftsMessage(*(message->id()), message->messageType()); |
610 } |
506 } |
|
507 else { |
|
508 mUniEditor->populateContent(*message); |
|
509 } |
|
510 } |
|
511 delete message; |
|
512 } |
611 } |
513 |
612 |
514 if (mServiceRequest) { |
613 if (mServiceRequest) { |
515 mMainWindow->setCurrentView(mUniEditor, false); |
614 mMainWindow->setCurrentView(mUniEditor); |
516 } |
615 } |
517 else { |
616 else { |
518 mMainWindow->setCurrentView(mUniEditor); |
617 mMainWindow->setCurrentView(mUniEditor); |
519 } |
618 } |
520 } |
619 } |
521 |
620 |
522 void MsgViewManager::switchToUniViewer(const QVariantList& data) |
621 void MsgViewManager::switchToUniViewer(const QVariantList& data) |
523 { |
622 { |
|
623 /** |
|
624 * Viewer is tried to open again before exiting the previously |
|
625 * opened viewer. Multi taping bubbles in CV. |
|
626 */ |
|
627 if (mUniViewer) { |
|
628 return; |
|
629 } |
|
630 |
524 mCurrentView = MsgBaseView::UNIVIEWER; |
631 mCurrentView = MsgBaseView::UNIVIEWER; |
525 mPreviousView = data.at(1).toInt(); |
632 mPreviousView = data.at(1).toInt(); |
526 |
633 |
527 //switch to univiewer. |
634 //switch to univiewer. |
528 if (data.length() > 2) { |
635 if (data.length() > 2) { |
531 int msgCount = data.at(4).toInt(); |
638 int msgCount = data.at(4).toInt(); |
532 |
639 |
533 ConvergedMessage *message = new ConvergedMessage; |
640 ConvergedMessage *message = new ConvergedMessage; |
534 QDataStream stream(&dataArray, QIODevice::ReadOnly); |
641 QDataStream stream(&dataArray, QIODevice::ReadOnly); |
535 message->deserialize(stream); |
642 message->deserialize(stream); |
536 qint32 messageId = message->id()->getId(); |
643 qint32 messageId = message->id()->getId(); |
537 if (!mUniViewer) { |
644 if (!mUniViewer) { |
538 mUniViewer = new UnifiedViewer(messageId); |
645 mUniViewer = new UnifiedViewer(messageId); |
539 mUniViewer->setNavigationAction(mBackAction); |
646 mUniViewer->setNavigationAction(mBackAction); |
540 mMainWindow->addView(mUniViewer); |
647 mMainWindow->addView(mUniViewer); |
541 connect(mUniViewer, SIGNAL(switchView(const QVariantList&)), this, |
648 connect(mUniViewer, SIGNAL(switchView(const QVariantList&)), this, |
551 mCurrentView = MsgBaseView::MSGSETTINGS; |
658 mCurrentView = MsgBaseView::MSGSETTINGS; |
552 mPreviousView = data.at(1).toInt(); |
659 mPreviousView = data.at(1).toInt(); |
553 |
660 |
554 if (!mSettingsView) { |
661 if (!mSettingsView) { |
555 mSettingsView = new MsgSettingsView(); |
662 mSettingsView = new MsgSettingsView(); |
556 connect(mSettingsView, SIGNAL(switchView(const QVariantList&)), this, |
663 mSettingsView->setNavigationAction(mBackAction); |
557 SLOT(switchView(const QVariantList&))); |
664 mMainWindow->addView(mSettingsView); |
558 } |
665 mMainWindow->setCurrentView(mSettingsView); |
559 else { |
666 } |
560 //re-connect the back action |
|
561 mSettingsView->connectCloseAction(); |
|
562 } |
|
563 |
|
564 mMainWindow->addView(mSettingsView); |
|
565 disconnect(mBackAction, SIGNAL(triggered()), this, SLOT(onBackAction())); |
|
566 mMainWindow->setCurrentView(mSettingsView); |
|
567 } |
667 } |
568 |
668 |
569 void MsgViewManager::handleDefault(const QVariantList& data) |
669 void MsgViewManager::handleDefault(const QVariantList& data) |
570 { |
670 { |
571 //special handling incase we switch from settings-view |
671 //special handling incase we switch from settings-view |
575 mCurrentView = mPreviousView; |
675 mCurrentView = mPreviousView; |
576 mPreviousView = previousViewId; |
676 mPreviousView = previousViewId; |
577 //remove the settings view from main window |
677 //remove the settings view from main window |
578 if (mSettingsView) { |
678 if (mSettingsView) { |
579 mMainWindow->removeView(mSettingsView); |
679 mMainWindow->removeView(mSettingsView); |
580 mSettingsView->setNavigationAction(mBackAction); |
680 delete mSettingsView; |
581 connect(mBackAction, SIGNAL(triggered()), this, SLOT(onBackAction())); |
681 mSettingsView = NULL; |
582 } |
682 } |
583 switch (mCurrentView) { |
683 switch (mCurrentView) { |
584 case MsgBaseView::CLV: |
684 case MsgBaseView::CLV: |
585 { |
685 { |
586 if (mListView) |
686 if (mListView) |
600 break; |
700 break; |
601 } |
701 } |
602 case MsgBaseView::UNIEDITOR: |
702 case MsgBaseView::UNIEDITOR: |
603 { |
703 { |
604 if (mServiceRequest) { |
704 if (mServiceRequest) { |
605 mMainWindow->setCurrentView(mUniEditor, false); |
705 mMainWindow->setCurrentView(mUniEditor); |
606 } |
706 } |
607 else { |
707 else { |
608 mMainWindow->setCurrentView(mUniEditor); |
708 mMainWindow->setCurrentView(mUniEditor); |
609 } |
709 } |
610 break; |
710 break; |
611 } |
711 } |
612 } |
712 } |
613 } |
713 } |
614 } |
714 } |
|
715 |
|
716 void MsgViewManager::view(int msgId) |
|
717 { |
|
718 int msgType; |
|
719 int msgSubType; |
|
720 |
|
721 qint32 messageId(msgId); |
|
722 ConversationsEngine::instance()->markAsReadAndGetType(messageId, msgType, msgSubType); |
|
723 |
|
724 switch (msgType) { |
|
725 case ConvergedMessage::Sms: |
|
726 case ConvergedMessage::Mms: |
|
727 case ConvergedMessage::MmsNotification: |
|
728 { |
|
729 handleSmsMmsMsg(msgId); |
|
730 break; |
|
731 } |
|
732 case ConvergedMessage::BioMsg: |
|
733 { |
|
734 if (msgSubType == ConvergedMessage::RingingTone) { |
|
735 handleRingtoneMsg(msgId); |
|
736 |
|
737 } |
|
738 else if (msgSubType == ConvergedMessage::Provisioning) { |
|
739 handleProvisoningMsg(msgId); |
|
740 } |
|
741 break; |
|
742 } |
|
743 case ConvergedMessage::BT: |
|
744 { |
|
745 break; |
|
746 } |
|
747 default: |
|
748 { |
|
749 // for un supported message show delete option |
|
750 bool result = HbMessageBox::question(LOC_DELETE_MESSAGE, LOC_BUTTON_DELETE, |
|
751 LOC_BUTTON_CANCEL); |
|
752 if (result) { |
|
753 QList<int> msgIdList; |
|
754 msgIdList << msgId; |
|
755 ConversationsEngine::instance()->deleteMessages(msgIdList); |
|
756 } |
|
757 HbApplication::quit(); // exit after handling |
|
758 break; |
|
759 } |
|
760 } |
|
761 } |
|
762 |
|
763 // ---------------------------------------------------------------------------- |
|
764 // MsgViewManager::handleSmsMmsMsg |
|
765 // @see header |
|
766 // ---------------------------------------------------------------------------- |
|
767 void MsgViewManager::handleSmsMmsMsg(int msgId) |
|
768 { |
|
769 mViewServiceRequest = true; |
|
770 |
|
771 mCurrentView = MsgBaseView::UNIVIEWER; |
|
772 |
|
773 if (!mUniViewer) { |
|
774 mUniViewer = new UnifiedViewer(msgId); |
|
775 mUniViewer->setNavigationAction(mBackAction); |
|
776 mMainWindow->addView(mUniViewer); |
|
777 connect(mUniViewer, SIGNAL(switchView(const QVariantList&)), this, |
|
778 SLOT(switchView(const QVariantList&))); |
|
779 } |
|
780 mUniViewer->populateContent(msgId, true, -1); |
|
781 |
|
782 mMainWindow->setCurrentView(mUniViewer); |
|
783 } |
|
784 |
|
785 // ---------------------------------------------------------------------------- |
|
786 // MsgViewManager::handleRingtoneMsg |
|
787 // @see header |
|
788 // ---------------------------------------------------------------------------- |
|
789 void MsgViewManager::handleRingtoneMsg(int msgId) |
|
790 { |
|
791 if (RingBc::askSaveQuery()) { |
|
792 UniDataModelLoader* pluginLoader = new UniDataModelLoader(); |
|
793 UniDataModelPluginInterface* pluginInterface = pluginLoader->getDataModelPlugin( |
|
794 ConvergedMessage::BioMsg); |
|
795 pluginInterface->setMessageId(msgId); |
|
796 UniMessageInfoList attachments = pluginInterface->attachmentList(); |
|
797 |
|
798 QString attachmentPath = attachments.at(0)->path(); |
|
799 |
|
800 RingBc* ringBc = new RingBc(); |
|
801 ringBc->saveTone(attachmentPath); |
|
802 |
|
803 // clear attachement list : its allocated at data model |
|
804 while (!attachments.isEmpty()) { |
|
805 delete attachments.takeFirst(); |
|
806 } |
|
807 |
|
808 delete ringBc; |
|
809 delete pluginLoader; |
|
810 } |
|
811 |
|
812 // close the application once its handled |
|
813 HbApplication::quit(); |
|
814 } |
|
815 |
|
816 // ---------------------------------------------------------------------------- |
|
817 // MsgViewManager::handleProvisoningMsg |
|
818 // @see header |
|
819 // ---------------------------------------------------------------------------- |
|
820 void MsgViewManager::handleProvisoningMsg(int msgId) |
|
821 { |
|
822 QString messageId; |
|
823 messageId.setNum(msgId); |
|
824 |
|
825 XQApplicationManager* aiwMgr = new XQApplicationManager(); |
|
826 |
|
827 XQAiwRequest* request = aiwMgr->create("com.nokia.services.MDM", "Provisioning", |
|
828 "ProcessMessage(QString)", true); // embedded |
|
829 |
|
830 if (request) { |
|
831 QList<QVariant> args; |
|
832 args << QVariant(messageId); |
|
833 request->setArguments(args); |
|
834 |
|
835 // Send the request |
|
836 bool res = request->send(); |
|
837 |
|
838 // Cleanup |
|
839 delete request; |
|
840 } |
|
841 |
|
842 delete aiwMgr; |
|
843 |
|
844 // close the application once its handled |
|
845 HbApplication::quit(); |
|
846 } |