emailuis/nmailui/src/nmmessagelistviewitem.cpp
changeset 23 2dc6caa42ec3
parent 20 ecc8def7944a
child 27 9ba4404ef423
equal deleted inserted replaced
20:ecc8def7944a 23:2dc6caa42ec3
    46 */
    46 */
    47 NmMessageListViewItem::~NmMessageListViewItem()
    47 NmMessageListViewItem::~NmMessageListViewItem()
    48 {
    48 {
    49 
    49 
    50 }
    50 }
    51 
       
    52 /*!
       
    53     type. Returns items type. In this case
       
    54     the item type is custom Hb list item.
       
    55 */
       
    56 int NmMessageListViewItem::type() const
       
    57 {
       
    58     return NmMessageListViewItem::ItemType;
       
    59 }
       
    60 
       
    61 
    51 
    62 /*!
    52 /*!
    63 */
    53 */
    64 HbTreeViewItem *NmMessageListViewItem::createItem()
    54 HbTreeViewItem *NmMessageListViewItem::createItem()
    65 {
    55 {
   200             mIcon1->setIcon(NmIcons::getIcon(NmIcons::NmIconPriorityHigh));
   190             mIcon1->setIcon(NmIcons::getIcon(NmIcons::NmIconPriorityHigh));
   201             mIcon1->show();
   191             mIcon1->show();
   202             break;
   192             break;
   203         case NmMessagePriorityNormal:
   193         case NmMessagePriorityNormal:
   204         default:
   194         default:
   205             // Normal priority has no icon so hide the label hide.
       
   206             mIcon1->setObjectName("ListViewItemMessageIconPriorityNormal");
       
   207             break;
   195             break;
   208     }
   196     }
   209     // attachments
   197     // attachments
   210     HbIconItem *attaIcon = (priorityIs ? mIcon2 : mIcon1);
   198     HbIconItem *attaIcon = (priorityIs ? mIcon2 : mIcon1);
   211     if (envelope.hasAttachments()) {
   199     if (envelope.hasAttachments()) {
   212         HbIcon &icon = NmIcons::getIcon(NmIcons::NmIconAttachment);
   200         HbIcon &icon = NmIcons::getIcon(NmIcons::NmIconAttachment);
   213         attaIcon->setIcon(icon);
   201         attaIcon->setIcon(icon);
       
   202         attaIcon->setObjectName("ListViewItemMessageIconAttachment");
   214         attaIcon->show();
   203         attaIcon->show();
   215     }
   204     }
   216     // message read status
   205     // message read status
   217     bool msgReadStatus(envelope.isRead());
   206     bool msgReadStatus(envelope.isRead());
   218     HbFrameDrawer *drawer(NULL);
   207     HbFrameDrawer *drawer(NULL);
   247     const QStyleOptionGraphicsItem *option,
   236     const QStyleOptionGraphicsItem *option,
   248     QWidget *widget)
   237     QWidget *widget)
   249 {
   238 {
   250     Q_UNUSED(option);
   239     Q_UNUSED(option);
   251     Q_UNUSED(widget);
   240     Q_UNUSED(widget);
   252     if (painter){
   241     Q_UNUSED(painter);
   253         painter->setOpacity(NmItemLineOpacity);
       
   254         QColor col = HbColorScheme::color("list_item_content_normal");
       
   255         if (col.isValid()) {
       
   256             painter->setPen(col);
       
   257         }
       
   258         QLineF line1( rect().topLeft().x(), rect().bottomRight().y(),
       
   259                      rect().bottomRight().x(), rect().bottomRight().y());
       
   260         painter->drawLine(line1);
       
   261         // Draw line before each item
       
   262         QLineF line2( rect().topLeft().x(), rect().topLeft().y(),
       
   263                      rect().bottomRight().x(), rect().topLeft().y());
       
   264         painter->drawLine(line2);
       
   265 
       
   266     }
       
   267 }
   242 }
   268 
   243 
   269 void  NmMessageListViewItem::setFontsUnread()
   244 void  NmMessageListViewItem::setFontsUnread()
   270 {    
   245 {    
   271     static QColor colorRole = HbColorScheme::color("list_item_title");
   246     static QColor colorRole = HbColorScheme::color("qtc_list_item_title_normal");
   272     HbFontSpec spekki(HbFontSpec::Primary);
   247     HbFontSpec spekki(HbFontSpec::Primary);
   273     setFonts(colorRole, spekki);
   248     setFonts(colorRole, spekki);
   274 }
   249 }
   275 
   250 
   276 void  NmMessageListViewItem::setFontsRead()
   251 void  NmMessageListViewItem::setFontsRead()
   277 {
   252 {
   278     static QColor colorRole = HbColorScheme::color("list_item_content");
   253     static QColor colorRole = HbColorScheme::color("qtc_list_item_content_normal");
   279     HbFontSpec spekki(HbFontSpec::Secondary);
   254     HbFontSpec spekki(HbFontSpec::Secondary);
   280     setFonts(colorRole, spekki);
   255     setFonts(colorRole, spekki);
   281 }
   256 }
   282 
   257 
   283 void  NmMessageListViewItem::getFontSizes()
   258 void  NmMessageListViewItem::getFontSizes()