messagingapp/msgui/msgapp/src/msgviewmanager.cpp
author hgs
Tue, 19 Oct 2010 11:30:16 +0530
changeset 76 60a8a215b0ec
parent 62 fdbe8253b596
permissions -rw-r--r--
201041
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     1
/*
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     2
 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     3
 * All rights reserved.
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     4
 * This component and the accompanying materials are made available
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     5
 * under the terms of "Eclipse Public License v1.0"
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     6
 * which accompanies this distribution, and is available
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     7
 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     8
 *
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     9
 * Initial Contributors:
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    10
 * Nokia Corporation - initial contribution.
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    11
 *
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    12
 * Contributors:
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    13
 *
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    14
 * Description:
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    15
 * class to manage differnt messaging views.
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    16
 *
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    17
 */
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    18
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    19
#include "msgviewmanager.h"
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    20
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    21
#include <HbMainWindow>
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    22
#include <HbAction>
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    23
#include <xqserviceutil.h>
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    24
#include <QSqlQuery>
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    25
#include <QSqlError>
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    26
#include <HbApplication>
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    27
#include <xqappmgr.h>
37
hgs
parents: 25
diff changeset
    28
#include <hbmessagebox.h>
hgs
parents: 25
diff changeset
    29
#include <HbView>
76
hgs
parents: 62
diff changeset
    30
#include <tstasksettings.h>
hgs
parents: 62
diff changeset
    31
#include <hbinstance.h>
hgs
parents: 62
diff changeset
    32
#include <xqserviceutil.h>
hgs
parents: 62
diff changeset
    33
#include <apgtask.h>
hgs
parents: 62
diff changeset
    34
#include <eikenv.h>
hgs
parents: 62
diff changeset
    35
#include <afactivitystorage.h>
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    36
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    37
#include "conversationsengine.h"
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    38
#include "msglistview.h"
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    39
#include "msgunieditorview.h"
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    40
#include "msgconversationbaseview.h"
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    41
#include "unifiedviewer.h"
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    42
#include "draftslistview.h"
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    43
#include "msgsettingsview.h"
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    44
#include "convergedmessageid.h"
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    45
#include "ringbc.h"
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    46
#include "unidatamodelloader.h"
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    47
#include "unidatamodelplugininterface.h"
37
hgs
parents: 25
diff changeset
    48
#include "msgcontacthandler.h"
76
hgs
parents: 62
diff changeset
    49
#include "msgactivityhandler.h"
37
hgs
parents: 25
diff changeset
    50
#include "debugtraces.h"
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    51
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    52
// LOCALIZATION
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    53
#define LOC_DELETE_MESSAGE hbTrId("txt_messaging_dialog_delete_message")
37
hgs
parents: 25
diff changeset
    54
#define LOC_DIALOG_SAVE_RINGTONE hbTrId("txt_conversations_dialog_save_ringing_tone")
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    55
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    56
const qint64 NULL_CONVERSATIONID = -1;
76
hgs
parents: 62
diff changeset
    57
const int INVALID_MSGID = -1;
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    58
76
hgs
parents: 62
diff changeset
    59
MsgViewManager::MsgViewManager(bool serviceRequest, HbMainWindow* mainWindow,
hgs
parents: 62
diff changeset
    60
    QObject* parent, int activityMsgId) :
hgs
parents: 62
diff changeset
    61
    QObject(parent), mMainWindow(mainWindow), mUniEditor(0), mListView(0),
hgs
parents: 62
diff changeset
    62
            mConversationView(0), mUniViewer(0), mDraftsListView(0),
hgs
parents: 62
diff changeset
    63
            mSettingsView(0), mBackAction(0), mActivityHandler(0), mClient(0),
hgs
parents: 62
diff changeset
    64
            mServiceRequest(serviceRequest), mConversationId(-1),
hgs
parents: 62
diff changeset
    65
            mViewServiceRequest(false), mMessageId(-1),
hgs
parents: 62
diff changeset
    66
            mBringtoForground(false)
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    67
{
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    68
    //creating back action.
37
hgs
parents: 25
diff changeset
    69
    mBackAction = new HbAction(Hb::BackNaviAction, this);
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    70
    connect(mBackAction, SIGNAL(triggered()), this, SLOT(onBackAction()));
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    71
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    72
    //create clv as first view if not a service request.
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    73
    if (!mServiceRequest) {
37
hgs
parents: 25
diff changeset
    74
    
hgs
parents: 25
diff changeset
    75
    if(activityMsgId == NULL_CONVERSATIONID)
hgs
parents: 25
diff changeset
    76
        {
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    77
        QVariantList param;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    78
        param << MsgBaseView::CLV;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    79
        param << MsgBaseView::CLV;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    80
        switchView(param);
37
hgs
parents: 25
diff changeset
    81
        }
hgs
parents: 25
diff changeset
    82
    else 
hgs
parents: 25
diff changeset
    83
        {
hgs
parents: 25
diff changeset
    84
        openUniEditorActivity(activityMsgId);
hgs
parents: 25
diff changeset
    85
        }
hgs
parents: 25
diff changeset
    86
    }
hgs
parents: 25
diff changeset
    87
    else
hgs
parents: 25
diff changeset
    88
    {
hgs
parents: 25
diff changeset
    89
        mDummyview = new HbView();
hgs
parents: 25
diff changeset
    90
        mMainWindow->addView(mDummyview);
hgs
parents: 25
diff changeset
    91
        mMainWindow->setCurrentView(mDummyview);
hgs
parents: 25
diff changeset
    92
        mViewTobeDeleted << mDummyview;
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    93
    }
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    94
}
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    95
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    96
MsgViewManager::~MsgViewManager()
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    97
{
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    98
}
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    99
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   100
void MsgViewManager::onBackAction()
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   101
{
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   102
    switch (mCurrentView) {
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   103
    case MsgBaseView::CLV:
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   104
    {
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   105
        // if its viewer service then quit the application
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   106
        if (mViewServiceRequest) {
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   107
            HbApplication::quit();
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   108
            break;
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   109
        }
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   110
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   111
        if (!mServiceRequest) {
76
hgs
parents: 62
diff changeset
   112
            handleSendToBackGround();
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   113
        }
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   114
        else {
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   115
            completeServiceRequest();
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   116
        }
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   117
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   118
        break;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   119
    }
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   120
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   121
    case MsgBaseView::CV:
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   122
    {
37
hgs
parents: 25
diff changeset
   123
	    mConversationId = -1; //reset the conversation view id since its closed
hgs
parents: 25
diff changeset
   124
		
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   125
        //Save content to drafts before switching to clv
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   126
        mConversationView->saveContentToDrafts();
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   127
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   128
        //marking messages as red in CV.
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   129
        mConversationView->markMessagesAsRead();
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   130
37
hgs
parents: 25
diff changeset
   131
        // reset the conversation id published
hgs
parents: 25
diff changeset
   132
        mConversationView->setPSCVId(false);
hgs
parents: 25
diff changeset
   133
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   134
        //clearing content of cv.
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   135
        mConversationView->clearContent();
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   136
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   137
        // if service request for veiwer the just switch to univiewer.
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   138
        if (mViewServiceRequest) {
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   139
            mCurrentView = MsgBaseView::UNIVIEWER;
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   140
            mMainWindow->setCurrentView(mUniViewer);
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   141
            break;
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   142
        }
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   143
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   144
        if (mServiceRequest) {
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   145
            completeServiceRequest();
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   146
        }
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   147
        else {
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   148
            //switch to clv.
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   149
            QVariantList param;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   150
            param << MsgBaseView::CLV;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   151
            param << MsgBaseView::CV;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   152
            switchView(param);
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   153
        }
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   154
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   155
        break;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   156
    }
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   157
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   158
    case MsgBaseView::DLV:
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   159
    {
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   160
        if (mServiceRequest) {
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   161
            completeServiceRequest();
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   162
        }
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   163
        else {
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   164
            //switch to clv.
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   165
            QVariantList param;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   166
            param << MsgBaseView::CLV;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   167
            param << MsgBaseView::DLV;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   168
            switchView(param);
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   169
        }
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   170
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   171
        break;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   172
    }
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   173
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   174
    case MsgBaseView::UNIEDITOR:
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   175
    {
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   176
        //Save content to drafts before switching to clv
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   177
        mUniEditor->saveContentToDrafts();
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   178
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   179
        // if service request for veiwer the just switch to univiewer.
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   180
        if (mViewServiceRequest) {
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   181
            mCurrentView = MsgBaseView::UNIVIEWER;
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   182
            mMainWindow->setCurrentView(mUniViewer);
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   183
            break;
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   184
        }
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   185
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   186
        //switch to clv.
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   187
        if (mServiceRequest) {
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   188
            completeServiceRequest();
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   189
        }
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   190
        else {
46
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   191
            //switch to previous view.
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   192
            QVariantList param;
46
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   193
            param << mPreviousView;
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   194
            param << MsgBaseView::UNIEDITOR;
46
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   195
            
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   196
            if(mPreviousView == MsgBaseView::CV) {
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   197
                param << mConversationId;
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   198
                }
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   199
            else if(mPreviousView == MsgBaseView::UNIVIEWER){
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   200
                qint32 contactId = mViewerData.at(0).toLongLong();
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   201
                qint32 messageId = mViewerData.at(1).toInt();
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   202
                int msgCount = mViewerData.at(2).toInt();
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   203
                
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   204
                param << contactId;
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   205
                param << messageId;
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   206
                param << msgCount;
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   207
            }
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   208
            else if(mPreviousView == MsgBaseView::UNIEDITOR){
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   209
                //TODO: Remove error handling once Audio fetcher 
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   210
                //becomes dialog
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   211
                param[0] = MsgBaseView::CLV;
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   212
                }
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   213
            
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   214
            switchView(param);
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   215
        }
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   216
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   217
        break;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   218
    }
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   219
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   220
    case MsgBaseView::UNIVIEWER:
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   221
    {
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   222
        // if its launched via service request quit the app
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   223
        if (mViewServiceRequest) {
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   224
            HbApplication::quit();
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   225
        }
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   226
        else {
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   227
            QVariantList param;
37
hgs
parents: 25
diff changeset
   228
            if (mConversationId != -1)
hgs
parents: 25
diff changeset
   229
                {
hgs
parents: 25
diff changeset
   230
                    //this means CV is till open then just open the fresh CV
hgs
parents: 25
diff changeset
   231
                    param << MsgBaseView::CV;
hgs
parents: 25
diff changeset
   232
                    param << MsgBaseView::UNIVIEWER;
hgs
parents: 25
diff changeset
   233
                    param << mConversationView->conversationId();
hgs
parents: 25
diff changeset
   234
                }
hgs
parents: 25
diff changeset
   235
                else
hgs
parents: 25
diff changeset
   236
                {
hgs
parents: 25
diff changeset
   237
                    param << MsgBaseView::CLV;
hgs
parents: 25
diff changeset
   238
                    param << MsgBaseView::UNIVIEWER;
hgs
parents: 25
diff changeset
   239
                }
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   240
            switchView(param);
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   241
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   242
        }
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   243
        break;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   244
    }
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   245
    case MsgBaseView::MSGSETTINGS:
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   246
    {
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   247
        QVariantList param;
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   248
        param << MsgBaseView::DEFAULT;
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   249
        param << MsgBaseView::MSGSETTINGS;
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   250
        switchView(param);
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   251
        break;
56
f42d9a78f435 201033_02
hgs
parents: 51
diff changeset
   252
    }    
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   253
    default:
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   254
    {
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   255
        break;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   256
    }
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   257
    }
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   258
}
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   259
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   260
void MsgViewManager::switchView(const QVariantList& data)
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   261
{
37
hgs
parents: 25
diff changeset
   262
    QCRITICAL_WRITE("MsgViewManager::switchView start.");
hgs
parents: 25
diff changeset
   263
    
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   264
    int viewId = data.at(0).toInt();
37
hgs
parents: 25
diff changeset
   265
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   266
    switch (viewId) {
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   267
    case MsgBaseView::DEFAULT:
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   268
    {
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   269
        handleDefault(data);
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   270
        break;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   271
    }
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   272
    case MsgBaseView::CLV:
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   273
    {
46
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   274
         switchToClv(data);
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   275
         break;
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   276
    }
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   277
46
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   278
    case MsgBaseView::CV:
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   279
    {
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   280
         switchToCv(data);
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   281
         break;
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   282
    }
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   283
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   284
    case MsgBaseView::DLV:
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   285
    {
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   286
        switchToDlv(data);
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   287
        break;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   288
    }
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   289
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   290
    case MsgBaseView::UNIEDITOR:
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   291
    {
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   292
        switchToUniEditor(data);
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   293
        break;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   294
    }
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   295
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   296
    case MsgBaseView::UNIVIEWER:
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   297
    {
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   298
        switchToUniViewer(data);
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   299
        break;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   300
    }
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   301
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   302
    case MsgBaseView::MSGSETTINGS:
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   303
    {
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   304
        switchToMsgSettings(data);
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   305
        break;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   306
    }
37
hgs
parents: 25
diff changeset
   307
    }
hgs
parents: 25
diff changeset
   308
    QCRITICAL_WRITE("MsgViewManager::switchView end.");
hgs
parents: 25
diff changeset
   309
}
hgs
parents: 25
diff changeset
   310
hgs
parents: 25
diff changeset
   311
void MsgViewManager::deletePreviousView()
hgs
parents: 25
diff changeset
   312
{
hgs
parents: 25
diff changeset
   313
    while(mViewTobeDeleted.count())
hgs
parents: 25
diff changeset
   314
    {
hgs
parents: 25
diff changeset
   315
        HbView* v = mViewTobeDeleted.takeAt(0);
hgs
parents: 25
diff changeset
   316
        mMainWindow->removeView(v);
hgs
parents: 25
diff changeset
   317
        delete v;
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   318
    }
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   319
}
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   320
37
hgs
parents: 25
diff changeset
   321
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   322
void MsgViewManager::send(const qint32 contactId, const QString phoneNumber,
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   323
    const QString displayName)
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   324
{
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   325
    qint64 conversationId = ConversationsEngine::instance()-> getConversationIdFromContactId(
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   326
        contactId);
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   327
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   328
    //set mode to viewer, if conversations found else send mode.
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   329
    QVariantList param;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   330
    if (conversationId > 0) {
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   331
        param << MsgBaseView::CV;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   332
        param << MsgBaseView::SERVICE;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   333
        param << conversationId;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   334
    }
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   335
    else {
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   336
        ConvergedMessage message;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   337
        ConvergedMessageAddress address;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   338
        address.setAddress(phoneNumber);
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   339
        address.setAlias(displayName);
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   340
        message.addToRecipient(address);
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   341
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   342
        QByteArray dataArray;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   343
        QDataStream messageStream(&dataArray, QIODevice::WriteOnly | QIODevice::Append);
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   344
        message.serialize(messageStream);
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   345
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   346
        param << MsgBaseView::UNIEDITOR;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   347
        param << MsgBaseView::SERVICE;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   348
        param << dataArray;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   349
    }
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   350
    switchView(param);
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   351
    XQServiceUtil::toBackground(false);
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   352
}
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   353
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   354
void MsgViewManager::send(const QString phoneNumber, const QString alias, const QString bodyText)
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   355
{
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   356
    ConvergedMessage message;
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   357
    ConvergedMessageAddress address;
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   358
    address.setAddress(phoneNumber);
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   359
    address.setAlias(alias);
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   360
    message.addToRecipient(address);
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   361
    message.setBodyText(bodyText);
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   362
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   363
    QVariantList param;
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   364
    QByteArray dataArray;
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   365
    QDataStream messageStream(&dataArray, QIODevice::WriteOnly | QIODevice::Append);
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   366
    message.serialize(messageStream);
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   367
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   368
    param << MsgBaseView::UNIEDITOR;
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   369
    param << MsgBaseView::SERVICE;
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   370
    param << dataArray;
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   371
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   372
    switchView(param);
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   373
    XQServiceUtil::toBackground(false);
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   374
}
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   375
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   376
void MsgViewManager::setServiceRequest(bool request)
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   377
{
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   378
    mServiceRequest = request;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   379
    mViewAtServiceRequest = mCurrentView;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   380
}
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   381
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   382
void MsgViewManager::switchToLastSavedView()
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   383
{
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   384
    QVariantList param;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   385
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   386
    switch (mViewAtServiceRequest) {
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   387
    case MsgBaseView::CV:
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   388
    {
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   389
        param << MsgBaseView::CV;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   390
        param << MsgBaseView::SERVICE;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   391
        param << mConversationId;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   392
        break;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   393
    }
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   394
    case MsgBaseView::UNIVIEWER:
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   395
    {
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   396
        param << MsgBaseView::UNIVIEWER;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   397
        param << MsgBaseView::SERVICE;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   398
        break;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   399
    }
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   400
    default:
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   401
    {
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   402
        param << MsgBaseView::CLV;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   403
        param << MsgBaseView::SERVICE;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   404
        break;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   405
    }
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   406
    }
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   407
    switchView(param);
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   408
}
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   409
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   410
void MsgViewManager::open(qint64 conversationId)
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   411
{
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   412
    QVariantList param;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   413
76
hgs
parents: 62
diff changeset
   414
    mClient->setVisibility(true);
hgs
parents: 62
diff changeset
   415
    mActivityHandler->clearActivities();
hgs
parents: 62
diff changeset
   416
    mBringtoForground = false;    
hgs
parents: 62
diff changeset
   417
    
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   418
    if (conversationId < 0) {
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   419
        param << MsgBaseView::CLV;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   420
        param << MsgBaseView::SERVICE;
37
hgs
parents: 25
diff changeset
   421
hgs
parents: 25
diff changeset
   422
        if( mCurrentView == MsgBaseView::CV && mConversationView)
hgs
parents: 25
diff changeset
   423
            {
hgs
parents: 25
diff changeset
   424
            mConversationView->setPSCVId(false);
hgs
parents: 25
diff changeset
   425
            }
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   426
    }
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   427
    else {
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   428
        param << MsgBaseView::CV;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   429
        param << MsgBaseView::SERVICE;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   430
        param << conversationId;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   431
    }
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   432
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   433
    switchView(param);
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   434
    XQServiceUtil::toBackground(false);
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   435
}
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   436
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   437
void MsgViewManager::send(QVariant data)
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   438
{
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   439
    ConvergedMessage message;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   440
    ConvergedMessageAttachmentList attachmentList;
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   441
    // handle multiple files from sendUI
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   442
    // e.g. contacts can send multiple vcards
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   443
    QStringList receivedFiles = data.toStringList();
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   444
    int recFileCount = receivedFiles.count();
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   445
    for (int i = 0; i < recFileCount; i++) {
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   446
        ConvergedMessageAttachment *attachment =
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   447
            new ConvergedMessageAttachment(receivedFiles.at(i));
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   448
        attachmentList.append(attachment);
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   449
    }
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   450
    message.addAttachments(attachmentList);
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   451
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   452
    QByteArray dataArray;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   453
    QDataStream messageStream(&dataArray, QIODevice::WriteOnly | QIODevice::Append);
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   454
    message.serialize(messageStream);
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   455
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   456
    QVariantList param;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   457
    param << MsgBaseView::UNIEDITOR;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   458
    param << MsgBaseView::SERVICE;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   459
    param << dataArray;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   460
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   461
    switchView(param);
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   462
    XQServiceUtil::toBackground(false);
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   463
}
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   464
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   465
qint64 MsgViewManager::findConversationId(const QString phoneNum)
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   466
{
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   467
    return ConversationsEngine::instance()-> getConversationIdFromAddress(phoneNum);
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   468
}
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   469
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   470
//will be depricated in future.
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   471
void MsgViewManager::openEditor(QString phoneNumber, QString name)
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   472
{
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   473
    ConvergedMessage message;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   474
    ConvergedMessageAddress address;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   475
    address.setAddress(phoneNumber);
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   476
    address.setAlias(name);
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   477
    message.addToRecipient(address);
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   478
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   479
    QByteArray dataArray;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   480
    QDataStream messageStream(&dataArray, QIODevice::WriteOnly | QIODevice::Append);
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   481
    message.serialize(messageStream);
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   482
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   483
    QVariantList param;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   484
    param << MsgBaseView::UNIEDITOR;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   485
    param << MsgBaseView::SERVICE;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   486
    param << dataArray;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   487
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   488
    switchView(param);
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   489
    XQServiceUtil::toBackground(false);
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   490
}
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   491
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   492
void MsgViewManager::completeServiceRequest()
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   493
{
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   494
    mServiceRequest = false;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   495
    XQServiceUtil::toBackground(true);
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   496
    switchToLastSavedView();
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   497
}
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   498
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   499
void MsgViewManager::switchToClv(const QVariantList& data)
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   500
{
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   501
    mPreviousView = data.at(1).toInt();
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   502
37
hgs
parents: 25
diff changeset
   503
    // delete case from viewer service
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   504
    if (mViewServiceRequest && (mPreviousView == MsgBaseView::UNIVIEWER)) {
37
hgs
parents: 25
diff changeset
   505
        // quit the application
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   506
        HbApplication::quit();
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   507
    }
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   508
37
hgs
parents: 25
diff changeset
   509
    // this is the case when viewer/editor is opened and contacts update takes
hgs
parents: 25
diff changeset
   510
    // place resulting in CV close, the view should directly come to CLV 
hgs
parents: 25
diff changeset
   511
    // bypassing the CV
hgs
parents: 25
diff changeset
   512
    if ((mCurrentView == MsgBaseView::UNIVIEWER 
hgs
parents: 25
diff changeset
   513
            && mPreviousView != MsgBaseView::UNIVIEWER)
hgs
parents: 25
diff changeset
   514
            || (mCurrentView == MsgBaseView::UNIEDITOR
hgs
parents: 25
diff changeset
   515
                    && mPreviousView != MsgBaseView::UNIEDITOR))
hgs
parents: 25
diff changeset
   516
    {
hgs
parents: 25
diff changeset
   517
        //dont do anything
hgs
parents: 25
diff changeset
   518
        //wait for the back from viewer/editor
hgs
parents: 25
diff changeset
   519
        //and reset the open CV id
hgs
parents: 25
diff changeset
   520
        mConversationId = -1;
hgs
parents: 25
diff changeset
   521
        return;
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   522
    }
51
3507212d340e 201031_02
hgs
parents: 48
diff changeset
   523
37
hgs
parents: 25
diff changeset
   524
    //delete UniEditor
hgs
parents: 25
diff changeset
   525
    if (mUniEditor)
hgs
parents: 25
diff changeset
   526
    {
hgs
parents: 25
diff changeset
   527
        appendViewToBeDeleted(mUniEditor);
hgs
parents: 25
diff changeset
   528
        mUniEditor = NULL;
hgs
parents: 25
diff changeset
   529
    }
hgs
parents: 25
diff changeset
   530
hgs
parents: 25
diff changeset
   531
    //delete UniViewer
hgs
parents: 25
diff changeset
   532
    if (mUniViewer)
hgs
parents: 25
diff changeset
   533
    {
hgs
parents: 25
diff changeset
   534
        appendViewToBeDeleted(mUniViewer);
hgs
parents: 25
diff changeset
   535
        mUniViewer = NULL;
hgs
parents: 25
diff changeset
   536
    }
hgs
parents: 25
diff changeset
   537
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   538
    if (mConversationView) {
37
hgs
parents: 25
diff changeset
   539
        mConversationView->saveContentToDrafts();
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   540
        //clearing content of cv.
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   541
        mConversationView->clearContent();
37
hgs
parents: 25
diff changeset
   542
        //reset the open CV id
hgs
parents: 25
diff changeset
   543
        mConversationId = -1;
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   544
    }
37
hgs
parents: 25
diff changeset
   545
    
hgs
parents: 25
diff changeset
   546
    //switch to CLV.
hgs
parents: 25
diff changeset
   547
    mCurrentView = MsgBaseView::CLV;
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   548
    if (!mListView) {
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   549
        mListView = new MsgListView();
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   550
        mListView->setNavigationAction(mBackAction);
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   551
        connect(mListView, SIGNAL(switchView(const QVariantList&)), this,
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   552
            SLOT(switchView(const QVariantList&)));
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   553
        mMainWindow->addView(mListView);
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   554
    }
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   555
48
4f501b74aeb1 201029_02
hgs
parents: 46
diff changeset
   556
    mMainWindow->setCurrentView(mListView,true,Hb::ViewSwitchSequential);
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   557
}
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   558
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   559
void MsgViewManager::switchToCv(const QVariantList& data)
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   560
{
46
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   561
    QCRITICAL_WRITE("MsgViewManager::switchToCv start.");
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   562
    
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   563
    //switch to CV.
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   564
    mCurrentView = MsgBaseView::CV;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   565
    mPreviousView = data.at(1).toInt();
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   566
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   567
    // delete case from viewer service
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   568
    if (mViewServiceRequest && (mPreviousView == MsgBaseView::UNIVIEWER)) {
37
hgs
parents: 25
diff changeset
   569
        // quit the application
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   570
        HbApplication::quit();
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   571
    }
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   572
37
hgs
parents: 25
diff changeset
   573
    //delete UniEditor
hgs
parents: 25
diff changeset
   574
    if (mUniEditor)
hgs
parents: 25
diff changeset
   575
    {
48
4f501b74aeb1 201029_02
hgs
parents: 46
diff changeset
   576
        // Save to drafts if CV is launched via service
4f501b74aeb1 201029_02
hgs
parents: 46
diff changeset
   577
        if (mPreviousView == MsgBaseView::SERVICE) {
4f501b74aeb1 201029_02
hgs
parents: 46
diff changeset
   578
            mUniEditor->saveContentToDrafts();
4f501b74aeb1 201029_02
hgs
parents: 46
diff changeset
   579
        }
37
hgs
parents: 25
diff changeset
   580
        appendViewToBeDeleted(mUniEditor);
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   581
        mUniEditor = NULL;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   582
    }
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   583
37
hgs
parents: 25
diff changeset
   584
    //delete UniViewer
hgs
parents: 25
diff changeset
   585
    if (mUniViewer)
hgs
parents: 25
diff changeset
   586
    {
hgs
parents: 25
diff changeset
   587
        appendViewToBeDeleted(mUniViewer);
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   588
        mUniViewer = NULL;
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   589
    }
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   590
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   591
    QVariant var = data.at(2);
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   592
    qint64 conversationId;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   593
    if (var.type() == QVariant::String) {
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   594
        QString phoneNumber = var.toString();
37
hgs
parents: 25
diff changeset
   595
        qint32 contactId = findContactId(phoneNumber);
hgs
parents: 25
diff changeset
   596
        if (contactId != -1) {
hgs
parents: 25
diff changeset
   597
            conversationId = ConversationsEngine::instance()->getConversationIdFromContactId(contactId);
hgs
parents: 25
diff changeset
   598
        }
hgs
parents: 25
diff changeset
   599
        else {
hgs
parents: 25
diff changeset
   600
            conversationId = findConversationId(phoneNumber);
hgs
parents: 25
diff changeset
   601
        }
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   602
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   603
        if (conversationId == NULL_CONVERSATIONID) {
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   604
            QVariantList param;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   605
            param << MsgBaseView::CLV;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   606
            param << MsgBaseView::CV;
37
hgs
parents: 25
diff changeset
   607
hgs
parents: 25
diff changeset
   608
            if( mCurrentView == MsgBaseView::CV && mConversationView){
hgs
parents: 25
diff changeset
   609
                mConversationView->setPSCVId(false);
hgs
parents: 25
diff changeset
   610
                }
hgs
parents: 25
diff changeset
   611
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   612
            switchView(param);
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   613
            return;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   614
        }
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   615
    }
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   616
    else if (var.type() == QVariant::Invalid) {
37
hgs
parents: 25
diff changeset
   617
        // this case comes when a message is deleted from
hgs
parents: 25
diff changeset
   618
        // Unified viewer  set curent view as conversation view
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   619
        // and return
48
4f501b74aeb1 201029_02
hgs
parents: 46
diff changeset
   620
        mMainWindow->setCurrentView(mConversationView,true,Hb::ViewSwitchSequential);
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   621
37
hgs
parents: 25
diff changeset
   622
		// publish already opened conversation's id
hgs
parents: 25
diff changeset
   623
        mConversationView->setPSCVId(true);
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   624
        return;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   625
    }
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   626
    else {
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   627
        conversationId = var.toLongLong();
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   628
    }
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   629
    //switch to CV.
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   630
    mConversationId = conversationId;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   631
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   632
    if (!mConversationView) {
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   633
        mConversationView = new MsgConversationBaseView();
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   634
        mConversationView->setNavigationAction(mBackAction);
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   635
        connect(mConversationView, SIGNAL(switchView(const QVariantList&)), this,
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   636
            SLOT(switchView(const QVariantList&)));
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   637
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   638
        mMainWindow->addView(mConversationView);
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   639
    }
37
hgs
parents: 25
diff changeset
   640
    else if (mConversationView->conversationId() != mConversationId){
hgs
parents: 25
diff changeset
   641
  		//Save content to drafts before switching to different CV
hgs
parents: 25
diff changeset
   642
        mConversationView->saveContentToDrafts();
hgs
parents: 25
diff changeset
   643
        //clearing content of current cv.
hgs
parents: 25
diff changeset
   644
        mConversationView->clearContent();
hgs
parents: 25
diff changeset
   645
    }
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   646
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   647
    mConversationView->openConversation(conversationId);
48
4f501b74aeb1 201029_02
hgs
parents: 46
diff changeset
   648
    mMainWindow->setCurrentView(mConversationView,true,Hb::ViewSwitchSequential);
46
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   649
    
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   650
    QCRITICAL_WRITE("MsgViewManager::switchToCv end.");
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   651
}
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   652
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   653
void MsgViewManager::switchToDlv(const QVariantList& data)
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   654
{
46
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   655
    //delete UniEditor
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   656
    if (mUniEditor)
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   657
    {
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   658
        appendViewToBeDeleted(mUniEditor);
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   659
        mUniEditor = NULL;
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   660
    }
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   661
    
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   662
    //switch to DLV.
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   663
    mCurrentView = MsgBaseView::DLV;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   664
    mPreviousView = data.at(1).toInt();
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   665
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   666
    if (!mDraftsListView) {
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   667
        mDraftsListView = new DraftsListView();
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   668
        mDraftsListView->setNavigationAction(mBackAction);
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   669
        connect(mDraftsListView, SIGNAL(switchView(const QVariantList&)), this,
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   670
            SLOT(switchView(const QVariantList&)));
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   671
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   672
        mMainWindow->addView(mDraftsListView);
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   673
    }
48
4f501b74aeb1 201029_02
hgs
parents: 46
diff changeset
   674
    mMainWindow->setCurrentView(mDraftsListView,true,Hb::ViewSwitchSequential);
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   675
}
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   676
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   677
void MsgViewManager::switchToUniEditor(const QVariantList& data)
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   678
{
46
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   679
    QCRITICAL_WRITE("MsgViewManager::switchToUniEditor start.");
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   680
    
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   681
    /**
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   682
     * Editor is tried to open again before exiting the previously
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   683
     * opened editor. Multi taping in DLV or Forward.
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   684
     */
56
f42d9a78f435 201033_02
hgs
parents: 51
diff changeset
   685
    if (mUniEditor)
37
hgs
parents: 25
diff changeset
   686
    {
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   687
        return;
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   688
    }
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   689
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   690
    mCurrentView = MsgBaseView::UNIEDITOR;
56
f42d9a78f435 201033_02
hgs
parents: 51
diff changeset
   691
    mPreviousView = data.at(1).toInt();
f42d9a78f435 201033_02
hgs
parents: 51
diff changeset
   692
    
37
hgs
parents: 25
diff changeset
   693
    // delete UniViewer
hgs
parents: 25
diff changeset
   694
	if (mUniViewer )
hgs
parents: 25
diff changeset
   695
	{
hgs
parents: 25
diff changeset
   696
	    appendViewToBeDeleted(mUniViewer);
hgs
parents: 25
diff changeset
   697
	    mUniViewer = NULL;
hgs
parents: 25
diff changeset
   698
	}
hgs
parents: 25
diff changeset
   699
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   700
37
hgs
parents: 25
diff changeset
   701
    // reset conversation id published
hgs
parents: 25
diff changeset
   702
    if(mPreviousView == MsgBaseView::CV && mConversationView)
hgs
parents: 25
diff changeset
   703
    {
hgs
parents: 25
diff changeset
   704
        mConversationView->setPSCVId(false);
hgs
parents: 25
diff changeset
   705
    }
hgs
parents: 25
diff changeset
   706
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   707
    //swich to unieditor.
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   708
    if (!mUniEditor) {
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   709
        mUniEditor = new MsgUnifiedEditorView();
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   710
        mMainWindow->addView(mUniEditor);
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   711
        mUniEditor->setNavigationAction(mBackAction);
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   712
        connect(mUniEditor, SIGNAL(switchView(const QVariantList&)), this,
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   713
            SLOT(switchView(const QVariantList&)));
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   714
    }
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   715
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   716
    // check if additional data for unieditor's consumption is available
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   717
    if (data.length() > 2) {
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   718
        QVariantList editorData;
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   719
        // i=2 because view manager consumed first two args
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   720
        for (int i = 2; i < data.length(); i++) {
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   721
            editorData << data.at(i);
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   722
        }
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   723
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   724
        if (MsgBaseView::DLV == mPreviousView) {
76
hgs
parents: 62
diff changeset
   725
            mUniEditor->openDraftsMessage(editorData);
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   726
        }
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   727
        else {
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   728
            mUniEditor->populateContent(editorData);
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   729
        }
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   730
    }
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   731
48
4f501b74aeb1 201029_02
hgs
parents: 46
diff changeset
   732
    mMainWindow->setCurrentView(mUniEditor,true,Hb::ViewSwitchSequential);
46
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   733
    
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   734
    QCRITICAL_WRITE("MsgViewManager::switchToUniEditor end.");
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   735
}
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   736
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   737
void MsgViewManager::switchToUniViewer(const QVariantList& data)
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   738
{
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   739
    /**
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   740
     * Viewer is tried to open again before exiting the previously
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   741
     * opened viewer. Multi taping bubbles in CV.
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   742
     */
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   743
    if (mUniViewer) {
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   744
        return;
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   745
    }
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   746
48
4f501b74aeb1 201029_02
hgs
parents: 46
diff changeset
   747
    if (mUniEditor)
4f501b74aeb1 201029_02
hgs
parents: 46
diff changeset
   748
    {
4f501b74aeb1 201029_02
hgs
parents: 46
diff changeset
   749
        appendViewToBeDeleted(mUniEditor);
4f501b74aeb1 201029_02
hgs
parents: 46
diff changeset
   750
        mUniEditor = NULL;
4f501b74aeb1 201029_02
hgs
parents: 46
diff changeset
   751
    }
4f501b74aeb1 201029_02
hgs
parents: 46
diff changeset
   752
46
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   753
    //Clear the old viewer data
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   754
    mViewerData.clear();
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   755
    
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   756
    mCurrentView = MsgBaseView::UNIVIEWER;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   757
    mPreviousView = data.at(1).toInt();
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   758
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   759
    //switch to univiewer.
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   760
    if (data.length() > 2) {
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   761
        qint32 contactId = data.at(2).toLongLong();
37
hgs
parents: 25
diff changeset
   762
        qint32 messageId = data.at(3).toInt();
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   763
        int msgCount = data.at(4).toInt();
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   764
46
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   765
        //Save the viewer data to be used when u come back from Editor
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   766
        mViewerData << contactId;
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   767
        mViewerData << messageId;
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   768
        mViewerData << msgCount;
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   769
        
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   770
        if (!mUniViewer) {
51
3507212d340e 201031_02
hgs
parents: 48
diff changeset
   771
            mUniViewer = new UnifiedViewer(messageId);
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   772
            mUniViewer->setNavigationAction(mBackAction);
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   773
            mMainWindow->addView(mUniViewer);
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   774
            connect(mUniViewer, SIGNAL(switchView(const QVariantList&)), this,
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   775
                SLOT(switchView(const QVariantList&)));
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   776
        }
62
fdbe8253b596 201035_03
hgs
parents: 56
diff changeset
   777
        mUniViewer->populateContent(messageId, true, msgCount, mConversationId);
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   778
    }
37
hgs
parents: 25
diff changeset
   779
hgs
parents: 25
diff changeset
   780
    if(mPreviousView==MsgBaseView::CV && mConversationView)
hgs
parents: 25
diff changeset
   781
        {
hgs
parents: 25
diff changeset
   782
        mConversationView->setPSCVId(false);
hgs
parents: 25
diff changeset
   783
        }
hgs
parents: 25
diff changeset
   784
48
4f501b74aeb1 201029_02
hgs
parents: 46
diff changeset
   785
    mMainWindow->setCurrentView(mUniViewer,true,Hb::ViewSwitchSequential);
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   786
}
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   787
void MsgViewManager::switchToMsgSettings(const QVariantList& data)
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   788
{
46
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   789
    int previousView = data.at(1).toInt();
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   790
    
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   791
    MsgSettingsView::SettingsView view = MsgSettingsView::DefaultView;
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   792
    if (previousView == MsgBaseView::UNIEDITOR || previousView
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   793
            == MsgBaseView::CV)
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   794
        {
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   795
        view = (MsgSettingsView::SettingsView)data.at(2).toInt();
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   796
        }
37
hgs
parents: 25
diff changeset
   797
46
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   798
    //launch settings service
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   799
    QList<QVariant> args;
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   800
    QString serviceName("messagesettings");
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   801
    QString interfaceName("com.nokia.symbian.IMessageSettings");
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   802
    QString operation("launchSettings(int)");
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   803
    XQAiwRequest* request;
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   804
    XQApplicationManager appManager;
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   805
    request = appManager.create(serviceName, interfaceName, operation, true); //embedded
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   806
    if ( request == NULL )
41
25fe1fe642e3 201027_02
hgs
parents: 37
diff changeset
   807
        {
46
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   808
        return;       
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   809
        }
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   810
 
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   811
    args <<  view;
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   812
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   813
    request->setArguments(args);
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   814
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   815
    if(previousView==MsgBaseView::CV && mConversationView){
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   816
        mConversationView->setPSCVId(false);
41
25fe1fe642e3 201027_02
hgs
parents: 37
diff changeset
   817
        }
46
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   818
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   819
    if(!request->send())
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   820
        {
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   821
        QDEBUG_WRITE("launchSettings failed")
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   822
        }
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   823
    delete request;
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   824
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   825
    
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   826
    if(previousView==MsgBaseView::CV && mConversationView){
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   827
        mConversationView->setPSCVId(true);
37
hgs
parents: 25
diff changeset
   828
        }
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   829
}
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   830
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   831
void MsgViewManager::handleDefault(const QVariantList& data)
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   832
{
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   833
    //special handling incase we switch from settings-view
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   834
    int previousViewId = data.at(1).toInt();
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   835
    if (MsgBaseView::MSGSETTINGS == previousViewId) {
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   836
        //switch to view, where from settings view was launched
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   837
        mCurrentView = mPreviousView;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   838
        mPreviousView = previousViewId;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   839
        //remove the settings view from main window
37
hgs
parents: 25
diff changeset
   840
        if (mSettingsView)
hgs
parents: 25
diff changeset
   841
        {
hgs
parents: 25
diff changeset
   842
            appendViewToBeDeleted(mSettingsView);
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   843
            mSettingsView = NULL;
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   844
        }
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   845
        switch (mCurrentView) {
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   846
        case MsgBaseView::CLV:
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   847
        {
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   848
            if (mListView)
48
4f501b74aeb1 201029_02
hgs
parents: 46
diff changeset
   849
                mMainWindow->setCurrentView(mListView,true,Hb::ViewSwitchSequential);
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   850
            break;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   851
        }
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   852
        case MsgBaseView::CV:
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   853
        {
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   854
            if (mConversationView)
48
4f501b74aeb1 201029_02
hgs
parents: 46
diff changeset
   855
                mMainWindow->setCurrentView(mConversationView,true,Hb::ViewSwitchSequential);
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   856
            break;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   857
        }
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   858
        case MsgBaseView::DLV:
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   859
        {
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   860
            if (mDraftsListView)
48
4f501b74aeb1 201029_02
hgs
parents: 46
diff changeset
   861
                mMainWindow->setCurrentView(mDraftsListView,true,Hb::ViewSwitchSequential);
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   862
            break;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   863
        }
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   864
        case MsgBaseView::UNIEDITOR:
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   865
        {
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   866
            if (mServiceRequest) {
48
4f501b74aeb1 201029_02
hgs
parents: 46
diff changeset
   867
                mMainWindow->setCurrentView(mUniEditor,true,Hb::ViewSwitchSequential);
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   868
            }
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   869
            else {
48
4f501b74aeb1 201029_02
hgs
parents: 46
diff changeset
   870
                mMainWindow->setCurrentView(mUniEditor,true,Hb::ViewSwitchSequential);
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   871
            }
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   872
            break;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   873
        }
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   874
        }
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   875
    }
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   876
}
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   877
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   878
void MsgViewManager::view(int msgId)
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   879
{
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   880
    int msgType;
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   881
    int msgSubType;
37
hgs
parents: 25
diff changeset
   882
    mMessageId = msgId;
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   883
    qint32 messageId(msgId);
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   884
    ConversationsEngine::instance()->markAsReadAndGetType(messageId, msgType, msgSubType);
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   885
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   886
    switch (msgType) {
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   887
    case ConvergedMessage::Sms:
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   888
    case ConvergedMessage::Mms:
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   889
    case ConvergedMessage::MmsNotification:
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   890
    {
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   891
        handleSmsMmsMsg(msgId);
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   892
        break;
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   893
    }
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   894
    case ConvergedMessage::BioMsg:
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   895
    {
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   896
        if (msgSubType == ConvergedMessage::RingingTone) {
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   897
            handleRingtoneMsg(msgId);
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   898
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   899
        }
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   900
        else if (msgSubType == ConvergedMessage::Provisioning) {
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   901
            handleProvisoningMsg(msgId);
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   902
        }
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   903
        break;
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   904
    }
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   905
    case ConvergedMessage::BT:
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   906
    {
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   907
        break;
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   908
    }
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   909
    default:
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   910
    {
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   911
        // for un supported message show delete option
37
hgs
parents: 25
diff changeset
   912
        HbMessageBox::question(LOC_DELETE_MESSAGE,this,
hgs
parents: 25
diff changeset
   913
                               SLOT(onDialogDeleteMsg(HbAction*)),
hgs
parents: 25
diff changeset
   914
                               HbMessageBox::Delete | HbMessageBox::Cancel);
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   915
        break;
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   916
    }
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   917
    }
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   918
}
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   919
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   920
// ----------------------------------------------------------------------------
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   921
// MsgViewManager::handleSmsMmsMsg
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   922
// @see header
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   923
// ----------------------------------------------------------------------------
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   924
void MsgViewManager::handleSmsMmsMsg(int msgId)
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   925
{
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   926
    mViewServiceRequest = true;
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   927
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   928
    mCurrentView = MsgBaseView::UNIVIEWER;
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   929
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   930
    if (!mUniViewer) {
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   931
        mUniViewer = new UnifiedViewer(msgId);
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   932
        mUniViewer->setNavigationAction(mBackAction);
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   933
        mMainWindow->addView(mUniViewer);
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   934
        connect(mUniViewer, SIGNAL(switchView(const QVariantList&)), this,
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   935
            SLOT(switchView(const QVariantList&)));
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   936
    }
62
fdbe8253b596 201035_03
hgs
parents: 56
diff changeset
   937
    mUniViewer->populateContent(msgId, true, -1, mConversationId);
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   938
48
4f501b74aeb1 201029_02
hgs
parents: 46
diff changeset
   939
    mMainWindow->setCurrentView(mUniViewer,true,Hb::ViewSwitchSequential);
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   940
}
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   941
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   942
// ----------------------------------------------------------------------------
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   943
// MsgViewManager::handleRingtoneMsg
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   944
// @see header
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   945
// ----------------------------------------------------------------------------
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   946
void MsgViewManager::handleRingtoneMsg(int msgId)
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   947
{
37
hgs
parents: 25
diff changeset
   948
    mMessageId = msgId;
hgs
parents: 25
diff changeset
   949
    HbMessageBox::question(LOC_DIALOG_SAVE_RINGTONE, this,
hgs
parents: 25
diff changeset
   950
                           SLOT(onDialogSaveTone(HbAction*)), 
hgs
parents: 25
diff changeset
   951
                           HbMessageBox::Save | HbMessageBox::Cancel);
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   952
}
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   953
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   954
// ----------------------------------------------------------------------------
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   955
// MsgViewManager::handleProvisoningMsg
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   956
// @see header
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   957
// ----------------------------------------------------------------------------
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   958
void MsgViewManager::handleProvisoningMsg(int msgId)
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   959
{
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   960
    QString messageId;
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   961
    messageId.setNum(msgId);
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   962
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   963
    XQApplicationManager* aiwMgr = new XQApplicationManager();
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   964
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   965
    XQAiwRequest* request = aiwMgr->create("com.nokia.services.MDM", "Provisioning",
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   966
        "ProcessMessage(QString)", true); // embedded
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   967
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   968
    if (request) {
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   969
        QList<QVariant> args;
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   970
        args << QVariant(messageId);
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   971
        request->setArguments(args);
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   972
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   973
        // Send the request
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   974
        bool res = request->send();
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   975
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   976
        // Cleanup
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   977
        delete request;
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   978
    }
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   979
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   980
    delete aiwMgr;
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   981
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   982
    // close the application once its handled
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   983
    HbApplication::quit();
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   984
}
37
hgs
parents: 25
diff changeset
   985
hgs
parents: 25
diff changeset
   986
void MsgViewManager::setViewInteractive()
hgs
parents: 25
diff changeset
   987
{
hgs
parents: 25
diff changeset
   988
    if(!mMainWindow->isInteractive())
hgs
parents: 25
diff changeset
   989
    {
hgs
parents: 25
diff changeset
   990
        mMainWindow->setInteractive(true);
hgs
parents: 25
diff changeset
   991
    }
hgs
parents: 25
diff changeset
   992
hgs
parents: 25
diff changeset
   993
    disconnect(mMainWindow, SIGNAL(viewReady()),this,SLOT(setViewInteractive()));
hgs
parents: 25
diff changeset
   994
}
hgs
parents: 25
diff changeset
   995
hgs
parents: 25
diff changeset
   996
void  MsgViewManager::appendViewToBeDeleted(HbView* view)
hgs
parents: 25
diff changeset
   997
{
hgs
parents: 25
diff changeset
   998
    if (view)
hgs
parents: 25
diff changeset
   999
    {
hgs
parents: 25
diff changeset
  1000
        mViewTobeDeleted << view;
hgs
parents: 25
diff changeset
  1001
        connect(mMainWindow, SIGNAL(viewReady()), this, SLOT(deletePreviousView()), Qt::UniqueConnection);
hgs
parents: 25
diff changeset
  1002
    }
hgs
parents: 25
diff changeset
  1003
}
hgs
parents: 25
diff changeset
  1004
hgs
parents: 25
diff changeset
  1005
// ----------------------------------------------------------------------------
hgs
parents: 25
diff changeset
  1006
// MsgViewManager::onDialogDeleteMsg
hgs
parents: 25
diff changeset
  1007
// @see header
hgs
parents: 25
diff changeset
  1008
// ----------------------------------------------------------------------------
hgs
parents: 25
diff changeset
  1009
void MsgViewManager::onDialogDeleteMsg(HbAction* action)
hgs
parents: 25
diff changeset
  1010
{
hgs
parents: 25
diff changeset
  1011
    HbMessageBox *dlg = qobject_cast<HbMessageBox*> (sender());
hgs
parents: 25
diff changeset
  1012
    if (action == dlg->actions().at(0)) {
hgs
parents: 25
diff changeset
  1013
        QList<int> msgIdList;
hgs
parents: 25
diff changeset
  1014
        msgIdList << mMessageId;
hgs
parents: 25
diff changeset
  1015
        ConversationsEngine::instance()->deleteMessages(msgIdList);
hgs
parents: 25
diff changeset
  1016
    }
hgs
parents: 25
diff changeset
  1017
    HbApplication::quit(); // exit after handling
hgs
parents: 25
diff changeset
  1018
}
hgs
parents: 25
diff changeset
  1019
hgs
parents: 25
diff changeset
  1020
// ----------------------------------------------------------------------------
hgs
parents: 25
diff changeset
  1021
// MsgViewManager::onDialogSaveTone
hgs
parents: 25
diff changeset
  1022
// @see header
hgs
parents: 25
diff changeset
  1023
// ----------------------------------------------------------------------------
hgs
parents: 25
diff changeset
  1024
void MsgViewManager::onDialogSaveTone(HbAction* action)
hgs
parents: 25
diff changeset
  1025
    {
hgs
parents: 25
diff changeset
  1026
        HbMessageBox *dlg = qobject_cast<HbMessageBox*> (sender());
hgs
parents: 25
diff changeset
  1027
        if (action == dlg->actions().at(0)) {
hgs
parents: 25
diff changeset
  1028
            UniDataModelLoader* pluginLoader = new UniDataModelLoader();
hgs
parents: 25
diff changeset
  1029
            UniDataModelPluginInterface* pluginInterface = pluginLoader->getDataModelPlugin(
hgs
parents: 25
diff changeset
  1030
                ConvergedMessage::BioMsg);
hgs
parents: 25
diff changeset
  1031
            pluginInterface->setMessageId(mMessageId);
hgs
parents: 25
diff changeset
  1032
            UniMessageInfoList attachments = pluginInterface->attachmentList();
hgs
parents: 25
diff changeset
  1033
hgs
parents: 25
diff changeset
  1034
            QString attachmentPath = attachments.at(0)->path();
hgs
parents: 25
diff changeset
  1035
hgs
parents: 25
diff changeset
  1036
            RingBc* ringBc = new RingBc();
hgs
parents: 25
diff changeset
  1037
            ringBc->saveTone(attachmentPath);
hgs
parents: 25
diff changeset
  1038
hgs
parents: 25
diff changeset
  1039
            // clear attachement list : its allocated at data model
hgs
parents: 25
diff changeset
  1040
            while (!attachments.isEmpty()) {
hgs
parents: 25
diff changeset
  1041
                delete attachments.takeFirst();
hgs
parents: 25
diff changeset
  1042
            }
hgs
parents: 25
diff changeset
  1043
hgs
parents: 25
diff changeset
  1044
            delete ringBc;
hgs
parents: 25
diff changeset
  1045
            delete pluginLoader;
hgs
parents: 25
diff changeset
  1046
        }
hgs
parents: 25
diff changeset
  1047
hgs
parents: 25
diff changeset
  1048
        // close the application once its handled
hgs
parents: 25
diff changeset
  1049
        HbApplication::quit();
hgs
parents: 25
diff changeset
  1050
}
hgs
parents: 25
diff changeset
  1051
hgs
parents: 25
diff changeset
  1052
// ----------------------------------------------------------------------------
hgs
parents: 25
diff changeset
  1053
// MsgViewManager::currentView
hgs
parents: 25
diff changeset
  1054
// @see header
hgs
parents: 25
diff changeset
  1055
// ----------------------------------------------------------------------------
hgs
parents: 25
diff changeset
  1056
int MsgViewManager::currentView()
hgs
parents: 25
diff changeset
  1057
    {
hgs
parents: 25
diff changeset
  1058
    return mCurrentView;
hgs
parents: 25
diff changeset
  1059
    }
hgs
parents: 25
diff changeset
  1060
hgs
parents: 25
diff changeset
  1061
// ----------------------------------------------------------------------------
hgs
parents: 25
diff changeset
  1062
// MsgViewManager::saveContentToDraft
hgs
parents: 25
diff changeset
  1063
// @see header
hgs
parents: 25
diff changeset
  1064
// ----------------------------------------------------------------------------
hgs
parents: 25
diff changeset
  1065
int MsgViewManager::saveContentToDraft()
hgs
parents: 25
diff changeset
  1066
    {
hgs
parents: 25
diff changeset
  1067
    int msgId = NULL_CONVERSATIONID;
hgs
parents: 25
diff changeset
  1068
    if( mCurrentView == MsgBaseView::CV )
hgs
parents: 25
diff changeset
  1069
        {
hgs
parents: 25
diff changeset
  1070
        msgId = mConversationView->saveContentToDrafts();
hgs
parents: 25
diff changeset
  1071
        }
hgs
parents: 25
diff changeset
  1072
    else if( mCurrentView ==MsgBaseView::UNIEDITOR)
hgs
parents: 25
diff changeset
  1073
        {
hgs
parents: 25
diff changeset
  1074
        msgId  = mUniEditor->saveContentToDrafts();
hgs
parents: 25
diff changeset
  1075
        }
hgs
parents: 25
diff changeset
  1076
    return msgId;
hgs
parents: 25
diff changeset
  1077
    }
hgs
parents: 25
diff changeset
  1078
hgs
parents: 25
diff changeset
  1079
// ----------------------------------------------------------------------------
62
fdbe8253b596 201035_03
hgs
parents: 56
diff changeset
  1080
// MsgViewManager::handleKeyEvent
fdbe8253b596 201035_03
hgs
parents: 56
diff changeset
  1081
// @see header
fdbe8253b596 201035_03
hgs
parents: 56
diff changeset
  1082
// ----------------------------------------------------------------------------
fdbe8253b596 201035_03
hgs
parents: 56
diff changeset
  1083
bool MsgViewManager::handleKeyEvent(int key)
fdbe8253b596 201035_03
hgs
parents: 56
diff changeset
  1084
{
fdbe8253b596 201035_03
hgs
parents: 56
diff changeset
  1085
    MsgBaseView *baseView = static_cast<MsgBaseView *>(mMainWindow->currentView());
fdbe8253b596 201035_03
hgs
parents: 56
diff changeset
  1086
    bool eventHandled = false;
fdbe8253b596 201035_03
hgs
parents: 56
diff changeset
  1087
    if (baseView) {
fdbe8253b596 201035_03
hgs
parents: 56
diff changeset
  1088
        eventHandled = baseView->handleKeyEvent(key);
fdbe8253b596 201035_03
hgs
parents: 56
diff changeset
  1089
    }
fdbe8253b596 201035_03
hgs
parents: 56
diff changeset
  1090
    return eventHandled;
fdbe8253b596 201035_03
hgs
parents: 56
diff changeset
  1091
}
fdbe8253b596 201035_03
hgs
parents: 56
diff changeset
  1092
fdbe8253b596 201035_03
hgs
parents: 56
diff changeset
  1093
// ----------------------------------------------------------------------------
37
hgs
parents: 25
diff changeset
  1094
// MsgViewManager::saveContentToDraft
hgs
parents: 25
diff changeset
  1095
// @see header
hgs
parents: 25
diff changeset
  1096
// ----------------------------------------------------------------------------
hgs
parents: 25
diff changeset
  1097
void MsgViewManager::openUniEditorActivity(int activityMsgId)
hgs
parents: 25
diff changeset
  1098
{
hgs
parents: 25
diff changeset
  1099
    int msgType;
hgs
parents: 25
diff changeset
  1100
    int msgSubType;
hgs
parents: 25
diff changeset
  1101
  
hgs
parents: 25
diff changeset
  1102
    qint32 messageId(activityMsgId);
hgs
parents: 25
diff changeset
  1103
    // get the message type
hgs
parents: 25
diff changeset
  1104
    ConversationsEngine::instance()->markAsReadAndGetType(messageId, msgType, msgSubType);
hgs
parents: 25
diff changeset
  1105
    
hgs
parents: 25
diff changeset
  1106
    if (!mUniEditor) {
hgs
parents: 25
diff changeset
  1107
           mUniEditor = new MsgUnifiedEditorView();
hgs
parents: 25
diff changeset
  1108
           mMainWindow->addView(mUniEditor);
hgs
parents: 25
diff changeset
  1109
           mUniEditor->setNavigationAction(mBackAction);
hgs
parents: 25
diff changeset
  1110
           connect(mUniEditor, SIGNAL(switchView(const QVariantList&)), this,
hgs
parents: 25
diff changeset
  1111
               SLOT(switchView(const QVariantList&)));
hgs
parents: 25
diff changeset
  1112
       }
hgs
parents: 25
diff changeset
  1113
    
hgs
parents: 25
diff changeset
  1114
    // buffer data to open the draft message
hgs
parents: 25
diff changeset
  1115
    ConvergedMessageId convergedMsgId(activityMsgId);
hgs
parents: 25
diff changeset
  1116
    ConvergedMessage message;
hgs
parents: 25
diff changeset
  1117
    message.setMessageType((ConvergedMessage::MessageType) msgType);
hgs
parents: 25
diff changeset
  1118
    message.setMessageId(convergedMsgId);
hgs
parents: 25
diff changeset
  1119
hgs
parents: 25
diff changeset
  1120
    // Launch uni-editor view
hgs
parents: 25
diff changeset
  1121
    QByteArray dataArray;
hgs
parents: 25
diff changeset
  1122
    QDataStream messageStream(&dataArray, QIODevice::WriteOnly | QIODevice::Append);
hgs
parents: 25
diff changeset
  1123
    message.serialize(messageStream);
hgs
parents: 25
diff changeset
  1124
    
hgs
parents: 25
diff changeset
  1125
    QVariantList editorData;
hgs
parents: 25
diff changeset
  1126
    editorData << dataArray;
hgs
parents: 25
diff changeset
  1127
    mUniEditor->openDraftsMessage(editorData);
hgs
parents: 25
diff changeset
  1128
    
hgs
parents: 25
diff changeset
  1129
    // set the current view
hgs
parents: 25
diff changeset
  1130
    mCurrentView = MsgBaseView::UNIEDITOR;
48
4f501b74aeb1 201029_02
hgs
parents: 46
diff changeset
  1131
    mPreviousView =MsgBaseView::CLV;
4f501b74aeb1 201029_02
hgs
parents: 46
diff changeset
  1132
    mMainWindow->setCurrentView(mUniEditor,true,Hb::ViewSwitchSequential);
37
hgs
parents: 25
diff changeset
  1133
}
hgs
parents: 25
diff changeset
  1134
hgs
parents: 25
diff changeset
  1135
// ----------------------------------------------------------------------------
hgs
parents: 25
diff changeset
  1136
// MsgViewManager::findContactId
hgs
parents: 25
diff changeset
  1137
// @see header
hgs
parents: 25
diff changeset
  1138
// ----------------------------------------------------------------------------
hgs
parents: 25
diff changeset
  1139
qint32 MsgViewManager::findContactId(QString address)
hgs
parents: 25
diff changeset
  1140
    {
hgs
parents: 25
diff changeset
  1141
    QString displayLabel;
hgs
parents: 25
diff changeset
  1142
    int count;
hgs
parents: 25
diff changeset
  1143
    int localId =
hgs
parents: 25
diff changeset
  1144
            MsgContactHandler::resolveContactDisplayName(address,
hgs
parents: 25
diff changeset
  1145
                                                         displayLabel,
hgs
parents: 25
diff changeset
  1146
                                                         count);
hgs
parents: 25
diff changeset
  1147
hgs
parents: 25
diff changeset
  1148
        return localId;
hgs
parents: 25
diff changeset
  1149
    }
hgs
parents: 25
diff changeset
  1150
76
hgs
parents: 62
diff changeset
  1151
// ----------------------------------------------------------------------------
hgs
parents: 62
diff changeset
  1152
// MsgViewManager::handleSendToBackGround
hgs
parents: 62
diff changeset
  1153
// @see header
hgs
parents: 62
diff changeset
  1154
// ----------------------------------------------------------------------------
hgs
parents: 62
diff changeset
  1155
void MsgViewManager::handleSendToBackGround()
hgs
parents: 62
diff changeset
  1156
    {
hgs
parents: 62
diff changeset
  1157
    if(mBringtoForground == false)
hgs
parents: 62
diff changeset
  1158
        {
hgs
parents: 62
diff changeset
  1159
        if (!mClient)
hgs
parents: 62
diff changeset
  1160
            mClient = new TsTaskSettings;
hgs
parents: 62
diff changeset
  1161
        mClient->setVisibility(false);
hgs
parents: 62
diff changeset
  1162
hgs
parents: 62
diff changeset
  1163
hgs
parents: 62
diff changeset
  1164
        mServiceRequest = false;
hgs
parents: 62
diff changeset
  1165
        mMainWindow->lower();
hgs
parents: 62
diff changeset
  1166
hgs
parents: 62
diff changeset
  1167
        mActivityHandler->saveActivity();
hgs
parents: 62
diff changeset
  1168
hgs
parents: 62
diff changeset
  1169
        mMainWindow->removeView(mListView);
hgs
parents: 62
diff changeset
  1170
        delete mListView;
hgs
parents: 62
diff changeset
  1171
        mListView = NULL;
hgs
parents: 62
diff changeset
  1172
hgs
parents: 62
diff changeset
  1173
        if(mConversationView)
hgs
parents: 62
diff changeset
  1174
            {
hgs
parents: 62
diff changeset
  1175
            mMainWindow->removeView(mConversationView);
hgs
parents: 62
diff changeset
  1176
            delete mConversationView;
hgs
parents: 62
diff changeset
  1177
            mConversationView = NULL;
hgs
parents: 62
diff changeset
  1178
            }
hgs
parents: 62
diff changeset
  1179
        
hgs
parents: 62
diff changeset
  1180
        if(mUniEditor)
hgs
parents: 62
diff changeset
  1181
            {
hgs
parents: 62
diff changeset
  1182
            mMainWindow->removeView(mUniEditor);
hgs
parents: 62
diff changeset
  1183
            delete mUniEditor;
hgs
parents: 62
diff changeset
  1184
            mUniEditor = NULL;
hgs
parents: 62
diff changeset
  1185
            }
hgs
parents: 62
diff changeset
  1186
hgs
parents: 62
diff changeset
  1187
        mBringtoForground = true;
hgs
parents: 62
diff changeset
  1188
hgs
parents: 62
diff changeset
  1189
        TUid appUid = RProcess().SecureId();
hgs
parents: 62
diff changeset
  1190
        TApaTaskList taskList(CEikonEnv::Static()->WsSession());
hgs
parents: 62
diff changeset
  1191
        TApaTask task = taskList.FindApp(appUid);
hgs
parents: 62
diff changeset
  1192
        if(task.Exists())
hgs
parents: 62
diff changeset
  1193
            {
hgs
parents: 62
diff changeset
  1194
            task.SendToBackground();
hgs
parents: 62
diff changeset
  1195
            }
hgs
parents: 62
diff changeset
  1196
        }
hgs
parents: 62
diff changeset
  1197
    mPreviousView = MsgBaseView::DEFAULT;
hgs
parents: 62
diff changeset
  1198
    mCurrentView = MsgBaseView::DEFAULT;      
hgs
parents: 62
diff changeset
  1199
    }
hgs
parents: 62
diff changeset
  1200
hgs
parents: 62
diff changeset
  1201
// ----------------------------------------------------------------------------
hgs
parents: 62
diff changeset
  1202
// MsgViewManager::handleApplicationActive
hgs
parents: 62
diff changeset
  1203
// @see header
hgs
parents: 62
diff changeset
  1204
// ----------------------------------------------------------------------------
hgs
parents: 62
diff changeset
  1205
void MsgViewManager::handleApplicationActive()
hgs
parents: 62
diff changeset
  1206
    {
hgs
parents: 62
diff changeset
  1207
    if(mBringtoForground)
hgs
parents: 62
diff changeset
  1208
        {
hgs
parents: 62
diff changeset
  1209
        mServiceRequest = false;
hgs
parents: 62
diff changeset
  1210
        mClient->setVisibility(true);
hgs
parents: 62
diff changeset
  1211
        mActivityHandler->clearActivities();
hgs
parents: 62
diff changeset
  1212
hgs
parents: 62
diff changeset
  1213
        mBringtoForground = false;        
hgs
parents: 62
diff changeset
  1214
hgs
parents: 62
diff changeset
  1215
        QVariantList param;
hgs
parents: 62
diff changeset
  1216
        param << MsgBaseView::CLV;
hgs
parents: 62
diff changeset
  1217
        param << MsgBaseView::CLV;
hgs
parents: 62
diff changeset
  1218
        switchView(param);
hgs
parents: 62
diff changeset
  1219
        }
hgs
parents: 62
diff changeset
  1220
    }
hgs
parents: 62
diff changeset
  1221
hgs
parents: 62
diff changeset
  1222
// ----------------------------------------------------------------------------
hgs
parents: 62
diff changeset
  1223
// MsgViewManager::setActivityHandler
hgs
parents: 62
diff changeset
  1224
// @see header
hgs
parents: 62
diff changeset
  1225
// ----------------------------------------------------------------------------
hgs
parents: 62
diff changeset
  1226
void MsgViewManager::setActivityHandler(MsgActivityHandler* activityHandler)
hgs
parents: 62
diff changeset
  1227
    {
hgs
parents: 62
diff changeset
  1228
    mActivityHandler = activityHandler;
hgs
parents: 62
diff changeset
  1229
    connect(mActivityHandler, 
hgs
parents: 62
diff changeset
  1230
        SIGNAL(activated(Af::ActivationReason, QString, QVariantHash)), 
hgs
parents: 62
diff changeset
  1231
        this, 
hgs
parents: 62
diff changeset
  1232
        SLOT(handleActivated(Af::ActivationReason, QString, QVariantHash)));
hgs
parents: 62
diff changeset
  1233
    }
hgs
parents: 62
diff changeset
  1234
hgs
parents: 62
diff changeset
  1235
// ----------------------------------------------------------------------------
hgs
parents: 62
diff changeset
  1236
// MsgViewManager::handleActivated
hgs
parents: 62
diff changeset
  1237
// @see header
hgs
parents: 62
diff changeset
  1238
// ----------------------------------------------------------------------------
hgs
parents: 62
diff changeset
  1239
void MsgViewManager::handleActivated(Af::ActivationReason reason, 
hgs
parents: 62
diff changeset
  1240
        QString name, 
hgs
parents: 62
diff changeset
  1241
        QVariantHash parameters)
hgs
parents: 62
diff changeset
  1242
    {
hgs
parents: 62
diff changeset
  1243
        Q_UNUSED(parameters)
hgs
parents: 62
diff changeset
  1244
        mClient->setVisibility(true);
hgs
parents: 62
diff changeset
  1245
        mBringtoForground = false;        
hgs
parents: 62
diff changeset
  1246
        mServiceRequest = false;
hgs
parents: 62
diff changeset
  1247
hgs
parents: 62
diff changeset
  1248
        if( reason == Af::ActivationReasonActivity)
hgs
parents: 62
diff changeset
  1249
            {
hgs
parents: 62
diff changeset
  1250
            QVariant data;
hgs
parents: 62
diff changeset
  1251
            if(name == EditorActivityName)
hgs
parents: 62
diff changeset
  1252
                {               
hgs
parents: 62
diff changeset
  1253
                bool ok = QMetaObject::invokeMethod(
hgs
parents: 62
diff changeset
  1254
                    mActivityHandler->activitiyStorage(),"activityData",
hgs
parents: 62
diff changeset
  1255
                    Q_RETURN_ARG(QVariant,data),Q_ARG(QString,name));
hgs
parents: 62
diff changeset
  1256
                }
hgs
parents: 62
diff changeset
  1257
            int activityMsgId = mActivityHandler->parseActivityData(data);
hgs
parents: 62
diff changeset
  1258
            if(activityMsgId == INVALID_MSGID)
hgs
parents: 62
diff changeset
  1259
                {
hgs
parents: 62
diff changeset
  1260
                QVariantList param;
hgs
parents: 62
diff changeset
  1261
                param << MsgBaseView::CLV;
hgs
parents: 62
diff changeset
  1262
                param << MsgBaseView::CLV;
hgs
parents: 62
diff changeset
  1263
                switchView(param);
hgs
parents: 62
diff changeset
  1264
                }
hgs
parents: 62
diff changeset
  1265
            else 
hgs
parents: 62
diff changeset
  1266
                {
hgs
parents: 62
diff changeset
  1267
                openUniEditorActivity(activityMsgId);
hgs
parents: 62
diff changeset
  1268
                }
hgs
parents: 62
diff changeset
  1269
            }        
hgs
parents: 62
diff changeset
  1270
        mActivityHandler->clearActivities();
hgs
parents: 62
diff changeset
  1271
    }
hgs
parents: 62
diff changeset
  1272
37
hgs
parents: 25
diff changeset
  1273
//EOF