35 #include "msgviewutils.h" |
37 #include "msgviewutils.h" |
36 #include "convergedmessage.h" |
38 #include "convergedmessage.h" |
37 #include "conversationsenginedefines.h" |
39 #include "conversationsenginedefines.h" |
38 |
40 |
39 // LOCAL CONSTANTS |
41 // LOCAL CONSTANTS |
40 const QString MSG_OUTBOX_ICON("qtg_small_outbox"); |
42 static const char MSG_OUTBOX_ICON[] = "qtg_small_outbox"; |
41 const QString MSG_FAIL_ICON("qtg_small_fail"); |
43 static const char MSG_FAIL_ICON[] = "qtg_small_fail"; |
42 const QString ANIMATION_FILE(":/qtg_anim_loading.axml"); |
44 static const char ANIMATION_FILE[] = ":/qtg_anim_loading.axml"; |
43 const QString ANIMATION_ICON_NAME("qtg_anim_loading"); |
45 static const char ANIMATION_ICON_NAME[] = "qtg_anim_loading"; |
44 const QString VCARD_ICON("qtg_large_mycard"); |
46 static const char VCARD_ICON[] = "qtg_large_mycard"; |
45 const QString IMAGE_ICON("qtg_small_image"); |
47 static const char IMAGE_ICON[] = "qtg_small_image"; |
46 const QString CORRUPTED_ICON("qtg_small_corrupted"); |
48 static const char CORRUPTED_ICON[] = "qtg_small_corrupted"; |
47 const QString MSG_VIDEO_ICON("qtg_small_video"); |
49 static const char MSG_VIDEO_ICON[] = "qtg_small_video"; |
|
50 |
|
51 // @see hbi18ndef.h |
|
52 static const char DATE_FORMAT[] = r_qtn_date_short_with_zero; |
|
53 static const char TIME_FORMAT[] = r_qtn_time_usual_with_zero; |
48 |
54 |
49 // LOCALIZATION |
55 // LOCALIZATION |
50 #define LOC_RINGING_TONE hbTrId("txt_messaging_dpopinfo_ringing_tone") |
56 #define LOC_RINGING_TONE hbTrId("txt_messaging_dpopinfo_ringing_tone") |
51 #define LOC_BUSINESS_CARD hbTrId("txt_messaging_list_business_card") |
57 #define LOC_BUSINESS_CARD hbTrId("txt_messaging_list_business_card") |
52 #define LOC_CALENDAR_EVENT hbTrId("txt_messaging_list_calendar_event") |
58 #define LOC_CALENDAR_EVENT hbTrId("txt_messaging_list_calendar_event") |
169 |
175 |
170 QDateTime dateTime; |
176 QDateTime dateTime; |
171 dateTime.setTime_t(index.data(TimeStamp).toUInt()); |
177 dateTime.setTime_t(index.data(TimeStamp).toUInt()); |
172 QString resendStateNote((index.data(SendingState).toInt() |
178 QString resendStateNote((index.data(SendingState).toInt() |
173 == ConvergedMessage::Resend) ? LOC_RESEND_AT : ""); |
179 == ConvergedMessage::Resend) ? LOC_RESEND_AT : ""); |
174 if (dateTime.date() == QDateTime::currentDateTime().date()) |
180 |
175 { |
181 HbExtendedLocale locale = HbExtendedLocale::system(); |
176 |
182 QString date = locale.format(dateTime.date(), DATE_FORMAT); |
177 mConversation->setTimeStamp(resendStateNote + dateTime.toString( |
183 QString time = locale.format(dateTime.time(), TIME_FORMAT); |
178 TIME_FORMAT)); |
184 |
179 } |
185 if (dateTime.date() == QDateTime::currentDateTime().date()) { |
180 else |
186 mConversation->setTimeStamp(resendStateNote % time); |
181 { |
187 } |
182 mConversation->setTimeStamp(resendStateNote + dateTime.toString( |
188 else { |
183 DATE_FORMAT)); |
189 mConversation->setTimeStamp(resendStateNote % date); |
184 } |
190 } |
185 |
191 |
186 if (messageSubType == ConvergedMessage::VCal) |
192 if (messageSubType == ConvergedMessage::VCal) |
187 { |
193 { |
188 mConversation->setSubject(LOC_UNSUPPORTED_MSG_TYPE); |
194 mConversation->setSubject(LOC_UNSUPPORTED_MSG_TYPE); |
189 } |
195 } |
190 else |
196 else |
191 { |
197 { |
192 QString bodyText = index.data(BodyText).toString(); |
198 QString bodyText = index.data(BodyText).toString(); |
193 bodyText.replace(QChar::ParagraphSeparator, QChar::LineSeparator); |
199 bodyText.replace(QChar::ParagraphSeparator, QChar::LineSeparator); |
194 bodyText.replace('\r', QChar::LineSeparator); |
200 bodyText.replace('\r', QChar::LineSeparator); |
195 mConversation->setSubject(bodyText); |
201 mConversation->setBodyText(bodyText); |
196 } |
202 } |
197 |
203 |
198 //repolish |
204 //repolish |
199 mConversation->repolishWidget(); |
205 mConversation->repolishWidget(); |
200 } |
206 } |
254 |
260 |
255 QDateTime dateTime; |
261 QDateTime dateTime; |
256 dateTime.setTime_t(index.data(TimeStamp).toUInt()); |
262 dateTime.setTime_t(index.data(TimeStamp).toUInt()); |
257 QString resendStateNote((index.data(SendingState).toInt() |
263 QString resendStateNote((index.data(SendingState).toInt() |
258 == ConvergedMessage::Resend) ? LOC_RESEND_AT : ""); |
264 == ConvergedMessage::Resend) ? LOC_RESEND_AT : ""); |
259 if (dateTime.date() == QDateTime::currentDateTime().date()) |
265 |
260 { |
266 HbExtendedLocale locale = HbExtendedLocale::system(); |
261 |
267 QString date = locale.format(dateTime.date(), DATE_FORMAT); |
262 mConversation->setTimeStamp(resendStateNote + dateTime.toString( |
268 QString time = locale.format(dateTime.time(), TIME_FORMAT); |
263 TIME_FORMAT)); |
269 |
264 } |
270 if (dateTime.date() == QDateTime::currentDateTime().date()) { |
265 else |
271 mConversation->setTimeStamp(resendStateNote % time); |
266 { |
272 } |
267 mConversation->setTimeStamp(resendStateNote + dateTime.toString( |
273 else { |
268 DATE_FORMAT)); |
274 mConversation->setTimeStamp(resendStateNote % date); |
269 } |
275 } |
270 |
276 |
271 if (messageType == ConvergedMessage::Mms) |
277 if (messageType == ConvergedMessage::Mms) |
272 { |
278 { |
273 //preview path |
279 //preview path |
274 QString previewPath = index.data(Attachments).toString(); |
280 QString previewPath = index.data(Attachments).toString(); |
455 // @see header file |
461 // @see header file |
456 //--------------------------------------------------------------- |
462 //--------------------------------------------------------------- |
457 void MsgConversationViewItem::setMessageStateIcon(int messageState) |
463 void MsgConversationViewItem::setMessageStateIcon(int messageState) |
458 { |
464 { |
459 HbIconAnimator& iconAnimator = mOutgoingMsgStateIconItem->animator(); |
465 HbIconAnimator& iconAnimator = mOutgoingMsgStateIconItem->animator(); |
460 HbIconAnimationManager* iconAnimationManager = |
466 |
461 HbIconAnimationManager::global(); |
|
462 switch (messageState) |
467 switch (messageState) |
463 { |
468 { |
464 case ConvergedMessage::Waiting: |
469 case ConvergedMessage::Waiting: |
465 case ConvergedMessage::Scheduled: |
470 case ConvergedMessage::Scheduled: |
466 case ConvergedMessage::Sending: |
471 case ConvergedMessage::Sending: |
467 { |
472 { |
468 bool defined = iconAnimationManager->addDefinitionFile( |
473 HbIconAnimationManager::global()->addDefinitionFile(ANIMATION_FILE); |
469 ANIMATION_FILE); |
474 mOutgoingMsgStateIconItem->setIconName(ANIMATION_ICON_NAME); |
470 HbIcon animIcon; |
|
471 animIcon.setIconName(ANIMATION_ICON_NAME); |
|
472 QSizeF size = mOutgoingMsgStateIconItem->size(); |
|
473 mOutgoingMsgStateIconItem->setIcon(animIcon); |
|
474 mOutgoingMsgStateIconItem->setVisible(true); |
475 mOutgoingMsgStateIconItem->setVisible(true); |
475 iconAnimator.startAnimation(); |
476 iconAnimator.startAnimation(); |
476 break; |
477 break; |
477 } |
478 } |
478 case ConvergedMessage::Suspended: |
479 case ConvergedMessage::Suspended: |
|
480 case ConvergedMessage::Resend: |
479 { |
481 { |
480 iconAnimator.stopAnimation(); |
482 iconAnimator.stopAnimation(); |
481 mOutgoingMsgStateIconItem->setIcon(MSG_OUTBOX_ICON); |
483 mOutgoingMsgStateIconItem->setIconName(MSG_OUTBOX_ICON); |
482 mOutgoingMsgStateIconItem->setVisible(true); |
484 mOutgoingMsgStateIconItem->setVisible(true); |
483 break; |
485 break; |
484 |
486 } |
485 } |
487 case ConvergedMessage::Failed: |
486 case ConvergedMessage::Resend: |
|
487 { |
488 { |
488 iconAnimator.stopAnimation(); |
489 iconAnimator.stopAnimation(); |
489 mOutgoingMsgStateIconItem->setIcon(MSG_OUTBOX_ICON); |
490 mOutgoingMsgStateIconItem->setIconName(MSG_FAIL_ICON); |
490 mOutgoingMsgStateIconItem->setVisible(true); |
|
491 break; |
|
492 } |
|
493 case ConvergedMessage::Failed: |
|
494 { |
|
495 iconAnimator.stopAnimation(); |
|
496 mOutgoingMsgStateIconItem->setIcon(MSG_FAIL_ICON); |
|
497 mOutgoingMsgStateIconItem->setVisible(true); |
491 mOutgoingMsgStateIconItem->setVisible(true); |
498 break; |
492 break; |
499 } |
493 } |
500 case ConvergedMessage::Unknown: |
494 case ConvergedMessage::Unknown: |
501 default: |
495 default: |