syncmlfw/dm/settings/src/NSmlDMResourceProfiles.cpp
branchRCL_3
changeset 62 19bba8228ff0
parent 61 b183ec05bd8c
child 76 3cdbd92ee07b
--- a/syncmlfw/dm/settings/src/NSmlDMResourceProfiles.cpp	Tue Aug 31 16:04:06 2010 +0300
+++ b/syncmlfw/dm/settings/src/NSmlDMResourceProfiles.cpp	Wed Sep 01 12:27:42 2010 +0100
@@ -18,9 +18,11 @@
 
 
 // INCLUDE FILES
+#include <featmgr.h>
+#include <centralrepository.h>
 #include "nsmldmsettings.h"
 #include "NSmlDMResourceProfile.h"
-#include <featmgr.h>
+#include "DevManInternalCRKeys.h"
 const TInt KNSmlDmBluetoothType = 0x101F99F1;
 // ----------------------------------------------------------
 // CNSmlDMResourceProfiles implementation 
@@ -77,7 +79,8 @@
 	{
 	RemoveDuplicateEntry();
 	RemoveObexEntryL();
-	for ( TInt i = 0; i < iProfileArray->Count(); i++ )
+	TInt count = iProfileArray->Count();
+	for ( TInt i = 0; i < count ; i++ )
 		{
 		CNSmlDMProfile* profile = iSettings->CreateProfileL();
 		CleanupStack::PushL( profile );
@@ -85,6 +88,14 @@
 		profile->SaveL();
 		CleanupStack::PopAndDestroy(); // profile
 		}
+    CRepository* centrep = NULL;
+    TRAPD( err, centrep = CRepository::NewL(KCRUidDeviceManagementInternalKeys));  
+    if (err==KErrNone ) 
+    {
+        TInt err = centrep->Set( KMaxFactoryDMProfileId , count-1 );
+        delete centrep;
+        centrep = NULL;
+		}
 	}
 
 // ----------------------------------------------------------