messagingapp/msgui/msgapp/inc/msglistviewitem.h
branchRCL_3
changeset 57 ebe688cedc25
equal deleted inserted replaced
54:fa1df4b99609 57:ebe688cedc25
       
     1 /*
       
     2  * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3  * All rights reserved.
       
     4  * This component and the accompanying materials are made available
       
     5  * under the terms of "Eclipse Public License v1.0"
       
     6  * which accompanies this distribution, and is available
       
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8  *
       
     9  * Initial Contributors:
       
    10  * Nokia Corporation - initial contribution.
       
    11  *
       
    12  * Contributors:
       
    13  *
       
    14  * Description:Item decorator of the message list view.
       
    15  *
       
    16  */
       
    17 
       
    18 #ifndef MSG_LIST_VIEW_ITEM_H
       
    19 #define MSG_LIST_VIEW_ITEM_H
       
    20 
       
    21 // INCLUDES
       
    22 #include <hblistviewitem.h>
       
    23 
       
    24 //forward declarations
       
    25 class HbIconItem;
       
    26 class HbFrameItem;
       
    27 class HbTextItem;
       
    28 class HbIconItem;
       
    29 
       
    30 /**
       
    31  * This class represents the item decorator of 
       
    32  * the message list view.  
       
    33  */
       
    34 class MsgListViewItem : public HbListViewItem
       
    35     {  
       
    36     Q_OBJECT    	
       
    37     Q_PROPERTY(bool unReadMsg READ hasUnReadMsg WRITE setHasUnReadMsg)   
       
    38 
       
    39 public:
       
    40     /**
       
    41      * Constructor
       
    42      */
       
    43     MsgListViewItem(QGraphicsItem* parent=0);
       
    44     
       
    45     /**
       
    46      * Creates the list view item
       
    47      */
       
    48     HbAbstractViewItem* createItem();
       
    49     
       
    50     /**
       
    51      * Sets up the list item layout and display
       
    52      */
       
    53     void updateChildItems();
       
    54        
       
    55     /**
       
    56      * Draws the seperator line between items in the View
       
    57      * @param painter the painter object for the current widget
       
    58      * @param option the graphics option for the widget
       
    59      * @param widget the widget instance
       
    60      */
       
    61     /*void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, 
       
    62     		QWidget *widget);*/
       
    63     		
       
    64     /**
       
    65      * Sets the mUnReadMsg
       
    66      * @param bool
       
    67      */
       
    68     void setHasUnReadMsg(bool unread = true);
       
    69 
       
    70     /**
       
    71      * Returns the value of mUnReadMsg
       
    72      * @return bool
       
    73      */
       
    74     bool hasUnReadMsg();    
       
    75    
       
    76 private slots:    
       
    77 
       
    78     /*
       
    79      * Handler for orientation changed
       
    80      * @param orientation Qt::Orientation
       
    81      */
       
    82     void orientationchanged(Qt::Orientation orientation);
       
    83     
       
    84 private:
       
    85 
       
    86     /**
       
    87      * Create permanent items.
       
    88      */
       
    89     void initItems();
       
    90 
       
    91     /**
       
    92      * Returns the preview text based on message type, sub type.
       
    93      * Also sets the indicator icon.
       
    94      * @return QString
       
    95      */
       
    96     QString defaultPreviewText(int msgType, int msgSubType);
       
    97  
       
    98     /**
       
    99      * Sets the preview text and timestamp.
       
   100      */
       
   101     void setTimestampAndPreviewText();
       
   102     
       
   103     /*
       
   104      * set Unread Count and frame
       
   105      */
       
   106     void setUnreadCountStatus();
       
   107     
       
   108     /*
       
   109      * set common indicator (icon/unread count)
       
   110      */
       
   111     void setCommonIndicator(const QString& string);
       
   112 
       
   113 private:
       
   114     /**
       
   115      * Property to change the color of text
       
   116      */
       
   117     bool mUnReadMsg;
       
   118 
       
   119     /**
       
   120      * To display the new message indication
       
   121      */
       
   122     HbFrameItem* mNewMsgIndicatorItem;
       
   123     
       
   124     /**
       
   125      * To display address.
       
   126      * Owned
       
   127      */
       
   128     HbTextItem *mAddressLabelItem;
       
   129 
       
   130     /**
       
   131      * To display time stamp.
       
   132      * Owned
       
   133      */
       
   134     HbTextItem *mTimestampItem;
       
   135 
       
   136     /**
       
   137      * To display message preview.
       
   138      * Owned
       
   139      */
       
   140     HbTextItem *mPreviewLabelItem;
       
   141 
       
   142     /**
       
   143      * To display unread message count
       
   144      * Owned
       
   145      */
       
   146     HbTextItem *mUnreadCountItem;
       
   147     
       
   148     /**
       
   149      * To display the presence indication
       
   150      */
       
   151     HbIconItem* mMsgCommonIndicatorItem;
       
   152     
       
   153     };
       
   154 
       
   155 #endif // MSG_LIST_VIEW_ITEM_H
       
   156 
       
   157 // EOF