diff -r 36f374c67aa8 -r 12db4185673b messagingapp/msgui/msgapp/src/msgviewmanager.cpp --- a/messagingapp/msgui/msgapp/src/msgviewmanager.cpp Tue Jul 06 14:12:40 2010 +0300 +++ b/messagingapp/msgui/msgapp/src/msgviewmanager.cpp Wed Aug 18 09:45:25 2010 +0300 @@ -179,10 +179,29 @@ completeServiceRequest(); } else { - //switch to clv. + //switch to previous view. QVariantList param; - param << MsgBaseView::CLV; + param << mPreviousView; param << MsgBaseView::UNIEDITOR; + + if(mPreviousView == MsgBaseView::CV) { + param << mConversationId; + } + else if(mPreviousView == MsgBaseView::UNIVIEWER){ + qint32 contactId = mViewerData.at(0).toLongLong(); + qint32 messageId = mViewerData.at(1).toInt(); + int msgCount = mViewerData.at(2).toInt(); + + param << contactId; + param << messageId; + param << msgCount; + } + else if(mPreviousView == MsgBaseView::UNIEDITOR){ + //TODO: Remove error handling once Audio fetcher + //becomes dialog + param[0] = MsgBaseView::CLV; + } + switchView(param); } @@ -256,16 +275,15 @@ } case MsgBaseView::CLV: { - switchToClv(data); - break; - } + switchToClv(data); + break; + } - case MsgBaseView::CV: - { - - switchToCv(data); - break; - } + case MsgBaseView::CV: + { + switchToCv(data); + break; + } case MsgBaseView::DLV: { @@ -507,7 +525,7 @@ mConversationId = -1; return; } - + //delete UniEditor if (mUniEditor) { @@ -540,11 +558,13 @@ mMainWindow->addView(mListView); } - mMainWindow->setCurrentView(mListView); + mMainWindow->setCurrentView(mListView,true,Hb::ViewSwitchSequential); } void MsgViewManager::switchToCv(const QVariantList& data) { + QCRITICAL_WRITE("MsgViewManager::switchToCv start."); + //switch to CV. mCurrentView = MsgBaseView::CV; mPreviousView = data.at(1).toInt(); @@ -565,6 +585,10 @@ //delete UniEditor if (mUniEditor) { + // Save to drafts if CV is launched via service + if (mPreviousView == MsgBaseView::SERVICE) { + mUniEditor->saveContentToDrafts(); + } appendViewToBeDeleted(mUniEditor); mUniEditor = NULL; } @@ -605,7 +629,7 @@ // this case comes when a message is deleted from // Unified viewer set curent view as conversation view // and return - mMainWindow->setCurrentView(mConversationView); + mMainWindow->setCurrentView(mConversationView,true,Hb::ViewSwitchSequential); // publish already opened conversation's id mConversationView->setPSCVId(true); @@ -633,11 +657,20 @@ } mConversationView->openConversation(conversationId); - mMainWindow->setCurrentView(mConversationView); + mMainWindow->setCurrentView(mConversationView,true,Hb::ViewSwitchSequential); + + QCRITICAL_WRITE("MsgViewManager::switchToCv end."); } void MsgViewManager::switchToDlv(const QVariantList& data) { + //delete UniEditor + if (mUniEditor) + { + appendViewToBeDeleted(mUniEditor); + mUniEditor = NULL; + } + //switch to DLV. mCurrentView = MsgBaseView::DLV; mPreviousView = data.at(1).toInt(); @@ -650,11 +683,13 @@ mMainWindow->addView(mDraftsListView); } - mMainWindow->setCurrentView(mDraftsListView); + mMainWindow->setCurrentView(mDraftsListView,true,Hb::ViewSwitchSequential); } void MsgViewManager::switchToUniEditor(const QVariantList& data) { + QCRITICAL_WRITE("MsgViewManager::switchToUniEditor start."); + /** * Editor is tried to open again before exiting the previously * opened editor. Multi taping in DLV or Forward. @@ -722,7 +757,9 @@ } } - mMainWindow->setCurrentView(mUniEditor); + mMainWindow->setCurrentView(mUniEditor,true,Hb::ViewSwitchSequential); + + QCRITICAL_WRITE("MsgViewManager::switchToUniEditor end."); } void MsgViewManager::switchToUniViewer(const QVariantList& data) @@ -735,6 +772,15 @@ return; } + if (mUniEditor) + { + appendViewToBeDeleted(mUniEditor); + mUniEditor = NULL; + } + + //Clear the old viewer data + mViewerData.clear(); + mCurrentView = MsgBaseView::UNIVIEWER; mPreviousView = data.at(1).toInt(); @@ -743,10 +789,14 @@ qint32 contactId = data.at(2).toLongLong(); qint32 messageId = data.at(3).toInt(); int msgCount = data.at(4).toInt(); - int canForwardMessage = data.at(5).toInt(); + //Save the viewer data to be used when u come back from Editor + mViewerData << contactId; + mViewerData << messageId; + mViewerData << msgCount; + if (!mUniViewer) { - mUniViewer = new UnifiedViewer(messageId, canForwardMessage); + mUniViewer = new UnifiedViewer(messageId); mUniViewer->setNavigationAction(mBackAction); mMainWindow->addView(mUniViewer); connect(mUniViewer, SIGNAL(switchView(const QVariantList&)), this, @@ -760,30 +810,50 @@ mConversationView->setPSCVId(false); } - mMainWindow->setCurrentView(mUniViewer); + mMainWindow->setCurrentView(mUniViewer,true,Hb::ViewSwitchSequential); } void MsgViewManager::switchToMsgSettings(const QVariantList& data) { - mCurrentView = MsgBaseView::MSGSETTINGS; - mPreviousView = data.at(1).toInt(); - - if (!mSettingsView) { + int previousView = data.at(1).toInt(); + + MsgSettingsView::SettingsView view = MsgSettingsView::DefaultView; + if (previousView == MsgBaseView::UNIEDITOR || previousView + == MsgBaseView::CV) + { + view = (MsgSettingsView::SettingsView)data.at(2).toInt(); + } - MsgSettingsView::SettingsView view = MsgSettingsView::DefaultView; - if (mPreviousView == MsgBaseView::UNIEDITOR || mPreviousView - == MsgBaseView::CV) - { - view = (MsgSettingsView::SettingsView)data.at(2).toInt(); - } + //launch settings service + QList args; + QString serviceName("messagesettings"); + QString interfaceName("com.nokia.symbian.IMessageSettings"); + QString operation("launchSettings(int)"); + XQAiwRequest* request; + XQApplicationManager appManager; + request = appManager.create(serviceName, interfaceName, operation, true); //embedded + if ( request == NULL ) + { + return; + } + + args << view; - mSettingsView = new MsgSettingsView(view); - mSettingsView->setNavigationAction(mBackAction); - mMainWindow->addView(mSettingsView); - mMainWindow->setCurrentView(mSettingsView); - } - if(mPreviousView==MsgBaseView::CV && mConversationView){ + request->setArguments(args); + + if(previousView==MsgBaseView::CV && mConversationView){ mConversationView->setPSCVId(false); } + + if(!request->send()) + { + QDEBUG_WRITE("launchSettings failed") + } + delete request; + + + if(previousView==MsgBaseView::CV && mConversationView){ + mConversationView->setPSCVId(true); + } } void MsgViewManager::handleDefault(const QVariantList& data) @@ -804,28 +874,28 @@ case MsgBaseView::CLV: { if (mListView) - mMainWindow->setCurrentView(mListView); + mMainWindow->setCurrentView(mListView,true,Hb::ViewSwitchSequential); break; } case MsgBaseView::CV: { if (mConversationView) - mMainWindow->setCurrentView(mConversationView); + mMainWindow->setCurrentView(mConversationView,true,Hb::ViewSwitchSequential); break; } case MsgBaseView::DLV: { if (mDraftsListView) - mMainWindow->setCurrentView(mDraftsListView); + mMainWindow->setCurrentView(mDraftsListView,true,Hb::ViewSwitchSequential); break; } case MsgBaseView::UNIEDITOR: { if (mServiceRequest) { - mMainWindow->setCurrentView(mUniEditor); + mMainWindow->setCurrentView(mUniEditor,true,Hb::ViewSwitchSequential); } else { - mMainWindow->setCurrentView(mUniEditor); + mMainWindow->setCurrentView(mUniEditor,true,Hb::ViewSwitchSequential); } break; } @@ -894,7 +964,7 @@ } mUniViewer->populateContent(msgId, true, -1); - mMainWindow->setCurrentView(mUniViewer); + mMainWindow->setCurrentView(mUniViewer,true,Hb::ViewSwitchSequential); } // ---------------------------------------------------------------------------- @@ -966,9 +1036,11 @@ // ---------------------------------------------------------------------------- void MsgViewManager::populateUniEditorAfterViewReady(const QVariantList& editorData) { + QCRITICAL_WRITE("MsgViewManager::populateUniEditorAfterViewReady start."); //Save the editor data and use it in ViewReady handler mEditorData = editorData; connect(mMainWindow, SIGNAL(viewReady()), this, SLOT(populateUniEditorView())); + QCRITICAL_WRITE("MsgViewManager::populateUniEditorAfterViewReady end."); } // ---------------------------------------------------------------------------- @@ -977,6 +1049,7 @@ // ---------------------------------------------------------------------------- void MsgViewManager::populateUniEditorView() { + QCRITICAL_WRITE("MsgViewManager::populateUniEditorView start."); if (mUniEditor) { mUniEditor->openDraftsMessage(mEditorData); @@ -985,6 +1058,7 @@ disconnect(mMainWindow, SIGNAL(viewReady()), this, SLOT(populateUniEditorView())); + QCRITICAL_WRITE("MsgViewManager::populateUniEditorView end."); } // ---------------------------------------------------------------------------- @@ -1076,7 +1150,7 @@ } mMainWindow->addView(mAudioFetcherView); - mMainWindow->setCurrentView(mAudioFetcherView); + mMainWindow->setCurrentView(mAudioFetcherView,true,Hb::ViewSwitchSequential); } // ---------------------------------------------------------------------------- @@ -1135,7 +1209,8 @@ // set the current view mCurrentView = MsgBaseView::UNIEDITOR; - mMainWindow->setCurrentView(mUniEditor); + mPreviousView =MsgBaseView::CLV; + mMainWindow->setCurrentView(mUniEditor,true,Hb::ViewSwitchSequential); } // ----------------------------------------------------------------------------