messagingapp/msgui/msgapp/src/msgviewmanager.cpp
changeset 34 84197e66a4bd
parent 31 ebfee66fde93
child 43 35b64624a9e7
equal deleted inserted replaced
31:ebfee66fde93 34:84197e66a4bd
    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 <xqappmgr.h>
    27 #include <xqappmgr.h>
    28 #include <HbMessageBox.h>
    28 #include <hbmessagebox.h>
    29 #include <HbView>
    29 #include <HbView>
    30 
    30 
    31 #include "conversationsengine.h"
    31 #include "conversationsengine.h"
    32 #include "msglistview.h"
    32 #include "msglistview.h"
    33 #include "msgunieditorview.h"
    33 #include "msgunieditorview.h"
   209     }
   209     }
   210 }
   210 }
   211 
   211 
   212 void MsgViewManager::switchView(const QVariantList& data)
   212 void MsgViewManager::switchView(const QVariantList& data)
   213 {
   213 {
   214    
       
   215     connect(mMainWindow, SIGNAL(viewReady()),this,SLOT(setViewInteractive()));
       
   216     mMainWindow->setInteractive(false);
       
   217     
   214     
   218     int viewId = data.at(0).toInt();
   215     int viewId = data.at(0).toInt();
   219     
   216     
   220     switch (viewId) {
   217     switch (viewId) {
   221     case MsgBaseView::DEFAULT:
   218     case MsgBaseView::DEFAULT:
   677     mPreviousView = data.at(1).toInt();
   674     mPreviousView = data.at(1).toInt();
   678 
   675 
   679     //switch to univiewer.
   676     //switch to univiewer.
   680     if (data.length() > 2) {
   677     if (data.length() > 2) {
   681         qint32 contactId = data.at(2).toLongLong();
   678         qint32 contactId = data.at(2).toLongLong();
   682         QByteArray dataArray = data.at(3).toByteArray();
   679         qint32 messageId = data.at(3).toInt();
   683         int msgCount = data.at(4).toInt();
   680         int msgCount = data.at(4).toInt();
   684 
   681         int canForwardMessage = data.at(5).toInt();
   685         ConvergedMessage *message = new ConvergedMessage;
   682         
   686         QDataStream stream(&dataArray, QIODevice::ReadOnly);
       
   687         message->deserialize(stream);
       
   688         qint32 messageId = message->id()->getId();
       
   689         if (!mUniViewer) {
   683         if (!mUniViewer) {
   690             mUniViewer = new UnifiedViewer(messageId);
   684             mUniViewer = new UnifiedViewer(messageId, canForwardMessage);
   691             mUniViewer->setNavigationAction(mBackAction);
   685             mUniViewer->setNavigationAction(mBackAction);
   692             mMainWindow->addView(mUniViewer);
   686             mMainWindow->addView(mUniViewer);
   693             connect(mUniViewer, SIGNAL(switchView(const QVariantList&)), this,
   687             connect(mUniViewer, SIGNAL(switchView(const QVariantList&)), this,
   694                 SLOT(switchView(const QVariantList&)));
   688                 SLOT(switchView(const QVariantList&)));
   695         }
   689         }
   696         mUniViewer->populateContent(messageId, true, msgCount);
   690         mUniViewer->populateContent(messageId, true, msgCount);        
   697         delete message;
       
   698     }
   691     }
   699     
   692     
   700     if(mPreviousView==MsgBaseView::CV && mConversationView)
   693     if(mPreviousView==MsgBaseView::CV && mConversationView)
   701         {
   694         {
   702         mConversationView->setPSCVId(false);
   695         mConversationView->setPSCVId(false);
   946 
   939 
   947         // close the application once its handled
   940         // close the application once its handled
   948         HbApplication::quit();
   941         HbApplication::quit();
   949 }
   942 }
   950 
   943 
       
   944 // ----------------------------------------------------------------------------
       
   945 // MsgViewManager::currentView
       
   946 // @see header
       
   947 // ----------------------------------------------------------------------------
       
   948 int MsgViewManager::currentView()
       
   949     {
       
   950     return mCurrentView;
       
   951     }