author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 06 Jul 2010 14:12:40 +0300 | |
changeset 44 | 36f374c67aa8 |
parent 34 | 84197e66a4bd |
child 47 | 5b14749788d7 |
child 52 | 12db4185673b |
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 |
||
44
36f374c67aa8
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
87 |
signals: |
36f374c67aa8
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
88 |
|
36f374c67aa8
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
89 |
/** |
36f374c67aa8
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
90 |
* |
36f374c67aa8
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
91 |
*/ |
36f374c67aa8
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
92 |
void conversationIdChanged(qint64 convId); |
36f374c67aa8
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
93 |
|
34
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
94 |
protected: |
31 | 95 |
|
96 |
/** |
|
34
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
97 |
* Event handler for gesture events. |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
98 |
* Reimplemented from HbWidgetBase. |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
99 |
* @see HbWidgetBase |
31 | 100 |
*/ |
34
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
101 |
virtual void gestureEvent(QGestureEvent *event); |
31 | 102 |
|
103 |
private: |
|
104 |
||
105 |
/** |
|
106 |
* Initialization function. |
|
107 |
*/ |
|
108 |
void init(); |
|
34
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
109 |
|
31 | 110 |
/** Helper method to get contact id against phone number. |
111 |
* @param value phone number. |
|
112 |
*/ |
|
113 |
int resolveContactId(const QString& value); |
|
114 |
||
115 |
/** |
|
34
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
116 |
* Handles pressed state. |
31 | 117 |
*/ |
34
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
118 |
void setPressed(bool pressed); |
31 | 119 |
|
120 |
private slots: |
|
34
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
121 |
|
31 | 122 |
/** |
44
36f374c67aa8
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
123 |
* show longp tap. |
31 | 124 |
*/ |
44
36f374c67aa8
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
125 |
void handleLongTap(const QPointF &position); |
36f374c67aa8
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
126 |
|
36f374c67aa8
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
127 |
/** |
36f374c67aa8
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
128 |
* handles short tap. |
36f374c67aa8
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
129 |
*/ |
36f374c67aa8
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
130 |
void handleShortTap(const QPointF &position); |
31 | 131 |
|
132 |
/** |
|
133 |
* Slot for handling valid returns from the framework. |
|
134 |
* Updates the display name in the contact card widget. |
|
135 |
* @param result const QVariant& |
|
136 |
*/ |
|
137 |
void handleOk(const QVariant& result); |
|
138 |
||
139 |
/** |
|
140 |
* Slot for handling errors. Error ids are provided as |
|
141 |
* 32-bit integers. |
|
142 |
* @param errorCode qint32 |
|
143 |
*/ |
|
144 |
void handleError(int errorCode, const QString& errorMessage); |
|
145 |
||
146 |
/** |
|
147 |
* Called when clicked() signal is emitted |
|
148 |
* Launches phonebook to view an existing contact |
|
149 |
* or to add a new contact |
|
150 |
*/ |
|
151 |
void openContactInfo(); |
|
152 |
||
153 |
/** |
|
154 |
* Launches Dialer Service |
|
155 |
*/ |
|
156 |
void call(); |
|
157 |
||
158 |
/** |
|
159 |
* Adds unknown number to phonebook |
|
160 |
*/ |
|
161 |
void addToContacts(); |
|
162 |
||
163 |
/** |
|
164 |
* Called after service request is completed. |
|
165 |
*/ |
|
166 |
void onServiceRequestCompleted(); |
|
34
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
167 |
|
31 | 168 |
/** |
169 |
* Slot hit when the thumbnail is ready. |
|
170 |
*/ |
|
171 |
void thumbnailReady(const QPixmap& pixmap, void *data, int id, int error); |
|
172 |
||
173 |
/** |
|
34
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
174 |
* Ignore gesture events. |
31 | 175 |
*/ |
34
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
176 |
void ignoreSignals(bool yes); |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
177 |
|
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
178 |
/** |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
179 |
* 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
|
180 |
* events back to back. |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
181 |
*/ |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
182 |
void regrabGesture(); |
31 | 183 |
|
184 |
private: |
|
185 |
||
186 |
/** |
|
34
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
187 |
* Bool variable on which gesture events are accepted/ignored. |
31 | 188 |
*/ |
34
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
189 |
bool mIgnoreEvents; |
31 | 190 |
|
191 |
/** |
|
192 |
* Contact Number for the conversation |
|
193 |
*/ |
|
194 |
QString mContactNumber; |
|
195 |
||
196 |
/** |
|
197 |
* Address string. |
|
198 |
*/ |
|
199 |
QString mAddress; |
|
200 |
||
201 |
/** |
|
202 |
* Avatar icon item. |
|
203 |
* Own. |
|
204 |
*/ |
|
205 |
HbIconItem *mAvatarIconItem; |
|
206 |
||
207 |
/** |
|
208 |
* Presence icon item. |
|
209 |
* Own. |
|
210 |
*/ |
|
211 |
HbIconItem *mPresenceIconItem; |
|
212 |
||
213 |
/** |
|
214 |
* Address text item. |
|
215 |
* Own. |
|
216 |
*/ |
|
217 |
HbTextItem *mAddressTextItem; |
|
218 |
||
219 |
/** |
|
220 |
* ThumbnailManager |
|
221 |
* Own. |
|
222 |
*/ |
|
223 |
ThumbnailManager *mThumbnailManager; |
|
224 |
}; |
|
225 |
||
226 |
#endif // MSGCONTACTCARDWIDGET_H |
|
227 |
// EOF |