syncmlfw/dm/settings/src/DMProfileContentHandler.cpp
branchRCL_3
changeset 24 13d7c31c74e0
parent 0 b497e44ab2fc
child 25 b183ec05bd8c
equal deleted inserted replaced
23:4af31167ea77 24:13d7c31c74e0
    20 // INCLUDE FILES
    20 // INCLUDE FILES
    21 #include <f32file.h>
    21 #include <f32file.h>
    22 #include <commdb.h>
    22 #include <commdb.h>
    23 #include <nsmldebug.h>
    23 #include <nsmldebug.h>
    24 #include <featmgr.h>
    24 #include <featmgr.h>
       
    25 #include <centralrepository.h>
    25 #include "DMprofileContentHandler.h"
    26 #include "DMprofileContentHandler.h"
    26 #include "nsmldmsettings.h"
    27 #include "nsmldmsettings.h"
       
    28 #include "DevManInternalCRKeys.h"
    27 
    29 
    28 
    30 
    29 #define DES_AS_8_BIT(str) (TPtrC8((TText8*)((str).Ptr()), (str).Size()))
    31 #define DES_AS_8_BIT(str) (TPtrC8((TText8*)((str).Ptr()), (str).Size()))
    30 
    32 
    31 // ============================ MEMBER FUNCTIONS ===============================
    33 // ============================ MEMBER FUNCTIONS ===============================
   176 	_DBG_FILE("CDMProfileContentHandler::SaveProfilesL(): begin");
   178 	_DBG_FILE("CDMProfileContentHandler::SaveProfilesL(): begin");
   177 	RemoveDuplicateEntry();
   179 	RemoveDuplicateEntry();
   178 	RemoveRSCEntryL();
   180 	RemoveRSCEntryL();
   179 	TInt iapId = 0;
   181 	TInt iapId = 0;
   180 	
   182 	
   181 	for ( TInt i = 0; i < iProfileArray->Count(); i++ )
   183 	TInt count = iProfileArray->Count();
       
   184 	for ( TInt i = 0; i < count; i++ )
   182 	{
   185 	{
   183 		if(iProfileArray->At(i)->iAccessPoint)
   186 		if(iProfileArray->At(i)->iAccessPoint)
   184 		{
   187 		{
   185 			if(GetAccessPointIdL(i, iapId))
   188 			if(GetAccessPointIdL(i, iapId))
   186 			{
   189 			{
   207 		CleanupStack::PushL( profile );
   210 		CleanupStack::PushL( profile );
   208 		iProfileArray->At(i)->SaveProfileL( profile );
   211 		iProfileArray->At(i)->SaveProfileL( profile );
   209 		profile->SaveL();
   212 		profile->SaveL();
   210 		CleanupStack::PopAndDestroy(); // profile
   213 		CleanupStack::PopAndDestroy(); // profile
   211 							
   214 							
       
   215 	}
       
   216   CRepository* centrep = NULL;
       
   217   TRAPD( err, centrep = CRepository::NewL(KCRUidDeviceManagementInternalKeys));  
       
   218   if (err==KErrNone ) 
       
   219   {
       
   220   	TInt num(-1);
       
   221   	TInt err = centrep->Get( KMaxFactoryDMProfileId , num );
       
   222   	if( num >= 0 )
       
   223   		err = centrep->Set( KMaxFactoryDMProfileId , (count + num ) );
       
   224   	else
       
   225   		err = centrep->Set( KMaxFactoryDMProfileId , count - 1);	
       
   226     delete centrep;
       
   227     centrep = NULL;
   212 	}
   228 	}
   213 	_DBG_FILE("CDMProfileContentHandler::SaveProfilesL(): end");
   229 	_DBG_FILE("CDMProfileContentHandler::SaveProfilesL(): end");
   214 }
   230 }
   215 // -----------------------------------------------------------------------------
   231 // -----------------------------------------------------------------------------
   216 //  CDMProfileContentHandler::IsChar
   232 //  CDMProfileContentHandler::IsChar