76 const TDesC& aTelNumber ) |
76 const TDesC& aTelNumber ) |
77 { |
77 { |
78 TEFLOGSTRING( KTAOBJECT, "CNT CPhCntMatcherImpl::MatchNumber" ); |
78 TEFLOGSTRING( KTAOBJECT, "CNT CPhCntMatcherImpl::MatchNumber" ); |
79 TInt err = CreateMatcher(); |
79 TInt err = CreateMatcher(); |
80 if ( !err ) |
80 if ( !err ) |
81 { |
81 { |
82 // Check if we already have the contact. |
82 // Check if we already have the contact. |
83 CPhCntContact* contact = iFoundContacts->FindContact( aTelNumber ); |
83 CPhCntContact* contact = iFoundContacts->FindContact( aTelNumber ); |
84 |
84 |
85 err = KErrNone; |
85 err = KErrNone; |
86 if( !contact ) |
86 if( !contact ) |
87 { |
87 { |
88 // Get contact from contact stores |
88 // Get contact from contact stores |
89 TRAPD( traperr, err = GetContactL( aMatch, aTelNumber )); |
89 TRAPD( traperr, err = GetContactL( aMatch, aTelNumber )); |
90 if ( traperr ) |
90 if ( traperr ) |
91 { |
91 { |
92 err = traperr; |
92 err = traperr; |
93 } |
93 } |
94 } |
94 } |
95 else |
95 else |
96 { |
96 { |
97 aMatch = contact; |
97 aMatch = contact; |
98 } |
98 } |
99 } |
99 } |
100 TEFLOGSTRING2( KTAOBJECT, "CNT CPhCntMatcherImpl::MatchNumber %d " , err); |
100 TEFLOGSTRING2( KTAOBJECT, "CNT CPhCntMatcherImpl::MatchNumber %d " , err); |
101 return err; |
101 return err; |
102 } |
102 } |
103 |
103 |
104 // --------------------------------------------------------------------------- |
104 // --------------------------------------------------------------------------- |
111 const TDesC& aTelNumber, |
111 const TDesC& aTelNumber, |
112 const CPhCntContactId& aContactId ) |
112 const CPhCntContactId& aContactId ) |
113 { |
113 { |
114 TInt err = CreateMatcher(); |
114 TInt err = CreateMatcher(); |
115 if ( !err ) |
115 if ( !err ) |
116 { |
116 { |
117 if( aContactId.IsValid() ) |
117 if( aContactId.IsValid() ) |
118 { |
118 { |
119 // Do we have existing contact for the link and number. |
119 // Do we have existing contact for the link and number. |
120 const CPhCntVPbkContactId& contactId = |
120 const CPhCntVPbkContactId& contactId = |
121 static_cast<const CPhCntVPbkContactId&>( aContactId ); |
121 static_cast<const CPhCntVPbkContactId&>( aContactId ); |
122 const MVPbkContactLink& link = contactId.ContactLink(); |
122 const MVPbkContactLink& link = contactId.ContactLink(); |
123 aMatch = |
123 aMatch = |
124 iFoundContacts->FindContact( aTelNumber, link ); |
124 iFoundContacts->FindContact( aTelNumber, link ); |
125 if( !aMatch ) |
125 if( !aMatch ) |
126 { |
126 { |
127 // Get the contact. |
127 // Get the contact. |
128 CPhCntContact* match = NULL; |
128 CPhCntContact* match = NULL; |
129 err = FetchContact( match, link, aTelNumber ); |
129 err = FetchContact( match, link, aTelNumber ); |
130 if( !err ) |
130 if( !err ) |
131 { |
131 { |
132 aMatch = match; |
132 aMatch = match; |
133 } |
133 } |
134 } |
134 } |
135 } |
135 } |
136 else |
136 else |
137 { |
137 { |
138 err = MatchNumber( aMatch, aTelNumber ); |
138 err = MatchNumber( aMatch, aTelNumber ); |
139 } |
139 } |
140 } |
140 } |
141 return err; |
141 return err; |
142 } |
142 } |
143 |
143 |
144 // --------------------------------------------------------------------------- |
144 // --------------------------------------------------------------------------- |
145 // From CPhCntMatcher |
145 // From CPhCntMatcher |
161 // Empty implementation. Implemented in CPhCntMatcherVoIPImpl. |
161 // Empty implementation. Implemented in CPhCntMatcherVoIPImpl. |
162 // --------------------------------------------------------------------------- |
162 // --------------------------------------------------------------------------- |
163 // |
163 // |
164 TInt CPhCntMatcherImpl::MatchVoipNumber( |
164 TInt CPhCntMatcherImpl::MatchVoipNumber( |
165 MPhCntMatch*& /*aMatch*/, |
165 MPhCntMatch*& /*aMatch*/, |
|
166 const TDesC& /*aMatchString*/, |
166 const CPhCntContactId& /*aContactId*/ ) |
167 const CPhCntContactId& /*aContactId*/ ) |
167 { |
168 { |
168 return KErrNotFound; |
169 return KErrNotFound; |
169 } |
170 } |
170 |
171 |
264 // --------------------------------------------------------------------------- |
265 // --------------------------------------------------------------------------- |
265 // Delayed on-demand based construction |
266 // Delayed on-demand based construction |
266 // --------------------------------------------------------------------------- |
267 // --------------------------------------------------------------------------- |
267 // |
268 // |
268 void CPhCntMatcherImpl::DoCreateMatcherL() |
269 void CPhCntMatcherImpl::DoCreateMatcherL() |
269 { |
270 { |
270 TEFLOGSTRING( KTAOBJECT, "CNT CPhCntMatcherImpl::DoCreateMatcherL" ); |
271 TEFLOGSTRING( KTAOBJECT, "CNT CPhCntMatcherImpl::DoCreateMatcherL" ); |
271 if ( !iContactStores ) |
272 if ( !iContactStores ) |
272 { |
273 { |
273 iFoundContacts = CPhCntFoundContacts::NewL(); |
274 iFoundContacts = CPhCntFoundContacts::NewL(); |
274 iContactStores = CPhCntContactStores::NewL( iContactManager ); |
275 iContactStores = CPhCntContactStores::NewL( iContactManager ); |
275 iMatchContact = CPhCntMatchContact::NewL(); |
276 iMatchContact = CPhCntMatchContact::NewL(); |
276 iFetchContact = CPhCntFetchContact::NewL( *iContactStores ); |
277 iFetchContact = CPhCntFetchContact::NewL( *iContactStores ); |
277 } |
278 } |
278 } |
279 } |
279 |
280 |
280 // --------------------------------------------------------------------------- |
281 // --------------------------------------------------------------------------- |
281 // Delayed on-demand based construction |
282 // Delayed on-demand based construction |
282 // --------------------------------------------------------------------------- |
283 // --------------------------------------------------------------------------- |
283 // |
284 // |
284 TInt CPhCntMatcherImpl::CreateMatcher() |
285 TInt CPhCntMatcherImpl::CreateMatcher() |
285 { |
286 { |
286 TRAPD( err, DoCreateMatcherL() ); |
287 TRAPD( err, DoCreateMatcherL() ); |
287 return err; |
288 return err; |
288 } |
289 } |
289 |
290 |
290 // --------------------------------------------------------------------------- |
291 // --------------------------------------------------------------------------- |
291 // Second phase constructor |
292 // Second phase constructor |
292 // --------------------------------------------------------------------------- |
293 // --------------------------------------------------------------------------- |
293 // |
294 // |