messagingapp/msgui/conversationview/src/msgconversationviewitem.cpp
changeset 70 a15d9966050f
parent 52 12db4185673b
child 72 6f657153cbc5
equal deleted inserted replaced
61:8ba0afbb4637 70:a15d9966050f
    18 #include "msgconversationviewitem.h"
    18 #include "msgconversationviewitem.h"
    19 
    19 
    20 // SYSTEM INCLUDES
    20 // SYSTEM INCLUDES
    21 #include <QDateTime>
    21 #include <QDateTime>
    22 #include "debugtraces.h"
    22 #include "debugtraces.h"
    23 #include <QDir>
       
    24 #include <QChar>
    23 #include <QChar>
    25 #include <QStringBuilder>
       
    26 #include <HbTextItem>
    24 #include <HbTextItem>
    27 #include <HbIconItem>
    25 #include <HbIconItem>
    28 #include <HbIconAnimationManager>
    26 #include <HbIconAnimationManager>
    29 #include <HbIconAnimator>
    27 #include <HbIconAnimator>
    30 #include <HbExtendedLocale>
    28 #include <HbExtendedLocale>
   171     mConversation->setUnread(unreadStatus);
   169     mConversation->setUnread(unreadStatus);
   172 
   170 
   173     mConversation->drawBubbleFrame();
   171     mConversation->drawBubbleFrame();
   174     mConversation->drawNewItemFrame();
   172     mConversation->drawNewItemFrame();
   175 
   173 
   176     QDateTime dateTime;
   174     mConversation->setTimeStamp(getMsgTimeStamp(index));
   177     dateTime.setTime_t(index.data(TimeStamp).toUInt());
       
   178     QString resendStateNote((index.data(SendingState).toInt()
       
   179                     == ConvergedMessage::Resend) ? LOC_RESEND_AT : "");
       
   180 
       
   181     HbExtendedLocale locale = HbExtendedLocale::system();
       
   182     QString date = locale.format(dateTime.date(), DATE_FORMAT);
       
   183     QString time = locale.format(dateTime.time(), TIME_FORMAT);
       
   184 
       
   185     if (dateTime.date() == QDateTime::currentDateTime().date()) {
       
   186         mConversation->setTimeStamp(resendStateNote % time);
       
   187     }
       
   188     else {
       
   189         mConversation->setTimeStamp(resendStateNote % date);
       
   190     }
       
   191 
   175 
   192     if (messageSubType == ConvergedMessage::VCal)
   176     if (messageSubType == ConvergedMessage::VCal)
   193         {
   177         {
   194          mConversation->setSubject(LOC_UNSUPPORTED_MSG_TYPE);
   178          mConversation->setSubject(LOC_UNSUPPORTED_MSG_TYPE);
   195         }
   179         }
   256     mConversation->setUnread(unreadStatus);
   240     mConversation->setUnread(unreadStatus);
   257 
   241 
   258     mConversation->drawBubbleFrame();
   242     mConversation->drawBubbleFrame();
   259     mConversation->drawNewItemFrame();
   243     mConversation->drawNewItemFrame();
   260 
   244 
   261     QDateTime dateTime;
   245     mConversation->setTimeStamp(getMsgTimeStamp(index));
   262     dateTime.setTime_t(index.data(TimeStamp).toUInt());
       
   263     QString resendStateNote((index.data(SendingState).toInt()
       
   264             == ConvergedMessage::Resend) ? LOC_RESEND_AT : "");
       
   265 
       
   266     HbExtendedLocale locale = HbExtendedLocale::system();
       
   267     QString date = locale.format(dateTime.date(), DATE_FORMAT);
       
   268     QString time = locale.format(dateTime.time(), TIME_FORMAT);
       
   269 
       
   270     if (dateTime.date() == QDateTime::currentDateTime().date()) {
       
   271         mConversation->setTimeStamp(resendStateNote % time);
       
   272     }
       
   273     else {
       
   274         mConversation->setTimeStamp(resendStateNote % date);
       
   275     }
       
   276 
   246 
   277     if (messageType == ConvergedMessage::Mms)
   247     if (messageType == ConvergedMessage::Mms)
   278         {
   248         {
   279         //preview path
   249         //preview path
   280         QString previewPath = index.data(Attachments).toString();
   250         QString previewPath = index.data(Attachments).toString();
   568     // Force polish to get all the sub-item properties right.
   538     // Force polish to get all the sub-item properties right.
   569     polishEvent();
   539     polishEvent();
   570 }
   540 }
   571 
   541 
   572 //---------------------------------------------------------------
   542 //---------------------------------------------------------------
       
   543 // MsgConversationViewItem::getMsgTimeStamp
       
   544 // @see header file
       
   545 //---------------------------------------------------------------
       
   546 QString MsgConversationViewItem::getMsgTimeStamp(const QModelIndex& index)
       
   547 {
       
   548     QDateTime dateTime;
       
   549     dateTime.setTime_t(index.data(TimeStamp).toUInt());
       
   550     
       
   551     HbExtendedLocale locale = HbExtendedLocale::system();
       
   552 
       
   553     QString timeStampStr;
       
   554     if (dateTime.date() == QDateTime::currentDateTime().date()) {
       
   555         timeStampStr = locale.format(dateTime.time(), TIME_FORMAT);
       
   556     }
       
   557     else {
       
   558         timeStampStr = locale.format(dateTime.date(), DATE_FORMAT);
       
   559     }
       
   560 
       
   561     QString msgTimeStamp;
       
   562     if (ConvergedMessage::Resend == index.data(SendingState).toInt()) {
       
   563         msgTimeStamp = LOC_RESEND_AT.arg(timeStampStr);
       
   564     }
       
   565     else {
       
   566         msgTimeStamp = timeStampStr;
       
   567     }
       
   568     return msgTimeStamp;
       
   569 }
       
   570 
       
   571 //---------------------------------------------------------------
   573 // MsgConversationViewItem::orientationchanged
   572 // MsgConversationViewItem::orientationchanged
   574 // @see header file
   573 // @see header file
   575 //---------------------------------------------------------------
   574 //---------------------------------------------------------------
   576 void MsgConversationViewItem::orientationchanged(Qt::Orientation orientation)
   575 void MsgConversationViewItem::orientationchanged(Qt::Orientation orientation)
   577 {
   576 {