messagingapp/msgui/msgapp/src/msglistviewitem.cpp
changeset 44 36f374c67aa8
parent 34 84197e66a4bd
child 47 5b14749788d7
child 52 12db4185673b
equal deleted inserted replaced
43:35b64624a9e7 44:36f374c67aa8
    23 #include <hbframeitem.h>
    23 #include <hbframeitem.h>
    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>
       
    29 #include <HbEvent>
    28 
    30 
    29 #include "msgcommondefines.h"
    31 #include "msgcommondefines.h"
    30 #include "conversationsengine.h"
    32 #include "conversationsengine.h"
    31 #include "conversationsenginedefines.h"
    33 #include "conversationsenginedefines.h"
    32 #include "msgutils.h"
    34 #include "msgutils.h"
    91     }
    93     }
    92     else
    94     else
    93     {
    95     {
    94         QString displayName = modelIndex().data(DisplayName).toString();
    96         QString displayName = modelIndex().data(DisplayName).toString();
    95         QString contactAddress = modelIndex().data(ConversationAddress).toString();
    97         QString contactAddress = modelIndex().data(ConversationAddress).toString();
    96 
    98         contactName.append(displayName);
    97         if (displayName.isEmpty())
       
    98         {
       
    99             contactName.append(contactAddress);
       
   100         }
       
   101         else
       
   102         {
       
   103             contactName.append(displayName);
       
   104         }        
       
   105     }
    99     }
   106     mAddressLabelItem->setText(contactName);
   100     mAddressLabelItem->setText(contactName);
   107 
   101 
   108     // Unread message count
   102     // Unread message count
   109     int unreadCount = modelIndex().data(UnreadCount).toInt();
   103     int unreadCount = modelIndex().data(UnreadCount).toInt();
   115         if(!mUnReadMsg)
   109         if(!mUnReadMsg)
   116         {
   110         {
   117             mUnReadMsg = true;
   111             mUnReadMsg = true;
   118             mNewMsgIndicatorItem->frameDrawer().setFrameGraphicsName(NEW_ITEM_FRAME);
   112             mNewMsgIndicatorItem->frameDrawer().setFrameGraphicsName(NEW_ITEM_FRAME);
   119             repolish();
   113             repolish();
       
   114             // Needed for colour group changes to be visible
       
   115             QCoreApplication::postEvent(this, new HbEvent(HbEvent::ThemeChanged));  
   120         }       
   116         }       
   121     }
   117     }
   122     else
   118     else
   123     {
   119     {
   124         mUnreadCountItem->setText(QString());        
   120         mUnreadCountItem->setText(QString());        
   125         if(mUnReadMsg)
   121         if(mUnReadMsg)
   126         {
   122         {
   127             mUnReadMsg = false;  
   123             mUnReadMsg = false;  
   128             mNewMsgIndicatorItem->frameDrawer().setFrameGraphicsName(QString());
   124             mNewMsgIndicatorItem->frameDrawer().setFrameGraphicsName(QString());
   129             repolish();
   125             repolish();
       
   126             // Needed for colour group changes to be visible
       
   127             QCoreApplication::postEvent(this, new HbEvent(HbEvent::ThemeChanged));  
   130         }
   128         }
   131     }
   129     }
   132 
   130 
   133     HbListViewItem::updateChildItems();
   131     HbListViewItem::updateChildItems();
   134 }
   132 }