messagingapp/msgui/conversationview/src/msgconversationview.cpp
author hgs
Tue, 05 Oct 2010 13:58:47 +0530
changeset 73 ecf6a73a9186
parent 67 fc91263aee62
permissions -rw-r--r--
201039_03
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:Conversation (chat) view for messaging application.
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    15
 *
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
#include "msgconversationview.h"
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    19
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    20
// SYSTEM INCLUDES
56
f42d9a78f435 201033_02
hgs
parents: 51
diff changeset
    21
#include <hbapplication.h>
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    22
#include <HbMenu>
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    23
#include <HbAction>
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    24
#include <HbListView>
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    25
#include <HbMessageBox>
37
hgs
parents: 25
diff changeset
    26
#include <HbFrameBackground>
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    27
#include <HbStaticVkbHost>
37
hgs
parents: 25
diff changeset
    28
#include <HbStyleLoader>
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    29
#include <xqaiwrequest.h>
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    30
#include <xqappmgr.h>
37
hgs
parents: 25
diff changeset
    31
#include <HbMainWindow>
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    32
56
f42d9a78f435 201033_02
hgs
parents: 51
diff changeset
    33
#include <QInputContext>
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    34
#include <QDir>
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    35
#include <QDateTime>
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    36
#include <QGraphicsLinearLayout>
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    37
#include <QStandardItemModel>
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    38
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    39
#include <cntservicescontact.h>
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    40
#include <ccsdefs.h>
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    41
#include <centralrepository.h>
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    42
#include <MmsEngineDomainCRKeys.h>
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    43
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    44
// USER INCLUDES
37
hgs
parents: 25
diff changeset
    45
#include "msgcontactsutil.h"
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    46
#include "msgsendutil.h"
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    47
#include "msgconversationviewitem.h"
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    48
#include "conversationsengine.h"
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    49
#include "convergedmessageid.h"
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    50
#include "conversationsenginedefines.h"
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    51
#include "msgcontactcardwidget.h"
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    52
#include "msgeditorwidget.h"
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    53
#include "msgviewdefines.h"
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    54
#include "debugtraces.h"
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    55
#include "unidatamodelloader.h"
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    56
#include "unidatamodelplugininterface.h"
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    57
#include "ringbc.h"
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    58
#include "mmsconformancecheck.h"
37
hgs
parents: 25
diff changeset
    59
#include "msgsettingsview.h"
46
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
    60
#include "unieditorpluginloader.h"
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
    61
#include "unieditorplugininterface.h"
56
f42d9a78f435 201033_02
hgs
parents: 51
diff changeset
    62
#include "msgaudiofetcherdialog.h"
73
ecf6a73a9186 201039_03
hgs
parents: 67
diff changeset
    63
#include "msgservicelaunchutil.h"
ecf6a73a9186 201039_03
hgs
parents: 67
diff changeset
    64
ecf6a73a9186 201039_03
hgs
parents: 67
diff changeset
    65
// LOCALIZATION
ecf6a73a9186 201039_03
hgs
parents: 67
diff changeset
    66
#define LOC_TITLE hbTrId("txt_messaging_title_messaging")
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    67
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    68
//Item specific menu.
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    69
#define LOC_COMMON_OPEN hbTrId("txt_common_menu_open")
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    70
#define LOC_COMMON_DELETE hbTrId("txt_common_menu_delete")
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    71
#define LOC_COMMON_FORWARD hbTrId("txt_common_menu_forward")
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    72
#define LOC_COMMON_DOWNLOAD hbTrId("txt_messaging_menu_download")
37
hgs
parents: 25
diff changeset
    73
#define LOC_COMMON_SEND  hbTrId("txt_common_button_send") 
hgs
parents: 25
diff changeset
    74
#define LOC_COMMON_SAVE  hbTrId("txt_common_menu_save")
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    75
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    76
#define LOC_DELETE_MESSAGE hbTrId("txt_messaging_dialog_delete_message")
46
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
    77
#define LOC_DELETE_SHARED_MESSAGE hbTrId("txt_messaging_dialog_same_message_exists_in_multip")
37
hgs
parents: 25
diff changeset
    78
#define LOC_SAVE_TO_CONTACTS hbTrId("txt_messaging_menu_save_to_contacts")
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    79
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    80
//main menu
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    81
#define LOC_ATTACH          hbTrId("txt_messaging_opt_attach")
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    82
#define LOC_PHOTO           hbTrId("txt_messaging_opt_attach_sub_photo")
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    83
#define LOC_SOUND           hbTrId("txt_messaging_opt_attach_sub_sound")
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    84
#define LOC_VCARD           hbTrId("txt_messaging_list_business_card")
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    85
#define LOC_ADD_RECIPIENTS  hbTrId("txt_messaging_opt_add_recipients")
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    86
#define LOC_ADD_SUBJECT     hbTrId("txt_messaging_opt_add_subject")
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    87
37
hgs
parents: 25
diff changeset
    88
#define LOC_MSG_SEND_FAILED hbTrId("txt_messaging_dialog_message_sending_failed")
41
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
    89
#define LOC_DIALOG_SMS_SETTINGS_INCOMPLETE hbTrId("txt_messaging_dialog_sms_message_centre_does_not_e")
37
hgs
parents: 25
diff changeset
    90
#define LOC_DIALOG_SAVE_RINGTONE hbTrId("txt_conversations_dialog_save_ringing_tone")
41
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
    91
#define LOC_MMS_RETRIEVAL_FAILED hbTrId("txt_messaging_dialog_mms_retrieval_failed")
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    92
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
const int INVALID_MSGID = -1;
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    95
const int INVALID_CONVID = -1;
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    96
const int CONTACT_INSERTION_MODE = 1;
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    97
const int VCARD_INSERTION_MODE = 0;
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    98
23
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
// MsgConversationView::MsgConversationView
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   101
// @see header file
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   102
//---------------------------------------------------------------
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   103
MsgConversationView::MsgConversationView(MsgContactCardWidget *contactCardWidget,
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   104
    QGraphicsItem *parent) :
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   105
    MsgBaseView(parent),
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   106
    mConversationList(NULL),
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   107
    mMessageModel(NULL),
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   108
    mEditorWidget(NULL),
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   109
    mContactCardWidget(contactCardWidget),
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   110
    mSendUtil(NULL),
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   111
    mVkbHost(NULL),
56
f42d9a78f435 201033_02
hgs
parents: 51
diff changeset
   112
    mDialog(NULL),
38
4e4b6adb1024 201025_01
hgs
parents: 37
diff changeset
   113
    mVisibleIndex(),
4e4b6adb1024 201025_01
hgs
parents: 37
diff changeset
   114
    mModelPopulated(false),
4e4b6adb1024 201025_01
hgs
parents: 37
diff changeset
   115
    mViewReady(false)
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   116
{
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   117
    //create send utils
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   118
    mSendUtil = new MsgSendUtil(this);
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   119
    //initialize view
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   120
    setupView();
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   121
    setupMenu();
37
hgs
parents: 25
diff changeset
   122
    
hgs
parents: 25
diff changeset
   123
    connect(ConversationsEngine::instance(), 
hgs
parents: 25
diff changeset
   124
                     SIGNAL(conversationModelUpdated()),
hgs
parents: 25
diff changeset
   125
                     this, 
hgs
parents: 25
diff changeset
   126
                     SLOT(scrollToBottom()));
hgs
parents: 25
diff changeset
   127
hgs
parents: 25
diff changeset
   128
    connect(ConversationsEngine::instance(), 
hgs
parents: 25
diff changeset
   129
                         SIGNAL(conversationViewEmpty()),
hgs
parents: 25
diff changeset
   130
                         this, 
hgs
parents: 25
diff changeset
   131
                         SLOT(onConversationViewEmpty()));
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   132
}
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   133
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   134
//---------------------------------------------------------------
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   135
// MsgConversationView::~MsgConversationView
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   136
// @see header file
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   137
//---------------------------------------------------------------
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   138
MsgConversationView::~MsgConversationView()
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   139
{
56
f42d9a78f435 201033_02
hgs
parents: 51
diff changeset
   140
    //delete the popup dialog
67
fc91263aee62 201037_04
hgs
parents: 62
diff changeset
   141
    if (mDialog) {
fc91263aee62 201037_04
hgs
parents: 62
diff changeset
   142
        delete mDialog;
fc91263aee62 201037_04
hgs
parents: 62
diff changeset
   143
    }
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   144
}
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   145
//---------------------------------------------------------------
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   146
// MsgConversationView::setupView
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   147
// @see header file
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   148
//---------------------------------------------------------------
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   149
void MsgConversationView::setupView()
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   150
{
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   151
    // Create HbListView and set properties
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   152
    mConversationList = new HbListView();
37
hgs
parents: 25
diff changeset
   153
    if (!HbStyleLoader::registerFilePath(":/layouts")) {
hgs
parents: 25
diff changeset
   154
        QDEBUG_WRITE("ERROR: ConversationView -> HbStyleLoader::registerFilePath");
hgs
parents: 25
diff changeset
   155
    }
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   156
    mConversationList->setLayoutName("custom");
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   157
    mConversationList->setItemRecycling(true);
67
fc91263aee62 201037_04
hgs
parents: 62
diff changeset
   158
	mConversationList->setItemPixmapCacheEnabled(true);
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   159
    MsgConversationViewItem *item = new MsgConversationViewItem(this);
37
hgs
parents: 25
diff changeset
   160
    HbFrameBackground defaultBackground;
hgs
parents: 25
diff changeset
   161
    defaultBackground.setFrameGraphicsName(QString(""));
hgs
parents: 25
diff changeset
   162
    item->setDefaultFrame(defaultBackground);
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   163
    mConversationList->setItemPrototype(item);
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   164
    mConversationList->setSelectionMode(HbListView::NoSelection);
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   165
    mConversationList->setClampingStyle(HbScrollArea::BounceBackClamping);
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   166
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   167
    mMessageModel = ConversationsEngine::instance()->getConversationsModel();
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   168
    
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   169
    connect(ConversationsEngine::instance(), 
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   170
            SIGNAL(conversationModelPopulated()), 
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   171
            this, 
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   172
            SLOT(populateConversationsView()));
23
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
    connect(mConversationList, SIGNAL(activated(QModelIndex)),
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   175
            this, SLOT(openItem(QModelIndex)));
37
hgs
parents: 25
diff changeset
   176
    connect(this->mainWindow(), SIGNAL(aboutToChangeOrientation()),
hgs
parents: 25
diff changeset
   177
                this, SLOT(onOrientationAboutToBeChanged()));
hgs
parents: 25
diff changeset
   178
    
hgs
parents: 25
diff changeset
   179
    connect(this->mainWindow(), SIGNAL(orientationChanged(Qt::Orientation)),
hgs
parents: 25
diff changeset
   180
                    this, SLOT(onOrientationChanged(Qt::Orientation)));
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   181
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   182
    // Long tap list item
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   183
    connect(mConversationList, SIGNAL(longPressed(HbAbstractViewItem*, QPointF)),
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   184
            this, SLOT(longPressed(HbAbstractViewItem*, QPointF)));
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   185
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   186
    // Create message editor widget, will be displayed based on msg type.
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   187
    mEditorWidget = new MsgEditorWidget(this);
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   188
    mEditorWidget->hide();
23
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
    connect(mEditorWidget, SIGNAL(sendMessage()), this, SLOT(send()));
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   191
    connect(mEditorWidget, SIGNAL(smsCharLimitReached()), 
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   192
        this, SLOT(handleSmsCharLimitReached()));
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   193
    connect(mEditorWidget, SIGNAL(replyStarted()), this, SIGNAL(replyStarted()));
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   194
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   195
    qreal spacing = HbDeviceProfile::profile(mConversationList).unitValue();
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   196
    
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   197
    mMainLayout = new QGraphicsLinearLayout(Qt::Vertical,this); 
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   198
    
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   199
    mMainLayout->setContentsMargins(CONTENT_MARGIN, CONTENT_MARGIN,
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   200
                                    CONTENT_MARGIN, CONTENT_MARGIN);   
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   201
    mMainLayout->setSpacing(spacing);
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   202
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   203
    mMainLayout->addItem(mConversationList);
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   204
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   205
    setLayout(mMainLayout);
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   206
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   207
    //Create VKB instance and listen to VKB open and close signals for resizing the view.
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   208
    mVkbHost = new HbStaticVkbHost(this);
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   209
	connect(mVkbHost, SIGNAL(keypadOpened()), this, SLOT(vkbOpened()));
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   210
	connect(mVkbHost, SIGNAL(keypadClosed()), this, SLOT(vkbClosed()));
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   211
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   212
    // Refresh view to show the header details
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   213
    refreshView();
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   214
}
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
// MsgConversationView::addMenu
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   218
// @see header file
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   219
//---------------------------------------------------------------
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   220
void MsgConversationView::setupMenu()
23
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
    // Just create dummy menu.
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   223
    // Actual menu will be created in menuAboutToShow()
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   224
    HbMenu *mainMenu = this->menu();
67
fc91263aee62 201037_04
hgs
parents: 62
diff changeset
   225
    mainMenu->addAction(QString());
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   226
    connect(mainMenu, SIGNAL(aboutToShow()), this, SLOT(menuAboutToShow()));
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   227
}
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   228
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   229
//---------------------------------------------------------------
38
4e4b6adb1024 201025_01
hgs
parents: 37
diff changeset
   230
// MsgConversationView::fetchMoreConversations
4e4b6adb1024 201025_01
hgs
parents: 37
diff changeset
   231
// @see header file
4e4b6adb1024 201025_01
hgs
parents: 37
diff changeset
   232
//---------------------------------------------------------------
4e4b6adb1024 201025_01
hgs
parents: 37
diff changeset
   233
void MsgConversationView::fetchMoreConversations()
4e4b6adb1024 201025_01
hgs
parents: 37
diff changeset
   234
{
4e4b6adb1024 201025_01
hgs
parents: 37
diff changeset
   235
    if (mViewReady && mModelPopulated) {
4e4b6adb1024 201025_01
hgs
parents: 37
diff changeset
   236
        ConversationsEngine::instance()->fetchMoreConversations();
4e4b6adb1024 201025_01
hgs
parents: 37
diff changeset
   237
        mViewReady = mModelPopulated = false;
4e4b6adb1024 201025_01
hgs
parents: 37
diff changeset
   238
    }
4e4b6adb1024 201025_01
hgs
parents: 37
diff changeset
   239
}
4e4b6adb1024 201025_01
hgs
parents: 37
diff changeset
   240
4e4b6adb1024 201025_01
hgs
parents: 37
diff changeset
   241
//---------------------------------------------------------------
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   242
// MsgConversationView::refreshView()
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   243
// @see header file
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   244
//---------------------------------------------------------------
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   245
void MsgConversationView::refreshView()
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   246
{
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   247
    // Hide editor in case of BT conversations.
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   248
    qint64 convId = ConversationsEngine::instance()->getCurrentConversationId();
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   249
    if (INVALID_CONVID != convId) {
67
fc91263aee62 201037_04
hgs
parents: 62
diff changeset
   250
        mContactCardWidget->updateContents();
fc91263aee62 201037_04
hgs
parents: 62
diff changeset
   251
        if (KBluetoothMsgsConversationId == convId || !(mContactCardWidget->isValidAddress())) {
73
ecf6a73a9186 201039_03
hgs
parents: 67
diff changeset
   252
            this->menu()->clearActions();
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   253
            mMainLayout->removeItem(mEditorWidget);
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   254
            mEditorWidget->hide();
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   255
            mEditorWidget->setParent(this);
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   256
        }
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   257
        else {
73
ecf6a73a9186 201039_03
hgs
parents: 67
diff changeset
   258
            HbMenu *mainMenu = this->menu();
ecf6a73a9186 201039_03
hgs
parents: 67
diff changeset
   259
            if(mainMenu->isEmpty()) {
ecf6a73a9186 201039_03
hgs
parents: 67
diff changeset
   260
               mainMenu->addAction(QString());
ecf6a73a9186 201039_03
hgs
parents: 67
diff changeset
   261
            }
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   262
            mMainLayout->addItem(mEditorWidget);
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   263
            mEditorWidget->show();
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   264
        }
67
fc91263aee62 201037_04
hgs
parents: 62
diff changeset
   265
        TRAP_IGNORE(mEditorWidget->setEncodingSettingsL());
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   266
    }
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   267
}
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
//---------------------------------------------------------------
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   270
// MsgConversationView::scrollToBottom()
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   271
// @see header file
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   272
//---------------------------------------------------------------
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   273
void MsgConversationView::scrollToBottom()
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   274
{
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   275
    const int rowCnt = mMessageModel->rowCount();
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   276
    mConversationList->scrollTo(
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   277
            mMessageModel->index(rowCnt - 1, 0));
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   278
}
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   279
37
hgs
parents: 25
diff changeset
   280
void MsgConversationView::onConversationViewEmpty()
hgs
parents: 25
diff changeset
   281
{
hgs
parents: 25
diff changeset
   282
    QVariantList param;
hgs
parents: 25
diff changeset
   283
    param << MsgBaseView::CLV; // target view
hgs
parents: 25
diff changeset
   284
    param << MsgBaseView::CV; // source view
hgs
parents: 25
diff changeset
   285
    emit switchView(param);
hgs
parents: 25
diff changeset
   286
}
hgs
parents: 25
diff changeset
   287
23
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
// MsgConversationView::longPressed
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   290
// @see header file
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   291
//---------------------------------------------------------------
41
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
   292
void MsgConversationView::longPressed(HbAbstractViewItem* viewItem, const QPointF& point)
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
   293
{ 
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
   294
    showContextMenu(viewItem,point,HbPopup::TopLeftCorner);
23
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
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   297
//---------------------------------------------------------------
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   298
// MsgConversationView::setContextMenu
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   299
// @see header
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   300
//---------------------------------------------------------------
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   301
void MsgConversationView::setContextMenu(MsgConversationViewItem* item, HbMenu* contextMenu, int sendingState)
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   302
{
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   303
    addOpenItemToContextMenu(item , contextMenu,sendingState);
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   304
    addResendItemToContextMenu(item, contextMenu, sendingState);
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   305
    addForwardItemToContextMenu(item, contextMenu, sendingState);
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   306
    addDownloadItemToContextMenu(item, contextMenu);
51
3507212d340e 201031_02
hgs
parents: 46
diff changeset
   307
    addSaveItemToContextMenu(item , contextMenu,sendingState);
37
hgs
parents: 25
diff changeset
   308
    addDeleteItemToContextMenu(item, contextMenu, sendingState);
hgs
parents: 25
diff changeset
   309
}
hgs
parents: 25
diff changeset
   310
hgs
parents: 25
diff changeset
   311
hgs
parents: 25
diff changeset
   312
//---------------------------------------------------------------
hgs
parents: 25
diff changeset
   313
// MsgEditorPrivate::addSaveItemToContextMenu
hgs
parents: 25
diff changeset
   314
// @see header
hgs
parents: 25
diff changeset
   315
//---------------------------------------------------------------
hgs
parents: 25
diff changeset
   316
void MsgConversationView::addSaveItemToContextMenu(MsgConversationViewItem* item,
hgs
parents: 25
diff changeset
   317
    HbMenu* contextMenu, int sendingState)
hgs
parents: 25
diff changeset
   318
{
hgs
parents: 25
diff changeset
   319
    Q_UNUSED(sendingState)
hgs
parents: 25
diff changeset
   320
hgs
parents: 25
diff changeset
   321
    int messageSubType = item->modelIndex().data(MessageSubType).toInt();
hgs
parents: 25
diff changeset
   322
    int direction =  item->modelIndex().data(Direction).toInt();
hgs
parents: 25
diff changeset
   323
    if ((messageSubType == ConvergedMessage::RingingTone) && 
hgs
parents: 25
diff changeset
   324
        (direction == ConvergedMessage::Incoming)) {
hgs
parents: 25
diff changeset
   325
        HbAction *contextItem = contextMenu->addAction(LOC_COMMON_SAVE);
hgs
parents: 25
diff changeset
   326
        connect(contextItem, SIGNAL(triggered()), this, SLOT(saveRingingTone()));
hgs
parents: 25
diff changeset
   327
    }
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   328
}
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   329
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   330
//---------------------------------------------------------------
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   331
// MsgEditorPrivate::addOpenItemToContextMenu
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   332
// @see header
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   333
//---------------------------------------------------------------
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   334
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   335
void MsgConversationView::addOpenItemToContextMenu(MsgConversationViewItem* item, HbMenu* contextMenu, int sendingState)
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   336
{
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   337
    int direction = item->modelIndex().data(Direction).toInt();
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   338
    int messageType = item->modelIndex().data(MessageType).toInt();
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   339
    int messageSubType = item->modelIndex().data(MessageSubType).toInt();
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   340
    
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   341
    if((messageSubType == ConvergedMessage::VCal) ||
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   342
        (messageSubType == ConvergedMessage::RingingTone) ||
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   343
        (messageType == ConvergedMessage::MmsNotification))
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   344
        {
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   345
        return;
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   346
        }
37
hgs
parents: 25
diff changeset
   347
    if ((messageSubType == ConvergedMessage::VCard) &&
hgs
parents: 25
diff changeset
   348
        (direction == ConvergedMessage::Incoming))
hgs
parents: 25
diff changeset
   349
        {
hgs
parents: 25
diff changeset
   350
        HbAction *contextItem = contextMenu->addAction(LOC_SAVE_TO_CONTACTS);
41
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
   351
        connect(contextItem, SIGNAL(triggered()),this, SLOT(saveVCard()));
37
hgs
parents: 25
diff changeset
   352
        return;
hgs
parents: 25
diff changeset
   353
        }
41
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
   354
    if( (sendingState == ConvergedMessage::SentState &&
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
   355
         messageSubType != ConvergedMessage::VCard) ||
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   356
        (direction == ConvergedMessage::Incoming))
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   357
    {
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   358
        HbAction *contextItem = contextMenu->addAction(LOC_COMMON_OPEN);
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   359
        connect(contextItem, SIGNAL(triggered()),this, SLOT(openItem()));
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   360
    }
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   361
    
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
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   364
//---------------------------------------------------------------
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   365
// MsgEditorPrivate::addResendItemToContextMenu
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   366
// @see header
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
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   369
void MsgConversationView::addResendItemToContextMenu(MsgConversationViewItem* item, HbMenu* contextMenu, int sendingState)
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   370
{
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   371
    Q_UNUSED(item)
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   372
    int direction = item->modelIndex().data(Direction).toInt();
41
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
   373
    int messageSubType = item->modelIndex().data(MessageSubType).toInt();
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   374
    
41
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
   375
    
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
   376
    if( ((direction == ConvergedMessage::Outgoing) &&
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
   377
        (messageSubType != ConvergedMessage::VCard))&&
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   378
        ((sendingState == ConvergedMessage::Resend ) ||
46
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   379
        
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   380
        (sendingState == ConvergedMessage::Failed )))
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   381
    {
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   382
        HbAction *contextItem = contextMenu->addAction(LOC_COMMON_SEND);
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   383
        connect(contextItem, SIGNAL(triggered()),this, SLOT(resendMessage()));
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   384
    }
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   385
}
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   386
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   387
//---------------------------------------------------------------
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   388
// MsgEditorPrivate::addForwardItemToContextMenu
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   389
// @see header
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   390
//---------------------------------------------------------------
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   391
void MsgConversationView::addForwardItemToContextMenu(MsgConversationViewItem* item, HbMenu* contextMenu, int sendingState)
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   392
{
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   393
    int messageType = item->modelIndex().data(MessageType).toInt();
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   394
    int direction = item->modelIndex().data(Direction).toInt();
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   395
    int messageSubType = item->modelIndex().data(MessageSubType).toInt();
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   396
    
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   397
    if( (messageType == ConvergedMessage::BT) ||
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   398
        (messageType == ConvergedMessage::MmsNotification) ||
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   399
        (messageSubType == ConvergedMessage::Provisioning ) ||
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   400
        (messageSubType == ConvergedMessage::RingingTone) ||
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   401
        (messageSubType == ConvergedMessage::VCal))
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   402
    {
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   403
        return;
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   404
    }
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   405
    
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   406
    qint32 messageId = item->modelIndex().data(ConvergedMsgId).toInt();
37
hgs
parents: 25
diff changeset
   407
    qint32 messageProperty = item->modelIndex().data(MessageProperty).toInt();
hgs
parents: 25
diff changeset
   408
    
hgs
parents: 25
diff changeset
   409
    bool canForwardMessage  = true;
hgs
parents: 25
diff changeset
   410
    if (messageType == ConvergedMessage::Mms){
hgs
parents: 25
diff changeset
   411
        canForwardMessage = (messageProperty & EPreviewForward)? true:false;
hgs
parents: 25
diff changeset
   412
    }            
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   413
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   414
    if( ((sendingState == ConvergedMessage::SentState) ||
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   415
        (sendingState == ConvergedMessage::Resend) ||
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   416
        (sendingState == ConvergedMessage::Failed) ||
46
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   417
        (sendingState == ConvergedMessage::Suspended )||
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   418
        (direction == ConvergedMessage::Incoming) ) &&
37
hgs
parents: 25
diff changeset
   419
        canForwardMessage)
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   420
    {
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   421
        HbAction *contextItem = contextMenu->addAction(LOC_COMMON_FORWARD);
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   422
        connect(contextItem, SIGNAL(triggered()),this, SLOT(forwardMessage()));
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   423
    }
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   424
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   425
}
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   426
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   427
//---------------------------------------------------------------
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   428
// MsgEditorPrivate::addDeleteItemToContextMenu
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   429
// @see header
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   430
//---------------------------------------------------------------
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   431
void MsgConversationView::addDeleteItemToContextMenu(MsgConversationViewItem* item, HbMenu* contextMenu, int sendingState)
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   432
{
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   433
    int direction = item->modelIndex().data(Direction).toInt();
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   434
    int messageType = item->modelIndex().data(MessageType).toInt();
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   435
    int notificationState = item->modelIndex().data(NotificationStatus).toInt();
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   436
    
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   437
    if( (messageType == ConvergedMessage::MmsNotification) && 
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   438
        ((notificationState == ConvergedMessage::NotifNull) || 
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   439
         (notificationState ==  ConvergedMessage::NotifRetrieving) ||
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   440
         (notificationState == ConvergedMessage::NotifWaiting)))
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   441
    {
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   442
        return;
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   443
    }
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   444
    
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   445
    if( (sendingState == ConvergedMessage::SentState) ||
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   446
        (sendingState == ConvergedMessage::Resend) ||
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   447
        (sendingState == ConvergedMessage::Suspended) ||
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   448
        (sendingState == ConvergedMessage::Failed) ||
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   449
        (direction == ConvergedMessage::Incoming))
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   450
    {
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   451
        HbAction *contextItem = contextMenu->addAction(LOC_COMMON_DELETE);
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   452
        connect(contextItem, SIGNAL(triggered()),this, SLOT(deleteItem()));
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   453
    }  
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   454
}
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   455
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   456
//---------------------------------------------------------------
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   457
// MsgEditorPrivate::addDownloadItemToContextMenu
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   458
// @see header
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   459
//---------------------------------------------------------------
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   460
void MsgConversationView::addDownloadItemToContextMenu(MsgConversationViewItem* item, HbMenu* contextMenu)
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   461
{
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   462
    int notificationState = item->modelIndex().data(NotificationStatus).toInt();
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   463
    int messageType = item->modelIndex().data(MessageType).toInt();
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   464
    qint32 messageId = item->modelIndex().data(ConvergedMsgId).toLongLong();
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   465
        
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   466
    if( messageType == ConvergedMessage::MmsNotification &&
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   467
        ConversationsEngine::instance()->downloadOperationSupported(messageId))
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   468
    {            
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   469
        HbAction *contextItem = contextMenu->addAction(LOC_COMMON_DOWNLOAD);
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   470
        connect(contextItem, SIGNAL(triggered()),this, SLOT(downloadMessage()));
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   471
    }
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   472
}
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   473
//---------------------------------------------------------------
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   474
// MsgEditorPrivate::send
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   475
// @see header
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   476
//---------------------------------------------------------------
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   477
void MsgConversationView::send()
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   478
{
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   479
    activateInputBlocker();
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   480
    ConvergedMessageAddressList addresses;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   481
    addresses = mContactCardWidget->address();
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   482
    int sendResult = KErrNone;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   483
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   484
    // Populate the ConvergedMessage.
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   485
    if (!addresses.isEmpty())
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   486
    {
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   487
        ConvergedMessage msg;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   488
        populateForSending(msg);
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   489
        msg.addToRecipients(addresses);
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
        // Send
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   492
        sendResult = mSendUtil->send(msg);
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   493
                   
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   494
        if( sendResult == KErrNone)
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   495
        {
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   496
            mEditorWidget->clear();
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
    }
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   499
    deactivateInputBlocker();
56
f42d9a78f435 201033_02
hgs
parents: 51
diff changeset
   500
f42d9a78f435 201033_02
hgs
parents: 51
diff changeset
   501
    // make sure virtual keyboard is closed
f42d9a78f435 201033_02
hgs
parents: 51
diff changeset
   502
    QInputContext *ic = qApp->inputContext();
f42d9a78f435 201033_02
hgs
parents: 51
diff changeset
   503
    if (ic) {
f42d9a78f435 201033_02
hgs
parents: 51
diff changeset
   504
    QEvent *closeEvent = new QEvent(QEvent::CloseSoftwareInputPanel);
f42d9a78f435 201033_02
hgs
parents: 51
diff changeset
   505
    ic->filterEvent(closeEvent);
f42d9a78f435 201033_02
hgs
parents: 51
diff changeset
   506
    delete closeEvent;
f42d9a78f435 201033_02
hgs
parents: 51
diff changeset
   507
    }
f42d9a78f435 201033_02
hgs
parents: 51
diff changeset
   508
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   509
    if( sendResult == KErrNotFound)
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   510
    {
37
hgs
parents: 25
diff changeset
   511
    HbMessageBox::question(LOC_DIALOG_SMS_SETTINGS_INCOMPLETE, this,
hgs
parents: 25
diff changeset
   512
                           SLOT(onDialogSettingsLaunch(HbAction*)), 
hgs
parents: 25
diff changeset
   513
                           HbMessageBox::Ok | HbMessageBox::Cancel);
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   514
    }
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   515
}
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   516
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   517
//---------------------------------------------------------------
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   518
// MsgConversationView::contactsFetchedForVCards
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   519
// @see header file
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   520
//---------------------------------------------------------------
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   521
void MsgConversationView::contactsFetchedForVCards(const QVariant& value)
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   522
{
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   523
    // get received contact-list and launch unieditor
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   524
    CntServicesContactList contactList = 
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   525
            qVariantValue<CntServicesContactList>(value);
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   526
    int cntCount = contactList.count();
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   527
    if(cntCount > 0)
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   528
    {
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   529
        QVariantList params;
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   530
        params << MsgBaseView::ADD_VCARD;
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   531
        params << value;
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   532
        launchUniEditor(params);        
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   533
    }
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   534
}
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   535
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   536
//---------------------------------------------------------------
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   537
// MsgConversationView::fetchContacts
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   538
// @see header file
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   539
//---------------------------------------------------------------
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   540
void MsgConversationView::fetchContacts()
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   541
{
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   542
    HbAction* action = qobject_cast<HbAction*>(sender());
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   543
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   544
    if(!action)
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   545
        return;
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   546
73
ecf6a73a9186 201039_03
hgs
parents: 67
diff changeset
   547
    QList<QVariant> args;
ecf6a73a9186 201039_03
hgs
parents: 67
diff changeset
   548
    args << LOC_TITLE;
ecf6a73a9186 201039_03
hgs
parents: 67
diff changeset
   549
62
fdbe8253b596 201035_03
hgs
parents: 56
diff changeset
   550
    QString service("phonebookservices");
fdbe8253b596 201035_03
hgs
parents: 56
diff changeset
   551
    QString interface("com.nokia.symbian.IContactsFetch");
fdbe8253b596 201035_03
hgs
parents: 56
diff changeset
   552
    QString operation("multiFetch(QString,QString)");
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   553
    XQAiwRequest* request;
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   554
    XQApplicationManager appManager;
62
fdbe8253b596 201035_03
hgs
parents: 56
diff changeset
   555
    request = appManager.create(service, interface, operation, true); //embedded
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   556
    if ( request == NULL )
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   557
    {
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   558
        return;       
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   559
    }
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   560
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   561
    int mode = action->data().toInt();
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   562
    
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   563
    if( VCARD_INSERTION_MODE == mode) //vcard-insert mode
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   564
    {
73
ecf6a73a9186 201039_03
hgs
parents: 67
diff changeset
   565
        args << KCntActionAll;
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   566
        connect(request, SIGNAL(requestOk(const QVariant&)),
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   567
            this, SLOT(contactsFetchedForVCards(const QVariant&)));      
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   568
    }
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   569
    else  //contact-insert mode
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   570
    {
73
ecf6a73a9186 201039_03
hgs
parents: 67
diff changeset
   571
        args << KCntActionSms;
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   572
        connect(request, SIGNAL(requestOk(const QVariant&)),
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   573
            this, SLOT(contactsFetched(const QVariant&)));
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   574
    }
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   575
    connect (request, SIGNAL(requestError(int,const QString&)), 
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   576
        this, SLOT(serviceRequestError(int,const QString&)));
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   577
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   578
    args << KCntFilterDisplayAll;
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   579
    request->setArguments(args);
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   580
    request->send();
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   581
    delete request;
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   582
}
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   583
//---------------------------------------------------------------
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   584
// MsgConversationView::fetchImages
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   585
// @see header file
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   586
//---------------------------------------------------------------
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   587
void MsgConversationView::fetchImages()
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   588
{
37
hgs
parents: 25
diff changeset
   589
    QString service("photos");
hgs
parents: 25
diff changeset
   590
    QString interface("com.nokia.symbian.IImageFetch");
hgs
parents: 25
diff changeset
   591
    QString operation("fetch()");
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   592
    XQAiwRequest* request = NULL;
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   593
    XQApplicationManager appManager;
37
hgs
parents: 25
diff changeset
   594
    request = appManager.create(service,interface, operation, true); // embedded
62
fdbe8253b596 201035_03
hgs
parents: 56
diff changeset
   595
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   596
    if(!request)
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   597
    {
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   598
        QDEBUG_WRITE("AIW-ERROR: NULL request");
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   599
        return;
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   600
    }
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   601
62
fdbe8253b596 201035_03
hgs
parents: 56
diff changeset
   602
    request->setSynchronous(true); // synchronous
fdbe8253b596 201035_03
hgs
parents: 56
diff changeset
   603
    
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   604
    connect(request, SIGNAL(requestOk(const QVariant&)),
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   605
        this, SLOT(imagesFetched(const QVariant&)));
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   606
    connect(request, SIGNAL(requestError(int,const QString&)),
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   607
        this, SLOT(serviceRequestError(int,const QString&)));
37
hgs
parents: 25
diff changeset
   608
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   609
    // Make the request
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   610
    if (!request->send())
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   611
    {
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   612
        QDEBUG_WRITE_FORMAT("AIW-ERROR: Request Send failed:" , request->lastError());
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   613
    }  
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   614
    delete request;
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   615
}
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   616
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   617
//---------------------------------------------------------------
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   618
// MsgConversationView::fetchAudio
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   619
// @see header file
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   620
//---------------------------------------------------------------
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   621
void MsgConversationView::fetchAudio()
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   622
{
56
f42d9a78f435 201033_02
hgs
parents: 51
diff changeset
   623
    // Launch Audio fetcher dialog
f42d9a78f435 201033_02
hgs
parents: 51
diff changeset
   624
    if (!mDialog)
f42d9a78f435 201033_02
hgs
parents: 51
diff changeset
   625
    {
f42d9a78f435 201033_02
hgs
parents: 51
diff changeset
   626
        mDialog = new MsgAudioFetcherDialog();
f42d9a78f435 201033_02
hgs
parents: 51
diff changeset
   627
        bool b = connect(mDialog,
f42d9a78f435 201033_02
hgs
parents: 51
diff changeset
   628
                SIGNAL(audioSelected(QString&)),
f42d9a78f435 201033_02
hgs
parents: 51
diff changeset
   629
                this,
f42d9a78f435 201033_02
hgs
parents: 51
diff changeset
   630
                SLOT(onAudioSelected(QString&)));
f42d9a78f435 201033_02
hgs
parents: 51
diff changeset
   631
    }
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   632
56
f42d9a78f435 201033_02
hgs
parents: 51
diff changeset
   633
    //show the dialog
f42d9a78f435 201033_02
hgs
parents: 51
diff changeset
   634
    mDialog->show();    
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   635
}
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   636
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   637
//---------------------------------------------------------------
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   638
// MsgConversationView::contactsFetched
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   639
// @see header file
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   640
//---------------------------------------------------------------
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   641
void MsgConversationView::contactsFetched(const QVariant& value)
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   642
{
51
3507212d340e 201031_02
hgs
parents: 46
diff changeset
   643
    //switch to editor.
3507212d340e 201031_02
hgs
parents: 46
diff changeset
   644
    QVariantList params;
3507212d340e 201031_02
hgs
parents: 46
diff changeset
   645
    params << MsgBaseView::ADD_RECIPIENTS;
3507212d340e 201031_02
hgs
parents: 46
diff changeset
   646
    params << value;
3507212d340e 201031_02
hgs
parents: 46
diff changeset
   647
    launchUniEditor(params);
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   648
}
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   649
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   650
//---------------------------------------------------------------
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   651
// MsgConversationView::imagesFetched()
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   652
// @see header file
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   653
//---------------------------------------------------------------
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   654
void MsgConversationView::imagesFetched(const QVariant& result )
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   655
{
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   656
    if(result.canConvert<QStringList>())
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   657
    {
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   658
        QStringList fileList = result.value<QStringList>();
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   659
        if ( fileList.size()>0 )
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   660
        {
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   661
            QString filepath(QDir::toNativeSeparators(fileList.at(0)));
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   662
            QVariantList params;
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   663
            params << MsgBaseView::ADD_PHOTO;
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   664
            params << filepath;
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   665
            launchUniEditor(params);
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   666
        }
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   667
    }
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   668
}
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   669
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   670
//---------------------------------------------------------------
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   671
// MsgConversationView::addSubject()
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   672
// @see header file
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   673
//---------------------------------------------------------------
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   674
void MsgConversationView::addSubject()
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
    QString filepath;
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   678
    QVariantList params;
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   679
    params << MsgBaseView::ADD_SUBJECT;
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   680
    launchUniEditor(params);
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   681
}
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   682
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   683
//---------------------------------------------------------------
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   684
// MsgConversationView::forwardMessage()
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   685
// Forwards the message
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   686
//---------------------------------------------------------------
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   687
void MsgConversationView::forwardMessage()
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   688
{
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   689
    QModelIndex index = mConversationList->currentIndex();
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   690
    //messageId & messageType to be forwarded
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   691
    qint32 messageId = index.data(ConvergedMsgId).toLongLong();
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   692
    int messageType = index.data(MessageType).toInt();
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   693
 
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   694
    //Mark the message to read before forwarding.
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   695
    if(index.data(UnReadStatus).toBool())
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   696
    {
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   697
        QList<int> msgIdList;
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   698
        msgIdList.append(messageId);
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   699
        ConversationsEngine::instance()->markMessagesRead(msgIdList);
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   700
    }
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   701
    // populate params and launch editor 
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   702
    QVariantList params;
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   703
    params << MsgBaseView::FORWARD_MSG;
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   704
    params << messageId;
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   705
    params << messageType;
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   706
    launchUniEditor(params);
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   707
}
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   708
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   709
//---------------------------------------------------------------
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   710
// MsgConversationView::resendMessage()
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   711
// Resends the message in the failed messages case
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   712
//---------------------------------------------------------------
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   713
void MsgConversationView::resendMessage()
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   714
{
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   715
    QModelIndex index = mConversationList->currentIndex();
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   716
    if(index.isValid())
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   717
    {
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   718
        qint32 messageId = index.data(ConvergedMsgId).toLongLong();    
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   719
        if(!(ConversationsEngine::instance()->resendMessage(messageId)))
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   720
        {
41
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
   721
            HbMessageBox::warning(LOC_MSG_SEND_FAILED, 0, 0, HbMessageBox::Ok);
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   722
        }
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   723
    }
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   724
    
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   725
}
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   726
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   727
//---------------------------------------------------------------
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   728
// MsgConversationView::downloadMessage()
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   729
// @see header
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   730
//---------------------------------------------------------------
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   731
void MsgConversationView::downloadMessage()
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   732
{
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   733
    QModelIndex index = mConversationList->currentIndex();
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   734
    if(index.isValid())
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   735
    {
41
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
   736
        qint32 messageId = index.data(ConvergedMsgId).toLongLong();
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   737
        if(ConversationsEngine::instance()->downloadMessage(messageId)!=KErrNone)
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   738
        {
41
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
   739
            HbMessageBox::warning(LOC_MMS_RETRIEVAL_FAILED, 0, 0, HbMessageBox::Ok);
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   740
        }
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   741
    }
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   742
    
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   743
}
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   744
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   745
//---------------------------------------------------------------
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   746
// MsgConversationView::deleteItem()
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   747
// Deletes the message
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   748
//---------------------------------------------------------------
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   749
void MsgConversationView::deleteItem()
46
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   750
{
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   751
    QString str = LOC_DELETE_MESSAGE;
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   752
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   753
    QModelIndex index = mConversationList->currentIndex();
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   754
    if(index.isValid())
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   755
    {
46
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   756
        int messageType = index.data(MessageType).toInt();        
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   757
        int direction = index.data(Direction).toInt();
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   758
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   759
        if ( direction == ConvergedMessage::Outgoing &&
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   760
            messageType == ConvergedMessage::Mms )
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   761
        {
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   762
            qint32 messageId = index.data(ConvergedMsgId).toLongLong();
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   763
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   764
            if(isSharedMessage(messageId))
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   765
            {
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   766
                str = LOC_DELETE_SHARED_MESSAGE;  
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   767
            }
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   768
        }
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   769
    }
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   770
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   771
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   772
    HbMessageBox::question(str,this,SLOT(onDialogdeleteMsg(HbAction*)),
37
hgs
parents: 25
diff changeset
   773
                           HbMessageBox::Delete | HbMessageBox::Cancel);
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   774
}
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   775
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   776
//---------------------------------------------------------------
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   777
// MsgConversationView::openItem()
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   778
// Opens the message
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   779
//---------------------------------------------------------------
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   780
void MsgConversationView::openItem()
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   781
{
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   782
    QModelIndex index = mConversationList->currentIndex();
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   783
    openItem(index);
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   784
}
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   785
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
// MsgConversationView::clearEditors()
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   788
// @See header
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   789
//---------------------------------------------------------------
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   790
void MsgConversationView::clearEditors()
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   791
{
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   792
    mEditorWidget->clear();
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   793
    mConversationList->setModel(NULL);
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   794
    mContactCardWidget->clearContent();
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   795
}
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   796
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   797
//---------------------------------------------------------------
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   798
// MsgConversationView::saveContentToDrafts()
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   799
// @See header
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   800
//---------------------------------------------------------------
37
hgs
parents: 25
diff changeset
   801
int MsgConversationView::saveContentToDrafts()
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   802
{
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   803
    int msgId = INVALID_MSGID;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   804
    if(!mEditorWidget->content().isEmpty())
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   805
    {
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   806
        activateInputBlocker();
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   807
        ConvergedMessageAddressList addresses;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   808
        addresses = mContactCardWidget->address();
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   809
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   810
        // Populate the ConvergedMessage.
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   811
        if (!addresses.isEmpty())
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   812
        {
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   813
            ConvergedMessage msg;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   814
            populateForSending(msg);
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   815
            msg.addToRecipients(addresses);
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   816
            
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   817
            // save to drafts
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   818
            msgId = mSendUtil->saveToDrafts(msg);
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   819
                     
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   820
            mEditorWidget->clear();
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   821
        }
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   822
        deactivateInputBlocker();
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   823
    }
37
hgs
parents: 25
diff changeset
   824
    return msgId;
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   825
}
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   826
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   827
//---------------------------------------------------------------
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   828
//MsgConversationView::populateForSending()
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   829
//@see header
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 MsgConversationView::populateForSending(ConvergedMessage &message)
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   832
{
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   833
    message.setMessageType(ConvergedMessage::Sms);
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   834
    message.setBodyText(mEditorWidget->content());
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   835
    message.setDirection(ConvergedMessage::Outgoing);
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   836
    QDateTime time = QDateTime::currentDateTime();
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   837
    message.setTimeStamp(time.toTime_t());
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   838
}
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   839
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   840
//---------------------------------------------------------------
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   841
//MsgConversationView::launchBtDisplayService()
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   842
//@see header
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   843
//---------------------------------------------------------------
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   844
void MsgConversationView::launchBtDisplayService(const QModelIndex & index)
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   845
{
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   846
    qint32 messageId = index.data(ConvergedMsgId).toLongLong();
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   847
73
ecf6a73a9186 201039_03
hgs
parents: 67
diff changeset
   848
    // launch using msgservicelaunchutils
37
hgs
parents: 25
diff changeset
   849
    
73
ecf6a73a9186 201039_03
hgs
parents: 67
diff changeset
   850
    MsgServiceLaunchUtil serviceLaunchUtil;
ecf6a73a9186 201039_03
hgs
parents: 67
diff changeset
   851
    
ecf6a73a9186 201039_03
hgs
parents: 67
diff changeset
   852
    serviceLaunchUtil.launchContentViewer(messageId);
ecf6a73a9186 201039_03
hgs
parents: 67
diff changeset
   853
   
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   854
}
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   855
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   856
//---------------------------------------------------------------
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   857
// MsgConversationView::menuAboutToShow()
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   858
// @See header
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   859
//---------------------------------------------------------------
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   860
void MsgConversationView::menuAboutToShow()
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   861
{
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   862
    // Clear all the previously added actions.
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   863
    HbMenu *mainMenu = this->menu();
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   864
    mainMenu->clearActions();
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   865
73
ecf6a73a9186 201039_03
hgs
parents: 67
diff changeset
   866
    // Attach sub-menu
ecf6a73a9186 201039_03
hgs
parents: 67
diff changeset
   867
    HbMenu *attachSubMenu = mainMenu->addMenu(LOC_ATTACH);
ecf6a73a9186 201039_03
hgs
parents: 67
diff changeset
   868
    
ecf6a73a9186 201039_03
hgs
parents: 67
diff changeset
   869
    attachSubMenu->addAction(LOC_PHOTO,this, SLOT(fetchImages()));
ecf6a73a9186 201039_03
hgs
parents: 67
diff changeset
   870
    attachSubMenu->addAction(LOC_SOUND,this, SLOT(fetchAudio()));
ecf6a73a9186 201039_03
hgs
parents: 67
diff changeset
   871
    
ecf6a73a9186 201039_03
hgs
parents: 67
diff changeset
   872
    HbAction* addVCard = attachSubMenu->addAction(LOC_VCARD);
ecf6a73a9186 201039_03
hgs
parents: 67
diff changeset
   873
    addVCard->setData(VCARD_INSERTION_MODE);        
ecf6a73a9186 201039_03
hgs
parents: 67
diff changeset
   874
    connect(addVCard, SIGNAL(triggered()),this,SLOT(fetchContacts()));
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   875
73
ecf6a73a9186 201039_03
hgs
parents: 67
diff changeset
   876
    HbAction *addRecipients = mainMenu->addAction(LOC_ADD_RECIPIENTS);
ecf6a73a9186 201039_03
hgs
parents: 67
diff changeset
   877
    addRecipients->setData(CONTACT_INSERTION_MODE);        
ecf6a73a9186 201039_03
hgs
parents: 67
diff changeset
   878
    connect(addRecipients, SIGNAL(triggered()), this, SLOT(fetchContacts()));
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   879
73
ecf6a73a9186 201039_03
hgs
parents: 67
diff changeset
   880
    mainMenu->addAction(LOC_ADD_SUBJECT,this, SLOT(addSubject()));
ecf6a73a9186 201039_03
hgs
parents: 67
diff changeset
   881
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   882
}
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   883
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   884
//---------------------------------------------------------------
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   885
//MsgConversationView::openItem
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   886
//@see header
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   887
//---------------------------------------------------------------
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   888
void MsgConversationView::openItem(const QModelIndex & index)
37
hgs
parents: 25
diff changeset
   889
{
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   890
    // Return if invalid index.
51
3507212d340e 201031_02
hgs
parents: 46
diff changeset
   891
    if (!index.isValid())
37
hgs
parents: 25
diff changeset
   892
    {
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   893
        return;
37
hgs
parents: 25
diff changeset
   894
    }
25
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
    int messageType = index.data(MessageType).toInt();
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   897
    int messageSubType = index.data(MessageSubType).toInt();
37
hgs
parents: 25
diff changeset
   898
    int messageId = index.data(ConvergedMsgId).toInt();
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   899
    
37
hgs
parents: 25
diff changeset
   900
    if (ConvergedMessage::BioMsg == messageType)
hgs
parents: 25
diff changeset
   901
    {
hgs
parents: 25
diff changeset
   902
        if (ConvergedMessage::RingingTone == messageSubType)
hgs
parents: 25
diff changeset
   903
        {
hgs
parents: 25
diff changeset
   904
            HbMessageBox::question(LOC_DIALOG_SAVE_RINGTONE, this,
hgs
parents: 25
diff changeset
   905
                                   SLOT(onDialogSaveTone(HbAction*)), 
hgs
parents: 25
diff changeset
   906
                                   HbMessageBox::Save | HbMessageBox::Cancel);
hgs
parents: 25
diff changeset
   907
            return;
hgs
parents: 25
diff changeset
   908
        }
hgs
parents: 25
diff changeset
   909
        else if(ConvergedMessage::Provisioning == messageSubType)
hgs
parents: 25
diff changeset
   910
        {
hgs
parents: 25
diff changeset
   911
            int messageId = index.data(ConvergedMsgId).toInt();
hgs
parents: 25
diff changeset
   912
            handleProvisoningMsg(messageId);
hgs
parents: 25
diff changeset
   913
            QList<int> msgIdList;
hgs
parents: 25
diff changeset
   914
            if(index.data(UnReadStatus).toInt())
hgs
parents: 25
diff changeset
   915
            {
hgs
parents: 25
diff changeset
   916
                msgIdList.clear();
hgs
parents: 25
diff changeset
   917
                msgIdList << messageId;
hgs
parents: 25
diff changeset
   918
                ConversationsEngine::instance()->markMessagesRead(msgIdList);
25
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
            return;
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   921
        }
37
hgs
parents: 25
diff changeset
   922
        else if(ConvergedMessage::VCard == messageSubType)
hgs
parents: 25
diff changeset
   923
        {
41
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
   924
            handleShortTap();
37
hgs
parents: 25
diff changeset
   925
            return;
hgs
parents: 25
diff changeset
   926
        }
hgs
parents: 25
diff changeset
   927
        else if(ConvergedMessage::VCal == messageSubType)
hgs
parents: 25
diff changeset
   928
        {
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   929
            return;
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   930
        }
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   931
    }
37
hgs
parents: 25
diff changeset
   932
    else if (ConvergedMessage::BT == messageType)
hgs
parents: 25
diff changeset
   933
    {
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   934
        launchBtDisplayService(index);
37
hgs
parents: 25
diff changeset
   935
        QList<int> msgIdList;
hgs
parents: 25
diff changeset
   936
        if(index.data(UnReadStatus).toInt())
hgs
parents: 25
diff changeset
   937
            {
hgs
parents: 25
diff changeset
   938
            msgIdList.clear();
hgs
parents: 25
diff changeset
   939
            msgIdList << messageId;
hgs
parents: 25
diff changeset
   940
            ConversationsEngine::instance()->markMessagesRead(msgIdList);
hgs
parents: 25
diff changeset
   941
            }
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   942
        return;
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   943
    }
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   944
    else if(ConvergedMessage::MmsNotification == messageType)
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   945
    {
41
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
   946
        qint32 messageId = index.data(ConvergedMsgId).toLongLong();
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   947
        if(!ConversationsEngine::instance()->downloadOperationSupported(messageId))           
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   948
        {
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   949
           int notificationState = index.data(NotificationStatus).toInt();
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   950
           if( notificationState == ConvergedMessage::NotifExpired)
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   951
           {
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   952
               deleteItem();
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
           return;
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   955
        }
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   956
        else
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
            //TODO: use logical str name
37
hgs
parents: 25
diff changeset
   959
            HbMessageBox::question("Download Message?",this,
hgs
parents: 25
diff changeset
   960
                                   SLOT(onDialogDownLoadMsg(HbAction*)),
hgs
parents: 25
diff changeset
   961
                                   HbMessageBox::Yes | HbMessageBox::Cancel);
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   962
            return;
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   963
        }
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
37
hgs
parents: 25
diff changeset
   966
    int direction = index.data(Direction).toInt();
hgs
parents: 25
diff changeset
   967
hgs
parents: 25
diff changeset
   968
    if (direction == ConvergedMessage::Outgoing && ConvergedMessage::Sms == messageType
hgs
parents: 25
diff changeset
   969
        && ConversationsEngine::instance()->getMsgSubType(messageId)== ConvergedMessage::NokiaService)
hgs
parents: 25
diff changeset
   970
    {
hgs
parents: 25
diff changeset
   971
        return;
hgs
parents: 25
diff changeset
   972
    }
hgs
parents: 25
diff changeset
   973
    
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   974
    // check whether message is in sending progress, then donot launch viewer.
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   975
    int location = index.data(MessageLocation).toInt();
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   976
    int sendingState = index.data(SendingState).toInt();
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   977
    
46
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   978
    // For suspended message both short tap and long tap needs to show the same
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   979
    // context menu.....
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   980
    if(direction == ConvergedMessage::Outgoing 
67
fc91263aee62 201037_04
hgs
parents: 62
diff changeset
   981
        	&& (sendingState == ConvergedMessage::Suspended))
46
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   982
    {
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   983
        handleShortTap();
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   984
        return;
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   985
    }
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
   986
    
67
fc91263aee62 201037_04
hgs
parents: 62
diff changeset
   987
    //If message is in any state other than 'Sent' or 'Failed'
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   988
    //do not open the message
37
hgs
parents: 25
diff changeset
   989
    if(direction == ConvergedMessage::Outgoing 
67
fc91263aee62 201037_04
hgs
parents: 62
diff changeset
   990
            && sendingState != ConvergedMessage::SentState 
fc91263aee62 201037_04
hgs
parents: 62
diff changeset
   991
            && sendingState != ConvergedMessage::Failed)
37
hgs
parents: 25
diff changeset
   992
           
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   993
    {
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   994
        return;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   995
    }
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   996
37
hgs
parents: 25
diff changeset
   997
    // contact Id
hgs
parents: 25
diff changeset
   998
    qint32 contactId = index.data(ContactId).toLongLong();  
hgs
parents: 25
diff changeset
   999
	    
hgs
parents: 25
diff changeset
  1000
    //if message unread, mark as read before opening view
hgs
parents: 25
diff changeset
  1001
    QList<int> msgIdList;
hgs
parents: 25
diff changeset
  1002
    if(index.data(UnReadStatus).toInt())
hgs
parents: 25
diff changeset
  1003
    {
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1004
        msgIdList.clear();
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1005
        msgIdList << messageId;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1006
        ConversationsEngine::instance()->markMessagesRead(msgIdList);
37
hgs
parents: 25
diff changeset
  1007
    }
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1008
37
hgs
parents: 25
diff changeset
  1009
    //switch view
hgs
parents: 25
diff changeset
  1010
    QVariantList param;
hgs
parents: 25
diff changeset
  1011
    param << MsgBaseView::UNIVIEWER;  // target view
hgs
parents: 25
diff changeset
  1012
    param << MsgBaseView::CV; // source view
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1013
37
hgs
parents: 25
diff changeset
  1014
    param << contactId;
hgs
parents: 25
diff changeset
  1015
    param << messageId;
hgs
parents: 25
diff changeset
  1016
    param << mMessageModel->rowCount();
hgs
parents: 25
diff changeset
  1017
    emit switchView(param);
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1018
}
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1019
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1020
//---------------------------------------------------------------
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1021
// MsgConversationView::launchUniEditor
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1022
// @see header file
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1023
//---------------------------------------------------------------
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1024
void MsgConversationView::launchUniEditor(const QVariantList& data)
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1025
{
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1026
    // param list for switching to editor view
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1027
    QVariantList params;
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1028
    QByteArray dataArray;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1029
    QDataStream messageStream
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1030
    (&dataArray, QIODevice::WriteOnly | QIODevice::Append);
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1031
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1032
    // first arg is always the editor operation
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1033
    int editorOperation = data.at(0).toInt();
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1034
    
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1035
    ConvergedMessage message;
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1036
    QVariant data2;
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1037
    if( editorOperation != MsgBaseView::FORWARD_MSG )
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1038
    {
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1039
        message.setBodyText(mEditorWidget->content());
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1040
37
hgs
parents: 25
diff changeset
  1041
        // add address from contact-card to to-field
73
ecf6a73a9186 201039_03
hgs
parents: 67
diff changeset
  1042
        ConvergedMessageAddressList addresses;
ecf6a73a9186 201039_03
hgs
parents: 67
diff changeset
  1043
        addresses = mContactCardWidget->address();
ecf6a73a9186 201039_03
hgs
parents: 67
diff changeset
  1044
        
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1045
        ConvergedMessageAddress address;
73
ecf6a73a9186 201039_03
hgs
parents: 67
diff changeset
  1046
        address.setAlias(addresses.at(0)->alias());
ecf6a73a9186 201039_03
hgs
parents: 67
diff changeset
  1047
        address.setAddress(addresses.at(0)->address());
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1048
        message.addToRecipient(address);
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1049
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1050
        if(editorOperation == MsgBaseView::ADD_PHOTO ||
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1051
           editorOperation == MsgBaseView::ADD_AUDIO ||
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1052
           editorOperation == MsgBaseView::ADD_VIDEO )
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1053
        {
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1054
            // filepath is sent in cases like ADD_PHOTO, ADD_AUDIO etc.
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1055
            QString filepath;
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1056
            filepath = data.at(1).toString();
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1057
            if(!filepath.isEmpty())
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1058
            {
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1059
                ConvergedMessageAttachment* attachment = 
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1060
                        new ConvergedMessageAttachment(filepath);
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1061
                ConvergedMessageAttachmentList attachmentList;
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1062
                attachmentList.append(attachment);
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1063
                message.addAttachments(attachmentList);
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1064
            }            
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1065
        }
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1066
        else if(editorOperation == MsgBaseView::ADD_VCARD)
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1067
        {
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1068
            // filepath is not sent in cases like VCards & recipients
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1069
            // instead, we will get a list of contacts. Pass it as it is.
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1070
            data2 = data.at(1);
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1071
        }
37
hgs
parents: 25
diff changeset
  1072
        else if(editorOperation == MsgBaseView::ADD_RECIPIENTS)
hgs
parents: 25
diff changeset
  1073
        {
hgs
parents: 25
diff changeset
  1074
            ConvergedMessageAddressList addresses;
hgs
parents: 25
diff changeset
  1075
            CntServicesContactList contactList = 
hgs
parents: 25
diff changeset
  1076
                    qVariantValue<CntServicesContactList>(data.at(1));
hgs
parents: 25
diff changeset
  1077
            // now add fetched contacts from contact selection dialog
hgs
parents: 25
diff changeset
  1078
            for(int i = 0; i < contactList.count(); i++ )
hgs
parents: 25
diff changeset
  1079
            {
hgs
parents: 25
diff changeset
  1080
                ConvergedMessageAddress* address = new ConvergedMessageAddress;
hgs
parents: 25
diff changeset
  1081
                address->setAlias(contactList[i].mDisplayName);
hgs
parents: 25
diff changeset
  1082
                if(!contactList[i].mPhoneNumber.isEmpty())
hgs
parents: 25
diff changeset
  1083
                {
hgs
parents: 25
diff changeset
  1084
                    address->setAddress(contactList[i].mPhoneNumber);
hgs
parents: 25
diff changeset
  1085
                }
hgs
parents: 25
diff changeset
  1086
                else
hgs
parents: 25
diff changeset
  1087
                {
hgs
parents: 25
diff changeset
  1088
                    address->setAddress(contactList[i].mEmailAddress);
hgs
parents: 25
diff changeset
  1089
                }
hgs
parents: 25
diff changeset
  1090
                addresses.append(address);
hgs
parents: 25
diff changeset
  1091
            }
hgs
parents: 25
diff changeset
  1092
            message.addToRecipients(addresses);
hgs
parents: 25
diff changeset
  1093
        }
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1094
    }
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1095
    else
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1096
    {
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1097
        qint32 msgId = (qint32)data.at(1).toInt();
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1098
        int msgType = data.at(2).toInt();
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1099
        ConvergedMessageId id(msgId);
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1100
        message.setMessageId(id);
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1101
        message.setMessageType((ConvergedMessage::MessageType)msgType);
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1102
    }
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1103
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1104
    message.serialize(messageStream);
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1105
    params << MsgBaseView::UNIEDITOR;
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1106
    params << MsgBaseView::CV;
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1107
    params << dataArray;
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1108
    params << editorOperation;
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1109
    if(!data2.isNull())
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1110
        params << data2;
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1111
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1112
    emit switchView(params);
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1113
}
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1114
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1115
//---------------------------------------------------------------
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1116
// MsgConversationView::populateConversationsView
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1117
// @see header file
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1118
//---------------------------------------------------------------
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1119
void MsgConversationView::populateConversationsView()
37
hgs
parents: 25
diff changeset
  1120
{    
38
4e4b6adb1024 201025_01
hgs
parents: 37
diff changeset
  1121
    mModelPopulated = true;
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1122
    mConversationList->setModel(mMessageModel);
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1123
    
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1124
    refreshView();
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1125
    scrollToBottom();
38
4e4b6adb1024 201025_01
hgs
parents: 37
diff changeset
  1126
    fetchMoreConversations();
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1127
}
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1128
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1129
//---------------------------------------------------------------
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1130
// MsgConversationView::saveRingingTone
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1131
// @see header file
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1132
//---------------------------------------------------------------
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1133
void MsgConversationView::saveRingingTone()
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1134
{
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1135
    QModelIndex index = mConversationList->currentIndex();
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1136
    int messageId = index.data(ConvergedMsgId).toInt();
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1137
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1138
    UniDataModelLoader* pluginLoader = new UniDataModelLoader();
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1139
    UniDataModelPluginInterface* pluginInterface = 
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1140
    pluginLoader->getDataModelPlugin(ConvergedMessage::BioMsg);
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1141
    pluginInterface->setMessageId(messageId);
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1142
    UniMessageInfoList attachments = pluginInterface->attachmentList();
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1143
    if(attachments.count() > 0)
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1144
    {
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1145
        QString attachmentPath = attachments[0]->path();
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1146
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1147
        RingBc* ringBc = new RingBc();
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1148
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1149
        ringBc->saveTone(attachmentPath);
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1150
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1151
        // clear attachement list : its allocated at data model
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1152
        while(!attachments.isEmpty())
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1153
        {
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1154
            delete attachments.takeFirst();
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1155
        }
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1156
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1157
        delete ringBc;
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1158
    }
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1159
    delete pluginLoader;
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1160
}
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1161
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1162
//---------------------------------------------------------------
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1163
// MsgConversationView::handleSmsCharLimitReached
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1164
// @see header file
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1165
//---------------------------------------------------------------
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1166
void MsgConversationView::handleSmsCharLimitReached()   
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1167
{
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1168
    QString filepath;
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1169
    QVariantList params;
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1170
    params << MsgBaseView::ADD_OTHERS;
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1171
    launchUniEditor(params);   
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1172
}
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1173
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1174
//---------------------------------------------------------------
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1175
// MsgConversationView::vkbOpened
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1176
// @see header file
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1177
//---------------------------------------------------------------
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1178
void MsgConversationView::vkbOpened()
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1179
{
51
3507212d340e 201031_02
hgs
parents: 46
diff changeset
  1180
    emit vkbOpened(true);
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1181
    
51
3507212d340e 201031_02
hgs
parents: 46
diff changeset
  1182
    scrollToBottom();
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1183
    
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1184
    QRectF appRect = mVkbHost->applicationArea();    
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1185
    qreal spacing = 0.0;
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1186
    qreal cardHeight = 0.0;
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1187
    if(mContactCardWidget->isVisible())
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1188
        {
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1189
        cardHeight = mContactCardWidget->rect().height();
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1190
        spacing = HbDeviceProfile::profile(this).unitValue();
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1191
        }
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1192
    
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1193
    this->setMaximumHeight(appRect.height()- cardHeight - spacing);
67
fc91263aee62 201037_04
hgs
parents: 62
diff changeset
  1194
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1195
    
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1196
    disconnect(mVkbHost,SIGNAL(keypadOpened()),this,SLOT(vkbOpened()));
51
3507212d340e 201031_02
hgs
parents: 46
diff changeset
  1197
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1198
}
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1199
	  
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1200
//---------------------------------------------------------------
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1201
// MsgConversationView::vkbClosed
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1202
// @see header file
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1203
//---------------------------------------------------------------
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1204
void MsgConversationView::vkbClosed()
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1205
{
37
hgs
parents: 25
diff changeset
  1206
    emit vkbOpened(false);
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1207
    
51
3507212d340e 201031_02
hgs
parents: 46
diff changeset
  1208
    scrollToBottom();
3507212d340e 201031_02
hgs
parents: 46
diff changeset
  1209
    
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1210
    this->setMaximumHeight(-1);
67
fc91263aee62 201037_04
hgs
parents: 62
diff changeset
  1211
    
51
3507212d340e 201031_02
hgs
parents: 46
diff changeset
  1212
    
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1213
    connect(mVkbHost,SIGNAL(keypadOpened()),this,SLOT(vkbOpened()));
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1214
}
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1215
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1216
//---------------------------------------------------------------
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1217
// MsgConversationView::serviceRequestError
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1218
// @see header file
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1219
//---------------------------------------------------------------
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1220
void MsgConversationView::serviceRequestError(int errorCode, const QString& errorMessage)
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1221
{
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1222
    QDEBUG_WRITE_FORMAT(errorMessage,errorCode);
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1223
}
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1224
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1225
//---------------------------------------------------------------
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1226
// MsgConversationView::activateInputBlocker
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1227
// @see header file
37
hgs
parents: 25
diff changeset
  1228
//---------------------------------------------------------------
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1229
void MsgConversationView::activateInputBlocker()
37
hgs
parents: 25
diff changeset
  1230
{
hgs
parents: 25
diff changeset
  1231
    mainWindow()->setInteractive(false);
hgs
parents: 25
diff changeset
  1232
}
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1233
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1234
//---------------------------------------------------------------
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1235
// MsgConversationView::deactivateInputBlocker
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1236
// @see header file
37
hgs
parents: 25
diff changeset
  1237
//---------------------------------------------------------------
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1238
void MsgConversationView::deactivateInputBlocker()
37
hgs
parents: 25
diff changeset
  1239
{
hgs
parents: 25
diff changeset
  1240
    mainWindow()->setInteractive(true);
hgs
parents: 25
diff changeset
  1241
}
hgs
parents: 25
diff changeset
  1242
hgs
parents: 25
diff changeset
  1243
//---------------------------------------------------------------
hgs
parents: 25
diff changeset
  1244
// MsgConversationView::handleProvisoningMsg
hgs
parents: 25
diff changeset
  1245
// @see header file
hgs
parents: 25
diff changeset
  1246
//---------------------------------------------------------------
hgs
parents: 25
diff changeset
  1247
void MsgConversationView::handleProvisoningMsg(int msgId)
hgs
parents: 25
diff changeset
  1248
	{
hgs
parents: 25
diff changeset
  1249
		QString messageId;
hgs
parents: 25
diff changeset
  1250
    messageId.setNum(msgId);
hgs
parents: 25
diff changeset
  1251
hgs
parents: 25
diff changeset
  1252
    XQApplicationManager* aiwMgr = new XQApplicationManager();
hgs
parents: 25
diff changeset
  1253
hgs
parents: 25
diff changeset
  1254
    XQAiwRequest* request = aiwMgr->create("com.nokia.services.MDM", 
hgs
parents: 25
diff changeset
  1255
            "Provisioning",
hgs
parents: 25
diff changeset
  1256
            "ProcessMessage(QString)", true); // embedded
hgs
parents: 25
diff changeset
  1257
hgs
parents: 25
diff changeset
  1258
    if (request) {
hgs
parents: 25
diff changeset
  1259
    QList<QVariant> args;
hgs
parents: 25
diff changeset
  1260
    args << QVariant(messageId);
hgs
parents: 25
diff changeset
  1261
    request->setArguments(args);
hgs
parents: 25
diff changeset
  1262
hgs
parents: 25
diff changeset
  1263
    // Send the request
hgs
parents: 25
diff changeset
  1264
    bool res = request->send();
hgs
parents: 25
diff changeset
  1265
hgs
parents: 25
diff changeset
  1266
    // Cleanup
hgs
parents: 25
diff changeset
  1267
    delete request;
hgs
parents: 25
diff changeset
  1268
    }
hgs
parents: 25
diff changeset
  1269
hgs
parents: 25
diff changeset
  1270
    delete aiwMgr;
hgs
parents: 25
diff changeset
  1271
	}
hgs
parents: 25
diff changeset
  1272
hgs
parents: 25
diff changeset
  1273
//---------------------------------------------------------------
hgs
parents: 25
diff changeset
  1274
// MsgConversationView::onDialogSettingsLaunch
hgs
parents: 25
diff changeset
  1275
// @see header file
hgs
parents: 25
diff changeset
  1276
//---------------------------------------------------------------
hgs
parents: 25
diff changeset
  1277
void MsgConversationView::onDialogSettingsLaunch(HbAction* action)
hgs
parents: 25
diff changeset
  1278
{
hgs
parents: 25
diff changeset
  1279
    HbMessageBox *dlg = qobject_cast<HbMessageBox*> (sender());
hgs
parents: 25
diff changeset
  1280
    if (action == dlg->actions().at(0)) {
hgs
parents: 25
diff changeset
  1281
        //switch to settings view
hgs
parents: 25
diff changeset
  1282
         QVariantList param;
hgs
parents: 25
diff changeset
  1283
         param << MsgBaseView::MSGSETTINGS;
hgs
parents: 25
diff changeset
  1284
         param << MsgBaseView::CV;
hgs
parents: 25
diff changeset
  1285
         param << MsgSettingsView::SMSView;
hgs
parents: 25
diff changeset
  1286
         emit switchView(param);
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1287
    }
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1288
37
hgs
parents: 25
diff changeset
  1289
}
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1290
37
hgs
parents: 25
diff changeset
  1291
//---------------------------------------------------------------
hgs
parents: 25
diff changeset
  1292
// MsgConversationView::onDialogdeleteMsg
hgs
parents: 25
diff changeset
  1293
// @see header file
hgs
parents: 25
diff changeset
  1294
//---------------------------------------------------------------
hgs
parents: 25
diff changeset
  1295
void MsgConversationView::onDialogdeleteMsg(HbAction* action)
hgs
parents: 25
diff changeset
  1296
{
hgs
parents: 25
diff changeset
  1297
    HbMessageBox *dlg = qobject_cast<HbMessageBox*> (sender());
hgs
parents: 25
diff changeset
  1298
    if (action == dlg->actions().at(0)) {
hgs
parents: 25
diff changeset
  1299
        QModelIndex index = mConversationList->currentIndex();
hgs
parents: 25
diff changeset
  1300
        if (index.isValid()) {
hgs
parents: 25
diff changeset
  1301
            int count = mMessageModel->rowCount();
hgs
parents: 25
diff changeset
  1302
            //delete message
hgs
parents: 25
diff changeset
  1303
            qint32 messageId = index.data(ConvergedMsgId).toLongLong();
hgs
parents: 25
diff changeset
  1304
            if (messageId) {
hgs
parents: 25
diff changeset
  1305
                QList<int> msgIdList;
hgs
parents: 25
diff changeset
  1306
                msgIdList.append(messageId);
hgs
parents: 25
diff changeset
  1307
                ConversationsEngine::instance()->deleteMessages(msgIdList);
hgs
parents: 25
diff changeset
  1308
                //switch view               
hgs
parents: 25
diff changeset
  1309
                if (count == 1) {
hgs
parents: 25
diff changeset
  1310
                    QVariantList param;
hgs
parents: 25
diff changeset
  1311
                    param << MsgBaseView::CLV; // target view
hgs
parents: 25
diff changeset
  1312
                    param << MsgBaseView::CV; // source view
hgs
parents: 25
diff changeset
  1313
                    emit switchView(param);
hgs
parents: 25
diff changeset
  1314
                }
hgs
parents: 25
diff changeset
  1315
            }
hgs
parents: 25
diff changeset
  1316
        }
hgs
parents: 25
diff changeset
  1317
hgs
parents: 25
diff changeset
  1318
    }
hgs
parents: 25
diff changeset
  1319
hgs
parents: 25
diff changeset
  1320
}
hgs
parents: 25
diff changeset
  1321
hgs
parents: 25
diff changeset
  1322
//---------------------------------------------------------------
hgs
parents: 25
diff changeset
  1323
// MsgConversationView::onDialogDownLoadMsg
hgs
parents: 25
diff changeset
  1324
// @see header file
hgs
parents: 25
diff changeset
  1325
//--------------------------------------------------------------
hgs
parents: 25
diff changeset
  1326
void MsgConversationView::onDialogDownLoadMsg(HbAction* action)
hgs
parents: 25
diff changeset
  1327
{
hgs
parents: 25
diff changeset
  1328
    HbMessageBox *dlg = qobject_cast<HbMessageBox*> (sender());
hgs
parents: 25
diff changeset
  1329
    if (action == dlg->actions().at(0)) {
hgs
parents: 25
diff changeset
  1330
        downloadMessage();
hgs
parents: 25
diff changeset
  1331
    }
41
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
  1332
    
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
  1333
    //if message unread, mark as read now
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
  1334
    QModelIndex index = mConversationList->currentIndex();
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
  1335
    qint32 messageId = index.data(ConvergedMsgId).toLongLong();
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
  1336
    QList<int> msgIdList;
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
  1337
    if(index.data(UnReadStatus).toInt())
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
  1338
    {
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
  1339
        msgIdList.clear();
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
  1340
        msgIdList << messageId;
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
  1341
        ConversationsEngine::instance()->markMessagesRead(msgIdList);
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
  1342
    }
37
hgs
parents: 25
diff changeset
  1343
}
hgs
parents: 25
diff changeset
  1344
hgs
parents: 25
diff changeset
  1345
//---------------------------------------------------------------
hgs
parents: 25
diff changeset
  1346
// MsgConversationView::onDialogSaveTone
hgs
parents: 25
diff changeset
  1347
// @see header file
hgs
parents: 25
diff changeset
  1348
//--------------------------------------------------------------
hgs
parents: 25
diff changeset
  1349
void MsgConversationView::onDialogSaveTone(HbAction* action)
hgs
parents: 25
diff changeset
  1350
    {
hgs
parents: 25
diff changeset
  1351
    HbMessageBox *dlg = qobject_cast<HbMessageBox*> (sender());
hgs
parents: 25
diff changeset
  1352
    if (action == dlg->actions().at(0)) {
hgs
parents: 25
diff changeset
  1353
        saveRingingTone();
hgs
parents: 25
diff changeset
  1354
    }
hgs
parents: 25
diff changeset
  1355
}
hgs
parents: 25
diff changeset
  1356
hgs
parents: 25
diff changeset
  1357
//---------------------------------------------------------------
hgs
parents: 25
diff changeset
  1358
// MsgConversationView::onOrientationChanged
hgs
parents: 25
diff changeset
  1359
// @see header file
hgs
parents: 25
diff changeset
  1360
//---------------------------------------------------------------
hgs
parents: 25
diff changeset
  1361
void MsgConversationView::onOrientationChanged(Qt::Orientation newOrientation)
hgs
parents: 25
diff changeset
  1362
{
hgs
parents: 25
diff changeset
  1363
    Q_UNUSED(newOrientation)
hgs
parents: 25
diff changeset
  1364
hgs
parents: 25
diff changeset
  1365
    // On orientation change always make the preserved index(last visible item) to be visible
hgs
parents: 25
diff changeset
  1366
    if(mVisibleIndex.isValid())
hgs
parents: 25
diff changeset
  1367
    {
hgs
parents: 25
diff changeset
  1368
    mConversationList->scrollTo(mVisibleIndex, HbAbstractItemView::PositionAtBottom);
hgs
parents: 25
diff changeset
  1369
    mVisibleIndex = QModelIndex();
hgs
parents: 25
diff changeset
  1370
    }
hgs
parents: 25
diff changeset
  1371
}
hgs
parents: 25
diff changeset
  1372
hgs
parents: 25
diff changeset
  1373
//---------------------------------------------------------------
hgs
parents: 25
diff changeset
  1374
// MsgConversationView::onOrientationAboutToBeChanged
hgs
parents: 25
diff changeset
  1375
// @see header file
hgs
parents: 25
diff changeset
  1376
//---------------------------------------------------------------
hgs
parents: 25
diff changeset
  1377
void MsgConversationView::onOrientationAboutToBeChanged()
hgs
parents: 25
diff changeset
  1378
{
hgs
parents: 25
diff changeset
  1379
    // Preserve the model index of the last visible item to be scrolled on orientation change
hgs
parents: 25
diff changeset
  1380
    QList<HbAbstractViewItem *>items = mConversationList->visibleItems();
hgs
parents: 25
diff changeset
  1381
    if (items.count() > 0) {
hgs
parents: 25
diff changeset
  1382
        mVisibleIndex = items.last()->modelIndex();
hgs
parents: 25
diff changeset
  1383
    }
hgs
parents: 25
diff changeset
  1384
}
hgs
parents: 25
diff changeset
  1385
hgs
parents: 25
diff changeset
  1386
//---------------------------------------------------------------
hgs
parents: 25
diff changeset
  1387
// MsgConversationView::onViewReady
hgs
parents: 25
diff changeset
  1388
// @see header file
hgs
parents: 25
diff changeset
  1389
//---------------------------------------------------------------
hgs
parents: 25
diff changeset
  1390
void MsgConversationView::onViewReady()
hgs
parents: 25
diff changeset
  1391
{
38
4e4b6adb1024 201025_01
hgs
parents: 37
diff changeset
  1392
    mViewReady = true;
37
hgs
parents: 25
diff changeset
  1393
    //Disconnect list View's signals, for avoiding execution of the default implementaion
hgs
parents: 25
diff changeset
  1394
    disconnect(mainWindow(), SIGNAL(aboutToChangeOrientation()), mConversationList, 0);
hgs
parents: 25
diff changeset
  1395
    disconnect(mainWindow(), SIGNAL(orientationChanged(Qt: rientation)), mConversationList, 0);
38
4e4b6adb1024 201025_01
hgs
parents: 37
diff changeset
  1396
    
4e4b6adb1024 201025_01
hgs
parents: 37
diff changeset
  1397
   fetchMoreConversations();
37
hgs
parents: 25
diff changeset
  1398
}
41
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
  1399
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
  1400
//---------------------------------------------------------------
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
  1401
// MsgConversationView::handleShortTap
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
  1402
// @see header file
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
  1403
//---------------------------------------------------------------
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
  1404
void MsgConversationView::handleShortTap()
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
  1405
{
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
  1406
    HbAbstractViewItem* item = mConversationList->currentViewItem();
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
  1407
    QRectF rc = item->rect();
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
  1408
    QPointF p = item->mapToScene(rc.center());
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
  1409
    
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
  1410
    showContextMenu(item,p,HbPopup::TopEdgeCenter);
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
  1411
}
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
  1412
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
  1413
//---------------------------------------------------------------
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
  1414
// MsgConversationView::handleShortTap
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
  1415
// @see header file
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
  1416
//---------------------------------------------------------------
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
  1417
void MsgConversationView::showContextMenu(HbAbstractViewItem* viewItem,const QPointF& point, int placement)
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
  1418
{    
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
  1419
    MsgConversationViewItem* item = qgraphicsitem_cast<MsgConversationViewItem *>(viewItem);
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
  1420
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
  1421
    // Show the item-specific menu
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
  1422
    if (this->isVisible())
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
  1423
    {
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
  1424
        //If message is in Sending state or is Scheduled to be sent later,
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
  1425
        //do not allow any operations on the message
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
  1426
        int sendingState = item->modelIndex().data(SendingState).toInt();
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
  1427
        
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
  1428
        if(sendingState == ConvergedMessage::Scheduled ||
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
  1429
            sendingState == ConvergedMessage::Sending ||
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
  1430
            sendingState == ConvergedMessage::Waiting)
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
  1431
            {
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
  1432
                return;
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
  1433
            }
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
  1434
        // Create new menu
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
  1435
        HbMenu* contextMenu = new HbMenu();
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
  1436
        contextMenu->setAttribute(Qt::WA_DeleteOnClose);
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
  1437
        contextMenu->setPreferredPos(point,HbPopup::Placement(placement));
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
  1438
        setContextMenu(item, contextMenu, sendingState);
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
  1439
        contextMenu->show();
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
  1440
    }
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
  1441
}
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
  1442
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
  1443
//---------------------------------------------------------------
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
  1444
// MsgConversationView::saveVCard
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
  1445
// @see header file
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
  1446
//---------------------------------------------------------------
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
  1447
void MsgConversationView::saveVCard()
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
  1448
{
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
  1449
    QModelIndex index = mConversationList->currentIndex();
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
  1450
    
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
  1451
    QString filepath = index.data(Attachments).toStringList().at(0);
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
  1452
    bool result = MsgContactsUtil::launchVCardViewer(filepath);
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
  1453
    if(result)
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
  1454
    {
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
  1455
        int messageId = index.data(ConvergedMsgId).toInt();
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
  1456
        QList<int> msgIdList;
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
  1457
        if(index.data(UnReadStatus).toInt())
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
  1458
        {
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
  1459
            msgIdList.clear();
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
  1460
            msgIdList << messageId;
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
  1461
            ConversationsEngine::instance()->markMessagesRead(msgIdList);
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
  1462
        }
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
  1463
    } 
25fe1fe642e3 201027_02
hgs
parents: 38
diff changeset
  1464
}
46
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
  1465
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
  1466
//---------------------------------------------------------------
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
  1467
// MsgConversationView::isSharedMessage
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
  1468
// @see header file
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
  1469
//---------------------------------------------------------------
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
  1470
bool MsgConversationView::isSharedMessage(qint32 messageId)
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
  1471
{
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
  1472
    bool shared = false;
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
  1473
51
3507212d340e 201031_02
hgs
parents: 46
diff changeset
  1474
    UniDataModelLoader* pluginLoader = new UniDataModelLoader();
3507212d340e 201031_02
hgs
parents: 46
diff changeset
  1475
    
3507212d340e 201031_02
hgs
parents: 46
diff changeset
  1476
    UniDataModelPluginInterface* pluginInterface =
3507212d340e 201031_02
hgs
parents: 46
diff changeset
  1477
        pluginLoader->getDataModelPlugin(ConvergedMessage::Mms);
46
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
  1478
    
51
3507212d340e 201031_02
hgs
parents: 46
diff changeset
  1479
    CMsvSession* session = pluginInterface->session();
46
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
  1480
51
3507212d340e 201031_02
hgs
parents: 46
diff changeset
  1481
    TMsvEntry entry; 
3507212d340e 201031_02
hgs
parents: 46
diff changeset
  1482
    TMsvId service;
3507212d340e 201031_02
hgs
parents: 46
diff changeset
  1483
    session->GetEntry(messageId, service, entry);
3507212d340e 201031_02
hgs
parents: 46
diff changeset
  1484
    
3507212d340e 201031_02
hgs
parents: 46
diff changeset
  1485
    if(entry.MultipleRecipients())
46
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
  1486
    {
51
3507212d340e 201031_02
hgs
parents: 46
diff changeset
  1487
        shared = true;
46
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
  1488
    }
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
  1489
    delete pluginLoader;    
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
  1490
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
  1491
    return shared;
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
  1492
}
b1f0785c289d 201027_03
hgs
parents: 41
diff changeset
  1493
62
fdbe8253b596 201035_03
hgs
parents: 56
diff changeset
  1494
//---------------------------------------------------------------
fdbe8253b596 201035_03
hgs
parents: 56
diff changeset
  1495
// MsgConversationView::onAudioSelected
fdbe8253b596 201035_03
hgs
parents: 56
diff changeset
  1496
// @see header file
fdbe8253b596 201035_03
hgs
parents: 56
diff changeset
  1497
//---------------------------------------------------------------
56
f42d9a78f435 201033_02
hgs
parents: 51
diff changeset
  1498
void MsgConversationView::onAudioSelected(QString& filePath)
f42d9a78f435 201033_02
hgs
parents: 51
diff changeset
  1499
{
f42d9a78f435 201033_02
hgs
parents: 51
diff changeset
  1500
    QVariantList params;
f42d9a78f435 201033_02
hgs
parents: 51
diff changeset
  1501
    QByteArray dataArray;
f42d9a78f435 201033_02
hgs
parents: 51
diff changeset
  1502
    QDataStream messageStream
f42d9a78f435 201033_02
hgs
parents: 51
diff changeset
  1503
    (&dataArray, QIODevice::WriteOnly | QIODevice::Append);
f42d9a78f435 201033_02
hgs
parents: 51
diff changeset
  1504
f42d9a78f435 201033_02
hgs
parents: 51
diff changeset
  1505
    ConvergedMessage message;
f42d9a78f435 201033_02
hgs
parents: 51
diff changeset
  1506
    message.setBodyText(mEditorWidget->content());
73
ecf6a73a9186 201039_03
hgs
parents: 67
diff changeset
  1507
   
ecf6a73a9186 201039_03
hgs
parents: 67
diff changeset
  1508
    // add address from contact-card to to-field    
ecf6a73a9186 201039_03
hgs
parents: 67
diff changeset
  1509
    ConvergedMessageAddressList addresses;
ecf6a73a9186 201039_03
hgs
parents: 67
diff changeset
  1510
    addresses = mContactCardWidget->address();
ecf6a73a9186 201039_03
hgs
parents: 67
diff changeset
  1511
    
56
f42d9a78f435 201033_02
hgs
parents: 51
diff changeset
  1512
    ConvergedMessageAddress address;
73
ecf6a73a9186 201039_03
hgs
parents: 67
diff changeset
  1513
    address.setAlias(addresses.at(0)->alias());
ecf6a73a9186 201039_03
hgs
parents: 67
diff changeset
  1514
    address.setAddress(addresses.at(0)->address());
56
f42d9a78f435 201033_02
hgs
parents: 51
diff changeset
  1515
    message.addToRecipient(address);
f42d9a78f435 201033_02
hgs
parents: 51
diff changeset
  1516
    
f42d9a78f435 201033_02
hgs
parents: 51
diff changeset
  1517
    //add the attachment as selected from audio picker
f42d9a78f435 201033_02
hgs
parents: 51
diff changeset
  1518
    ConvergedMessageAttachment* attachment =
f42d9a78f435 201033_02
hgs
parents: 51
diff changeset
  1519
                new ConvergedMessageAttachment(filePath);
f42d9a78f435 201033_02
hgs
parents: 51
diff changeset
  1520
    ConvergedMessageAttachmentList attachmentList;
f42d9a78f435 201033_02
hgs
parents: 51
diff changeset
  1521
    attachmentList.append(attachment);
f42d9a78f435 201033_02
hgs
parents: 51
diff changeset
  1522
    message.addAttachments(attachmentList);
f42d9a78f435 201033_02
hgs
parents: 51
diff changeset
  1523
    message.serialize(messageStream);
f42d9a78f435 201033_02
hgs
parents: 51
diff changeset
  1524
f42d9a78f435 201033_02
hgs
parents: 51
diff changeset
  1525
    params << MsgBaseView::UNIEDITOR; // target view
f42d9a78f435 201033_02
hgs
parents: 51
diff changeset
  1526
    params << MsgBaseView::CV; // source view
f42d9a78f435 201033_02
hgs
parents: 51
diff changeset
  1527
    params << dataArray;
f42d9a78f435 201033_02
hgs
parents: 51
diff changeset
  1528
    params << MsgBaseView::ADD_AUDIO;
f42d9a78f435 201033_02
hgs
parents: 51
diff changeset
  1529
    emit switchView(params);
f42d9a78f435 201033_02
hgs
parents: 51
diff changeset
  1530
}
f42d9a78f435 201033_02
hgs
parents: 51
diff changeset
  1531
62
fdbe8253b596 201035_03
hgs
parents: 56
diff changeset
  1532
//---------------------------------------------------------------
fdbe8253b596 201035_03
hgs
parents: 56
diff changeset
  1533
// MsgConversationView::handleKeyEvent
fdbe8253b596 201035_03
hgs
parents: 56
diff changeset
  1534
// @see header file
fdbe8253b596 201035_03
hgs
parents: 56
diff changeset
  1535
//---------------------------------------------------------------
fdbe8253b596 201035_03
hgs
parents: 56
diff changeset
  1536
bool MsgConversationView::handleKeyEvent(int key)
fdbe8253b596 201035_03
hgs
parents: 56
diff changeset
  1537
{
fdbe8253b596 201035_03
hgs
parents: 56
diff changeset
  1538
    bool eventHandled = false;
fdbe8253b596 201035_03
hgs
parents: 56
diff changeset
  1539
    if (Qt::Key_Yes == key) {
fdbe8253b596 201035_03
hgs
parents: 56
diff changeset
  1540
        //getting address of last sent/received msg.
fdbe8253b596 201035_03
hgs
parents: 56
diff changeset
  1541
        const int rowCount = mMessageModel->rowCount();
fdbe8253b596 201035_03
hgs
parents: 56
diff changeset
  1542
        QModelIndex index = mMessageModel->index(rowCount - 1, 0);
fdbe8253b596 201035_03
hgs
parents: 56
diff changeset
  1543
        QString address = index.data(ConversationAddress).toString();
fdbe8253b596 201035_03
hgs
parents: 56
diff changeset
  1544
fdbe8253b596 201035_03
hgs
parents: 56
diff changeset
  1545
        if (!address.isEmpty()) {
fdbe8253b596 201035_03
hgs
parents: 56
diff changeset
  1546
            call(address);
fdbe8253b596 201035_03
hgs
parents: 56
diff changeset
  1547
            eventHandled = true;
fdbe8253b596 201035_03
hgs
parents: 56
diff changeset
  1548
        }
fdbe8253b596 201035_03
hgs
parents: 56
diff changeset
  1549
    }
fdbe8253b596 201035_03
hgs
parents: 56
diff changeset
  1550
    return eventHandled;
fdbe8253b596 201035_03
hgs
parents: 56
diff changeset
  1551
}
fdbe8253b596 201035_03
hgs
parents: 56
diff changeset
  1552
fdbe8253b596 201035_03
hgs
parents: 56
diff changeset
  1553
//---------------------------------------------------------------
fdbe8253b596 201035_03
hgs
parents: 56
diff changeset
  1554
// MsgConversationView::call
fdbe8253b596 201035_03
hgs
parents: 56
diff changeset
  1555
// @see header
fdbe8253b596 201035_03
hgs
parents: 56
diff changeset
  1556
//---------------------------------------------------------------
fdbe8253b596 201035_03
hgs
parents: 56
diff changeset
  1557
void MsgConversationView::call(const QString& address)
fdbe8253b596 201035_03
hgs
parents: 56
diff changeset
  1558
{
fdbe8253b596 201035_03
hgs
parents: 56
diff changeset
  1559
    QString service("phoneui");
fdbe8253b596 201035_03
hgs
parents: 56
diff changeset
  1560
    QString interface("com.nokia.symbian.ICallDial");
fdbe8253b596 201035_03
hgs
parents: 56
diff changeset
  1561
    QString operation("dial(QString)");
fdbe8253b596 201035_03
hgs
parents: 56
diff changeset
  1562
fdbe8253b596 201035_03
hgs
parents: 56
diff changeset
  1563
    XQApplicationManager appManager;
fdbe8253b596 201035_03
hgs
parents: 56
diff changeset
  1564
    QScopedPointer<XQAiwRequest> request(appManager.create(service, interface, operation, false));
fdbe8253b596 201035_03
hgs
parents: 56
diff changeset
  1565
    if (request) {
fdbe8253b596 201035_03
hgs
parents: 56
diff changeset
  1566
        QList<QVariant> args;
fdbe8253b596 201035_03
hgs
parents: 56
diff changeset
  1567
        args << address;
fdbe8253b596 201035_03
hgs
parents: 56
diff changeset
  1568
        request->setArguments(args);
fdbe8253b596 201035_03
hgs
parents: 56
diff changeset
  1569
        request->send();
fdbe8253b596 201035_03
hgs
parents: 56
diff changeset
  1570
    }
fdbe8253b596 201035_03
hgs
parents: 56
diff changeset
  1571
}
fdbe8253b596 201035_03
hgs
parents: 56
diff changeset
  1572
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1573
// EOF