39 #include "ringbc.h" |
39 #include "ringbc.h" |
40 #include "unidatamodelloader.h" |
40 #include "unidatamodelloader.h" |
41 #include "unidatamodelplugininterface.h" |
41 #include "unidatamodelplugininterface.h" |
42 #include "msgcontacthandler.h" |
42 #include "msgcontacthandler.h" |
43 #include "debugtraces.h" |
43 #include "debugtraces.h" |
44 #include "msgaudiofetcherview.h" |
|
45 |
44 |
46 // LOCALIZATION |
45 // LOCALIZATION |
47 #define LOC_DELETE_MESSAGE hbTrId("txt_messaging_dialog_delete_message") |
46 #define LOC_DELETE_MESSAGE hbTrId("txt_messaging_dialog_delete_message") |
48 #define LOC_DIALOG_SAVE_RINGTONE hbTrId("txt_conversations_dialog_save_ringing_tone") |
47 #define LOC_DIALOG_SAVE_RINGTONE hbTrId("txt_conversations_dialog_save_ringing_tone") |
49 |
48 |
50 const qint64 NULL_CONVERSATIONID = -1; |
49 const qint64 NULL_CONVERSATIONID = -1; |
51 |
50 |
52 MsgViewManager::MsgViewManager(bool serviceRequest, HbMainWindow* mainWindow, QObject* parent,int activityMsgId) : |
51 MsgViewManager::MsgViewManager(bool serviceRequest, HbMainWindow* mainWindow, QObject* parent,int activityMsgId) : |
53 QObject(parent), mMainWindow(mainWindow), mUniEditor(0), mListView(0), mConversationView(0), |
52 QObject(parent), mMainWindow(mainWindow), mUniEditor(0), mListView(0), mConversationView(0), |
54 mUniViewer(0), mDraftsListView(0), mSettingsView(0), mAudioFetcherView(0), mBackAction(0), |
53 mUniViewer(0), mDraftsListView(0), mSettingsView(0), mBackAction(0), |
55 mServiceRequest(serviceRequest), mConversationId(-1), mViewServiceRequest(false),mMessageId(-1) |
54 mServiceRequest(serviceRequest), mConversationId(-1), mViewServiceRequest(false),mMessageId(-1) |
56 { |
55 { |
57 //creating back action. |
56 //creating back action. |
58 mBackAction = new HbAction(Hb::BackNaviAction, this); |
57 mBackAction = new HbAction(Hb::BackNaviAction, this); |
59 connect(mBackAction, SIGNAL(triggered()), this, SLOT(onBackAction())); |
58 connect(mBackAction, SIGNAL(triggered()), this, SLOT(onBackAction())); |
573 if (mViewServiceRequest && (mPreviousView == MsgBaseView::UNIVIEWER)) { |
554 if (mViewServiceRequest && (mPreviousView == MsgBaseView::UNIVIEWER)) { |
574 // quit the application |
555 // quit the application |
575 HbApplication::quit(); |
556 HbApplication::quit(); |
576 } |
557 } |
577 |
558 |
578 // delete Audio Fetcher view |
|
579 if(mAudioFetcherView) |
|
580 { |
|
581 appendViewToBeDeleted(mAudioFetcherView); |
|
582 mAudioFetcherView = NULL; |
|
583 } |
|
584 |
|
585 //delete UniEditor |
559 //delete UniEditor |
586 if (mUniEditor) |
560 if (mUniEditor) |
587 { |
561 { |
588 // Save to drafts if CV is launched via service |
562 // Save to drafts if CV is launched via service |
589 if (mPreviousView == MsgBaseView::SERVICE) { |
563 if (mPreviousView == MsgBaseView::SERVICE) { |
692 |
666 |
693 /** |
667 /** |
694 * Editor is tried to open again before exiting the previously |
668 * Editor is tried to open again before exiting the previously |
695 * opened editor. Multi taping in DLV or Forward. |
669 * opened editor. Multi taping in DLV or Forward. |
696 */ |
670 */ |
697 if (mUniEditor && !mAudioFetcherView) |
671 if (mUniEditor) |
698 { |
672 { |
699 return; |
673 return; |
700 } |
674 } |
701 |
675 |
702 mCurrentView = MsgBaseView::UNIEDITOR; |
676 mCurrentView = MsgBaseView::UNIEDITOR; |
703 if(MsgBaseView::AUDIOFETCHER != data.at(1).toInt()) |
677 mPreviousView = data.at(1).toInt(); |
704 { |
678 |
705 mPreviousView = data.at(1).toInt(); |
|
706 } |
|
707 |
|
708 // delete Audio Fetcher view |
|
709 if(mAudioFetcherView) |
|
710 { |
|
711 appendViewToBeDeleted(mAudioFetcherView); |
|
712 mAudioFetcherView = NULL; |
|
713 } |
|
714 |
|
715 // delete UniViewer |
679 // delete UniViewer |
716 if (mUniViewer ) |
680 if (mUniViewer ) |
717 { |
681 { |
718 appendViewToBeDeleted(mUniViewer); |
682 appendViewToBeDeleted(mUniViewer); |
719 mUniViewer = NULL; |
683 mUniViewer = NULL; |
720 } |
684 } |
721 |
685 |
722 if (mConversationView) |
|
723 { |
|
724 //clearing content of cv. |
|
725 mConversationView->clearContent(); |
|
726 } |
|
727 |
686 |
728 // reset conversation id published |
687 // reset conversation id published |
729 if(mPreviousView == MsgBaseView::CV && mConversationView) |
688 if(mPreviousView == MsgBaseView::CV && mConversationView) |
730 { |
689 { |
731 mConversationView->setPSCVId(false); |
690 mConversationView->setPSCVId(false); |
800 mUniViewer->setNavigationAction(mBackAction); |
759 mUniViewer->setNavigationAction(mBackAction); |
801 mMainWindow->addView(mUniViewer); |
760 mMainWindow->addView(mUniViewer); |
802 connect(mUniViewer, SIGNAL(switchView(const QVariantList&)), this, |
761 connect(mUniViewer, SIGNAL(switchView(const QVariantList&)), this, |
803 SLOT(switchView(const QVariantList&))); |
762 SLOT(switchView(const QVariantList&))); |
804 } |
763 } |
805 mUniViewer->populateContent(messageId, true, msgCount); |
764 mUniViewer->populateContent(messageId, true, msgCount, mConversationId); |
806 } |
765 } |
807 |
766 |
808 if(mPreviousView==MsgBaseView::CV && mConversationView) |
767 if(mPreviousView==MsgBaseView::CV && mConversationView) |
809 { |
768 { |
810 mConversationView->setPSCVId(false); |
769 mConversationView->setPSCVId(false); |
960 mUniViewer->setNavigationAction(mBackAction); |
919 mUniViewer->setNavigationAction(mBackAction); |
961 mMainWindow->addView(mUniViewer); |
920 mMainWindow->addView(mUniViewer); |
962 connect(mUniViewer, SIGNAL(switchView(const QVariantList&)), this, |
921 connect(mUniViewer, SIGNAL(switchView(const QVariantList&)), this, |
963 SLOT(switchView(const QVariantList&))); |
922 SLOT(switchView(const QVariantList&))); |
964 } |
923 } |
965 mUniViewer->populateContent(msgId, true, -1); |
924 mUniViewer->populateContent(msgId, true, -1, mConversationId); |
966 |
925 |
967 mMainWindow->setCurrentView(mUniViewer,true,Hb::ViewSwitchSequential); |
926 mMainWindow->setCurrentView(mUniViewer,true,Hb::ViewSwitchSequential); |
968 } |
927 } |
969 |
928 |
970 // ---------------------------------------------------------------------------- |
929 // ---------------------------------------------------------------------------- |
1116 { |
1075 { |
1117 return mCurrentView; |
1076 return mCurrentView; |
1118 } |
1077 } |
1119 |
1078 |
1120 // ---------------------------------------------------------------------------- |
1079 // ---------------------------------------------------------------------------- |
1121 // MsgViewManager::switchToAudioFetcher |
|
1122 // @see header |
|
1123 // ---------------------------------------------------------------------------- |
|
1124 void MsgViewManager::switchToAudioFetcher(const QVariantList& data) |
|
1125 { |
|
1126 /** |
|
1127 * Audio Fetcher is tried to open again |
|
1128 */ |
|
1129 if(mAudioFetcherView) |
|
1130 { |
|
1131 return; |
|
1132 } |
|
1133 |
|
1134 //switch to Audio Fetcher view |
|
1135 mCurrentView = MsgBaseView::AUDIOFETCHER; |
|
1136 mPreviousView = data.at(1).toInt(); |
|
1137 QVariantList editorData; |
|
1138 // i=2 because view manager consumed first two args |
|
1139 for (int i = 2; i < data.length(); i++) { |
|
1140 editorData << data.at(i); |
|
1141 } |
|
1142 mAudioFetcherView = new MsgAudioFetcherView(editorData); |
|
1143 mAudioFetcherView->setNavigationAction(mBackAction); |
|
1144 connect(mAudioFetcherView, SIGNAL(switchView(const QVariantList&)), this, |
|
1145 SLOT(switchView(const QVariantList&))); |
|
1146 |
|
1147 if(mPreviousView==MsgBaseView::CV && mConversationView) |
|
1148 { |
|
1149 mConversationView->setPSCVId(false); |
|
1150 } |
|
1151 |
|
1152 mMainWindow->addView(mAudioFetcherView); |
|
1153 mMainWindow->setCurrentView(mAudioFetcherView,true,Hb::ViewSwitchSequential); |
|
1154 } |
|
1155 |
|
1156 // ---------------------------------------------------------------------------- |
|
1157 // MsgViewManager::saveContentToDraft |
1080 // MsgViewManager::saveContentToDraft |
1158 // @see header |
1081 // @see header |
1159 // ---------------------------------------------------------------------------- |
1082 // ---------------------------------------------------------------------------- |
1160 int MsgViewManager::saveContentToDraft() |
1083 int MsgViewManager::saveContentToDraft() |
1161 { |
1084 { |
1168 { |
1091 { |
1169 msgId = mUniEditor->saveContentToDrafts(); |
1092 msgId = mUniEditor->saveContentToDrafts(); |
1170 } |
1093 } |
1171 return msgId; |
1094 return msgId; |
1172 } |
1095 } |
|
1096 |
|
1097 // ---------------------------------------------------------------------------- |
|
1098 // MsgViewManager::handleKeyEvent |
|
1099 // @see header |
|
1100 // ---------------------------------------------------------------------------- |
|
1101 bool MsgViewManager::handleKeyEvent(int key) |
|
1102 { |
|
1103 MsgBaseView *baseView = static_cast<MsgBaseView *>(mMainWindow->currentView()); |
|
1104 bool eventHandled = false; |
|
1105 if (baseView) { |
|
1106 eventHandled = baseView->handleKeyEvent(key); |
|
1107 } |
|
1108 return eventHandled; |
|
1109 } |
1173 |
1110 |
1174 // ---------------------------------------------------------------------------- |
1111 // ---------------------------------------------------------------------------- |
1175 // MsgViewManager::saveContentToDraft |
1112 // MsgViewManager::saveContentToDraft |
1176 // @see header |
1113 // @see header |
1177 // ---------------------------------------------------------------------------- |
1114 // ---------------------------------------------------------------------------- |