syncmlfw/ds/dsutils/ProfileUtil/src/NsmlProfileUtil.cpp
changeset 73 ae69c2e8bc34
parent 66 08c8318ec9cb
equal deleted inserted replaced
71:d2517372cc44 73:ae69c2e8bc34
   155 EXPORT_C void CNsmlProfileUtil::InternalizeFromSettingsDBL(TInt aProfileId)
   155 EXPORT_C void CNsmlProfileUtil::InternalizeFromSettingsDBL(TInt aProfileId)
   156 {
   156 {
   157 
   157 
   158     DBG_FILE(_S8("CNsmlProfileUtil::InternalizeFromSettingsDBL, BEGIN"));
   158     DBG_FILE(_S8("CNsmlProfileUtil::InternalizeFromSettingsDBL, BEGIN"));
   159     // Read the profile details from settings database
   159     // Read the profile details from settings database
   160 	CNSmlDSSettings* dsSettings = CNSmlDSSettings::NewL();	       
   160 	CNSmlDSSettings* dsSettings = CNSmlDSSettings::NewL();	 
       
   161 	CleanupStack::PushL(dsSettings);      
   161 	CNSmlDSProfile* profile = dsSettings->ProfileL( aProfileId );
   162 	CNSmlDSProfile* profile = dsSettings->ProfileL( aProfileId );
   162 	
   163 	CleanupStack::PushL(profile);  
       
   164 		
   163 	iProfileId = aProfileId;	
   165 	iProfileId = aProfileId;	
   164 	iDisplayName = 	profile->StrValue( EDSProfileDisplayName ).AllocL();
   166 	iDisplayName = 	profile->StrValue( EDSProfileDisplayName ).AllocL();
   165 	iProtocolVer = static_cast<TSmlProtocolVersion>( profile->IntValue( EDSProfileProtocolVersion ) );	
   167 	iProtocolVer = static_cast<TSmlProtocolVersion>( profile->IntValue( EDSProfileProtocolVersion ) );	
   166 	iTransportId=static_cast<TSmlTransportId>( profile->IntValue( EDSProfileTransportId ) );
   168 	iTransportId=static_cast<TSmlTransportId>( profile->IntValue( EDSProfileTransportId ) );
   167 	iIapId=profile->IntValue(EDSProfileIAPId);
   169 	iIapId=profile->IntValue(EDSProfileIAPId);
   176 
   178 
   177 	// Read content types
   179 	// Read content types
   178 	for ( int i = 0; i < profile->iContentTypes->Count(); i++ ) 
   180 	for ( int i = 0; i < profile->iContentTypes->Count(); i++ ) 
   179 	{
   181 	{
   180 	    CNsmlContentData* contentData = CNsmlContentData::NewL();
   182 	    CNsmlContentData* contentData = CNsmlContentData::NewL();
   181 	    
   183 	    CleanupStack::PushL(contentData);  
   182 	    // From settings DB
   184 	    // From settings DB
   183 	    CNSmlDSContentType* contentType = static_cast<CNSmlDSContentType*>(profile->iContentTypes->At(i));
   185 	    CNSmlDSContentType* contentType = static_cast<CNSmlDSContentType*>(profile->iContentTypes->At(i));
   184 	   
   186 	   
   185 	    // Fill the local content data 			
   187 	    // Fill the local content data 			
   186 	    contentData->SetServerDataSourceL(contentType->StrValue(EDSAdapterServerDataSource));		    
   188 	    contentData->SetServerDataSourceL(contentType->StrValue(EDSAdapterServerDataSource));		    
   188 	    contentData->SetContentEnabled(contentType->IntValue(EDSAdapterEnabled));
   190 	    contentData->SetContentEnabled(contentType->IntValue(EDSAdapterEnabled));
   189 	    
   191 	    
   190 	    //SyncType is same for all the contents from UI
   192 	    //SyncType is same for all the contents from UI
   191 	    iSyncType=static_cast<TSmlSyncType>(contentType->IntValue(EDSAdapterSyncType));
   193 	    iSyncType=static_cast<TSmlSyncType>(contentType->IntValue(EDSAdapterSyncType));
   192 	    // Add to this object
   194 	    // Add to this object
   193 	    iContents.AppendL(contentData);			
   195 	    iContents.AppendL(contentData);		
       
   196 	    CleanupStack::Pop(contentData);	
   194 	}
   197 	}
   195 	
   198 	
   196 	// Cleanup
   199 	// Cleanup
   197 	delete profile;
   200 	CleanupStack::PopAndDestroy(profile);
   198 	delete dsSettings;
   201 	CleanupStack::PopAndDestroy(dsSettings);
   199 	DBG_FILE(_S8("CNsmlProfileUtil::InternalizeFromSettingsDBL, END"));
   202 	DBG_FILE(_S8("CNsmlProfileUtil::InternalizeFromSettingsDBL, END"));
   200 }
   203 }
   201 
   204 
   202 // -----------------------------------------------------------------------------
   205 // -----------------------------------------------------------------------------
   203 // CNsmlProfileUtil::InternalizeFromCenrepL
   206 // CNsmlProfileUtil::InternalizeFromCenrepL