|
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 = ConvergedMessage::None); |
|
98 |
|
99 /* |
|
100 * Update item with mms type content |
|
101 */ |
|
102 void updateMmsTypeItem(const QModelIndex& index, int messageType,int messageSubType); |
|
103 |
|
104 protected: |
|
105 |
|
106 /** |
|
107 * Reimplemented from HbAbstractViewItem. |
|
108 * This function is called whenever item press state changes. |
|
109 * @see HbAbstractViewItem::pressStateChanged |
|
110 */ |
|
111 virtual void pressStateChanged (bool pressed, bool animate); |
|
112 |
|
113 private: |
|
114 |
|
115 /** |
|
116 * Info about received or outgoing message. |
|
117 * true if received message else false. |
|
118 */ |
|
119 bool mIncoming; |
|
120 |
|
121 /* |
|
122 * The chat custom control to show the conversation item |
|
123 * Owned |
|
124 */ |
|
125 MsgConversationWidget *mConversation; |
|
126 |
|
127 /** |
|
128 * Graphics Item to hold message sending state. |
|
129 * Owned |
|
130 */ |
|
131 HbIconItem *mMessageStateIconItem; |
|
132 }; |
|
133 |
|
134 #endif // MSG_CONVERSATION_VIEW_ITEM_H |
|
135 // EOF |