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