24 #include <hbframedrawer.h> |
24 #include <hbframedrawer.h> |
25 #include <HbTextItem> |
25 #include <HbTextItem> |
26 #include <HbFrameItem> |
26 #include <HbFrameItem> |
27 #include <HbIconItem> |
27 #include <HbIconItem> |
28 #include <QCoreApplication> |
28 #include <QCoreApplication> |
|
29 #include <QStringBuilder> |
29 #include <HbEvent> |
30 #include <HbEvent> |
30 #include <HbInstance> |
31 #include <HbInstance> |
|
32 #include <HbExtendedLocale> |
31 |
33 |
32 #include "msgcommondefines.h" |
34 #include "msgcommondefines.h" |
33 #include "conversationsengine.h" |
35 #include "conversationsengine.h" |
34 #include "conversationsenginedefines.h" |
36 #include "conversationsenginedefines.h" |
35 #include "msgutils.h" |
37 #include "msgutils.h" |
42 #define LOC_MSG_RESEND_AT hbTrId("txt_messaging_list_listview_resend_at_time") |
44 #define LOC_MSG_RESEND_AT hbTrId("txt_messaging_list_listview_resend_at_time") |
43 #define LOC_BUSINESS_CARD hbTrId("txt_messaging_list_business_card") |
45 #define LOC_BUSINESS_CARD hbTrId("txt_messaging_list_business_card") |
44 #define LOC_CALENDAR_EVENT hbTrId("txt_messaging_list_calendar_event") |
46 #define LOC_CALENDAR_EVENT hbTrId("txt_messaging_list_calendar_event") |
45 #define LOC_UNSUPPORTED_MSG_TYPE hbTrId("txt_messaging_list_unsupported_message_type") |
47 #define LOC_UNSUPPORTED_MSG_TYPE hbTrId("txt_messaging_list_unsupported_message_type") |
46 #define LOC_RECEIVED_FILES hbTrId("txt_messaging_list_received_files") |
48 #define LOC_RECEIVED_FILES hbTrId("txt_messaging_list_received_files") |
|
49 #define LOC_MULTIMEDIA_MSG hbTrId("txt_messaging_list_multimedia_message") |
47 |
50 |
48 const QString NEW_ITEM_FRAME("qtg_fr_list_new_item"); |
51 const QString NEW_ITEM_FRAME("qtg_fr_list_new_item"); |
49 const QString BT_ICON("qtg_large_bluetooth"); |
52 const QString BT_ICON("qtg_large_bluetooth"); |
50 const QString MSG_OUTGOING_ICON("qtg_mono_outbox"); |
53 const QString MSG_OUTGOING_ICON("qtg_mono_outbox"); |
51 const QString MSG_FAILED_ICON("qtg_mono_failed"); |
54 const QString MSG_FAILED_ICON("qtg_mono_failed"); |
|
55 |
|
56 // @see hbi18ndef.h |
|
57 static const char DATE_FORMAT[] = r_qtn_date_short_with_zero; |
|
58 static const char TIME_FORMAT[] = r_qtn_time_usual_with_zero; |
52 |
59 |
53 //--------------------------------------------------------------- |
60 //--------------------------------------------------------------- |
54 // MsgListViewItem::MsgListViewItem |
61 // MsgListViewItem::MsgListViewItem |
55 // Constructor |
62 // Constructor |
56 //--------------------------------------------------------------- |
63 //--------------------------------------------------------------- |
202 void MsgListViewItem::setTimestampAndPreviewText() |
212 void MsgListViewItem::setTimestampAndPreviewText() |
203 { |
213 { |
204 // Get timestamp |
214 // Get timestamp |
205 QDateTime dateTime; |
215 QDateTime dateTime; |
206 dateTime.setTime_t(modelIndex().data(TimeStamp).toUInt()); |
216 dateTime.setTime_t(modelIndex().data(TimeStamp).toUInt()); |
207 QString dateString; |
217 |
|
218 HbExtendedLocale locale = HbExtendedLocale::system(); |
|
219 QString dateTimeString; |
208 if (dateTime.date() == QDateTime::currentDateTime().date()) { |
220 if (dateTime.date() == QDateTime::currentDateTime().date()) { |
209 dateString = MsgUtils::dateTimeToString(dateTime, TIME_FORMAT); |
221 dateTimeString = locale.format(dateTime.time(), TIME_FORMAT); |
210 } |
222 } |
211 else { |
223 else { |
212 dateString = MsgUtils::dateTimeToString(dateTime, DATE_FORMAT); |
224 dateTimeString = locale.format(dateTime.date(), DATE_FORMAT); |
213 } |
225 } |
214 |
226 |
215 // Set preview text & time based on direction |
227 // Set preview text & time based on direction |
216 int msgType = modelIndex().data(MessageType).toInt(); |
228 int msgType = modelIndex().data(MessageType).toInt(); |
217 int msgSubType = modelIndex().data(MessageSubType).toInt(); |
229 int msgSubType = modelIndex().data(MessageSubType).toInt(); |
230 setUnreadCountStatus(); |
242 setUnreadCountStatus(); |
231 |
243 |
232 switch (sendState) { |
244 switch (sendState) { |
233 case ConvergedMessage::Resend: |
245 case ConvergedMessage::Resend: |
234 { |
246 { |
235 previewText = LOC_MSG_RESEND_AT + dateString; |
247 previewText = LOC_MSG_RESEND_AT + dateTimeString; |
236 dateString = QString(); |
248 dateTimeString = QString(); |
237 setCommonIndicator(MSG_OUTGOING_ICON); |
249 setCommonIndicator(MSG_OUTGOING_ICON); |
238 break; |
250 break; |
239 } |
251 } |
240 case ConvergedMessage::Sending: |
252 case ConvergedMessage::Sending: |
241 case ConvergedMessage::Suspended: |
253 case ConvergedMessage::Suspended: |
266 } |
278 } |
267 } |
279 } |
268 previewText.replace(QChar::ParagraphSeparator, QChar::LineSeparator); |
280 previewText.replace(QChar::ParagraphSeparator, QChar::LineSeparator); |
269 previewText.replace('\r', QChar::LineSeparator); |
281 previewText.replace('\r', QChar::LineSeparator); |
270 mPreviewLabelItem->setText(previewText); |
282 mPreviewLabelItem->setText(previewText); |
271 mTimestampItem->setText(dateString); |
283 mTimestampItem->setText(dateTimeString); |
272 } |
284 } |
273 |
285 |
274 //--------------------------------------------------------------- |
286 //--------------------------------------------------------------- |
275 // MsgListViewItem::paint. |
287 // MsgListViewItem::paint. |
276 // @see header |
288 // @see header |