omads/omadsextensions/adapters/agenda/src/nsmlagendadatastore.cpp
branchRCL_3
changeset 67 2abf74df9cdc
parent 61 57a9de0b82e8
equal deleted inserted replaced
61:57a9de0b82e8 67:2abf74df9cdc
    32 #include <sysutil.h>
    32 #include <sysutil.h>
    33 #include <SmlDataProvider.h>
    33 #include <SmlDataProvider.h>
    34 #include <SmlDataFormat.h>
    34 #include <SmlDataFormat.h>
    35 #include <SmlDataSyncDefs.h>
    35 #include <SmlDataSyncDefs.h>
    36 #include <data_caging_path_literals.hrh>
    36 #include <data_caging_path_literals.hrh>
    37 #include <nsmlagendadatastore_1_1_2.rsg>
    37 #include <NSmlAgendaDataStore_1_1_2.rsg>
    38 #include <e32property.h>
    38 #include <e32property.h>
    39 #include <DataSyncInternalPSKeys.h>
    39 #include <DataSyncInternalPSKeys.h>
    40 #include <CalenImporter.h>
    40 #include <CalenImporter.h>
    41 #include <CalenInterimUtils2.h>
    41 #include <CalenInterimUtils2.h>
    42 #include <utf.h>
    42 #include <utf.h>
   215     if ( iCommittedUidArr )
   215     if ( iCommittedUidArr )
   216        {
   216        {
   217        iCommittedUidArr->Reset();
   217        iCommittedUidArr->Reset();
   218        delete iCommittedUidArr;
   218        delete iCommittedUidArr;
   219        }
   219        }
   220     
       
   221      delete iAgendaAdapterLog;
       
   222 	FLOG(_L("CNSmlAgendaDataStore::~CNSmlAgendaDataStore(): END"));
   220 	FLOG(_L("CNSmlAgendaDataStore::~CNSmlAgendaDataStore(): END"));
   223 	}
   221 	}
   224 
   222 
   225 // -----------------------------------------------------------------------------
   223 // -----------------------------------------------------------------------------
   226 // CNSmlAgendaDataStore::DoOpenL
   224 // CNSmlAgendaDataStore::DoOpenL
   255 	TInt err( KErrNone );	
   253 	TInt err( KErrNone );	
   256 	if ( aStoreName == KNSmlAgendaFileNameForDefaultDB )
   254 	if ( aStoreName == KNSmlAgendaFileNameForDefaultDB )
   257 		{
   255 		{
   258 		FLOG(_L("CNSmlAgendaDataStore::DoOpenL: Calling the OpenStoreL: '%S'"), &aStoreName);
   256 		FLOG(_L("CNSmlAgendaDataStore::DoOpenL: Calling the OpenStoreL: '%S'"), &aStoreName);
   259 		TRAP( err, OpenStoreL() );
   257 		TRAP( err, OpenStoreL() );
   260 		}    
   258 		}
       
   259     else 
       
   260     	{
       
   261     	// Provided profile is created from the DS Application
       
   262     	FLOG(_L("CNSmlAgendaDataStore::DoOpenL: storename: '%S'"), &aStoreName);    	
       
   263     	if ( iOpenedStoreName )
       
   264             {
       
   265             delete iOpenedStoreName;
       
   266             iOpenedStoreName = NULL;
       
   267             }
       
   268         iOpenedStoreName = aStoreName.AllocL();  
       
   269         
       
   270         CCalSession* calsession = CCalSession::NewL();
       
   271         CleanupStack::PushL(calsession);
       
   272         TRAP( err, calsession->OpenL( aStoreName ) );
       
   273         if ( err )
       
   274             {
       
   275             FLOG(_L("CNSmlAgendaDataStore::DoOpenL: Cannot open the session: '%d'"), err); 
       
   276             CleanupStack::PopAndDestroy( calsession ); 
       
   277             User::RequestComplete( iCallerStatus, err );
       
   278             return;
       
   279             }
       
   280             
       
   281         // Disable notifications
       
   282         TRAP_IGNORE( calsession->DisablePubSubNotificationsL() );
       
   283         TRAP_IGNORE( calsession->DisableChangeBroadcast() );    
       
   284         // Get ID of database
       
   285         calsession->FileIdL( iOpenedStoreId );
       
   286         
       
   287         // Close the session
       
   288         CleanupStack::PopAndDestroy( calsession ); 
       
   289     	}
   261 		
   290 		
   262 	if ( err )
   291 	if ( err )
   263 	    {
   292 	    {
   264 	    User::RequestComplete( iCallerStatus, err );
   293 	    User::RequestComplete( iCallerStatus, err );
   265 	    return;
   294 	    return;
   272 		iChangeFinder = NULL;
   301 		iChangeFinder = NULL;
   273 		}
   302 		}
   274 	
   303 	
   275 	iChangeFinder = CNSmlChangeFinder::NewL( aContext, iKey, iHasHistory,
   304 	iChangeFinder = CNSmlChangeFinder::NewL( aContext, iKey, iHasHistory,
   276 	                                         KNSmlAgendaAdapterImplUid );
   305 	                                         KNSmlAgendaAdapterImplUid );
   277 	if (iAgendaAdapterLog)
       
   278 	    {
       
   279 	    delete iAgendaAdapterLog;
       
   280 	    iAgendaAdapterLog = NULL;
       
   281 	    }
       
   282 	iAgendaAdapterLog = CNSmlAgendaAdapterLog::NewL( aContext );
   306 	iAgendaAdapterLog = CNSmlAgendaAdapterLog::NewL( aContext );
   283 	iState = ENSmlOpenAndWaiting;
   307 	iState = ENSmlOpenAndWaiting;
   284     User::RequestComplete( iCallerStatus, err );
   308     User::RequestComplete( iCallerStatus, err );
   285 	    
   309 	    
   286 	FLOG(_L("CNSmlAgendaDataStore::DoOpenL: END"));
   310 	FLOG(_L("CNSmlAgendaDataStore::DoOpenL: END"));