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 QGraphicsSceneMouseEvent;
|
|
29 |
//class HbGestureSceneFilter;
|
|
30 |
class ThumbnailManager;
|
|
31 |
|
|
32 |
#include "convergedmessageaddress.h"
|
|
33 |
|
|
34 |
/**
|
|
35 |
* This class is a custom layout widget for Contact Card layout.
|
|
36 |
*/
|
|
37 |
class MsgContactCardWidget: public HbWidget
|
|
38 |
{
|
|
39 |
Q_OBJECT
|
|
40 |
|
|
41 |
public:
|
|
42 |
|
|
43 |
/**
|
|
44 |
* Constructor
|
|
45 |
*/
|
|
46 |
explicit MsgContactCardWidget(QGraphicsItem *parent = 0);
|
|
47 |
|
|
48 |
/**
|
|
49 |
* Destructor
|
|
50 |
*/
|
|
51 |
virtual ~MsgContactCardWidget();
|
|
52 |
|
|
53 |
public:
|
|
54 |
|
|
55 |
/**
|
|
56 |
* Sets the avatar
|
|
57 |
* @param avatar Avatar to be set.
|
|
58 |
*/
|
|
59 |
void setAvatar(const HbIcon &avatar);
|
|
60 |
|
|
61 |
/**
|
|
62 |
* Sets the presence icon
|
|
63 |
* @param presenceIcon Presence icon to set.
|
|
64 |
*/
|
|
65 |
void setPresenceIcon(const HbIcon &presenceIcon);
|
|
66 |
|
|
67 |
/**
|
|
68 |
* Sets the address to be displayed.
|
|
69 |
* @param address Address string to be set.
|
|
70 |
*/
|
|
71 |
void setAddress(const QString &address);
|
|
72 |
|
|
73 |
/**
|
|
74 |
* Returns the address displayed in the Contact card.
|
|
75 |
*/
|
|
76 |
ConvergedMessageAddressList address();
|
|
77 |
|
|
78 |
/**
|
|
79 |
* Refreshes all the Contact card fields.
|
|
80 |
*/
|
|
81 |
void updateContents();
|
|
82 |
|
|
83 |
/**
|
|
84 |
* Clears all the Contact card fields.
|
|
85 |
*/
|
|
86 |
void clearContent();
|
|
87 |
|
|
88 |
/**
|
|
89 |
* for tactile feed back.
|
|
90 |
* Depricated
|
|
91 |
*/
|
|
92 |
// HbFeedback::InstantEffect overrideFeedback(Hb::InstantInteraction interaction) const;
|
|
93 |
|
|
94 |
/**
|
|
95 |
* To connect/disconnect clicked signal
|
|
96 |
*/
|
|
97 |
void connectSignals(bool yes);
|
|
98 |
|
|
99 |
protected:
|
|
100 |
/**
|
|
101 |
* reimplemented from base class.
|
|
102 |
*/
|
|
103 |
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
|
|
104 |
|
|
105 |
/**
|
|
106 |
* reimplemented from base class.
|
|
107 |
*/
|
|
108 |
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
|
|
109 |
|
|
110 |
private:
|
|
111 |
|
|
112 |
/**
|
|
113 |
* Initialization function.
|
|
114 |
*/
|
|
115 |
void init();
|
|
116 |
|
|
117 |
/** Helper method to get contact id against phone number.
|
|
118 |
* @param value phone number.
|
|
119 |
*/
|
|
120 |
int resolveContactId(const QString& value);
|
|
121 |
|
|
122 |
/**
|
|
123 |
* Helper method to set back ground.
|
|
124 |
*/
|
|
125 |
void setBackGround(const QString& bg);
|
|
126 |
|
|
127 |
private slots:
|
|
128 |
/**
|
|
129 |
* show longpress menu for attachment object
|
|
130 |
*/
|
|
131 |
void handleLongPress(QPointF position);
|
|
132 |
|
|
133 |
/**
|
|
134 |
* Helper method to initialize gesture.
|
|
135 |
*/
|
|
136 |
void initGesture();
|
|
137 |
|
|
138 |
/**
|
|
139 |
* Slot for handling valid returns from the framework.
|
|
140 |
* Updates the display name in the contact card widget.
|
|
141 |
* @param result const QVariant&
|
|
142 |
*/
|
|
143 |
void handleOk(const QVariant& result);
|
|
144 |
|
|
145 |
/**
|
|
146 |
* Slot for handling errors. Error ids are provided as
|
|
147 |
* 32-bit integers.
|
|
148 |
* @param errorCode qint32
|
|
149 |
*/
|
|
150 |
void handleError(int errorCode, const QString& errorMessage);
|
|
151 |
|
|
152 |
/**
|
|
153 |
* Called when clicked() signal is emitted
|
|
154 |
* Launches phonebook to view an existing contact
|
|
155 |
* or to add a new contact
|
|
156 |
*/
|
|
157 |
void openContactInfo();
|
|
158 |
|
|
159 |
/**
|
|
160 |
* Launches Dialer Service
|
|
161 |
*/
|
|
162 |
void call();
|
|
163 |
|
|
164 |
/**
|
|
165 |
* Adds unknown number to phonebook
|
|
166 |
*/
|
|
167 |
void addToContacts();
|
|
168 |
|
|
169 |
/**
|
|
170 |
* Called after service request is completed.
|
|
171 |
*/
|
|
172 |
void onServiceRequestCompleted();
|
|
173 |
|
|
174 |
/**
|
|
175 |
* Slot hit when the thumbnail is ready.
|
|
176 |
*/
|
|
177 |
void thumbnailReady(const QPixmap& pixmap, void *data, int id, int error);
|
|
178 |
|
|
179 |
signals:
|
|
180 |
/**
|
|
181 |
* Emitted when contact card is short tapped.
|
|
182 |
*/
|
|
183 |
void clicked();
|
|
184 |
|
|
185 |
private:
|
|
186 |
// Data
|
|
187 |
|
|
188 |
|
|
189 |
/**
|
|
190 |
* To supress short tap if long tap triggered.
|
|
191 |
*/
|
|
192 |
bool mMenuShown;
|
|
193 |
|
|
194 |
/**
|
|
195 |
* Contact Number for the conversation
|
|
196 |
*/
|
|
197 |
QString mContactNumber;
|
|
198 |
|
|
199 |
/**
|
|
200 |
* Address string.
|
|
201 |
*/
|
|
202 |
QString mAddress;
|
|
203 |
|
|
204 |
/**
|
|
205 |
* Avatar icon item.
|
|
206 |
* Own.
|
|
207 |
*/
|
|
208 |
HbIconItem *mAvatarIconItem;
|
|
209 |
|
|
210 |
/**
|
|
211 |
* Presence icon item.
|
|
212 |
* Own.
|
|
213 |
*/
|
|
214 |
HbIconItem *mPresenceIconItem;
|
|
215 |
|
|
216 |
/**
|
|
217 |
* Address text item.
|
|
218 |
* Own.
|
|
219 |
*/
|
|
220 |
HbTextItem *mAddressTextItem;
|
|
221 |
|
|
222 |
/**
|
|
223 |
* gesture filter for long press.
|
|
224 |
*/
|
|
225 |
// HbGestureSceneFilter* mGestureFilter;
|
|
226 |
|
|
227 |
/**
|
|
228 |
* ThumbnailManager
|
|
229 |
* Own.
|
|
230 |
*/
|
|
231 |
ThumbnailManager *mThumbnailManager;
|
|
232 |
};
|
|
233 |
|
|
234 |
#endif // MSGCONTACTCARDWIDGET_H
|
|
235 |
// EOF
|