292 // --------------------------------------------------------------------------- |
292 // --------------------------------------------------------------------------- |
293 // |
293 // |
294 void CCchImpl::GetServicesL( TCCHSubserviceType aType, |
294 void CCchImpl::GetServicesL( TCCHSubserviceType aType, |
295 RPointerArray<CCchService>& aServices ) |
295 RPointerArray<CCchService>& aServices ) |
296 { |
296 { |
|
297 CCHLOGSTRING( "CCchImpl::GetServicesL: IN" ); |
|
298 |
|
299 CleanupClosePushL( aServices ); // CS: 1 |
|
300 |
297 TInt error = KErrNone; |
301 TInt error = KErrNone; |
298 TServiceSelection selection( 0, aType, ECchInitial ); |
302 TServiceSelection selection( 0, aType, ECchInitial ); |
299 CCHLOGSTRING( "CCchImpl::GetServices: IN" ); |
303 |
300 CCchServiceImpl* cchServiceImpl = NULL; |
304 CCchServiceImpl* cchServiceImpl = NULL; |
301 CArrayFixFlat<TCCHService>* cchServices; |
305 CArrayFixFlat<TCCHService>* cchServices; |
302 cchServices = new (ELeave) CArrayFixFlat<TCCHService>(1); |
306 cchServices = new (ELeave) CArrayFixFlat<TCCHService>(1); |
303 CleanupStack::PushL( cchServices ); |
307 CleanupStack::PushL( cchServices ); // CS: 2 |
304 error = GetCchServicesL( 0, aType, *cchServices ); |
308 error = GetCchServicesL( 0, aType, *cchServices ); |
|
309 |
305 if( KErrNone == error ) |
310 if( KErrNone == error ) |
306 { |
311 { |
307 for ( TInt i = 0; i < cchServices->Count(); i++ ) |
312 for ( TInt i = 0; i < cchServices->Count(); i++ ) |
308 { |
313 { |
309 TCCHService service = cchServices->At( i ); |
314 TCCHService service = cchServices->At( i ); |
310 TInt idx = FindService( service.iServiceId ); |
315 TInt idx = FindService( service.iServiceId ); |
311 if( idx == KErrNotFound ) |
316 |
|
317 if( KErrNotFound == idx ) |
312 { |
318 { |
313 cchServiceImpl = CCchServiceImpl::NewL( *this, service.iServiceId, |
319 cchServiceImpl = CCchServiceImpl::NewLC( *this, // CS: 3 |
314 *iCchUi ); |
320 service.iServiceId, *iCchUi ); |
315 error = iCchServiceImpls.Append( cchServiceImpl ); |
321 iCchServiceImpls.AppendL( cchServiceImpl ); |
316 if( error == KErrNone ) |
322 CleanupStack::Pop( cchServiceImpl ); // CS: 2 |
317 { |
|
318 cchServiceImpl = iCchServiceImpls[ iCchServiceImpls.Count() - 1 ]; |
|
319 } |
|
320 else |
|
321 { |
|
322 delete cchServiceImpl; |
|
323 cchServiceImpl = NULL; |
|
324 } |
|
325 } |
323 } |
326 else |
324 else |
327 { |
325 { |
328 cchServiceImpl = iCchServiceImpls[ idx ]; |
326 cchServiceImpl = iCchServiceImpls[ idx ]; |
329 } |
327 } |
330 error = aServices.Append( cchServiceImpl ); |
328 |
331 if( error ) |
329 aServices.AppendL( cchServiceImpl ); |
332 { |
|
333 delete cchServiceImpl; |
|
334 cchServiceImpl = NULL; |
|
335 } |
|
336 } |
330 } |
337 } |
331 } |
|
332 |
338 cchServices->Reset(); |
333 cchServices->Reset(); |
339 CleanupStack::PopAndDestroy( cchServices ); |
334 CleanupStack::PopAndDestroy( cchServices ); // CS: 1 |
340 CCHLOGSTRING( "CCchImpl::GetServices: OUT" ); |
|
341 User::LeaveIfError( error ); |
335 User::LeaveIfError( error ); |
|
336 CleanupStack::Pop( &aServices ); // CS: 0 |
|
337 |
|
338 CCHLOGSTRING( "CCchImpl::GetServicesL: OUT" ); |
342 } |
339 } |
343 |
340 |
344 // --------------------------------------------------------------------------- |
341 // --------------------------------------------------------------------------- |
345 // CCCHServiceHandler::FindService |
342 // CCCHServiceHandler::FindService |
346 // --------------------------------------------------------------------------- |
343 // --------------------------------------------------------------------------- |