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