author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Fri, 11 Jun 2010 13:35:48 +0300 | |
changeset 34 | 84197e66a4bd |
parent 31 | ebfee66fde93 |
child 44 | 36f374c67aa8 |
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: Custom layout widget for Contact Card layout. |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
#ifndef MSGCONTACTCARDWIDGET_H |
|
19 |
#define MSGCONTACTCARDWIDGET_H |
|
20 |
||
21 |
// SYSTEM INCLUDES |
|
22 |
#include <HbWidget> |
|
23 |
||
24 |
// FORWORD DECLARATIONS |
|
25 |
class HbIconItem; |
|
26 |
class HbTextItem; |
|
27 |
class HbIcon; |
|
28 |
class ThumbnailManager; |
|
29 |
||
30 |
#include "convergedmessageaddress.h" |
|
31 |
||
32 |
/** |
|
34
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
33 |
* @class MsgContactCardWidget |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
34 |
* @brief This class is a custom layout widget for Contact Card layout. |
31 | 35 |
*/ |
36 |
class MsgContactCardWidget: public HbWidget |
|
37 |
{ |
|
38 |
Q_OBJECT |
|
39 |
||
40 |
public: |
|
41 |
||
42 |
/** |
|
43 |
* Constructor |
|
44 |
*/ |
|
45 |
explicit MsgContactCardWidget(QGraphicsItem *parent = 0); |
|
46 |
||
47 |
/** |
|
48 |
* Destructor |
|
49 |
*/ |
|
50 |
virtual ~MsgContactCardWidget(); |
|
51 |
||
52 |
public: |
|
53 |
||
54 |
/** |
|
55 |
* Sets the avatar |
|
56 |
* @param avatar Avatar to be set. |
|
57 |
*/ |
|
58 |
void setAvatar(const HbIcon &avatar); |
|
59 |
||
60 |
/** |
|
61 |
* Sets the presence icon |
|
62 |
* @param presenceIcon Presence icon to set. |
|
63 |
*/ |
|
64 |
void setPresenceIcon(const HbIcon &presenceIcon); |
|
65 |
||
66 |
/** |
|
67 |
* Sets the address to be displayed. |
|
68 |
* @param address Address string to be set. |
|
69 |
*/ |
|
70 |
void setAddress(const QString &address); |
|
71 |
||
72 |
/** |
|
73 |
* Returns the address displayed in the Contact card. |
|
74 |
*/ |
|
75 |
ConvergedMessageAddressList address(); |
|
76 |
||
77 |
/** |
|
78 |
* Refreshes all the Contact card fields. |
|
79 |
*/ |
|
80 |
void updateContents(); |
|
81 |
||
82 |
/** |
|
83 |
* Clears all the Contact card fields. |
|
84 |
*/ |
|
85 |
void clearContent(); |
|
86 |
||
34
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
87 |
protected: |
31 | 88 |
|
89 |
/** |
|
34
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
90 |
* Event handler for gesture events. |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
91 |
* Reimplemented from HbWidgetBase. |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
92 |
* @see HbWidgetBase |
31 | 93 |
*/ |
34
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
94 |
virtual void gestureEvent(QGestureEvent *event); |
31 | 95 |
|
96 |
private: |
|
97 |
||
98 |
/** |
|
99 |
* Initialization function. |
|
100 |
*/ |
|
101 |
void init(); |
|
34
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
102 |
|
31 | 103 |
/** Helper method to get contact id against phone number. |
104 |
* @param value phone number. |
|
105 |
*/ |
|
106 |
int resolveContactId(const QString& value); |
|
107 |
||
108 |
/** |
|
34
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
109 |
* Handles pressed state. |
31 | 110 |
*/ |
34
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
111 |
void setPressed(bool pressed); |
31 | 112 |
|
113 |
private slots: |
|
34
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
114 |
|
31 | 115 |
/** |
116 |
* show longpress menu for attachment object |
|
117 |
*/ |
|
34
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
118 |
void handleLongPress(const QPointF &position); |
31 | 119 |
|
120 |
/** |
|
121 |
* Slot for handling valid returns from the framework. |
|
122 |
* Updates the display name in the contact card widget. |
|
123 |
* @param result const QVariant& |
|
124 |
*/ |
|
125 |
void handleOk(const QVariant& result); |
|
126 |
||
127 |
/** |
|
128 |
* Slot for handling errors. Error ids are provided as |
|
129 |
* 32-bit integers. |
|
130 |
* @param errorCode qint32 |
|
131 |
*/ |
|
132 |
void handleError(int errorCode, const QString& errorMessage); |
|
133 |
||
134 |
/** |
|
135 |
* Called when clicked() signal is emitted |
|
136 |
* Launches phonebook to view an existing contact |
|
137 |
* or to add a new contact |
|
138 |
*/ |
|
139 |
void openContactInfo(); |
|
140 |
||
141 |
/** |
|
142 |
* Launches Dialer Service |
|
143 |
*/ |
|
144 |
void call(); |
|
145 |
||
146 |
/** |
|
147 |
* Adds unknown number to phonebook |
|
148 |
*/ |
|
149 |
void addToContacts(); |
|
150 |
||
151 |
/** |
|
152 |
* Called after service request is completed. |
|
153 |
*/ |
|
154 |
void onServiceRequestCompleted(); |
|
34
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
155 |
|
31 | 156 |
/** |
157 |
* Slot hit when the thumbnail is ready. |
|
158 |
*/ |
|
159 |
void thumbnailReady(const QPixmap& pixmap, void *data, int id, int error); |
|
160 |
||
161 |
/** |
|
34
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
162 |
* Ignore gesture events. |
31 | 163 |
*/ |
34
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
164 |
void ignoreSignals(bool yes); |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
165 |
|
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
166 |
/** |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
167 |
* Slot to regrab gesture after some delay (300 ms) to avoid multiple gesture |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
168 |
* events back to back. |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
169 |
*/ |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
170 |
void regrabGesture(); |
31 | 171 |
|
172 |
private: |
|
173 |
||
174 |
/** |
|
34
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
175 |
* Bool variable on which gesture events are accepted/ignored. |
31 | 176 |
*/ |
34
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
177 |
bool mIgnoreEvents; |
31 | 178 |
|
179 |
/** |
|
180 |
* Contact Number for the conversation |
|
181 |
*/ |
|
182 |
QString mContactNumber; |
|
183 |
||
184 |
/** |
|
185 |
* Address string. |
|
186 |
*/ |
|
187 |
QString mAddress; |
|
188 |
||
189 |
/** |
|
190 |
* Avatar icon item. |
|
191 |
* Own. |
|
192 |
*/ |
|
193 |
HbIconItem *mAvatarIconItem; |
|
194 |
||
195 |
/** |
|
196 |
* Presence icon item. |
|
197 |
* Own. |
|
198 |
*/ |
|
199 |
HbIconItem *mPresenceIconItem; |
|
200 |
||
201 |
/** |
|
202 |
* Address text item. |
|
203 |
* Own. |
|
204 |
*/ |
|
205 |
HbTextItem *mAddressTextItem; |
|
206 |
||
207 |
/** |
|
208 |
* ThumbnailManager |
|
209 |
* Own. |
|
210 |
*/ |
|
211 |
ThumbnailManager *mThumbnailManager; |
|
212 |
}; |
|
213 |
||
214 |
#endif // MSGCONTACTCARDWIDGET_H |
|
215 |
// EOF |