84 CVIMPSTStorageVPbkServerStore* |
84 CVIMPSTStorageVPbkServerStore* |
85 CVIMPSTStorageVPbkServerStore::NewLC(const TDesC& aContactDb, |
85 CVIMPSTStorageVPbkServerStore::NewLC(const TDesC& aContactDb, |
86 const TDesC& aServiceName, |
86 const TDesC& aServiceName, |
87 MVIMPSTStorageServiceCacheWriter& aServiceCacheWriter ) |
87 MVIMPSTStorageServiceCacheWriter& aServiceCacheWriter ) |
88 { |
88 { |
89 TRACE( T_LIT("CVIMPSTStorageVPbkServerStore::NewLC() begin" )); |
89 TRACER_AUTO; |
90 CVIMPSTStorageVPbkServerStore* self = |
90 CVIMPSTStorageVPbkServerStore* self = |
91 new (ELeave) CVIMPSTStorageVPbkServerStore(aServiceCacheWriter); |
91 new (ELeave) CVIMPSTStorageVPbkServerStore(aServiceCacheWriter); |
92 CleanupStack::PushL( self ); |
92 CleanupStack::PushL( self ); |
93 self->ConstructL( aContactDb,aServiceName ); |
93 self->ConstructL( aContactDb,aServiceName ); |
94 TRACE( T_LIT("CVIMPSTStorageVPbkServerStore::NewLC() end" )); |
94 |
95 return self; |
95 return self; |
96 } |
96 } |
97 |
97 |
98 // --------------------------------------------------------------------------- |
98 // --------------------------------------------------------------------------- |
99 // CVIMPSTStorageVPbkServerStore:: |
99 // CVIMPSTStorageVPbkServerStore:: |
100 // ~CVIMPSTStorageVPbkServerStore |
100 // ~CVIMPSTStorageVPbkServerStore |
101 // --------------------------------------------------------------------------- |
101 // --------------------------------------------------------------------------- |
102 // |
102 // |
103 CVIMPSTStorageVPbkServerStore::~CVIMPSTStorageVPbkServerStore() |
103 CVIMPSTStorageVPbkServerStore::~CVIMPSTStorageVPbkServerStore() |
104 { |
104 { |
105 TRACE( T_LIT("CVIMPSTStorageVPbkServerStore::~CVIMPSTStorageVPbkServerStore() begin")); |
105 TRACER_AUTO; |
106 iRetrivedXSPIdArray.ResetAndDestroy(); |
106 iRetrivedXSPIdArray.ResetAndDestroy(); |
107 TRAP_IGNORE( ResetAndDestroyLocalArrayL() ); |
107 TRAP_IGNORE( ResetAndDestroyLocalArrayL() ); |
108 delete iVPbkStoreHandler; |
108 delete iVPbkStoreHandler; |
109 TRACE( T_LIT("CVIMPSTStorageVPbkServerStore::~CVIMPSTStorageVPbkServerStore() end")); |
109 |
110 } |
110 } |
111 |
111 |
112 // --------------------------------------------------------------------------- |
112 // --------------------------------------------------------------------------- |
113 // CVIMPSTStorageVPbkServerStore::ResetAndDestroyLocalArrayL |
113 // CVIMPSTStorageVPbkServerStore::ResetAndDestroyLocalArrayL |
114 // --------------------------------------------------------------------------- |
114 // --------------------------------------------------------------------------- |
115 // |
115 // |
116 void CVIMPSTStorageVPbkServerStore::ResetAndDestroyLocalArrayL() |
116 void CVIMPSTStorageVPbkServerStore::ResetAndDestroyLocalArrayL() |
117 { |
117 { |
118 TRACE( T_LIT("CVIMPSTStorageVPbkServerStore::ResetAndDestroyLocalArrayL() begin") ); |
118 TRACER_AUTO; |
119 TInt count = iFetchContactsToBeAdded.Count(); |
119 TInt count = iFetchContactsToBeAdded.Count(); |
120 while( count ) |
120 while( count ) |
121 { |
121 { |
122 TVIMPSTContactInfo contactInf = iFetchContactsToBeAdded[ count-1 ]; |
122 TVIMPSTContactInfo contactInf = iFetchContactsToBeAdded[ count-1 ]; |
123 iFetchContactsToBeAdded.Remove( count-1 ); |
123 iFetchContactsToBeAdded.Remove( count-1 ); |
128 // not exist need to add |
128 // not exist need to add |
129 iFetchContactsToBeAdded.Compress(); |
129 iFetchContactsToBeAdded.Compress(); |
130 count = iFetchContactsToBeAdded.Count(); |
130 count = iFetchContactsToBeAdded.Count(); |
131 } |
131 } |
132 iFetchContactsToBeAdded.Reset(); |
132 iFetchContactsToBeAdded.Reset(); |
133 TRACE( T_LIT("CVIMPSTStorageVPbkServerStore::ResetAndDestroyLocalArrayL() end") ); |
133 |
134 } |
134 } |
135 // ---------------------------------------------------------- |
135 // ---------------------------------------------------------- |
136 // CVIMPSTStorageVPbkServerStore::LocalStore |
136 // CVIMPSTStorageVPbkServerStore::LocalStore |
137 // ---------------------------------------------------------- |
137 // ---------------------------------------------------------- |
138 // |
138 // |
139 TBool CVIMPSTStorageVPbkServerStore::LocalStore() const |
139 TBool CVIMPSTStorageVPbkServerStore::LocalStore() const |
140 { |
140 { |
141 TRACE( T_LIT("CVIMPSTStorageVPbkServerStore::LocalStore Function begin") ); |
141 TRACER_AUTO; |
142 TRACE( T_LIT("CVIMPSTStorageVPbkServerStore::LocalStore Function End") ); |
|
143 return EFalse; |
142 return EFalse; |
144 } |
143 } |
145 |
144 |
146 // --------------------------------------------------------------------------- |
145 // --------------------------------------------------------------------------- |
147 // CVIMPSTStorageVPbkServerStore::HandleVPbkStoreEventL |
146 // CVIMPSTStorageVPbkServerStore::HandleVPbkStoreEventL |
148 // --------------------------------------------------------------------------- |
147 // --------------------------------------------------------------------------- |
149 // |
148 // |
150 void CVIMPSTStorageVPbkServerStore::HandleVPbkStoreEventL(TVIMPSTVPbkStoreEvent aVPbkStoreEvent) |
149 void CVIMPSTStorageVPbkServerStore::HandleVPbkStoreEventL(TVIMPSTVPbkStoreEvent aVPbkStoreEvent) |
151 { |
150 { |
152 TRACE( T_LIT("CVIMPSTStorageVPbkServerStore::HandleVPbkStoreEventL() begin") ); |
151 TRACER_AUTO; |
153 switch( aVPbkStoreEvent.iEventType ) |
152 switch( aVPbkStoreEvent.iEventType ) |
154 { |
153 { |
155 case EVPbkContactReadCompleted: |
154 case EVPbkContactReadCompleted: |
156 { |
155 { |
157 TRACE( T_LIT("CVIMPSTStorageVPbkServerStore::HandleVPbkStoreEventL() EVPbkContactReadCompleted started") ); |
156 TRACE( "EVPbkContactReadCompleted started" ); |
158 iServiceCacheWriter.NotifyServiceViewL(TVIMPSTEnums::EStorageContactReadComplete); |
157 iServiceCacheWriter.NotifyServiceViewL(TVIMPSTEnums::EStorageContactReadComplete); |
159 if( iFetchStep == EFetchingCalled ) |
158 if( iFetchStep == EFetchingCalled ) |
160 { |
159 { |
161 TRACE( T_LIT("CVIMPSTStorageVPbkServerStore::HandleVPbkStoreEventL() EVPbkContactReadCompleted fetcing in progress ") ); |
160 TRACE( "EVPbkContactReadCompleted fetcing in progress " ); |
162 IssueRequest(); |
161 IssueRequest(); |
163 } |
162 } |
164 TRACE( T_LIT("iFetchStep set to state EContactReadComplete") ); |
163 TRACE( "iFetchStep set to state EContactReadComplete" ); |
165 iFetchStep = EContactReadComplete; |
164 iFetchStep = EContactReadComplete; |
166 TRACE( T_LIT("CVIMPSTStorageVPbkServerStore::HandleVPbkStoreEventL completed") ); |
165 TRACE( " completed" ); |
167 break; |
166 break; |
168 } |
167 } |
169 case EVPbkContactReading: |
168 case EVPbkContactReading: |
170 { |
169 { |
171 TRACE( T_LIT("CVIMPSTStorageVPbkServerStore::HandleVPbkStoreEventL EVPbkContactReading started") ); |
170 TRACE(" EVPbkContactReading started"); |
172 // a contact entry has been created in virtual database store |
171 // a contact entry has been created in virtual database store |
173 // create the cache contact |
172 // create the cache contact |
174 // fetched one by one contact from cdb file |
173 // fetched one by one contact from cdb file |
175 // Add to storage cache |
174 // Add to storage cache |
176 |
175 |
177 iServiceCacheWriter.AddContactToCacheL(*aVPbkStoreEvent.iContactLink , |
176 iServiceCacheWriter.AddContactToCacheL(*aVPbkStoreEvent.iContactLink , |
178 aVPbkStoreEvent.iUserId , |
177 aVPbkStoreEvent.iUserId , |
179 aVPbkStoreEvent.iDisplayName , |
178 aVPbkStoreEvent.iDisplayName , |
180 aVPbkStoreEvent.iAvatarContent, |
179 aVPbkStoreEvent.iAvatarContent, |
181 TVIMPSTEnums::EStorageContactReading ); |
180 TVIMPSTEnums::EStorageContactReading ); |
182 TRACE( T_LIT("CVIMPSTStorageVPbkServerStore::HandleVPbkStoreEventL EVPbkContactReading completed" ) ); |
181 TRACE( "EVPbkContactReading completed" ); |
183 break; |
182 break; |
184 } |
183 } |
185 case EVPbkContactFetching: |
184 case EVPbkContactFetching: |
186 case EVPbkContactAdded: |
185 case EVPbkContactAdded: |
187 { |
186 { |
188 TRACE( T_LIT("CVIMPSTStorageVPbkServerStore::HandleVPbkStoreEventL EVPbkContactAdded or EVPbkContactFetching" ) ); |
187 TRACE( "EVPbkContactAdded or EVPbkContactFetching" ); |
189 TVIMPSTEnums::TVIMPSTStorgaeEventType event = TVIMPSTEnums::EStorageEventContactAddition; |
188 TVIMPSTEnums::TVIMPSTStorgaeEventType event = TVIMPSTEnums::EStorageEventContactAddition; |
190 // a contact entry has been created in virtual database store |
189 // a contact entry has been created in virtual database store |
191 // create the cache contact |
190 // create the cache contact |
192 // fetched one by one contact from cdb file |
191 // fetched one by one contact from cdb file |
193 // Add to storage cache |
192 // Add to storage cache |
200 aVPbkStoreEvent.iDisplayName , |
199 aVPbkStoreEvent.iDisplayName , |
201 aVPbkStoreEvent.iAvatarContent, |
200 aVPbkStoreEvent.iAvatarContent, |
202 event ); |
201 event ); |
203 if(iFetchStep == EFetchingOn) |
202 if(iFetchStep == EFetchingOn) |
204 { |
203 { |
205 TRACE( T_LIT("CVIMPSTStorageVPbkServerStore::HandleVPbkStoreEventL EVPbkContactAdded or EVPbkContactFetching fetchin on" ) ); |
204 TRACE( "EVPbkContactAdded or EVPbkContactFetching fetchin on" ); |
206 IssueRequest(); |
205 IssueRequest(); |
207 } |
206 } |
208 TRACE( T_LIT("CVIMPSTStorageVPbkServerStore::HandleVPbkStoreEventL EVPbkContactAdded or EVPbkContactFetching completed" ) ); |
207 TRACE( " EVPbkContactAdded or EVPbkContactFetching completed" ); |
209 break; |
208 break; |
210 } |
209 } |
211 case EVPbkContactSynchronizing: |
210 case EVPbkContactSynchronizing: |
212 { |
211 { |
213 TRACE( T_LIT("CVIMPSTStorageVPbkServerStore::HandleVPbkStoreEventL EVPbkContactSynchronizing " ) ); |
212 TRACE( "EVPbkContactSynchronizing " ); |
214 // a contact entry has been created in virtual database store |
213 // a contact entry has been created in virtual database store |
215 // create the cache contact |
214 // create the cache contact |
216 // fetched one by one contact from cdb file |
215 // fetched one by one contact from cdb file |
217 // Add to storage cache |
216 // Add to storage cache |
218 iServiceCacheWriter.AddContactToCacheL(*aVPbkStoreEvent.iContactLink , |
217 iServiceCacheWriter.AddContactToCacheL(*aVPbkStoreEvent.iContactLink , |
219 aVPbkStoreEvent.iUserId , |
218 aVPbkStoreEvent.iUserId , |
220 aVPbkStoreEvent.iDisplayName , |
219 aVPbkStoreEvent.iDisplayName , |
221 aVPbkStoreEvent.iAvatarContent, |
220 aVPbkStoreEvent.iAvatarContent, |
222 TVIMPSTEnums::EStorageContactSynchronizing ); |
221 TVIMPSTEnums::EStorageContactSynchronizing ); |
223 TRACE( T_LIT("CVIMPSTStorageVPbkServerStore::HandleVPbkStoreEventL EVPbkContactSynchronizing(iFetchStep): %d " ), iFetchStep ); |
222 TRACE( "EVPbkContactSynchronizing(iFetchStep): %d " , iFetchStep ); |
224 if(iFetchStep == EFetchingOn) |
223 if(iFetchStep == EFetchingOn) |
225 { |
224 { |
226 TRACE( T_LIT("CVIMPSTStorageVPbkServerStore::HandleVPbkStoreEventL EVPbkContactSynchronizing fetchin on" ) ); |
225 TRACE( " EVPbkContactSynchronizing fetchin on" ); |
227 IssueRequest(); |
226 IssueRequest(); |
228 } |
227 } |
229 TRACE( T_LIT("CVIMPSTStorageVPbkServerStore::HandleVPbkStoreEventL EVPbkContactSynchronizing completed" ) ); |
228 TRACE( " EVPbkContactSynchronizing completed" ); |
230 break; |
229 break; |
231 } |
230 } |
232 case EVPbkContactDeleted: |
231 case EVPbkContactDeleted: |
233 { |
232 { |
234 TRACE( T_LIT("CVIMPSTStorageVPbkServerStore::HandleVPbkStoreEventL EVPbkContactDeleted Event") ); |
233 TRACE( "EVPbkContactDeleted Event" ); |
235 // a contact entry has been deleted from virtual database store |
234 // a contact entry has been deleted from virtual database store |
236 // delete from cache contact |
235 // delete from cache contact |
237 // not Needed in case of server contact |
236 // not Needed in case of server contact |
238 iServiceCacheWriter.RemoveContactFromCacheL(*aVPbkStoreEvent.iContactLink, |
237 iServiceCacheWriter.RemoveContactFromCacheL(*aVPbkStoreEvent.iContactLink, |
239 TVIMPSTEnums::EStorageEventContactDelete ); |
238 TVIMPSTEnums::EStorageEventContactDelete ); |
240 TRACE( T_LIT("CVIMPSTStorageVPbkServerStore::HandleVPbkStoreEventL EVPbkContactDeleted Event done") ); |
239 TRACE( " EVPbkContactDeleted Event done" ); |
241 break; |
240 break; |
242 } |
241 } |
243 case EVPbkContactChanged: |
242 case EVPbkContactChanged: |
244 { |
243 { |
245 TRACE( T_LIT("CVIMPSTStorageVPbkServerStore::HandleVPbkStoreEventL EVPbkContactChanged started") ); |
244 TRACE( " EVPbkContactChanged started" ); |
246 // a contact entry has been updated to virtual database store |
245 // a contact entry has been updated to virtual database store |
247 // update to cache contact |
246 // update to cache contact |
248 // not Needed in case of server contact |
247 // not Needed in case of server contact |
249 iServiceCacheWriter.UpdateCacheContactL(*aVPbkStoreEvent.iContactLink , |
248 iServiceCacheWriter.UpdateCacheContactL(*aVPbkStoreEvent.iContactLink , |
250 aVPbkStoreEvent.iUserId , |
249 aVPbkStoreEvent.iUserId , |
251 aVPbkStoreEvent.iDisplayName, |
250 aVPbkStoreEvent.iDisplayName, |
252 aVPbkStoreEvent.iAvatarContent); |
251 aVPbkStoreEvent.iAvatarContent); |
253 if(iFetchStep == EFetchingOn) |
252 if(iFetchStep == EFetchingOn) |
254 { |
253 { |
255 TRACE( T_LIT("CVIMPSTStorageVPbkServerStore::HandleVPbkStoreEventL EVPbkContactAdded or EVPbkContactFetching fetchin on" ) ); |
254 TRACE(" EVPbkContactAdded or EVPbkContactFetching fetchin on" ); |
256 IssueRequest(); |
255 IssueRequest(); |
257 } |
256 } |
258 TRACE( T_LIT("CVIMPSTStorageVPbkServerStore::HandleVPbkStoreEventL EVPbkContactChanged started") ); |
257 TRACE( " EVPbkContactChanged started" ); |
259 break; |
258 break; |
260 } |
259 } |
261 case EVPbkContactRetriving: |
260 case EVPbkContactRetriving: |
262 { |
261 { |
263 TRACE( T_LIT("CVIMPSTStorageVPbkServerStore::HandleVPbkStoreEventL EVPbkContactRetriving started ") ); |
262 TRACE( " EVPbkContactRetriving started " ); |
264 // ONLY VALID USER ID ALLOWED |
263 // ONLY VALID USER ID ALLOWED |
265 if( aVPbkStoreEvent.iUserId.Length() ) |
264 if( aVPbkStoreEvent.iUserId.Length() ) |
266 { |
265 { |
267 TRACE( T_LIT("CVIMPSTStorageVPbkServerStore::HandleVPbkStoreEventL EVPbkContactRetriving valid id ") ); |
266 TRACE( "EVPbkContactRetriving valid id " ); |
268 HBufC* sxpId = aVPbkStoreEvent.iUserId.AllocL(); |
267 HBufC* sxpId = aVPbkStoreEvent.iUserId.AllocL(); |
269 iRetrivedXSPIdArray.Append( sxpId ); // takes the ownership of retrivedContact |
268 iRetrivedXSPIdArray.Append( sxpId ); // takes the ownership of retrivedContact |
270 // keep the backup of retrieved contacts |
269 // keep the backup of retrieved contacts |
271 // user can add later once it sent to server |
270 // user can add later once it sent to server |
272 } |
271 } |
273 TRACE( T_LIT("CVIMPSTStorageVPbkServerStore::HandleVPbkStoreEventL EVPbkContactRetriving done") ); |
272 TRACE( " EVPbkContactRetriving done" ); |
274 break; |
273 break; |
275 } |
274 } |
276 case EVPbkUnknownChanges: |
275 case EVPbkUnknownChanges: |
277 { |
276 { |
278 TRACE( T_LIT("CVIMPSTStorageVPbkServerStore::HandleVPbkStoreEventL EVPbkUnknownChanges Event in") ); |
277 TRACE( " EVPbkUnknownChanges Event in" ); |
279 // unknow mean all contact deleted from store |
278 // unknow mean all contact deleted from store |
280 // Not supported in case of server contact |
279 // Not supported in case of server contact |
281 iServiceCacheWriter.RemoveAllCacheContactsL(); |
280 iServiceCacheWriter.RemoveAllCacheContactsL(); |
282 if(iFetchStep == EFetchingCalled ) |
281 if(iFetchStep == EFetchingCalled ) |
283 { |
282 { |
284 TRACE( T_LIT("CVIMPSTStorageVPbkServerStore::HandleVPbkStoreEventL EVPbkUnknownChanges fetching on") ); |
283 TRACE( " EVPbkUnknownChanges fetching on" ); |
285 IssueRequest(); |
284 IssueRequest(); |
286 } |
285 } |
287 TRACE( T_LIT("CVIMPSTStorageVPbkServerStore::HandleVPbkStoreEventL EVPbkUnknownChanges Event done") ); |
286 TRACE( "EVPbkUnknownChanges Event done" ); |
288 break; |
287 break; |
289 } |
288 } |
290 default: |
289 default: |
291 { |
290 { |
292 TRACE( T_LIT("CVIMPSTStorageVPbkServerStore::HandleVPbkStoreEventL default") ); |
291 TRACE( "default" ); |
293 break; |
292 break; |
294 } |
293 } |
295 } |
294 } |
296 TRACE( T_LIT("CVIMPSTStorageVPbkServerStore::HandleVPbkStoreEventL() End") ); |
295 |
297 } |
296 } |
298 |
297 |
299 |
298 |
300 // -------------------------------------------------------------------------- |
299 // -------------------------------------------------------------------------- |
301 // CVIMPSTStorageVPbkServerStore::IssueRequest |
300 // CVIMPSTStorageVPbkServerStore::IssueRequest |
302 // -------------------------------------------------------------------------- |
301 // -------------------------------------------------------------------------- |
303 // |
302 // |
304 void CVIMPSTStorageVPbkServerStore::IssueRequest() |
303 void CVIMPSTStorageVPbkServerStore::IssueRequest() |
305 { |
304 { |
306 TRACE( T_LIT("CVIMPSTStorageVPbkServerStore::IssueRequest() begin") ); |
305 TRACER_AUTO; |
307 if( !IsActive() ) |
306 if( !IsActive() ) |
308 { |
307 { |
309 TRequestStatus* status = &iStatus; |
308 TRequestStatus* status = &iStatus; |
310 TRACE( T_LIT("CVIMPSTStorageVPbkServerStore::IssueRequest() RequestComplete")); |
309 TRACE( "RequestComplete"); |
311 User::RequestComplete( status, KErrNone ); |
310 User::RequestComplete( status, KErrNone ); |
312 SetActive(); |
311 SetActive(); |
313 } |
312 } |
314 TRACE( T_LIT("CVIMPSTStorageVPbkServerStore::IssueRequest() end") ); |
313 |
315 } |
314 } |
316 |
315 |
317 // -------------------------------------------------------------------------- |
316 // -------------------------------------------------------------------------- |
318 // CVIMPSTStorageVPbkServerStore::RunL |
317 // CVIMPSTStorageVPbkServerStore::RunL |
319 // -------------------------------------------------------------------------- |
318 // -------------------------------------------------------------------------- |
320 // |
319 // |
321 void CVIMPSTStorageVPbkServerStore::RunL() |
320 void CVIMPSTStorageVPbkServerStore::RunL() |
322 { |
321 { |
323 TRACE( T_LIT("CVIMPSTStorageVPbkServerStore::RunL() begin") ); |
322 TRACER_AUTO; |
324 TInt count = iFetchContactsToBeAdded.Count(); |
323 TInt count = iFetchContactsToBeAdded.Count(); |
325 TRACE( T_LIT("CVIMPSTStorageVPbkServerStore::FetchContactsToBeAdded count = %d"),count ); |
324 TRACE( " count = %d",count ); |
326 if( !count ) |
325 if( !count ) |
327 { |
326 { |
328 TRACE( T_LIT("CVIMPSTStorageVPbkServerStore::iFetchStep set to state EContactReadComplete") ); |
327 TRACE(" set to state EContactReadComplete" ); |
329 iFetchStep = EContactReadComplete; |
328 iFetchStep = EContactReadComplete; |
330 iServiceCacheWriter.NotifyServiceViewL( TVIMPSTEnums::EStorageContactFetchComplete ); |
329 iServiceCacheWriter.NotifyServiceViewL( TVIMPSTEnums::EStorageContactFetchComplete ); |
331 TRACE( T_LIT("calling NotifyFetchCompleteL") ); |
330 TRACE( "calling NotifyFetchCompleteL" ); |
332 } |
331 } |
333 else |
332 else |
334 { |
333 { |
335 TRACE( T_LIT("CVIMPSTStorageVPbkServerStore::iFetchStep set to state EFetchingOn") ); |
334 TRACE( " set to state EFetchingOn" ); |
336 iFetchStep = EFetchingOn; |
335 iFetchStep = EFetchingOn; |
337 TVIMPSTContactInfo contactInfoToAdd = iFetchContactsToBeAdded[0]; |
336 TVIMPSTContactInfo contactInfoToAdd = iFetchContactsToBeAdded[0]; |
338 // pass the display NAme in place of NULL |
337 // pass the display NAme in place of NULL |
339 TRACE( T_LIT("calling CreateVPbkContactL") ); |
338 TRACE( "calling CreateVPbkContactL" ); |
340 iVPbkStoreHandler->CreateVPbkContactL( *contactInfoToAdd.iUserId, *contactInfoToAdd.iDisplayName ); // process always 0th item |
339 iVPbkStoreHandler->CreateVPbkContactL( *contactInfoToAdd.iUserId, *contactInfoToAdd.iDisplayName ); // process always 0th item |
341 |
340 |
342 iFetchContactsToBeAdded.Remove( 0 ); |
341 iFetchContactsToBeAdded.Remove( 0 ); |
343 delete contactInfoToAdd.iUserId; |
342 delete contactInfoToAdd.iUserId; |
344 contactInfoToAdd.iUserId = NULL; |
343 contactInfoToAdd.iUserId = NULL; |
345 delete contactInfoToAdd.iDisplayName; |
344 delete contactInfoToAdd.iDisplayName; |
346 contactInfoToAdd.iDisplayName = NULL ; |
345 contactInfoToAdd.iDisplayName = NULL ; |
347 |
346 |
348 iFetchContactsToBeAdded.Compress(); |
347 iFetchContactsToBeAdded.Compress(); |
349 } |
348 } |
350 TRACE( T_LIT("CVIMPSTStorageVPbkServerStore::RunL() end") ); |
349 |
351 } |
350 } |
352 |
351 |
353 // -------------------------------------------------------------------------- |
352 // -------------------------------------------------------------------------- |
354 // CVIMPSTStorageVPbkServerStore::DoCancel |
353 // CVIMPSTStorageVPbkServerStore::DoCancel |
355 // -------------------------------------------------------------------------- |
354 // -------------------------------------------------------------------------- |
356 // |
355 // |
357 void CVIMPSTStorageVPbkServerStore::DoCancel() |
356 void CVIMPSTStorageVPbkServerStore::DoCancel() |
358 { |
357 { |
359 TRACE( T_LIT("CVIMPSTStorageVPbkServerStore::DoCancel begin") ); |
358 TRACER_AUTO; |
360 TRACE( T_LIT("CVIMPSTStorageVPbkServerStore::DoCancel end") ); |
|
361 } |
359 } |
362 |
360 |
363 // -------------------------------------------------------------------------- |
361 // -------------------------------------------------------------------------- |
364 // CVIMPSTStorageVPbkServerStore::RunError |
362 // CVIMPSTStorageVPbkServerStore::RunError |
365 // -------------------------------------------------------------------------- |
363 // -------------------------------------------------------------------------- |
366 // |
364 // |
367 TInt CVIMPSTStorageVPbkServerStore::RunError( TInt aError ) |
365 TInt CVIMPSTStorageVPbkServerStore::RunError( TInt aError ) |
368 { |
366 { |
369 TRACE( T_LIT("CVIMPSTStorageVPbkServerStore::RunError begin") ); |
367 TRACER_AUTO; |
370 TRACE( T_LIT("error code = %d"), aError ); |
368 TRACE( "error code = %d", aError ); |
371 TRACE( T_LIT("CVIMPSTStorageVPbkServerStore::RunError end") ); |
369 |
372 return aError; |
370 return aError; |
373 } |
371 } |
374 |
372 |
375 ////////////////////////////////////////////////////////// |
373 ////////////////////////////////////////////////////////// |
376 // --------------------------------------------------------------------------- |
374 // --------------------------------------------------------------------------- |
392 void CVIMPSTStorageVPbkServerStore::AddVPbkFetchContactsL( RArray <TPtrC>& aFirstNameList, |
390 void CVIMPSTStorageVPbkServerStore::AddVPbkFetchContactsL( RArray <TPtrC>& aFirstNameList, |
393 RArray <TPtrC> &aServiceField ) |
391 RArray <TPtrC> &aServiceField ) |
394 { |
392 { |
395 // in case of server case we delete all contacts and then add fetch contacts |
393 // in case of server case we delete all contacts and then add fetch contacts |
396 // in case of server contacts delete all contacts |
394 // in case of server contacts delete all contacts |
397 TRACE( T_LIT("CVIMPSTStorageVPbkServerStore::AddVPbkFetchContactsL() begin") ); |
395 TRACER_AUTO; |
398 TInt oldContactCount = RemoveAllVPbkContactsL(); |
396 TInt oldContactCount = RemoveAllVPbkContactsL(); |
399 TRACE( T_LIT("CVIMPSTStorageVPbkServerStore::AddVPbkFetchContactsL() oldContactCount = %d"), oldContactCount ); |
397 TRACE( " oldContactCount = %d", oldContactCount ); |
400 ResetAndDestroyLocalArrayL(); |
398 ResetAndDestroyLocalArrayL(); |
401 TInt fetchContactCount = aServiceField.Count(); |
399 TInt fetchContactCount = aServiceField.Count(); |
402 for( TInt i = 0; i<fetchContactCount; i++ ) |
400 for( TInt i = 0; i<fetchContactCount; i++ ) |
403 { |
401 { |
404 TRACE( T_LIT("CVIMPSTStorageVPbkServerStore::FetchContactsToBeAdded Append = %d"),i ); |
402 TRACE( " Append = %d",i ); |
405 TVIMPSTContactInfo contactInf = |
403 TVIMPSTContactInfo contactInf = |
406 { |
404 { |
407 aServiceField[i].AllocL() , |
405 aServiceField[i].AllocL() , |
408 aFirstNameList[i].AllocL() |
406 aFirstNameList[i].AllocL() |
409 }; |
407 }; |
410 iFetchContactsToBeAdded.Append( contactInf ); |
408 iFetchContactsToBeAdded.Append( contactInf ); |
411 } |
409 } |
412 TRACE( T_LIT("CVIMPSTStorageVPbkServerStore::AddVPbkFetchContactsL() iFetchStep = %d"), iFetchStep ); |
410 TRACE( "iFetchStep = %d", iFetchStep ); |
413 if( iFetchStep == EContactReadComplete || !oldContactCount) |
411 if( iFetchStep == EContactReadComplete || !oldContactCount) |
414 { |
412 { |
415 TRACE( T_LIT("CVIMPSTStorageVPbkServerStore::AddVPbkFetchContactsL() inside if") ); |
413 TRACE( "inside if" ); |
416 IssueRequest(); |
414 IssueRequest(); |
417 } |
415 } |
418 else |
416 else |
419 { |
417 { |
420 TRACE( T_LIT("CVIMPSTStorageVPbkServerStore::iFetchStep set to state EFetchingCalled") ); |
418 TRACE( " set to state EFetchingCalled" ); |
421 iFetchStep = EFetchingCalled; |
419 iFetchStep = EFetchingCalled; |
422 } |
420 } |
423 TRACE( T_LIT("CVIMPSTStorageVPbkServerStore::AddVPbkFetchContactsL() end") ); |
421 |
424 } |
422 } |
425 // --------------------------------------------------------------------------- |
423 // --------------------------------------------------------------------------- |
426 // CVIMPSTStorageVPbkServerStore::RemoveVPbkContactL |
424 // CVIMPSTStorageVPbkServerStore::RemoveVPbkContactL |
427 // --------------------------------------------------------------------------- |
425 // --------------------------------------------------------------------------- |
428 // |
426 // |
429 TInt CVIMPSTStorageVPbkServerStore::RemoveVPbkContactL(const MVPbkContactLink& aContactLink) |
427 TInt CVIMPSTStorageVPbkServerStore::RemoveVPbkContactL(const MVPbkContactLink& aContactLink) |
430 { |
428 { |
431 TRACE( T_LIT("CVIMPSTStorageVPbkServerStore::RemoveVPbkContactL() begin") ); |
429 TRACER_AUTO;; |
432 // text now holds the name (or first field of the contact) |
430 // text now holds the name (or first field of the contact) |
433 CVPbkContactLinkArray* contactsToDelete = CVPbkContactLinkArray::NewLC(); |
431 CVPbkContactLinkArray* contactsToDelete = CVPbkContactLinkArray::NewLC(); |
434 MVPbkContactLink* link = aContactLink.CloneLC(); |
432 MVPbkContactLink* link = aContactLink.CloneLC(); |
435 contactsToDelete->AppendL( link ); // takes ownership |
433 contactsToDelete->AppendL( link ); // takes ownership |
436 CleanupStack::Pop(); // link |
434 CleanupStack::Pop(); // link |
437 TInt error = iVPbkStoreHandler->RemoveVPbkContactL( *contactsToDelete ); |
435 TInt error = iVPbkStoreHandler->RemoveVPbkContactL( *contactsToDelete ); |
438 CleanupStack::PopAndDestroy(); // contactsToDelete |
436 CleanupStack::PopAndDestroy(); // contactsToDelete |
439 TRACE( T_LIT("CVIMPSTStorageVPbkServerStore::returned error code = %d"), error ); |
437 TRACE( " error code = %d", error ); |
440 TRACE( T_LIT("CVIMPSTStorageVPbkServerStore::RemoveVPbkContactL() end") ); |
438 |
441 return error; |
439 return error; |
442 } |
440 } |
443 |
441 |
444 // --------------------------------------------------------------------------- |
442 // --------------------------------------------------------------------------- |
445 // CVIMPSTStorageVPbkServerStore::RemoveAllVPbkContactsL |
443 // CVIMPSTStorageVPbkServerStore::RemoveAllVPbkContactsL |
446 // --------------------------------------------------------------------------- |
444 // --------------------------------------------------------------------------- |
447 // |
445 // |
448 TInt CVIMPSTStorageVPbkServerStore::RemoveAllVPbkContactsL() |
446 TInt CVIMPSTStorageVPbkServerStore::RemoveAllVPbkContactsL() |
449 { |
447 { |
450 TRACE( T_LIT("CVIMPSTStorageVPbkServerStore::RemoveAllVPbkContactsL() begin") ); |
448 TRACER_AUTO; |
451 iRetrivedXSPIdArray.ResetAndDestroy(); |
449 iRetrivedXSPIdArray.ResetAndDestroy(); |
452 return iVPbkStoreHandler->RemoveAllVPbkContactsL(); |
450 return iVPbkStoreHandler->RemoveAllVPbkContactsL(); |
453 } |
451 } |
454 // --------------------------------------------------------------------------- |
452 // --------------------------------------------------------------------------- |
455 // CVIMPSTStorageVPbkServerStore::RetrieveVPbkXSPIdL |
453 // CVIMPSTStorageVPbkServerStore::RetrieveVPbkXSPIdL |
456 // --------------------------------------------------------------------------- |
454 // --------------------------------------------------------------------------- |
457 // |
455 // |
458 TInt CVIMPSTStorageVPbkServerStore::RetrieveVPbkXSPIdL(const TDesC8& aPackedLinks ) |
456 TInt CVIMPSTStorageVPbkServerStore::RetrieveVPbkXSPIdL(const TDesC8& aPackedLinks ) |
459 { |
457 { |
460 TRACE( T_LIT("CVIMPSTStorageVPbkServerStore::RetrieveVPbkContactL() begin") ); |
458 TRACER_AUTO; |
461 iRetrivedXSPIdArray.ResetAndDestroy(); |
459 iRetrivedXSPIdArray.ResetAndDestroy(); |
462 TRACE( T_LIT("CVIMPSTStorageVPbkLocalStore::RetrieveVPbkXSPIdL() iRetrivedXSPIdArray Reset" ) ); |
460 TRACE( " iRetrivedXSPIdArray Reset" ); |
463 iVPbkStoreHandler->RetrieveVPbkContactL( aPackedLinks ); |
461 iVPbkStoreHandler->RetrieveVPbkContactL( aPackedLinks ); |
464 TRACE( T_LIT("CVIMPSTStorageVPbkServerStore::RetrieveVPbkContactL() end") ); |
462 |
465 return iRetrivedXSPIdArray.Count(); |
463 return iRetrivedXSPIdArray.Count(); |
466 } |
464 } |
467 |
465 |
468 // --------------------------------------------------------------------------- |
466 // --------------------------------------------------------------------------- |
469 // CVIMPSTStorageVPbkServerStore::GetRetrieveVPbkXSPIdL |
467 // CVIMPSTStorageVPbkServerStore::GetRetrieveVPbkXSPIdL |
470 // --------------------------------------------------------------------------- |
468 // --------------------------------------------------------------------------- |
471 // |
469 // |
472 const TDesC& CVIMPSTStorageVPbkServerStore::GetRetrieveVPbkXSPIdL(TInt aIndex ) |
470 const TDesC& CVIMPSTStorageVPbkServerStore::GetRetrieveVPbkXSPIdL(TInt aIndex ) |
473 { |
471 { |
474 TRACE( T_LIT("CVIMPSTStorageVPbkServerStore::RetrieveVPbkXSPIdL() begin") ); |
472 TRACER_AUTO; |
475 HBufC* contactId = NULL; |
473 HBufC* contactId = NULL; |
476 if( aIndex >= 0 && aIndex < iRetrivedXSPIdArray.Count() ) |
474 if( aIndex >= 0 && aIndex < iRetrivedXSPIdArray.Count() ) |
477 { |
475 { |
478 contactId = iRetrivedXSPIdArray[ aIndex ]; |
476 contactId = iRetrivedXSPIdArray[ aIndex ]; |
479 } |
477 } |
480 if( contactId ) |
478 if( contactId ) |
481 { |
479 { |
482 TRACE( T_LIT("CVIMPSTStorageVPbkServerStore::RetrieveVPbkXSPIdL() end") ); |
480 TRACE( "RetrieveVPbkXSPIdL() end"); |
483 return *contactId; |
481 return *contactId; |
484 } |
482 } |
485 TRACE( T_LIT("CVIMPSTStorageVPbkServerStore::RetrieveVPbkXSPIdL() end") ); |
483 |
486 return KNullDesC ; |
484 return KNullDesC ; |
487 } |
485 } |
488 // --------------------------------------------------------------------------- |
486 // --------------------------------------------------------------------------- |
489 // CVIMPSTStorageVPbkServerStore::CreateRetriveVPbkContactL |
487 // CVIMPSTStorageVPbkServerStore::CreateRetriveVPbkContactL |
490 // --------------------------------------------------------------------------- |
488 // --------------------------------------------------------------------------- |
491 // |
489 // |
492 TInt CVIMPSTStorageVPbkServerStore::CreateRetriveVPbkContactL( TInt /*aIndexToUse*/ ) |
490 TInt CVIMPSTStorageVPbkServerStore::CreateRetriveVPbkContactL( TInt /*aIndexToUse*/ ) |
493 { |
491 { |
494 TRACE( T_LIT("CVIMPSTStorageVPbkServerStore::CreateRetriveVPbkContactL()") ); |
492 TRACER_AUTO; |
495 // Not applicable for server store |
493 // Not applicable for server store |
496 return KErrNotSupported; |
494 return KErrNotSupported; |
497 } |
495 } |
498 // --------------------------------------------------------------------------- |
496 // --------------------------------------------------------------------------- |
499 // CVIMPSTStorageVPbkServerStore::deleteRetriveVPbkContactL |
497 // CVIMPSTStorageVPbkServerStore::deleteRetriveVPbkContactL |
500 // --------------------------------------------------------------------------- |
498 // --------------------------------------------------------------------------- |
501 // |
499 // |
502 TInt CVIMPSTStorageVPbkServerStore::deleteRetriveVPbkContactL( TInt /*aIndexToUse*/ ) |
500 TInt CVIMPSTStorageVPbkServerStore::deleteRetriveVPbkContactL( TInt /*aIndexToUse*/ ) |
503 { |
501 { |
504 TRACE( T_LIT("CVIMPSTStorageVPbkServerStore::deleteRetriveVPbkContactL()") ); |
502 TRACER_AUTO; |
505 // Not applicable for server store |
503 // Not applicable for server store |
506 return KErrNotSupported; |
504 return KErrNotSupported; |
507 } |
505 } |
508 // CVIMPSTStorageVPbkServerStore::UpdateAvatarFieldDataL() |
506 // CVIMPSTStorageVPbkServerStore::UpdateAvatarFieldDataL() |
509 // --------------------------------------------------------------------------- |
507 // --------------------------------------------------------------------------- |
510 // |
508 // |
511 TInt CVIMPSTStorageVPbkServerStore::UpdateAvatarFieldDataL(const MVPbkContactLink& aContactLink, |
509 TInt CVIMPSTStorageVPbkServerStore::UpdateAvatarFieldDataL(const MVPbkContactLink& aContactLink, |
512 const TDesC8& aAvatartData ) |
510 const TDesC8& aAvatartData ) |
513 { |
511 { |
514 TRACE( T_LIT("CVIMPSTStorageVPbkServerStore::UpdateAvatarFieldDataL() ") ); |
512 TRACER_AUTO; |
515 return iVPbkStoreHandler->UpdateAvatarFieldDataL( aContactLink, aAvatartData ); |
513 return iVPbkStoreHandler->UpdateAvatarFieldDataL( aContactLink, aAvatartData ); |
516 } |
514 } |
517 |
515 |
518 // --------------------------------------------------------------------------- |
516 // --------------------------------------------------------------------------- |
519 // CVIMPSTStorageVPbkServerStore::RemoveAvatarFieldL() |
517 // CVIMPSTStorageVPbkServerStore::RemoveAvatarFieldL() |
520 // --------------------------------------------------------------------------- |
518 // --------------------------------------------------------------------------- |
521 // |
519 // |
522 TInt CVIMPSTStorageVPbkServerStore::RemoveAvatarFieldL(MVPbkStoreContact& aStoreContact) |
520 TInt CVIMPSTStorageVPbkServerStore::RemoveAvatarFieldL(MVPbkStoreContact& aStoreContact) |
523 { |
521 { |
524 TRACE( T_LIT("CVIMPSTStorageVPbkServerStore::RemoveAvatarFieldL()") ); |
522 TRACER_AUTO; |
525 return iVPbkStoreHandler->RemoveAvatarFieldL( aStoreContact ); |
523 return iVPbkStoreHandler->RemoveAvatarFieldL( aStoreContact ); |
526 } |
524 } |
527 |
525 |
528 // ---------------------------------------------------------- |
526 // ---------------------------------------------------------- |
529 // CVIMPSTStorageVPbkServerStore::DeleteDatabaseL |
527 // CVIMPSTStorageVPbkServerStore::DeleteDatabaseL |
530 // ---------------------------------------------------------- |
528 // ---------------------------------------------------------- |
531 void CVIMPSTStorageVPbkServerStore::DeleteDatabaseL() |
529 void CVIMPSTStorageVPbkServerStore::DeleteDatabaseL() |
532 { |
530 { |
533 TRACE( T_LIT("CVIMPSTStorageVPbkServerStore::DeleteDatabaseL begin") ); |
531 TRACER_AUTO; |
534 // TODO : Not supported yet |
532 // TODO : Not supported yet |
535 TRACE( T_LIT("CVIMPSTStorageVPbkServerStore::DeleteDatabaseL end") ); |
533 |
536 } |
534 } |
537 // End of file |
535 // End of file |
538 |
536 |
539 |
537 |