diff -r 57a9de0b82e8 -r 2abf74df9cdc omads/omadsextensions/adapters/agenda/src/nsmlagendadatastore.cpp --- a/omads/omadsextensions/adapters/agenda/src/nsmlagendadatastore.cpp Wed Sep 15 11:57:08 2010 +0300 +++ b/omads/omadsextensions/adapters/agenda/src/nsmlagendadatastore.cpp Wed Oct 13 14:15:45 2010 +0300 @@ -34,7 +34,7 @@ #include #include #include -#include +#include #include #include #include @@ -217,8 +217,6 @@ iCommittedUidArr->Reset(); delete iCommittedUidArr; } - - delete iAgendaAdapterLog; FLOG(_L("CNSmlAgendaDataStore::~CNSmlAgendaDataStore(): END")); } @@ -257,7 +255,38 @@ { FLOG(_L("CNSmlAgendaDataStore::DoOpenL: Calling the OpenStoreL: '%S'"), &aStoreName); TRAP( err, OpenStoreL() ); - } + } + else + { + // Provided profile is created from the DS Application + FLOG(_L("CNSmlAgendaDataStore::DoOpenL: storename: '%S'"), &aStoreName); + if ( iOpenedStoreName ) + { + delete iOpenedStoreName; + iOpenedStoreName = NULL; + } + iOpenedStoreName = aStoreName.AllocL(); + + CCalSession* calsession = CCalSession::NewL(); + CleanupStack::PushL(calsession); + TRAP( err, calsession->OpenL( aStoreName ) ); + if ( err ) + { + FLOG(_L("CNSmlAgendaDataStore::DoOpenL: Cannot open the session: '%d'"), err); + CleanupStack::PopAndDestroy( calsession ); + User::RequestComplete( iCallerStatus, err ); + return; + } + + // Disable notifications + TRAP_IGNORE( calsession->DisablePubSubNotificationsL() ); + TRAP_IGNORE( calsession->DisableChangeBroadcast() ); + // Get ID of database + calsession->FileIdL( iOpenedStoreId ); + + // Close the session + CleanupStack::PopAndDestroy( calsession ); + } if ( err ) { @@ -274,11 +303,6 @@ iChangeFinder = CNSmlChangeFinder::NewL( aContext, iKey, iHasHistory, KNSmlAgendaAdapterImplUid ); - if (iAgendaAdapterLog) - { - delete iAgendaAdapterLog; - iAgendaAdapterLog = NULL; - } iAgendaAdapterLog = CNSmlAgendaAdapterLog::NewL( aContext ); iState = ENSmlOpenAndWaiting; User::RequestComplete( iCallerStatus, err );