messagingapp/msgui/conversationview/src/msgconversationviewitem.cpp
changeset 56 f42d9a78f435
parent 51 3507212d340e
child 67 fc91263aee62
--- a/messagingapp/msgui/conversationview/src/msgconversationviewitem.cpp	Wed Aug 18 00:46:12 2010 +0530
+++ b/messagingapp/msgui/conversationview/src/msgconversationviewitem.cpp	Tue Aug 31 18:53:38 2010 +0530
@@ -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
 //---------------------------------------------------------------