42 #include "msgcontacthandler.h" |
42 #include "msgcontacthandler.h" |
43 #include "debugtraces.h" |
43 #include "debugtraces.h" |
44 #include "msgaudiofetcherview.h" |
44 #include "msgaudiofetcherview.h" |
45 |
45 |
46 // LOCALIZATION |
46 // LOCALIZATION |
47 #define LOC_BUTTON_DELETE hbTrId("txt_common_button_delete") |
|
48 #define LOC_BUTTON_CANCEL hbTrId("txt_common_button_cancel") |
|
49 #define LOC_DELETE_MESSAGE hbTrId("txt_messaging_dialog_delete_message") |
47 #define LOC_DELETE_MESSAGE hbTrId("txt_messaging_dialog_delete_message") |
50 #define LOC_DIALOG_SAVE_RINGTONE hbTrId("txt_conversations_dialog_save_ringing_tone") |
48 #define LOC_DIALOG_SAVE_RINGTONE hbTrId("txt_conversations_dialog_save_ringing_tone") |
51 #define LOC_COMMON_SAVE hbTrId("txt_common_menu_save") |
|
52 |
49 |
53 const qint64 NULL_CONVERSATIONID = -1; |
50 const qint64 NULL_CONVERSATIONID = -1; |
54 |
51 |
55 MsgViewManager::MsgViewManager(bool serviceRequest, HbMainWindow* mainWindow, QObject* parent,int activityMsgId) : |
52 MsgViewManager::MsgViewManager(bool serviceRequest, HbMainWindow* mainWindow, QObject* parent,int activityMsgId) : |
56 QObject(parent), mMainWindow(mainWindow), mUniEditor(0), mListView(0), mConversationView(0), |
53 QObject(parent), mMainWindow(mainWindow), mUniEditor(0), mListView(0), mConversationView(0), |
112 break; |
109 break; |
113 } |
110 } |
114 |
111 |
115 case MsgBaseView::CV: |
112 case MsgBaseView::CV: |
116 { |
113 { |
|
114 mConversationId = -1; //reset the conversation view id since its closed |
|
115 |
117 //Save content to drafts before switching to clv |
116 //Save content to drafts before switching to clv |
118 mConversationView->saveContentToDrafts(); |
117 mConversationView->saveContentToDrafts(); |
119 |
118 |
120 //marking messages as red in CV. |
119 //marking messages as red in CV. |
121 mConversationView->markMessagesAsRead(); |
120 mConversationView->markMessagesAsRead(); |
196 if (mViewServiceRequest) { |
195 if (mViewServiceRequest) { |
197 HbApplication::quit(); |
196 HbApplication::quit(); |
198 } |
197 } |
199 else { |
198 else { |
200 QVariantList param; |
199 QVariantList param; |
201 param << MsgBaseView::CV; |
200 if (mConversationId != -1) |
202 param << MsgBaseView::UNIVIEWER; |
201 { |
203 param << mConversationId; |
202 //this means CV is till open then just open the fresh CV |
|
203 param << MsgBaseView::CV; |
|
204 param << MsgBaseView::UNIVIEWER; |
|
205 param << mConversationView->conversationId(); |
|
206 } |
|
207 else |
|
208 { |
|
209 param << MsgBaseView::CLV; |
|
210 param << MsgBaseView::UNIVIEWER; |
|
211 } |
204 switchView(param); |
212 switchView(param); |
205 |
213 |
206 } |
214 } |
207 break; |
215 break; |
208 } |
216 } |
214 switchView(param); |
222 switchView(param); |
215 break; |
223 break; |
216 } |
224 } |
217 case MsgBaseView::AUDIOFETCHER: |
225 case MsgBaseView::AUDIOFETCHER: |
218 { |
226 { |
219 // switch to CV. |
227 // switch back to previous view |
220 QVariantList param; |
228 QVariantList param; |
221 param << mPreviousView; |
229 param << mPreviousView; |
222 param << MsgBaseView::AUDIOFETCHER; |
230 param << MsgBaseView::AUDIOFETCHER; |
223 if(mPreviousView == MsgBaseView::CV) |
231 if(mPreviousView == MsgBaseView::CV) |
224 { |
232 { |
225 param << mConversationId; |
233 param << mConversationId; |
226 } |
234 } |
227 switchView(param); |
235 switchView(param); |
|
236 break; |
228 } |
237 } |
229 default: |
238 default: |
230 { |
239 { |
231 break; |
240 break; |
232 } |
241 } |
474 switchToLastSavedView(); |
483 switchToLastSavedView(); |
475 } |
484 } |
476 |
485 |
477 void MsgViewManager::switchToClv(const QVariantList& data) |
486 void MsgViewManager::switchToClv(const QVariantList& data) |
478 { |
487 { |
479 //switch to CLV. |
|
480 mCurrentView = MsgBaseView::CLV; |
|
481 mPreviousView = data.at(1).toInt(); |
488 mPreviousView = data.at(1).toInt(); |
482 |
489 |
483 // delete case from viewer service |
490 // delete case from viewer service |
484 if (mViewServiceRequest && (mPreviousView == MsgBaseView::UNIVIEWER)) { |
491 if (mViewServiceRequest && (mPreviousView == MsgBaseView::UNIVIEWER)) { |
485 // quit the application |
492 // quit the application |
486 HbApplication::quit(); |
493 HbApplication::quit(); |
487 } |
494 } |
488 |
495 |
|
496 // this is the case when viewer/editor is opened and contacts update takes |
|
497 // place resulting in CV close, the view should directly come to CLV |
|
498 // bypassing the CV |
|
499 if ((mCurrentView == MsgBaseView::UNIVIEWER |
|
500 && mPreviousView != MsgBaseView::UNIVIEWER) |
|
501 || (mCurrentView == MsgBaseView::UNIEDITOR |
|
502 && mPreviousView != MsgBaseView::UNIEDITOR)) |
|
503 { |
|
504 //dont do anything |
|
505 //wait for the back from viewer/editor |
|
506 //and reset the open CV id |
|
507 mConversationId = -1; |
|
508 return; |
|
509 } |
|
510 |
489 //delete UniEditor |
511 //delete UniEditor |
490 if (mUniEditor) |
512 if (mUniEditor) |
491 { |
513 { |
492 appendViewToBeDeleted(mUniEditor); |
514 appendViewToBeDeleted(mUniEditor); |
493 mUniEditor = NULL; |
515 mUniEditor = NULL; |
502 |
524 |
503 if (mConversationView) { |
525 if (mConversationView) { |
504 mConversationView->saveContentToDrafts(); |
526 mConversationView->saveContentToDrafts(); |
505 //clearing content of cv. |
527 //clearing content of cv. |
506 mConversationView->clearContent(); |
528 mConversationView->clearContent(); |
507 } |
529 //reset the open CV id |
508 |
530 mConversationId = -1; |
|
531 } |
|
532 |
|
533 //switch to CLV. |
|
534 mCurrentView = MsgBaseView::CLV; |
509 if (!mListView) { |
535 if (!mListView) { |
510 mListView = new MsgListView(); |
536 mListView = new MsgListView(); |
511 mListView->setNavigationAction(mBackAction); |
537 mListView->setNavigationAction(mBackAction); |
512 connect(mListView, SIGNAL(switchView(const QVariantList&)), this, |
538 connect(mListView, SIGNAL(switchView(const QVariantList&)), this, |
513 SLOT(switchView(const QVariantList&))); |
539 SLOT(switchView(const QVariantList&))); |
637 { |
663 { |
638 return; |
664 return; |
639 } |
665 } |
640 |
666 |
641 mCurrentView = MsgBaseView::UNIEDITOR; |
667 mCurrentView = MsgBaseView::UNIEDITOR; |
642 mPreviousView = data.at(1).toInt(); |
668 if(MsgBaseView::AUDIOFETCHER != data.at(1).toInt()) |
|
669 { |
|
670 mPreviousView = data.at(1).toInt(); |
|
671 } |
643 |
672 |
644 // delete Audio Fetcher view |
673 // delete Audio Fetcher view |
645 if(mAudioFetcherView) |
674 if(mAudioFetcherView) |
646 { |
675 { |
647 appendViewToBeDeleted(mAudioFetcherView); |
676 appendViewToBeDeleted(mAudioFetcherView); |
874 // ---------------------------------------------------------------------------- |
903 // ---------------------------------------------------------------------------- |
875 void MsgViewManager::handleRingtoneMsg(int msgId) |
904 void MsgViewManager::handleRingtoneMsg(int msgId) |
876 { |
905 { |
877 mMessageId = msgId; |
906 mMessageId = msgId; |
878 HbMessageBox::question(LOC_DIALOG_SAVE_RINGTONE, this, |
907 HbMessageBox::question(LOC_DIALOG_SAVE_RINGTONE, this, |
879 SLOT(onDialogSaveTone(HbAction*)), LOC_COMMON_SAVE, LOC_BUTTON_CANCEL); |
908 SLOT(onDialogSaveTone(HbAction*)), |
|
909 HbMessageBox::Save | HbMessageBox::Cancel); |
880 } |
910 } |
881 |
911 |
882 // ---------------------------------------------------------------------------- |
912 // ---------------------------------------------------------------------------- |
883 // MsgViewManager::handleProvisoningMsg |
913 // MsgViewManager::handleProvisoningMsg |
884 // @see header |
914 // @see header |
1018 // @see header |
1048 // @see header |
1019 // ---------------------------------------------------------------------------- |
1049 // ---------------------------------------------------------------------------- |
1020 void MsgViewManager::switchToAudioFetcher(const QVariantList& data) |
1050 void MsgViewManager::switchToAudioFetcher(const QVariantList& data) |
1021 { |
1051 { |
1022 /** |
1052 /** |
1023 * Audio Fetcher is tried to open again before exiting |
1053 * Audio Fetcher is tried to open again |
1024 * opened editor. |
|
1025 */ |
1054 */ |
1026 if(mAudioFetcherView) |
1055 if(mAudioFetcherView) |
1027 { |
1056 { |
1028 return; |
1057 return; |
1029 } |
1058 } |
1030 |
1059 |
1031 //switch to Audio Fetcher view |
1060 //switch to Audio Fetcher view |
1032 mCurrentView = MsgBaseView::AUDIOFETCHER; |
1061 mCurrentView = MsgBaseView::AUDIOFETCHER; |
1033 mPreviousView = data.at(1).toInt(); |
1062 mPreviousView = data.at(1).toInt(); |
1034 |
1063 QVariantList editorData; |
1035 mAudioFetcherView = new MsgAudioFetcherView(); |
1064 // i=2 because view manager consumed first two args |
|
1065 for (int i = 2; i < data.length(); i++) { |
|
1066 editorData << data.at(i); |
|
1067 } |
|
1068 mAudioFetcherView = new MsgAudioFetcherView(editorData); |
1036 mAudioFetcherView->setNavigationAction(mBackAction); |
1069 mAudioFetcherView->setNavigationAction(mBackAction); |
1037 connect(mAudioFetcherView, SIGNAL(switchView(const QVariantList&)), this, |
1070 connect(mAudioFetcherView, SIGNAL(switchView(const QVariantList&)), this, |
1038 SLOT(switchView(const QVariantList&))); |
1071 SLOT(switchView(const QVariantList&))); |
1039 |
1072 |
1040 if(mPreviousView==MsgBaseView::CV && mConversationView) |
1073 if(mPreviousView==MsgBaseView::CV && mConversationView) |