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