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