|
1 /* |
|
2 * Copyright (c) 2006 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: Contact |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CPHCNTCONTACT_H |
|
20 #define CPHCNTCONTACT_H |
|
21 |
|
22 #include <e32base.h> |
|
23 #include "mphcntmatch.h" |
|
24 #include "tphcntnumber.h" |
|
25 |
|
26 class MPhCntContactFields; |
|
27 class CPhCntFoundContacts; |
|
28 class MPhCntContactManager; |
|
29 class MVPbkContactLinkArray; |
|
30 class MVPbkStoreContact; |
|
31 class MPbk2ImageGetObserver; |
|
32 class MPbk2ImageOperation; |
|
33 class CPhCntVPbkContactId; |
|
34 class TPhCntSipURI; |
|
35 class CCntRawPhoneNumberExtractor; |
|
36 |
|
37 /** |
|
38 * Contact data. |
|
39 * |
|
40 * @lib PhoneCntFinder |
|
41 * @since S60 v3.1 |
|
42 */ |
|
43 NONSHARABLE_CLASS( CPhCntContact ) : public CBase, public MPhCntMatch |
|
44 { |
|
45 public: |
|
46 |
|
47 /** |
|
48 * Static constructor. |
|
49 * |
|
50 * @since S60 v3.1 |
|
51 * @param aContactFields Contact fields, takes ownership. |
|
52 * @param aContactManager Contact manager. |
|
53 */ |
|
54 static CPhCntContact* NewL( |
|
55 MPhCntContactFields* aContactFields, |
|
56 MPhCntContactManager& aContactManager ); |
|
57 |
|
58 /** |
|
59 * Destructor. |
|
60 */ |
|
61 ~CPhCntContact(); |
|
62 |
|
63 public: |
|
64 |
|
65 /** |
|
66 * The number, which was used to match this contact, should be |
|
67 * set here. |
|
68 * |
|
69 * @since S60 v3.1 |
|
70 * @param aNumber Number, which was used to match this contact. |
|
71 */ |
|
72 void SetOriginalNumberL( const TDesC& aNumber ); |
|
73 |
|
74 /** |
|
75 * Gives the original number used for matching this contact. |
|
76 * |
|
77 * @since S60 v3.1 |
|
78 * @return Origianl number used for matching this contact. |
|
79 */ |
|
80 const TDesC& OriginalNumber() const; |
|
81 |
|
82 /** |
|
83 * Sets the owner of this contact. |
|
84 * |
|
85 * @since S60 v3.1 |
|
86 * @param aContactOwner Owner of this contact. |
|
87 */ |
|
88 void SetOwner( CPhCntFoundContacts* aContactOwner ); |
|
89 |
|
90 /** |
|
91 * Increase reference count. |
|
92 * |
|
93 * @since S60 v3.1 |
|
94 */ |
|
95 void IncreaseReferenceCount(); |
|
96 |
|
97 /** |
|
98 * Gives all phone numbers that this contact has. |
|
99 * |
|
100 * @since S60 v3.2 |
|
101 * @return All phone numbers contact has. |
|
102 */ |
|
103 virtual const RArray<TPhCntNumber>& AllNumbers() const; |
|
104 |
|
105 /** |
|
106 * Gives DTMF number, which was selected by user. |
|
107 * |
|
108 * @since S60 v3.2 |
|
109 * @return DTMF number or empty descriptor if dmtf |
|
110 * was not defined for this contact. |
|
111 */ |
|
112 virtual TPtrC Dtmf() const; |
|
113 |
|
114 /** |
|
115 * Sets the number that matched to the original number. |
|
116 * |
|
117 * @since S60 v3.1 |
|
118 * @param aNumber Number. |
|
119 */ |
|
120 void SetMatchedVoipNumber( const TPhCntSipURI& aSipUri ); |
|
121 |
|
122 |
|
123 // From base class MPhCntMatch |
|
124 |
|
125 /** |
|
126 * From base class MPhCntMatch |
|
127 * @since S60 v3.1 |
|
128 * @see MPhCntMatch |
|
129 */ |
|
130 void Release(); |
|
131 |
|
132 /** |
|
133 * From base class MPhCntMatch |
|
134 * @since S60 v3.1 |
|
135 * @see MPhCntMatch |
|
136 */ |
|
137 MPhCntMatch::TNumberType NumberType() const; |
|
138 |
|
139 /** |
|
140 * From base class MPhCntMatch |
|
141 * @since S60 v3.1 |
|
142 * @see MPhCntMatch |
|
143 */ |
|
144 CPhCntContactId* ContactId() const; |
|
145 |
|
146 /** |
|
147 * From base class MPhCntMatch |
|
148 * @since S60 v3.1 |
|
149 * @see MPhCntMatch |
|
150 */ |
|
151 MVPbkContactLink* ContactLink() const; |
|
152 |
|
153 /** |
|
154 * From base class MPhCntMatch |
|
155 * @since S60 v3.1 |
|
156 * @see MPhCntMatch |
|
157 */ |
|
158 TCliType Cli( HBufC*& aCliText ) const; |
|
159 |
|
160 /** |
|
161 * From base class MPhCntMatch |
|
162 * @since S60 v3.1 |
|
163 * @see MPhCntMatch |
|
164 */ |
|
165 TPtrC FirstName() const; |
|
166 |
|
167 /** |
|
168 * From base class MPhCntMatch |
|
169 * @since S60 v3.1 |
|
170 * @see MPhCntMatch |
|
171 */ |
|
172 TPtrC LastName() const; |
|
173 |
|
174 /** |
|
175 * From base class MPhCntMatch |
|
176 * @since S60 v3.1 |
|
177 * @see MPhCntMatch |
|
178 */ |
|
179 TPtrC CompanyName() const; |
|
180 |
|
181 /** |
|
182 * From base class MPhCntMatch |
|
183 * @since S60 v3.1 |
|
184 * @see MPhCntMatch |
|
185 */ |
|
186 TPtrC Number() const; |
|
187 |
|
188 /** |
|
189 * Finds a phone number for the requested speed dial position. |
|
190 * @since S60 v3.2 |
|
191 * @param aPosition The speed dial position. |
|
192 * @return Phone number. Empty if there isn't one specified. |
|
193 */ |
|
194 TPhCntNumber SpeedDialNumber( const TInt aPosition ); |
|
195 |
|
196 /** |
|
197 * From base class MPhCntMatch |
|
198 * @since S60 v3.1 |
|
199 * @see MPhCntMatch |
|
200 */ |
|
201 TPtrC PersonalRingingTone() const; |
|
202 |
|
203 /** |
|
204 * From base class MPhCntMatch |
|
205 * @since S60 v3.1 |
|
206 * @see MPhCntMatch |
|
207 */ |
|
208 TBool BelongsToGroups( |
|
209 const CArrayFix<TContactItemId>& aGroupArray ) const; |
|
210 |
|
211 /** |
|
212 * From base class MPhCntMatch |
|
213 * @since S60 v3.1 |
|
214 * @see MPhCntMatch |
|
215 */ |
|
216 HBufC* TextToSpeechTextL() const; |
|
217 |
|
218 /** |
|
219 * From base class MPhCntMatch |
|
220 * @since S60 v3.1 |
|
221 * @see MPhCntMatch |
|
222 */ |
|
223 TPtrC CallText() const; |
|
224 |
|
225 /** |
|
226 * From base class MPhCntMatch |
|
227 * @since S60 v3.1 |
|
228 * @see MPhCntMatch |
|
229 */ |
|
230 TPtrC CallImage() const; |
|
231 |
|
232 /** |
|
233 * From base class MPhCntMatch |
|
234 * @since S60 v3.1 |
|
235 * @see MPhCntMatch |
|
236 */ |
|
237 TBool HasThumbnailImage() const; |
|
238 |
|
239 /** |
|
240 * Loads the thumbnail of this contact. |
|
241 * |
|
242 * @since S60 3.1 |
|
243 * @param aObserver Observer of the loading. |
|
244 * @return Operation, that can be canceled by deleting it. Ownership is given. |
|
245 */ |
|
246 MPbk2ImageOperation* LoadThumbnailL( |
|
247 MPbk2ImageGetObserver& aObserver ); |
|
248 |
|
249 /** |
|
250 * From base class MPhCntMatch |
|
251 * @since S60 v3.2 |
|
252 * @see MPhCntMatch |
|
253 */ |
|
254 CDesCArray& AllDtmfNumbers() const; |
|
255 |
|
256 |
|
257 |
|
258 protected: |
|
259 |
|
260 CPhCntContact( |
|
261 MPhCntContactFields* aContactFields, |
|
262 MPhCntContactManager& aContactManager ); |
|
263 |
|
264 void ConstructL(); |
|
265 |
|
266 /** |
|
267 * Determines if this contact belongs to a group of contacts. |
|
268 * |
|
269 * @since S60 v3.1. |
|
270 * @param aGroup Array of contact links, which defines a group. |
|
271 * @return ETrue - This contact belongs to group. |
|
272 * EFalse - This contact does not belong to group. |
|
273 */ |
|
274 TBool BelongsToGroupsL( MVPbkContactLinkArray* aGroups ) const; |
|
275 |
|
276 private: |
|
277 |
|
278 /** |
|
279 * Get number type from number that matches with supplied number |
|
280 * @since S60 v3.2 |
|
281 * @param aNumber Number which type is unknown |
|
282 * @return Number type |
|
283 */ |
|
284 MPhCntMatch::TNumberType NumberType( const TDesC& aNumber ) const; |
|
285 |
|
286 protected: // Data |
|
287 |
|
288 /** |
|
289 * Contacts fields |
|
290 * Own. |
|
291 */ |
|
292 MPhCntContactFields* iContactFields; |
|
293 |
|
294 /** |
|
295 * Number, which was used for matching this contact. |
|
296 * Own. |
|
297 */ |
|
298 HBufC* iOriginalNumber; |
|
299 |
|
300 /** |
|
301 * Owner of this contact. |
|
302 * Not Own. |
|
303 */ |
|
304 CPhCntFoundContacts* iOwner; |
|
305 |
|
306 /** |
|
307 * Number of references of this object. |
|
308 */ |
|
309 TInt iReferenceCount; |
|
310 |
|
311 /** |
|
312 * Contact manager. |
|
313 * Not own. |
|
314 */ |
|
315 MPhCntContactManager& iContactManager; |
|
316 |
|
317 /** |
|
318 * Contact identifier. |
|
319 * own. |
|
320 */ |
|
321 CPhCntVPbkContactId* iContactId; |
|
322 |
|
323 /** |
|
324 * Matched voip number. |
|
325 * own. |
|
326 */ |
|
327 HBufC* iMatchedVoipNumber; |
|
328 |
|
329 /** |
|
330 * Number extractor. |
|
331 * Own. |
|
332 */ |
|
333 CCntRawPhoneNumberExtractor* iNumberExtractor; |
|
334 }; |
|
335 |
|
336 #endif // CPHCNTCONTACT_H |