syncmlfw/dm/settings/src/DMProfileContentHandler.cpp
branchRCL_3
changeset 76 3cdbd92ee07b
parent 62 19bba8228ff0
equal deleted inserted replaced
69:a082c848c9a9 76:3cdbd92ee07b
    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>
       
    26 #include "DMprofileContentHandler.h"
    25 #include "DMprofileContentHandler.h"
    27 #include "nsmldmsettings.h"
    26 #include "nsmldmsettings.h"
    28 #include "DevManInternalCRKeys.h"
       
    29 
    27 
    30 
    28 
    31 #define DES_AS_8_BIT(str) (TPtrC8((TText8*)((str).Ptr()), (str).Size()))
    29 #define DES_AS_8_BIT(str) (TPtrC8((TText8*)((str).Ptr()), (str).Size()))
    32 
    30 
    33 // ============================ MEMBER FUNCTIONS ===============================
    31 // ============================ MEMBER FUNCTIONS ===============================
   178 	_DBG_FILE("CDMProfileContentHandler::SaveProfilesL(): begin");
   176 	_DBG_FILE("CDMProfileContentHandler::SaveProfilesL(): begin");
   179 	RemoveDuplicateEntry();
   177 	RemoveDuplicateEntry();
   180 	RemoveRSCEntryL();
   178 	RemoveRSCEntryL();
   181 	TInt iapId = 0;
   179 	TInt iapId = 0;
   182 	
   180 	
   183 	TInt count = iProfileArray->Count();
   181 	for ( TInt i = 0; i < iProfileArray->Count(); i++ )
   184 	for ( TInt i = 0; i < count; i++ )
       
   185 	{
   182 	{
   186 		if(iProfileArray->At(i)->iAccessPoint)
   183 		if(iProfileArray->At(i)->iAccessPoint)
   187 		{
   184 		{
   188 			if(GetAccessPointIdL(i, iapId))
   185 			if(GetAccessPointIdL(i, iapId))
   189 			{
   186 			{
   210 		CleanupStack::PushL( profile );
   207 		CleanupStack::PushL( profile );
   211 		iProfileArray->At(i)->SaveProfileL( profile );
   208 		iProfileArray->At(i)->SaveProfileL( profile );
   212 		profile->SaveL();
   209 		profile->SaveL();
   213 		CleanupStack::PopAndDestroy(); // profile
   210 		CleanupStack::PopAndDestroy(); // profile
   214 							
   211 							
   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;
       
   228 	}
   212 	}
   229 	_DBG_FILE("CDMProfileContentHandler::SaveProfilesL(): end");
   213 	_DBG_FILE("CDMProfileContentHandler::SaveProfilesL(): end");
   230 }
   214 }
   231 // -----------------------------------------------------------------------------
   215 // -----------------------------------------------------------------------------
   232 //  CDMProfileContentHandler::IsChar
   216 //  CDMProfileContentHandler::IsChar