|
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: Matcher implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef CPHCNTCNTMATCHERIMPL_H |
|
19 #define CPHCNTCNTMATCHERIMPL_H |
|
20 |
|
21 #include <e32base.h> |
|
22 #include "CPhCntMatcher.h" |
|
23 #include "MVPbkContactLink.h" |
|
24 |
|
25 class MPhCntContactStores; |
|
26 class CPhCntContactManager; |
|
27 class CPhCntContact; |
|
28 class CPhCntMatchContact; |
|
29 class CPhCntFetchContact; |
|
30 class MVPbkContactLink; |
|
31 class CPhCntFoundContacts; |
|
32 class CCntNumberParser; |
|
33 class MPhoneCntPbkOwner; |
|
34 class MPhCntContactMatchStrategy; |
|
35 class CVPbkContactStoreUriArray; |
|
36 |
|
37 |
|
38 /** |
|
39 * CPhCntMatcher implementation. |
|
40 * |
|
41 * @since S60 v3.1 |
|
42 * @lib PhoneCntFinder.lib. |
|
43 */ |
|
44 NONSHARABLE_CLASS( CPhCntMatcherImpl ) : public CPhCntMatcher |
|
45 { |
|
46 public: |
|
47 |
|
48 /** |
|
49 * Static constructor. |
|
50 * |
|
51 * @since S60 v3.1 |
|
52 * @param aOwner Phonebook owner. |
|
53 */ |
|
54 static CPhCntMatcherImpl* NewL( const MPhoneCntPbkOwner& aOwner ); |
|
55 |
|
56 /** |
|
57 * Destructor. |
|
58 * |
|
59 * @since S60 v3.1 |
|
60 */ |
|
61 ~CPhCntMatcherImpl(); |
|
62 |
|
63 // From base class CPhCntMatcher |
|
64 |
|
65 /** |
|
66 * From base class CPhCntMatcher |
|
67 * |
|
68 * @since S60 v3.1 |
|
69 * @see CPhCntMatcher. |
|
70 */ |
|
71 TInt MatchNumber( |
|
72 MPhCntMatch*& aMatch, |
|
73 const TDesC& aTelNumber ); |
|
74 |
|
75 /** |
|
76 * From base class CPhCntMatcher |
|
77 * |
|
78 * @since S60 v3.1 |
|
79 * @see CPhCntMatcher. |
|
80 */ |
|
81 TInt MatchNumber( |
|
82 MPhCntMatch*& aMatch, |
|
83 const TDesC& aTelNumber, |
|
84 const CPhCntContactId& aContactId ); |
|
85 |
|
86 |
|
87 // NOT USED BY ANYONE? |
|
88 /** |
|
89 * Match number to phonebook. |
|
90 * @param aMatch Found match, owership tranferred. NULL if not found any. |
|
91 * @param aTelNumber Number to match against. |
|
92 * @param aContactId Current contact. |
|
93 * @param aFieldId Current field id (index from CnmModel); |
|
94 * @return Error code: KErrNone - one match found |
|
95 * KErrNotFound - no matches found |
|
96 * KErrAlreadyExists - several matches -> no match |
|
97 * KErrUnderflow - Number too short for matching |
|
98 * KErrAccessDenied - Can't get phonebook instance |
|
99 * other - normal Symbian OS error |
|
100 */ |
|
101 TInt MatchNumber( |
|
102 MPhCntMatch*& /*aMatch*/, |
|
103 const TDesC& /*aTelNumber*/, |
|
104 const CPhCntContactId& /*aContactId*/, |
|
105 MPhCntMatch::TNumberType /*aNumberType*/ ) |
|
106 { |
|
107 return KErrNotFound; |
|
108 }; |
|
109 |
|
110 /** |
|
111 * Match number to phonebook. |
|
112 * @param aMatch Found match, owership tranferred. NULL if not found any. |
|
113 * @param aNumber Number to match against. |
|
114 * @return Error code: KErrNone - one match found |
|
115 * KErrNotFound - no matches found |
|
116 * other - normal Symbian OS error |
|
117 */ |
|
118 TInt MatchVoipNumber( |
|
119 MPhCntMatch*& aMatch, |
|
120 const TDesC& aNumber, |
|
121 TBool aAllowUserNameMatch, |
|
122 MDesCArray* aContactStoreUris, |
|
123 TInt aCharsForMatching = 0 ); |
|
124 |
|
125 /** |
|
126 * From CPhCntMatcher, gets VoIP call contact info from phonebook |
|
127 * by contact id. |
|
128 * @since Series60 3.0 |
|
129 * @param aMatch for found match, owership tranferred. Empty if not found. |
|
130 * @param aContactId for current contact. |
|
131 * @return Error code: KErrNone - VoIP call contact found |
|
132 * KErrNotFound - no VoIP call contact found |
|
133 * other - normal Symbian OS error |
|
134 */ |
|
135 TInt MatchVoipNumber( |
|
136 MPhCntMatch*& aMatch, |
|
137 const CPhCntContactId& aContactId ); |
|
138 |
|
139 |
|
140 /** |
|
141 * From CPhCntMatcher |
|
142 * Determines if contact has other type of numbers than |
|
143 * voip numbers. |
|
144 * |
|
145 * @since S60 v3.2. |
|
146 * @param aContactId Id of the contact. |
|
147 * @return ETrue - CS numbers found from contact. |
|
148 * EFalse - No CS numbers found from contact. |
|
149 */ |
|
150 TBool HasCSNumbers( |
|
151 const CPhCntContactId& aContactId ); |
|
152 |
|
153 private: |
|
154 |
|
155 /** |
|
156 * Tries to get a contact with known number. |
|
157 * |
|
158 * @since S60 v3.1 |
|
159 * @param aMatch Contact |
|
160 * @param aTelNumber Phone number. |
|
161 * @return Error code. |
|
162 */ |
|
163 TInt GetContactL( |
|
164 MPhCntMatch*& aMatch, |
|
165 const TDesC& aTelNumber ); |
|
166 |
|
167 /** |
|
168 * Match contacts against product specific stores. |
|
169 * |
|
170 * @since S60 v3.2 |
|
171 * @param aLinkArray Array of contacts to match |
|
172 * @return Error code. |
|
173 */ |
|
174 TInt MatchFromAdditionalStore( const MVPbkContactLinkArray& aLinkArray ) const; |
|
175 |
|
176 |
|
177 protected: |
|
178 |
|
179 CPhCntMatcherImpl( const MPhoneCntPbkOwner& aOwner ); |
|
180 |
|
181 void ConstructL(); |
|
182 |
|
183 /** |
|
184 * Delayed on-demand based construction (grabs leaves). |
|
185 * Should be called from functions where a member attribute |
|
186 * (those constructed here) is referenced. |
|
187 */ |
|
188 TInt CreateMatcher(); |
|
189 |
|
190 /** |
|
191 * Delayed on-demand based construction (leaving). |
|
192 */ |
|
193 void DoCreateMatcherL(); |
|
194 |
|
195 /** |
|
196 * Fetches contact pointed by aContactLink from |
|
197 * contact stores. |
|
198 * |
|
199 * @since S60 v3.1 |
|
200 * @param aMatch Fetched contact. Is null if contact was not found. |
|
201 * @param aContactLink Link to the contact. |
|
202 * @param aOrigNumber Phone number that was used |
|
203 * to find the contact. |
|
204 * @return Error code. |
|
205 */ |
|
206 TInt FetchContact( |
|
207 CPhCntContact*& aMatch, |
|
208 const MVPbkContactLink& aContactLink, |
|
209 const TDesC& aOrigNumber ); |
|
210 |
|
211 |
|
212 |
|
213 protected: // Data |
|
214 |
|
215 /** |
|
216 * Already found contacs. |
|
217 * Own. |
|
218 */ |
|
219 CPhCntFoundContacts* iFoundContacts; |
|
220 |
|
221 /** |
|
222 * Contact mathching operation. |
|
223 * Own. |
|
224 */ |
|
225 CPhCntMatchContact* iMatchContact; |
|
226 |
|
227 |
|
228 /** |
|
229 * Contact fetching operation. |
|
230 * Own. |
|
231 */ |
|
232 CPhCntFetchContact* iFetchContact; |
|
233 |
|
234 |
|
235 /** |
|
236 * Contact manager. |
|
237 * Not own. |
|
238 */ |
|
239 CPhCntContactManager& iContactManager; |
|
240 |
|
241 private: // Data |
|
242 |
|
243 /** |
|
244 * Contact stores |
|
245 * Own. |
|
246 */ |
|
247 MPhCntContactStores* iContactStores; |
|
248 |
|
249 /** |
|
250 * Owner of phone book. |
|
251 * Not own. |
|
252 */ |
|
253 const MPhoneCntPbkOwner& iPbkOwner; |
|
254 |
|
255 /** |
|
256 * Match strategy used for CS calls. |
|
257 * Own. |
|
258 */ |
|
259 MPhCntContactMatchStrategy* iCSMatchStrategy; |
|
260 |
|
261 }; |
|
262 |
|
263 #endif // CPHCNTCNTMATCHERIMPL_H |