phonebookui/cnthistorymodel/src/cnthistorymodel.cpp
changeset 40 b46a585f6909
parent 37 fd64c38c277d
child 46 efe85016a067
equal deleted inserted replaced
37:fd64c38c277d 40:b46a585f6909
    22 #include <hbframebackground.h>
    22 #include <hbframebackground.h>
    23 
    23 
    24 #include "cnthistorymodel_p.h"
    24 #include "cnthistorymodel_p.h"
    25 #include "cnthistorymodel.h"
    25 #include "cnthistorymodel.h"
    26 
    26 
       
    27 
    27 // Unnamed namespace for helper functions
    28 // Unnamed namespace for helper functions
    28 namespace
    29 namespace
    29 {
    30 {
    30     bool greaterThan(const HItemPointer& t1, const HItemPointer& t2)
    31     bool greaterThan(const HItemPointer& t1, const HItemPointer& t2)
    31     {
    32     {
   111  *  index 2 Time stamp
   112  *  index 2 Time stamp
   112  */
   113  */
   113 QVariant CntHistoryModel::displayRoleData(const HistoryItem& item) const
   114 QVariant CntHistoryModel::displayRoleData(const HistoryItem& item) const
   114 {
   115 {
   115     QStringList list;
   116     QStringList list;
       
   117     HbExtendedLocale locale = d->m_extendedLocale;
   116     
   118     
   117     if (item.timeStamp.date() == QDateTime::currentDateTime().date())
   119     if (item.timeStamp.date() == QDateTime::currentDateTime().date())
   118     {
   120     {
   119         list << item.title << item.message << item.timeStamp.toString(TIME_FORMAT);
   121         list << item.title << item.message << locale.format(item.timeStamp.time(), r_qtn_time_usual);
   120     }
   122     }
   121     else
   123     else
   122     {
   124     {
   123         list << item.title << item.message << item.timeStamp.toString(DATE_FORMAT);
   125         list << item.title << item.message << locale.format(item.timeStamp.date(), r_qtn_date_usual);
   124     }
   126     }
   125     
   127     
   126     return QVariant(list);
   128     return QVariant(list);
   127 }
   129 }
   128 
   130 
   541     if (event.isAttributeSet(MsgItem::MsgAttributeAttachment))
   543     if (event.isAttributeSet(MsgItem::MsgAttributeAttachment))
   542         item.flags |= Attachment;
   544         item.flags |= Attachment;
   543     
   545     
   544     item.flags |= Message;
   546     item.flags |= Message;
   545     item.number = event.phoneNumber();
   547     item.number = event.phoneNumber();
   546     item.message = event.body();
   548     
       
   549     if (event.body().isEmpty())
       
   550     {
       
   551         item.message = " ";
       
   552     }
       
   553     else
       
   554     {
       
   555         item.message = event.body();
       
   556     }
       
   557     
   547     item.timeStamp = event.timeStamp().toLocalTime();
   558     item.timeStamp = event.timeStamp().toLocalTime();
   548 }
   559 }
   549 
   560 
   550 /*!
   561 /*!
   551  * Slot to receive new messages for the first time
   562  * Slot to receive new messages for the first time