messagingapp/msgui/conversationview/src/msgconversationviewitem.cpp
changeset 70 a15d9966050f
parent 52 12db4185673b
child 72 6f657153cbc5
--- a/messagingapp/msgui/conversationview/src/msgconversationviewitem.cpp	Thu Sep 02 20:23:03 2010 +0300
+++ b/messagingapp/msgui/conversationview/src/msgconversationviewitem.cpp	Fri Sep 17 08:28:39 2010 +0300
@@ -20,9 +20,7 @@
 // SYSTEM INCLUDES
 #include <QDateTime>
 #include "debugtraces.h"
-#include <QDir>
 #include <QChar>
-#include <QStringBuilder>
 #include <HbTextItem>
 #include <HbIconItem>
 #include <HbIconAnimationManager>
@@ -173,21 +171,7 @@
     mConversation->drawBubbleFrame();
     mConversation->drawNewItemFrame();
 
-    QDateTime dateTime;
-    dateTime.setTime_t(index.data(TimeStamp).toUInt());
-    QString resendStateNote((index.data(SendingState).toInt()
-                    == ConvergedMessage::Resend) ? LOC_RESEND_AT : "");
-
-    HbExtendedLocale locale = HbExtendedLocale::system();
-    QString date = locale.format(dateTime.date(), DATE_FORMAT);
-    QString time = locale.format(dateTime.time(), TIME_FORMAT);
-
-    if (dateTime.date() == QDateTime::currentDateTime().date()) {
-        mConversation->setTimeStamp(resendStateNote % time);
-    }
-    else {
-        mConversation->setTimeStamp(resendStateNote % date);
-    }
+    mConversation->setTimeStamp(getMsgTimeStamp(index));
 
     if (messageSubType == ConvergedMessage::VCal)
         {
@@ -258,21 +242,7 @@
     mConversation->drawBubbleFrame();
     mConversation->drawNewItemFrame();
 
-    QDateTime dateTime;
-    dateTime.setTime_t(index.data(TimeStamp).toUInt());
-    QString resendStateNote((index.data(SendingState).toInt()
-            == ConvergedMessage::Resend) ? LOC_RESEND_AT : "");
-
-    HbExtendedLocale locale = HbExtendedLocale::system();
-    QString date = locale.format(dateTime.date(), DATE_FORMAT);
-    QString time = locale.format(dateTime.time(), TIME_FORMAT);
-
-    if (dateTime.date() == QDateTime::currentDateTime().date()) {
-        mConversation->setTimeStamp(resendStateNote % time);
-    }
-    else {
-        mConversation->setTimeStamp(resendStateNote % date);
-    }
+    mConversation->setTimeStamp(getMsgTimeStamp(index));
 
     if (messageType == ConvergedMessage::Mms)
         {
@@ -570,6 +540,35 @@
 }
 
 //---------------------------------------------------------------
+// MsgConversationViewItem::getMsgTimeStamp
+// @see header file
+//---------------------------------------------------------------
+QString MsgConversationViewItem::getMsgTimeStamp(const QModelIndex& index)
+{
+    QDateTime dateTime;
+    dateTime.setTime_t(index.data(TimeStamp).toUInt());
+    
+    HbExtendedLocale locale = HbExtendedLocale::system();
+
+    QString timeStampStr;
+    if (dateTime.date() == QDateTime::currentDateTime().date()) {
+        timeStampStr = locale.format(dateTime.time(), TIME_FORMAT);
+    }
+    else {
+        timeStampStr = locale.format(dateTime.date(), DATE_FORMAT);
+    }
+
+    QString msgTimeStamp;
+    if (ConvergedMessage::Resend == index.data(SendingState).toInt()) {
+        msgTimeStamp = LOC_RESEND_AT.arg(timeStampStr);
+    }
+    else {
+        msgTimeStamp = timeStampStr;
+    }
+    return msgTimeStamp;
+}
+
+//---------------------------------------------------------------
 // MsgConversationViewItem::orientationchanged
 // @see header file
 //---------------------------------------------------------------