|
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: |
|
77 |
|
78 /** |
|
79 * Returns the preview text based on message type, sub type and state. |
|
80 * @return QString |
|
81 */ |
|
82 QString previewText(int msgType, int msgSubType, int msgState,int msgDirection); |
|
83 |
|
84 /** |
|
85 * return the preview text based on state. |
|
86 * @return bool |
|
87 */ |
|
88 QString textBySendState(int sendState,int msgDirection); |
|
89 |
|
90 private: |
|
91 /** |
|
92 * Property to change the color of text |
|
93 */ |
|
94 bool mUnReadMsg; |
|
95 |
|
96 /** |
|
97 * To display the new message indication |
|
98 */ |
|
99 HbFrameItem* mNewMsgIndicatorItem; |
|
100 |
|
101 /** |
|
102 * To display address. |
|
103 * Owned |
|
104 */ |
|
105 HbTextItem *mAddressLabelItem; |
|
106 |
|
107 /** |
|
108 * To display time stamp. |
|
109 * Owned |
|
110 */ |
|
111 HbTextItem *mTimestampItem; |
|
112 |
|
113 /** |
|
114 * To display message preview. |
|
115 * Owned |
|
116 */ |
|
117 HbTextItem *mPreviewLabelItem; |
|
118 |
|
119 /** |
|
120 * To display unread message count |
|
121 * Owned |
|
122 */ |
|
123 HbTextItem *mUnreadCountItem; |
|
124 |
|
125 /** |
|
126 * To display the presence indication |
|
127 */ |
|
128 HbIconItem* mPresenceIndicatorItem; |
|
129 |
|
130 }; |
|
131 |
|
132 #endif // MSG_LIST_VIEW_ITEM_H |
|
133 |
|
134 // EOF |