equal
deleted
inserted
replaced
29 // --------------------------------------------------------- |
29 // --------------------------------------------------------- |
30 // |
30 // |
31 EXPORT_C TInt TXdmSettingsApi::CreateCollectionL( const CXdmSettingsCollection& aCollection ) |
31 EXPORT_C TInt TXdmSettingsApi::CreateCollectionL( const CXdmSettingsCollection& aCollection ) |
32 { |
32 { |
33 #ifdef _DEBUG |
33 #ifdef _DEBUG |
34 WriteToLog( _L8( "TXdmSettingsApi::CreateCollectionL() - begin" ) ); |
34 WriteToLog( _L8( "TXdmSettingsApi::CreateCollectionL()" ) ); |
35 #endif |
35 #endif |
36 TInt error = KErrArgument; |
36 TInt error = KErrArgument; |
37 CRepository* repository = CRepository::NewL( KCRUidXdmEngine ); |
37 CRepository* repository = CRepository::NewL( KCRUidXdmEngine ); |
38 CleanupStack::PushL( repository ); // CS: 1 |
38 CleanupStack::PushL( repository ); |
39 TInt row = LastRow( repository ); |
39 TInt row = LastRow( repository ); |
40 TInt count = aCollection.Count(); |
40 TInt count = aCollection.Count(); |
41 __ASSERT_DEBUG( count > 0, User::Leave( KErrArgument ) ); |
41 __ASSERT_DEBUG( count > 0, User::Leave( KErrArgument ) ); |
42 for( TInt i = 0;i < count;i++ ) |
42 for( TInt i = 0;i < count;i++ ) |
43 { |
43 { |
362 // --------------------------------------------------------- |
362 // --------------------------------------------------------- |
363 // |
363 // |
364 EXPORT_C CDesCArray* TXdmSettingsApi::CollectionNamesLC( RArray<TInt>& aSettingIds ) |
364 EXPORT_C CDesCArray* TXdmSettingsApi::CollectionNamesLC( RArray<TInt>& aSettingIds ) |
365 { |
365 { |
366 #ifdef _DEBUG |
366 #ifdef _DEBUG |
367 WriteToLog( _L8( "TXdmSettingsApi::CollectionNamesLC() - begin" ) ); |
367 WriteToLog( _L8( "TXdmSettingsApi::CollectionNamesL()" ) ); |
368 #endif |
368 #endif |
369 TInt nameError = KErrNone; |
|
370 TInt idError = KErrNone; |
|
371 TInt error = KErrNone; |
369 TInt error = KErrNone; |
372 CDesCArrayFlat* propertySet = new ( ELeave ) CDesCArrayFlat( 10 ); |
370 CDesCArrayFlat* propertySet = new ( ELeave ) CDesCArrayFlat( 10 ); |
373 CleanupStack::PushL( propertySet ); |
371 CleanupStack::PushL( propertySet ); |
374 CRepository* repository = CRepository::NewL( KCRUidXdmEngine ); |
372 CRepository* repository = CRepository::NewL( KCRUidXdmEngine ); |
375 CleanupStack::PushL( repository ); |
373 CleanupStack::PushL( repository ); |
390 for( TInt i = 0;i < count;i++ ) |
388 for( TInt i = 0;i < count;i++ ) |
391 { |
389 { |
392 identifier.Zero(); |
390 identifier.Zero(); |
393 name = HBufC::NewLC( NCentralRepositoryConstants::KMaxUnicodeStringLength ); |
391 name = HBufC::NewLC( NCentralRepositoryConstants::KMaxUnicodeStringLength ); |
394 TPtr desc( name->Des()); |
392 TPtr desc( name->Des()); |
395 nameError = repository->Get( nameKeys[i], desc ); |
393 error = repository->Get( nameKeys[i], desc ); |
396 idError = repository->Get( idKeys[i], identifier ); |
394 error = repository->Get( idKeys[i], identifier ); |
397 if( idError == KErrNone && desc.Length() > 0 && identifier.Length() > 0 ) |
395 if( error == KErrNone && desc.Length() > 0 && identifier.Length() > 0 ) |
398 { |
396 { |
399 #ifdef _DEBUG |
397 #ifdef _DEBUG |
400 HBufC8* eightName = HBufC8::NewLC( desc.Length() ); |
398 HBufC8* eightName = HBufC8::NewLC( desc.Length() ); |
401 TPtr8 eightDesc( eightName->Des() ); |
399 TPtr8 eightDesc( eightName->Des() ); |
402 eightDesc.Copy( desc ); |
400 eightDesc.Copy( desc ); |
404 CleanupStack::PopAndDestroy(); //eightName |
402 CleanupStack::PopAndDestroy(); //eightName |
405 #endif |
403 #endif |
406 propertySet->AppendL( desc ); |
404 propertySet->AppendL( desc ); |
407 TLex id( identifier ); |
405 TLex id( identifier ); |
408 error = id.Val( numId ); |
406 error = id.Val( numId ); |
409 aSettingIds.AppendL( error == KErrNone ? numId : error ); |
407 aSettingIds.Append( error == KErrNone ? numId : error ); |
410 } |
408 } |
411 else |
409 else |
412 { |
410 { |
413 #ifdef _DEBUG |
411 #ifdef _DEBUG |
414 WriteToLog( _L8( " Fetching of the name no. %d failed with idError:%d & nameError:%d" ), i, idError, nameError ); |
412 WriteToLog( _L8( " Fetching of the name no. %d failed with: %d" ), i, error ); |
415 #endif |
413 #endif |
416 } |
414 } |
417 CleanupStack::PopAndDestroy(); //name |
415 CleanupStack::PopAndDestroy(); //name |
418 } |
416 } |
419 } |
417 } |
420 CleanupStack::PopAndDestroy( 3 ); //idKeys, nameKeys, repository |
418 CleanupStack::PopAndDestroy( 3 ); //idKeys, nameKeys, repository |
421 #ifdef _DEBUG |
|
422 WriteToLog( _L8( "TXdmSettingsApi::CollectionNamesLC() - end" ) ); |
|
423 #endif |
|
424 return propertySet; |
419 return propertySet; |
425 } |
420 } |
426 |
421 |
427 // --------------------------------------------------------- |
422 // --------------------------------------------------------- |
428 // TXdmSettingsApi::SettingsCollectionLC |
423 // TXdmSettingsApi::SettingsCollectionLC |
521 #endif |
516 #endif |
522 error = count > 0 ? KErrGeneral : KErrNotFound; |
517 error = count > 0 ? KErrGeneral : KErrNotFound; |
523 User::Leave( error ); |
518 User::Leave( error ); |
524 } |
519 } |
525 CleanupStack::PopAndDestroy( 2 ); //keys, repository |
520 CleanupStack::PopAndDestroy( 2 ); //keys, repository |
526 WriteToLog( _L8( " Return: %S" ), buf ); |
|
527 return buf; |
521 return buf; |
528 } |
522 } |
529 |
523 |
530 // End of File |
524 // End of File |
531 |
525 |