author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Fri, 11 Jun 2010 13:35:48 +0300 | |
changeset 34 | 84197e66a4bd |
parent 31 | ebfee66fde93 |
child 43 | 35b64624a9e7 |
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: |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
#include "msgconversationviewitem.h" |
|
19 |
||
20 |
// SYSTEM INCLUDES |
|
21 |
#include <QDateTime> |
|
22 |
#include "debugtraces.h" |
|
23 |
#include <QDir> |
|
24 |
#include <QChar> |
|
25 |
#include <HbTextItem> |
|
26 |
#include <HbIconItem> |
|
27 |
#include <HbIconAnimationManager> |
|
28 |
#include <HbIconAnimator> |
|
29 |
#include <ccsdefs.h> |
|
30 |
||
31 |
// USER INCLUDES |
|
32 |
#include "msgconversationwidget.h" |
|
33 |
#include "msgviewdefines.h" |
|
34 |
#include "msgviewutils.h" |
|
35 |
#include "convergedmessage.h" |
|
36 |
#include "conversationsenginedefines.h" |
|
37 |
||
38 |
// LOCAL CONSTANTS |
|
39 |
const QString MSG_OUTBOX_ICON("qtg_small_outbox"); |
|
40 |
const QString MSG_FAIL_ICON("qtg_small_fail"); |
|
41 |
const QString ANIMATION_FILE(":/qtg_anim_loading.axml"); |
|
42 |
const QString ANIMATION_ICON_NAME("qtg_anim_loading"); |
|
43 |
const QString VCARD_ICON("qtg_large_mycard"); |
|
44 |
||
45 |
// LOCALIZATION |
|
46 |
#define LOC_RINGING_TONE hbTrId("txt_messaging_dpopinfo_ringing_tone") |
|
47 |
#define LOC_BUSINESS_CARD hbTrId("txt_messaging_list_business_card") |
|
48 |
#define LOC_CALENDAR_EVENT hbTrId("txt_messaging_list_calendar_event") |
|
49 |
#define LOC_UNSUPPORTED_MSG_TYPE hbTrId("txt_messaging_list_listview_unsupported_message_type") |
|
50 |
#define LOC_RESEND_AT hbTrId("Resend at ") |
|
51 |
||
52 |
//--------------------------------------------------------------- |
|
53 |
// MsgConversationViewItem::MsgConversationViewItem |
|
54 |
// Constructor |
|
55 |
//--------------------------------------------------------------- |
|
56 |
MsgConversationViewItem::MsgConversationViewItem(QGraphicsItem* parent) : |
|
57 |
HbListViewItem(parent), mIncoming(false), mConversation(0), |
|
34
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
58 |
mIncomingMsgStateIconItem(0), mOutgoingMsgStateIconItem(0) |
31 | 59 |
{ |
60 |
} |
|
61 |
||
62 |
//--------------------------------------------------------------- |
|
63 |
// MsgConversationViewItem::MsgConversationViewItem |
|
64 |
// Destructor |
|
65 |
//--------------------------------------------------------------- |
|
66 |
MsgConversationViewItem::~MsgConversationViewItem() |
|
67 |
{ |
|
68 |
} |
|
69 |
||
70 |
//--------------------------------------------------------------- |
|
71 |
// MsgConversationViewItem::createItem |
|
72 |
// Create a new decorator item. |
|
73 |
//--------------------------------------------------------------- |
|
74 |
MsgConversationViewItem* MsgConversationViewItem::createItem() |
|
34
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
75 |
{ |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
76 |
MsgConversationViewItem *item = new MsgConversationViewItem(*this); |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
77 |
item->init(); |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
78 |
return item; |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
79 |
} |
31 | 80 |
|
81 |
//--------------------------------------------------------------- |
|
82 |
// MsgConversationViewItem::updateChildItems |
|
83 |
// |
|
84 |
//--------------------------------------------------------------- |
|
85 |
void MsgConversationViewItem::updateChildItems() |
|
34
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
86 |
{ |
31 | 87 |
QModelIndex index = modelIndex(); |
88 |
||
89 |
#ifdef _DEBUG_TRACES_ |
|
90 |
qCritical() << "START MsgConversationViewItem::updateChildItems: " |
|
91 |
<< index.data(ConvergedMsgId).toInt(); |
|
92 |
#endif |
|
93 |
||
94 |
int messageType = index.data(MessageType).toInt(); |
|
95 |
int messageSubType = index.data(MessageSubType).toInt(); |
|
96 |
||
97 |
||
98 |
if (messageType == ConvergedMessage::Sms) |
|
99 |
{ |
|
100 |
updateSmsTypeItem(index); |
|
101 |
} |
|
102 |
else if (messageType == ConvergedMessage::Mms || messageType |
|
103 |
== ConvergedMessage::MmsNotification || messageType |
|
104 |
== ConvergedMessage::BT) |
|
105 |
{ |
|
106 |
updateMmsTypeItem(index, messageType, messageSubType); |
|
107 |
} |
|
108 |
else if (messageType == ConvergedMessage::BioMsg) |
|
109 |
{ |
|
110 |
if (messageSubType == ConvergedMessage::VCard || messageSubType |
|
111 |
== ConvergedMessage::RingingTone) |
|
112 |
{ |
|
113 |
updateMmsTypeItem(index, messageType, messageSubType); |
|
114 |
} |
|
115 |
else |
|
116 |
{ |
|
117 |
updateSmsTypeItem(index, messageSubType); |
|
118 |
} |
|
119 |
} |
|
120 |
||
121 |
#ifdef _DEBUG_TRACES_ |
|
122 |
qCritical() << "END MsgConversationViewItem::updateChildItems: " |
|
123 |
<< index.data(ConvergedMsgId).toInt(); |
|
124 |
#endif |
|
125 |
||
126 |
repolish(); |
|
127 |
HbListViewItem::updateChildItems(); |
|
128 |
} |
|
129 |
||
130 |
//--------------------------------------------------------------- |
|
131 |
// MsgConversationViewItem::updateSmsTypeItem |
|
132 |
// @see header file |
|
133 |
//--------------------------------------------------------------- |
|
34
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
134 |
void MsgConversationViewItem::updateSmsTypeItem(const QModelIndex& index, |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
135 |
int messageSubType) |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
136 |
{ |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
137 |
|
31 | 138 |
mIncoming = false; |
139 |
mConversation->resetProperties(); |
|
140 |
||
141 |
int direction = index.data(Direction).toInt(); |
|
142 |
||
143 |
if (direction == ConvergedMessage::Incoming) |
|
144 |
{ |
|
145 |
setIncoming(true); |
|
146 |
mConversation->setIncoming(true); |
|
147 |
||
34
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
148 |
mIncomingMsgStateIconItem->setVisible(false); |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
149 |
} |
31 | 150 |
else if (direction == ConvergedMessage::Outgoing) |
151 |
{ |
|
152 |
setIncoming(false); |
|
153 |
mConversation->setIncoming(false); |
|
154 |
||
155 |
int sendingState = index.data(SendingState).toInt(); |
|
156 |
mConversation->setSendingState(sendingState); |
|
157 |
setMessageStateIcon(sendingState); |
|
158 |
} |
|
159 |
||
160 |
bool unreadStatus = index.data(UnReadStatus).toBool(); |
|
161 |
mConversation->setUnread(unreadStatus); |
|
162 |
||
163 |
mConversation->drawBubbleFrame(); |
|
164 |
mConversation->drawNewItemFrame(); |
|
165 |
||
166 |
QDateTime dateTime; |
|
167 |
dateTime.setTime_t(index.data(TimeStamp).toUInt()); |
|
168 |
QString resendStateNote((index.data(SendingState).toInt() |
|
169 |
== ConvergedMessage::Resend) ? LOC_RESEND_AT : ""); |
|
170 |
if (dateTime.date() == QDateTime::currentDateTime().date()) |
|
171 |
{ |
|
172 |
||
173 |
mConversation->setTimeStamp(resendStateNote + dateTime.toString( |
|
174 |
TIME_FORMAT)); |
|
175 |
} |
|
176 |
else |
|
177 |
{ |
|
178 |
mConversation->setTimeStamp(resendStateNote + dateTime.toString( |
|
179 |
DATE_FORMAT)); |
|
180 |
} |
|
181 |
||
182 |
if (messageSubType == ConvergedMessage::VCal) |
|
183 |
{ |
|
184 |
mConversation->setSubject(LOC_UNSUPPORTED_MSG_TYPE); |
|
185 |
} |
|
186 |
else |
|
187 |
{ |
|
188 |
QString bodyText = index.data(BodyText).toString(); |
|
189 |
bodyText.replace(QChar::ParagraphSeparator, QChar::LineSeparator); |
|
190 |
bodyText.replace('\r', QChar::LineSeparator); |
|
191 |
mConversation->setSubject(bodyText); |
|
192 |
} |
|
193 |
||
194 |
//repolish |
|
195 |
mConversation->repolishWidget(); |
|
196 |
} |
|
197 |
||
198 |
//--------------------------------------------------------------- |
|
199 |
// MsgConversationViewItem::updateMmsTypeItem |
|
200 |
// @see header file |
|
201 |
//--------------------------------------------------------------- |
|
202 |
void MsgConversationViewItem::updateMmsTypeItem(const QModelIndex& index, |
|
203 |
int messageType, int messageSubType) |
|
204 |
{ |
|
205 |
// create widget |
|
206 |
if (!mConversation) |
|
207 |
{ |
|
208 |
mConversation = new MsgConversationWidget(this); |
|
209 |
HbStyle::setItemName(mConversation, "msgconvwidget"); |
|
210 |
} |
|
211 |
mIncoming = false; |
|
212 |
mConversation->resetProperties(); |
|
213 |
||
214 |
mConversation->setMMS(true); |
|
215 |
int direction = index.data(Direction).toInt(); |
|
216 |
QString bodyText = index.data(BodyText).toString(); |
|
217 |
||
218 |
if (direction == ConvergedMessage::Incoming) |
|
219 |
{ |
|
220 |
setIncoming(true); |
|
221 |
mConversation->setIncoming(true); |
|
222 |
||
223 |
if (messageType == ConvergedMessage::MmsNotification) |
|
224 |
{ |
|
225 |
mConversation->setMMSNotification(true); |
|
226 |
int notificationState = index.data(NotificationStatus).toInt(); |
|
227 |
mConversation->setNotificationState(notificationState); |
|
228 |
setNotificationStateIcon(notificationState); |
|
229 |
} |
|
230 |
else |
|
231 |
{ |
|
34
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
232 |
mIncomingMsgStateIconItem->setVisible(false); |
31 | 233 |
} |
234 |
} |
|
235 |
else if (direction == ConvergedMessage::Outgoing) |
|
236 |
{ |
|
237 |
setIncoming(false); |
|
238 |
mConversation->setIncoming(false); |
|
239 |
||
240 |
int sendingState = index.data(SendingState).toInt(); |
|
241 |
mConversation->setSendingState(sendingState); |
|
242 |
setMessageStateIcon(sendingState); |
|
243 |
} |
|
244 |
||
245 |
bool unreadStatus = index.data(UnReadStatus).toBool(); |
|
246 |
mConversation->setUnread(unreadStatus); |
|
247 |
||
248 |
mConversation->drawBubbleFrame(); |
|
249 |
mConversation->drawNewItemFrame(); |
|
250 |
||
251 |
QDateTime dateTime; |
|
252 |
dateTime.setTime_t(index.data(TimeStamp).toUInt()); |
|
253 |
QString resendStateNote((index.data(SendingState).toInt() |
|
254 |
== ConvergedMessage::Resend) ? LOC_RESEND_AT : ""); |
|
255 |
if (dateTime.date() == QDateTime::currentDateTime().date()) |
|
256 |
{ |
|
257 |
||
258 |
mConversation->setTimeStamp(resendStateNote + dateTime.toString( |
|
259 |
TIME_FORMAT)); |
|
260 |
} |
|
261 |
else |
|
262 |
{ |
|
263 |
mConversation->setTimeStamp(resendStateNote + dateTime.toString( |
|
264 |
DATE_FORMAT)); |
|
265 |
} |
|
266 |
||
267 |
if (messageType == ConvergedMessage::Mms) |
|
268 |
{ |
|
269 |
//preview path |
|
270 |
QString previewPath = index.data(Attachments).toString(); |
|
271 |
QString subject = index.data(Subject).toString(); |
|
272 |
||
273 |
int msgProperty = index.data(MessageProperty).toInt(); |
|
274 |
bool hasAttachments = (msgProperty & EPreviewAttachment) ? true : false; |
|
275 |
||
276 |
if (hasAttachments) |
|
277 |
{ |
|
278 |
mConversation->setAttachment(); |
|
279 |
} |
|
280 |
else |
|
281 |
{ |
|
282 |
mConversation->setAttachment(false); |
|
283 |
} |
|
284 |
||
285 |
// Now set the media contents |
|
286 |
||
287 |
//preview image |
|
288 |
bool hasImage = (msgProperty & EPreviewImage) ? true : false; |
|
289 |
||
290 |
if (hasImage) |
|
34
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
291 |
{ |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
292 |
QVariant previewData = index.data(PreviewIcon); |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
293 |
|
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
294 |
HbIcon previewIcon; |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
295 |
previewIcon = qvariant_cast<HbIcon> (previewData); |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
296 |
|
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
297 |
mConversation->setPreviewIcon(previewIcon); |
31 | 298 |
mConversation->setImage(true); |
299 |
} |
|
300 |
||
301 |
bool hasVideo = (msgProperty & EPreviewVideo) ? true : false; |
|
302 |
||
303 |
if (hasVideo) |
|
304 |
{ |
|
305 |
mConversation->setVideo(true); |
|
306 |
} |
|
307 |
||
308 |
bool hasAudio = (msgProperty & EPreviewAudio) ? true : false; |
|
309 |
if (hasAudio) |
|
310 |
{ |
|
311 |
mConversation->setAudio(true); |
|
312 |
} |
|
313 |
||
314 |
mConversation->displayAudioIcon(); |
|
315 |
||
316 |
int priority = index.data(MessagePriority).toInt(); |
|
317 |
mConversation->setPriority(priority); |
|
318 |
mConversation->setSubject(subject); |
|
319 |
mConversation->setBodyText(bodyText); |
|
320 |
} |
|
321 |
else if (messageType == ConvergedMessage::BioMsg) |
|
322 |
{ |
|
323 |
if (messageSubType == ConvergedMessage::RingingTone) |
|
324 |
{ |
|
325 |
mConversation->setImage(false); |
|
326 |
mConversation->setAudio(true); |
|
327 |
mConversation->displayAudioIcon(); |
|
328 |
mConversation->setSubject(LOC_RINGING_TONE); |
|
34
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
329 |
mConversation->setBodyText(bodyText); |
31 | 330 |
} |
331 |
else if (messageSubType == ConvergedMessage::VCard) |
|
332 |
{ |
|
333 |
mConversation->setImage(false); |
|
334 |
mConversation->setAudio(true); |
|
335 |
mConversation->displayAudioIcon(VCARD_ICON); |
|
336 |
mConversation->setSubject(LOC_BUSINESS_CARD); |
|
337 |
mConversation->setBodyText(bodyText); |
|
338 |
} |
|
339 |
} |
|
340 |
else if (messageType == ConvergedMessage::BT) |
|
341 |
{ |
|
342 |
QString deviceName = index.data(ConversationAddress).toString(); |
|
343 |
mConversation->setSubject(deviceName); |
|
344 |
QString blueToothBody; |
|
345 |
if (messageSubType == ConvergedMessage::VCard) |
|
346 |
{ |
|
347 |
mConversation->setImage(false); |
|
348 |
mConversation->setAudio(true); |
|
349 |
mConversation->displayAudioIcon(VCARD_ICON); |
|
350 |
blueToothBody.append(LOC_BUSINESS_CARD); |
|
351 |
blueToothBody.append(QChar::LineSeparator); |
|
352 |
blueToothBody.append(bodyText); |
|
353 |
} |
|
354 |
else |
|
355 |
{ |
|
356 |
blueToothBody.append(bodyText); |
|
357 |
} |
|
358 |
mConversation->setBodyText(blueToothBody); |
|
359 |
} |
|
360 |
else if (messageType == ConvergedMessage::MmsNotification) |
|
361 |
{ |
|
362 |
QString subject = index.data(Subject).toString(); |
|
363 |
int priority = index.data(MessagePriority).toInt(); |
|
364 |
mConversation->setPriority(priority); |
|
365 |
mConversation->setSubject(subject); |
|
366 |
mConversation->setBodyText(bodyText); |
|
367 |
} |
|
368 |
||
369 |
//repolish widget |
|
370 |
mConversation->repolishWidget(); |
|
371 |
} |
|
372 |
||
373 |
//--------------------------------------------------------------- |
|
374 |
// MsgConversationViewItem::containsPoint |
|
375 |
// |
|
376 |
//--------------------------------------------------------------- |
|
377 |
bool MsgConversationViewItem::containsPoint(const QPointF& point) |
|
378 |
{ |
|
34
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
379 |
return mConversation->boundingRect(). contains(mConversation->mapFromScene( |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
380 |
point)); |
31 | 381 |
} |
382 |
||
383 |
//--------------------------------------------------------------- |
|
384 |
// MsgConversationViewItem::setIncoming |
|
385 |
// @see header file |
|
386 |
//--------------------------------------------------------------- |
|
387 |
void MsgConversationViewItem::setIncoming(bool incoming) |
|
388 |
{ |
|
389 |
mIncoming = incoming; |
|
34
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
390 |
|
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
391 |
if (mIncoming) |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
392 |
{ |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
393 |
HbStyle::setItemName(mOutgoingMsgStateIconItem, ""); |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
394 |
mOutgoingMsgStateIconItem->setVisible(false); |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
395 |
HbStyle::setItemName(mIncomingMsgStateIconItem, |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
396 |
"msgStateIconIncoming"); |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
397 |
} |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
398 |
else |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
399 |
{ |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
400 |
HbStyle::setItemName(mIncomingMsgStateIconItem, ""); |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
401 |
mIncomingMsgStateIconItem->setVisible(false); |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
402 |
HbStyle::setItemName(mOutgoingMsgStateIconItem, |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
403 |
"msgStateIconOutgoing"); |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
404 |
} |
31 | 405 |
} |
406 |
||
407 |
//--------------------------------------------------------------- |
|
408 |
// MsgConversationViewItem::isIncoming |
|
409 |
// @see header file |
|
410 |
//--------------------------------------------------------------- |
|
411 |
bool MsgConversationViewItem::isIncoming() |
|
412 |
{ |
|
413 |
return mIncoming; |
|
414 |
} |
|
415 |
||
416 |
//--------------------------------------------------------------- |
|
417 |
// MsgConversationViewItem::setMessageStateIcon |
|
418 |
// @see header file |
|
419 |
//--------------------------------------------------------------- |
|
420 |
void MsgConversationViewItem::setMessageStateIcon(int messageState) |
|
421 |
{ |
|
34
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
422 |
HbIconAnimator& iconAnimator = mOutgoingMsgStateIconItem->animator(); |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
423 |
HbIconAnimationManager* iconAnimationManager = |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
424 |
HbIconAnimationManager::global(); |
31 | 425 |
switch (messageState) |
426 |
{ |
|
427 |
case ConvergedMessage::Waiting: |
|
428 |
case ConvergedMessage::Scheduled: |
|
429 |
case ConvergedMessage::Sending: |
|
34
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
430 |
{ |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
431 |
bool defined = iconAnimationManager->addDefinitionFile( |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
432 |
ANIMATION_FILE); |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
433 |
HbIcon animIcon; |
31 | 434 |
animIcon.setIconName(ANIMATION_ICON_NAME); |
34
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
435 |
QSizeF size = mOutgoingMsgStateIconItem->size(); |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
436 |
mOutgoingMsgStateIconItem->setIcon(animIcon); |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
437 |
mOutgoingMsgStateIconItem->setVisible(true); |
31 | 438 |
iconAnimator.startAnimation(); |
439 |
break; |
|
440 |
} |
|
441 |
case ConvergedMessage::Suspended: |
|
442 |
{ |
|
34
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
443 |
iconAnimator.stopAnimation(); |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
444 |
mOutgoingMsgStateIconItem->setIcon(MSG_OUTBOX_ICON); |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
445 |
mOutgoingMsgStateIconItem->setVisible(true); |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
446 |
break; |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
447 |
|
31 | 448 |
} |
449 |
case ConvergedMessage::Resend: |
|
450 |
{ |
|
451 |
iconAnimator.stopAnimation(); |
|
34
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
452 |
mOutgoingMsgStateIconItem->setIcon(MSG_OUTBOX_ICON); |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
453 |
mOutgoingMsgStateIconItem->setVisible(true); |
31 | 454 |
break; |
455 |
} |
|
456 |
case ConvergedMessage::Failed: |
|
457 |
{ |
|
458 |
iconAnimator.stopAnimation(); |
|
34
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
459 |
mOutgoingMsgStateIconItem->setIcon(MSG_FAIL_ICON); |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
460 |
mOutgoingMsgStateIconItem->setVisible(true); |
31 | 461 |
break; |
462 |
} |
|
463 |
case ConvergedMessage::Unknown: |
|
464 |
default: |
|
465 |
{ |
|
466 |
iconAnimator.stopAnimation(); |
|
34
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
467 |
mOutgoingMsgStateIconItem->setVisible(false); |
31 | 468 |
break; |
469 |
} |
|
470 |
} |
|
471 |
} |
|
472 |
||
473 |
//--------------------------------------------------------------- |
|
474 |
// MsgConversationViewItem::setNotificationStateIcon |
|
475 |
// @see header file |
|
476 |
//--------------------------------------------------------------- |
|
477 |
||
478 |
void MsgConversationViewItem::setNotificationStateIcon(int notificationState) |
|
479 |
{ |
|
34
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
480 |
HbIconAnimator& iconAnimator = mIncomingMsgStateIconItem->animator(); |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
481 |
HbIconAnimationManager* iconAnimationManager = |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
482 |
HbIconAnimationManager::global(); |
31 | 483 |
switch (notificationState) |
484 |
{ |
|
485 |
case ConvergedMessage::NotifRetrieving: |
|
486 |
case ConvergedMessage::NotifWaiting: |
|
487 |
{ |
|
488 |
//TODO: Temp icon until official icons are received |
|
34
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
489 |
bool defined = iconAnimationManager->addDefinitionFile( |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
490 |
ANIMATION_FILE); |
31 | 491 |
HbIcon animIcon; |
492 |
animIcon.setIconName(ANIMATION_ICON_NAME); |
|
34
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
493 |
QSizeF size = mIncomingMsgStateIconItem->size(); |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
494 |
mIncomingMsgStateIconItem->setIcon(animIcon); |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
495 |
mIncomingMsgStateIconItem->setVisible(true); |
31 | 496 |
iconAnimator.startAnimation(); |
497 |
break; |
|
498 |
} |
|
499 |
default: |
|
500 |
{ |
|
501 |
iconAnimator.stopAnimation(); |
|
34
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
502 |
mIncomingMsgStateIconItem->setVisible(false); |
31 | 503 |
break; |
504 |
} |
|
505 |
} |
|
506 |
} |
|
507 |
||
508 |
//--------------------------------------------------------------- |
|
509 |
// MsgConversationViewItem::pressStateChanged |
|
510 |
// @see header file |
|
511 |
//--------------------------------------------------------------- |
|
512 |
void MsgConversationViewItem::pressStateChanged (bool pressed, bool animate) |
|
513 |
{ |
|
514 |
mConversation->pressStateChanged(pressed, animate); |
|
515 |
} |
|
516 |
||
34
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
517 |
//--------------------------------------------------------------- |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
518 |
// MsgConversationViewItem::init |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
519 |
// @see header file |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
520 |
//--------------------------------------------------------------- |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
521 |
void MsgConversationViewItem::init() |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
522 |
{ |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
523 |
mConversation = new MsgConversationWidget(this); |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
524 |
HbStyle::setItemName(mConversation, "msgconvwidget"); |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
525 |
|
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
526 |
mIncomingMsgStateIconItem = new HbIconItem(this); |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
527 |
|
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
528 |
mOutgoingMsgStateIconItem = new HbIconItem(this); |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
529 |
} |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
530 |
|
31 | 531 |
// EOF |