author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Thu, 02 Sep 2010 20:23:03 +0300 | |
changeset 61 | 8ba0afbb4637 |
parent 52 | 12db4185673b |
child 70 | a15d9966050f |
permissions | -rw-r--r-- |
31 | 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 |
|
52
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
37 |
Q_PROPERTY(bool unReadMsg READ hasUnReadMsg WRITE setHasUnReadMsg) |
31 | 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 |
*/ |
|
52
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
74 |
bool hasUnReadMsg(); |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
75 |
|
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
76 |
private slots: |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
77 |
|
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
78 |
/* |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
79 |
* Handler for orientation changed |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
80 |
* @param orientation Qt::Orientation |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
81 |
*/ |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
82 |
void orientationchanged(Qt::Orientation orientation); |
31 | 83 |
|
84 |
private: |
|
85 |
||
86 |
/** |
|
34
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
87 |
* Create permanent items. |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
88 |
*/ |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
89 |
void initItems(); |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
90 |
|
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
91 |
/** |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
92 |
* Returns the preview text based on message type, sub type. |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
93 |
* Also sets the indicator icon. |
31 | 94 |
* @return QString |
95 |
*/ |
|
34
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
96 |
QString defaultPreviewText(int msgType, int msgSubType); |
31 | 97 |
|
98 |
/** |
|
34
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
99 |
* Sets the preview text and timestamp. |
31 | 100 |
*/ |
34
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
101 |
void setTimestampAndPreviewText(); |
52
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
102 |
|
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
103 |
/* |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
104 |
* set Unread Count and frame |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
105 |
*/ |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
106 |
void setUnreadCountStatus(); |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
107 |
|
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
108 |
/* |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
109 |
* set common indicator (icon/unread count) |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
110 |
*/ |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
111 |
void setCommonIndicator(const QString& string); |
34
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
112 |
|
31 | 113 |
private: |
114 |
/** |
|
34
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
115 |
* Property to change the color of text |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
116 |
*/ |
31 | 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 |
*/ |
|
52
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
151 |
HbIconItem* mMsgCommonIndicatorItem; |
31 | 152 |
|
153 |
}; |
|
154 |
||
155 |
#endif // MSG_LIST_VIEW_ITEM_H |
|
156 |
||
157 |
// EOF |