messagingapp/msgui/conversationview/inc/msgconversationviewitem.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:Message chat View decorator item prototype
       
    15  *
       
    16  */
       
    17 
       
    18 #ifndef MSG_CONVERSATION_VIEW_ITEM_H
       
    19 #define MSG_CONVERSATION_VIEW_ITEM_H
       
    20 
       
    21 // INCLUDES
       
    22 #include <HbListViewItem>
       
    23 #include "convergedmessage.h"
       
    24 
       
    25 //Forward Declarations
       
    26 class MsgConversationWidget;
       
    27 class HbTextItem;
       
    28 class HbIconItem;
       
    29 
       
    30 /**
       
    31  * This class represents the item decorator of 
       
    32  * the conversation view.  
       
    33  */
       
    34 class MsgConversationViewItem : public HbListViewItem
       
    35 {
       
    36 Q_OBJECT
       
    37 
       
    38     Q_PROPERTY(bool isIncoming READ isIncoming WRITE setIncoming)
       
    39 
       
    40 public:
       
    41     /**
       
    42      * Constructor
       
    43      * @param parent, reference of QGraphicsItem
       
    44      * default set to 0
       
    45      */
       
    46     MsgConversationViewItem(QGraphicsItem* parent = 0);
       
    47     
       
    48     /**
       
    49      * Destructor
       
    50      */
       
    51     virtual ~MsgConversationViewItem();
       
    52 
       
    53     /**
       
    54      * Factory method to the items
       
    55      */
       
    56     virtual MsgConversationViewItem* createItem();
       
    57 
       
    58     /**
       
    59      * Overridden method to draw the custom item in the list view
       
    60      */
       
    61     void updateChildItems();
       
    62 
       
    63     /**
       
    64      * Checks if point in question is within bubble frame or not.
       
    65      * @param point, point to be checked.
       
    66      * @return returns true is point is within bubble frame geometry.
       
    67      */
       
    68     bool containsPoint(const QPointF& point);
       
    69 
       
    70     /**
       
    71      * Specify if this widget's message is incoming
       
    72      * @param incoming
       
    73      */
       
    74     void setIncoming(bool incoming = true);
       
    75 
       
    76     /**
       
    77      * Get to find if this is incoming message
       
    78      * @return bool
       
    79      */
       
    80     bool isIncoming();
       
    81 
       
    82 private:
       
    83 
       
    84     /**
       
    85      * Set the Icon that displays the message state.
       
    86      */
       
    87     void setMessageStateIcon(int messageState);
       
    88 
       
    89     /**
       
    90      * Set the Icon that displays the message notification state.
       
    91      */
       
    92     void setNotificationStateIcon(int notificationState);
       
    93     
       
    94     /*
       
    95      * Update item with sms content
       
    96      */
       
    97     void updateSmsTypeItem(const QModelIndex& index, int messageSubType =
       
    98             ConvergedMessage::None);
       
    99 
       
   100     /*
       
   101      * Update item with mms type content
       
   102      */
       
   103     void updateMmsTypeItem(const QModelIndex& index, int messageType,
       
   104         int messageSubType);
       
   105 
       
   106     /*
       
   107      * Initializes the msgconverstionviewitem
       
   108      */
       
   109     void init();
       
   110 
       
   111 private slots:    
       
   112 
       
   113     /*
       
   114      * Handler for orientation changed
       
   115      * @param orientation Qt::Orientation
       
   116      */
       
   117     void orientationchanged(Qt::Orientation orientation);
       
   118     
       
   119 protected:
       
   120 
       
   121     /**
       
   122      * Reimplemented from HbAbstractViewItem.
       
   123      * This function is called whenever item press state changes.
       
   124      * @see HbAbstractViewItem::pressStateChanged
       
   125      */
       
   126     virtual void pressStateChanged (bool pressed, bool animate);
       
   127 
       
   128 private:
       
   129 
       
   130     /**
       
   131      * Info about received or outgoing message.
       
   132      * true if received message else false.
       
   133      */
       
   134     bool mIncoming;
       
   135 
       
   136     /*
       
   137      * The chat custom control to show the conversation item
       
   138      * Owned
       
   139      */
       
   140     MsgConversationWidget *mConversation;
       
   141 
       
   142     /**
       
   143      * Graphics Item to hold message incoming state. 
       
   144      * Applicable for notification
       
   145      * Owned
       
   146      */
       
   147     HbIconItem *mIncomingMsgStateIconItem;
       
   148 
       
   149     /**
       
   150      * Graphics Item to hold message sending state.
       
   151      * Owned
       
   152      */
       
   153     HbIconItem *mOutgoingMsgStateIconItem;
       
   154 };
       
   155 
       
   156 #endif // MSG_CONVERSATION_VIEW_ITEM_H
       
   157 // EOF