author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 18 Aug 2010 09:45:25 +0300 | |
changeset 52 | 12db4185673b |
parent 44 | 36f374c67aa8 |
child 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: Main view of unified viewer |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
#include "unifiedviewer.h" |
|
19 |
||
20 |
// SYSTEM INCLUDES |
|
21 |
#include <QGraphicsLinearLayout> |
|
22 |
#include <HbAction> |
|
23 |
#include <HbToolBar> |
|
24 |
#include <hbmessagebox.h> |
|
25 |
#include <hbnotificationdialog.h> |
|
26 |
#include <HbStyleLoader> |
|
27 |
#include <centralrepository.h> |
|
28 |
#include <MmsEngineDomainCRKeys.h> |
|
52
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
29 |
#include <ccsdefs.h> |
31 | 30 |
|
31 |
// USER INCLUDES |
|
32 |
#include "uniscrollarea.h" |
|
33 |
#include "unicontentswidget.h" |
|
34 |
#include "univiewerfeeder.h" |
|
35 |
#include "convergedmessageid.h" |
|
36 |
#include "convergedmessage.h" |
|
37 |
#include "convergedmessageaddress.h" |
|
38 |
#include "conversationsenginedefines.h" |
|
39 |
#include "conversationsengine.h" |
|
40 |
#include "debugtraces.h" |
|
41 |
#include "nativemessageconsts.h" |
|
52
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
42 |
#include "mmsconformancecheck.h" |
31 | 43 |
|
44 |
// LOCAL CONSTANTS |
|
45 |
const QString REPLY_ICON("qtg_mono_reply"); |
|
46 |
const QString REPLY_ALL_ICON("qtg_mono_reply_all"); |
|
47 |
const QString FORWARD_ICON("qtg_mono_forward_msg"); |
|
48 |
const QString SEND_ICON("qtg_mono_send"); |
|
49 |
const QString DELETE_ICON("qtg_mono_delete"); |
|
50 |
||
52
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
51 |
//DB-file |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
52 |
_LIT(KDbFileName, "c:[2002A542]conversations.db"); |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
53 |
// query to see if msg is forwardable |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
54 |
_LIT(KSelectMsgPropertyStmt, " SELECT message_id, msg_property FROM conversation_messages WHERE message_id=:message_id "); |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
55 |
|
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
56 |
|
31 | 57 |
//LOCALIZED CONSTANTS |
58 |
#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
|
59 |
#define LOC_DELETE_SHARED_MESSAGE hbTrId("txt_messaging_dialog_same_message_exists_in_multip") |
31 | 60 |
|
61 |
//---------------------------------------------------------------------------- |
|
62 |
// UnifiedViewer::UnifiedViewer |
|
63 |
// constructor |
|
64 |
//---------------------------------------------------------------------------- |
|
52
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
65 |
UnifiedViewer::UnifiedViewer(const qint32 messageId, |
34
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
66 |
QGraphicsItem *parent) : |
52
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
67 |
MsgBaseView(parent) |
31 | 68 |
{ |
69 |
QDEBUG_WRITE("UnifiedViewer contruction start"); |
|
70 |
||
71 |
if (!HbStyleLoader::registerFilePath(":/layouts")) |
|
72 |
{ |
|
73 |
QDEBUG_WRITE("ERROR: UnifiedViewer -> HbStyleLoader::registerFilePath"); |
|
74 |
} |
|
75 |
||
76 |
mMessageId = messageId; |
|
77 |
mViewFeeder = new UniViewerFeeder(mMessageId, this); |
|
78 |
||
79 |
mScrollArea = new UniScrollArea(this); |
|
80 |
this->setWidget(mScrollArea); |
|
81 |
||
82 |
mContentsWidget = new UniContentsWidget(mViewFeeder,this); |
|
83 |
||
84 |
connect(mContentsWidget,SIGNAL(sendMessage(const QString&,const QString&)), |
|
85 |
this, SLOT(sendMessage(const QString&,const QString&))); |
|
86 |
||
87 |
connect(mScrollArea, SIGNAL(scrolledToNextSlide()), |
|
88 |
mContentsWidget, SLOT(populateNextSlide())); |
|
89 |
||
90 |
mScrollArea->setContentWidget(mContentsWidget); |
|
91 |
mScrollArea->setHorizontalScrollBarPolicy(HbScrollArea::ScrollBarAlwaysOff); |
|
92 |
mScrollArea->setVerticalScrollBarPolicy(HbScrollArea::ScrollBarAutoHide); |
|
93 |
||
94 |
QDEBUG_WRITE("UnifiedViewer contruction End"); |
|
95 |
} |
|
96 |
||
97 |
//---------------------------------------------------------------------------- |
|
98 |
// UnifiedViewer::UnifiedViewer |
|
99 |
// Destructor |
|
100 |
//---------------------------------------------------------------------------- |
|
101 |
UnifiedViewer::~UnifiedViewer() |
|
102 |
{ |
|
103 |
HbStyleLoader::unregisterFilePath(":/layouts"); |
|
104 |
} |
|
105 |
||
106 |
//---------------------------------------------------------------------------- |
|
107 |
// UnifiedViewer::createToolBar |
|
108 |
// Creates tool bar actions |
|
109 |
//---------------------------------------------------------------------------- |
|
110 |
void UnifiedViewer::createToolBar() |
|
111 |
{ |
|
112 |
HbToolBar* toolbar = this->toolBar(); |
|
113 |
toolbar->setOrientation(Qt::Horizontal); |
|
114 |
||
115 |
int sendingState = mViewFeeder->sendingState(); |
|
116 |
||
117 |
if (mViewFeeder->sendingState() == ConvergedMessage::Failed) |
|
118 |
{ |
|
119 |
toolbar->addAction(HbIcon(SEND_ICON), ""); |
|
120 |
} |
|
121 |
else |
|
122 |
{ |
|
52
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
123 |
// do not show reply option for multi recipient outgoing message |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
124 |
if(!(!mViewFeeder->isIncoming() && mViewFeeder->recipientCount()>1)) |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
125 |
{ |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
126 |
toolbar->addAction(HbIcon(REPLY_ICON), "", this, SLOT(handleReplyAction())); |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
127 |
} |
34
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
128 |
|
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
129 |
if (mViewFeeder->recipientCount() > 1) |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
130 |
{ |
52
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
131 |
toolbar->addAction(HbIcon(REPLY_ALL_ICON), "", this, SLOT(handleReplyAllAction())); |
34
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
132 |
} |
31 | 133 |
} |
134 |
||
52
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
135 |
if (isForwardOk()) |
31 | 136 |
{ |
137 |
toolbar->addAction(HbIcon(FORWARD_ICON), "", this, SLOT(handleFwdAction())); |
|
138 |
} |
|
139 |
||
140 |
toolbar->addAction(HbIcon(DELETE_ICON), "", this, SLOT(handleDeleteAction())); |
|
141 |
} |
|
142 |
||
143 |
//--------------------------------------------------------------- |
|
144 |
// UnifiedViewer::clearContent |
|
145 |
// @see header file |
|
146 |
//--------------------------------------------------------------- |
|
147 |
void UnifiedViewer::clearContent() |
|
148 |
{ |
|
149 |
QDEBUG_WRITE("UnifiedViewer clearContent start"); |
|
150 |
||
151 |
mContentsWidget->clearContent(); |
|
152 |
mContentsWidget->resize(mContentsWidget->rect().width(), -1); |
|
153 |
mScrollArea->setPosToStart(); |
|
154 |
mViewFeeder->clearContent(); |
|
155 |
||
156 |
QDEBUG_WRITE("UnifiedViewer clearContent End"); |
|
157 |
} |
|
158 |
||
159 |
//--------------------------------------------------------------- |
|
160 |
// UnifiedViewer::populateContent |
|
161 |
// @see header file |
|
162 |
//--------------------------------------------------------------- |
|
163 |
void UnifiedViewer::populateContent(const qint32 messageId, bool update, int msgCount) |
|
164 |
{ |
|
165 |
QDEBUG_WRITE("UnifiedViewer populateContent Start"); |
|
166 |
||
167 |
mMsgCount = msgCount; |
|
168 |
mMessageId = messageId; |
|
169 |
||
170 |
QDEBUG_WRITE("UnifiedViewer feeder->updateContent START"); |
|
171 |
||
172 |
if (update) |
|
173 |
{ |
|
174 |
mViewFeeder->updateContent(messageId); |
|
175 |
} |
|
176 |
QDEBUG_WRITE("UnifiedViewer feeder->updateContent END"); |
|
177 |
||
178 |
// Dont show the scroll bar. |
|
179 |
mScrollArea->setVerticalScrollBarPolicy(HbScrollArea::ScrollBarAlwaysOff); |
|
180 |
||
181 |
if ( (mViewFeeder->msgType() == KSenduiMtmMmsUidValue) && |
|
182 |
(mViewFeeder->slideCount() > 0) ) |
|
183 |
{ |
|
184 |
mScrollArea->setTotalSlides(mViewFeeder->slideCount()); |
|
185 |
} |
|
186 |
else |
|
187 |
{ |
|
188 |
mScrollArea->setTotalSlides(1); |
|
189 |
} |
|
190 |
mScrollArea->resetCurrentSlide(); |
|
191 |
||
192 |
mContentsWidget->populateContent(); |
|
193 |
||
194 |
//Creation of toolbar now depends on content |
|
195 |
createToolBar(); |
|
52
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
196 |
|
31 | 197 |
QDEBUG_WRITE("UnifiedViewer populateContent END"); |
198 |
} |
|
199 |
||
200 |
//--------------------------------------------------------------- |
|
201 |
// UnifiedViewer::handleFwdAction |
|
202 |
// @see header file |
|
203 |
//--------------------------------------------------------------- |
|
204 |
void UnifiedViewer::handleFwdAction() |
|
205 |
{ |
|
52
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
206 |
launchEditor(MsgBaseView::FORWARD_MSG); |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
207 |
} |
31 | 208 |
|
52
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
209 |
//--------------------------------------------------------------- |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
210 |
// UnifiedViewer::handleReplyAction |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
211 |
// @see header file |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
212 |
//--------------------------------------------------------------- |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
213 |
void UnifiedViewer::handleReplyAction() |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
214 |
{ |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
215 |
launchEditor(MsgBaseView::REPLY_MSG); |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
216 |
} |
31 | 217 |
|
52
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
218 |
//--------------------------------------------------------------- |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
219 |
// UnifiedViewer::handleReplyAllAction |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
220 |
// @see header file |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
221 |
//--------------------------------------------------------------- |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
222 |
void UnifiedViewer::handleReplyAllAction() |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
223 |
{ |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
224 |
launchEditor(MsgBaseView::REPLY_ALL_MSG); |
31 | 225 |
} |
226 |
||
227 |
//--------------------------------------------------------------- |
|
228 |
// UnifiedViewer::resizeEvent |
|
229 |
// @see header file |
|
230 |
//--------------------------------------------------------------- |
|
231 |
void UnifiedViewer::resizeEvent(QGraphicsSceneResizeEvent * event) |
|
232 |
{ |
|
233 |
Q_UNUSED(event) |
|
234 |
mContentsWidget->resize(this->rect().width(), this->rect().height()+1); |
|
235 |
} |
|
236 |
||
237 |
//--------------------------------------------------------------- |
|
238 |
// UnifiedViewer::handleDeleteAction |
|
239 |
// @see header file |
|
240 |
//--------------------------------------------------------------- |
|
241 |
void UnifiedViewer::handleDeleteAction() |
|
242 |
{ |
|
52
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
243 |
QString txt = LOC_DELETE_MESSAGE; |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
244 |
|
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
245 |
//if mms and out going. check for sharing |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
246 |
if((mViewFeeder->msgType() == KSenduiMtmMmsUidValue) && (!mViewFeeder->isIncoming())) |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
247 |
{ |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
248 |
if(mViewFeeder->recipientCount() > 1 ) |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
249 |
{ |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
250 |
txt = LOC_DELETE_SHARED_MESSAGE; |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
251 |
} |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
252 |
} |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
253 |
|
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
254 |
HbMessageBox::question(txt,this,SLOT(onDialogDeleteMsg(int)), |
44
36f374c67aa8
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
255 |
HbMessageBox::Delete | HbMessageBox::Cancel); |
31 | 256 |
} |
257 |
||
258 |
//--------------------------------------------------------------- |
|
259 |
// UnifiedViewer::sendMessage |
|
260 |
// @see header file |
|
261 |
//--------------------------------------------------------------- |
|
262 |
void UnifiedViewer::sendMessage(const QString& phoneNumber,const QString& alias) |
|
263 |
{ |
|
264 |
ConvergedMessage message; |
|
265 |
message.setBodyText(QString()); |
|
266 |
||
267 |
ConvergedMessageAddress address; |
|
268 |
address.setAlias(alias); |
|
269 |
address.setAddress(phoneNumber); |
|
270 |
message.addToRecipient(address); |
|
271 |
||
272 |
QByteArray dataArray; |
|
273 |
QDataStream messageStream |
|
274 |
(&dataArray, QIODevice::WriteOnly | QIODevice::Append); |
|
275 |
message.serialize(messageStream); |
|
276 |
||
277 |
QVariantList params; |
|
278 |
params << MsgBaseView::UNIEDITOR; |
|
279 |
params << MsgBaseView::UNIVIEWER; |
|
280 |
params << dataArray; |
|
281 |
||
282 |
emit switchView(params); |
|
283 |
} |
|
284 |
||
285 |
//--------------------------------------------------------------- |
|
286 |
// UnifiedViewer::onDialogDeleteMsg |
|
287 |
// @see header file |
|
288 |
//--------------------------------------------------------------- |
|
52
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
289 |
void UnifiedViewer::onDialogDeleteMsg(int val) |
31 | 290 |
{ |
52
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
291 |
if (val == HbMessageBox::Delete) { |
31 | 292 |
QList<int> msgIdList; |
293 |
msgIdList << mMessageId; |
|
294 |
||
295 |
ConversationsEngine::instance()->deleteMessages(msgIdList); |
|
296 |
||
297 |
QVariantList param; |
|
298 |
if (mMsgCount > 1) { |
|
299 |
param << MsgBaseView::CV; |
|
300 |
param << MsgBaseView::UNIVIEWER; |
|
301 |
} |
|
302 |
else { |
|
303 |
param << MsgBaseView::CLV; |
|
304 |
param << MsgBaseView::UNIVIEWER; |
|
305 |
} |
|
306 |
||
307 |
QVariant dummy(QVariant::Invalid); |
|
308 |
param << dummy; |
|
309 |
emit switchView(param); |
|
310 |
} |
|
311 |
} |
|
312 |
||
52
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
313 |
//--------------------------------------------------------------- |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
314 |
// UnifiedViewer::launchEditor |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
315 |
// @see header file |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
316 |
//--------------------------------------------------------------- |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
317 |
void UnifiedViewer::launchEditor( |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
318 |
MsgBaseView::UniEditorOperation operation) |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
319 |
{ |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
320 |
ConvergedMessage message; |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
321 |
ConvergedMessageId id(mMessageId); |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
322 |
message.setMessageId(id); |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
323 |
if(mViewFeeder->msgType() == KSenduiMtmMmsUidValue) |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
324 |
{ |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
325 |
message.setMessageType(ConvergedMessage::Mms); |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
326 |
} |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
327 |
else |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
328 |
{ |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
329 |
message.setMessageType(ConvergedMessage::Sms); |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
330 |
} |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
331 |
|
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
332 |
QByteArray dataArray; |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
333 |
QDataStream messageStream |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
334 |
(&dataArray, QIODevice::WriteOnly | QIODevice::Append); |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
335 |
message.serialize(messageStream); |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
336 |
|
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
337 |
QVariantList params; |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
338 |
params << MsgBaseView::UNIEDITOR; // target view |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
339 |
params << MsgBaseView::UNIVIEWER; // source view |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
340 |
|
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
341 |
params << dataArray; |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
342 |
params << operation; |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
343 |
|
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
344 |
emit switchView(params); |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
345 |
} |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
346 |
|
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
347 |
//--------------------------------------------------------------- |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
348 |
// UnifiedViewer::isForwardOk |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
349 |
// @see header file |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
350 |
//--------------------------------------------------------------- |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
351 |
bool UnifiedViewer::isForwardOk() |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
352 |
{ |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
353 |
bool canForwardMsg = true; |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
354 |
if(mViewFeeder->msgType() == KSenduiMtmMmsUidValue) |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
355 |
{ |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
356 |
// open DB |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
357 |
RSqlDatabase sqlDb; |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
358 |
TInt error = sqlDb.Open(KDbFileName); |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
359 |
if(error == KErrNone) |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
360 |
{ |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
361 |
RSqlStatement sqlSelectStmt; |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
362 |
CleanupClosePushL(sqlSelectStmt); |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
363 |
sqlSelectStmt.PrepareL(sqlDb,KSelectMsgPropertyStmt); |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
364 |
TInt msgIdIndex = sqlSelectStmt.ParameterIndex(_L(":message_id")); |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
365 |
sqlSelectStmt.BindInt(msgIdIndex, mMessageId); |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
366 |
// read the flag |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
367 |
TInt msgPropertyIndex = |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
368 |
sqlSelectStmt.ColumnIndex(_L("msg_property")); |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
369 |
TInt retValue = 0; |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
370 |
if (sqlSelectStmt.Next() == KSqlAtRow) |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
371 |
{ |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
372 |
retValue = static_cast<TInt> |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
373 |
(sqlSelectStmt.ColumnInt(msgPropertyIndex)); |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
374 |
} |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
375 |
CleanupStack::PopAndDestroy(&sqlSelectStmt); |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
376 |
sqlDb.Close(); |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
377 |
canForwardMsg = (retValue & EPreviewForward)? true:false; |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
378 |
} |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
379 |
else |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
380 |
{ |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
381 |
// fall-back plan |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
382 |
MmsConformanceCheck* mmsConformanceCheck = new MmsConformanceCheck; |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
383 |
canForwardMsg = mmsConformanceCheck->validateMsgForForward(mMessageId); |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
384 |
delete mmsConformanceCheck; |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
385 |
} |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
386 |
} |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
387 |
return canForwardMsg; |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
388 |
} |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
389 |
|
31 | 390 |
// EOF |