messagingapp/msgui/msgapp/inc/msglistviewitem.h
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Mon, 03 May 2010 12:29:07 +0300
changeset 25 84d9eb65b26f
parent 23 238255e8b033
child 27 e4592d119491
child 37 518b245aa84c
permissions -rw-r--r--
Revision: 201015 Kit: 201018

/*
 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
 * which accompanies this distribution, and is available
 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
 *
 * Initial Contributors:
 * Nokia Corporation - initial contribution.
 *
 * Contributors:
 *
 * Description:Item decorator of the message list view.
 *
 */

#ifndef MSG_LIST_VIEW_ITEM_H
#define MSG_LIST_VIEW_ITEM_H

// INCLUDES
#include <hblistviewitem.h>

//forward declarations
class HbIconItem;
class HbFrameItem;
class HbTextItem;
class HbIconItem;

/**
 * This class represents the item decorator of 
 * the message list view.  
 */
class MsgListViewItem : public HbListViewItem
    {  
    Q_OBJECT    	
    Q_PROPERTY(bool unReadMsg READ hasUnReadMsg WRITE setHasUnReadMsg)    	  

public:
    /**
     * Constructor
     */
    MsgListViewItem(QGraphicsItem* parent=0);
    
    /**
     * Creates the list view item
     */
    HbAbstractViewItem* createItem();
    
    /**
     * Sets up the list item layout and display
     */
    void updateChildItems();
       
    /**
     * Draws the seperator line between items in the View
     * @param painter the painter object for the current widget
     * @param option the graphics option for the widget
     * @param widget the widget instance
     */
    /*void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, 
    		QWidget *widget);*/
    		
    /**
     * Sets the mUnReadMsg
     * @param bool
     */
    void setHasUnReadMsg(bool unread = true);

    /**
     * Returns the value of mUnReadMsg
     * @return bool
     */
    bool hasUnReadMsg();
    
private:

    /**
     * Returns the preview text based on message type, sub type and state.
     * @return QString
     */
    QString previewText(int msgType, int msgSubType, int msgState,int msgDirection);
 
    /**
     * return the preview text based on state.
     * @return bool
     */
    QString textBySendState(int sendState,int msgDirection);
    
private:
    /**
 	   * Property to change the color of text
	   */
    bool mUnReadMsg;

    /**
     * To display the new message indication
     */
    HbFrameItem* mNewMsgIndicatorItem;
    
    /**
     * Background frame for item.
     */
    HbFrameItem* mBgFrameItem;

    /**
     * To display address.
     * Owned
     */
    HbTextItem *mAddressLabelItem;

    /**
     * To display time stamp.
     * Owned
     */
    HbTextItem *mTimestampItem;

    /**
     * To display message preview.
     * Owned
     */
    HbTextItem *mPreviewLabelItem;

    /**
     * To display unread message count
     * Owned
     */
    HbTextItem *mUnreadCountItem;
    
    /**
     * To display the presence indication
     */
    HbIconItem* mPresenceIndicatorItem;
    
    };

#endif // MSG_LIST_VIEW_ITEM_H

// EOF