securitydialogs/SecUi/Src/SecUiSecurityHandler.cpp
changeset 1 d5423fbb4f29
parent 0 164170e6151a
child 10 ece4bbb094df
child 15 318c4eab2439
--- a/securitydialogs/SecUi/Src/SecUiSecurityHandler.cpp	Tue Jan 26 15:20:08 2010 +0200
+++ b/securitydialogs/SecUi/Src/SecUiSecurityHandler.cpp	Tue Feb 02 00:44:34 2010 +0200
@@ -208,6 +208,28 @@
     #if defined(_DEBUG)
     RDebug::Print(_L("(SECUI)CSecurityHandler::AskSecCodeL()"));
     #endif
+
+    /* if code is still not initialized, then there's no need to ask it. This fixes the error when the RFS requests the code */
+    const TUid KCRUidSCPLockCode = {0x2002677B};
+    const TUint32 KSCPLockCodeDefaultLockCode = 0x00000001;
+	
+    CRepository* repository = CRepository::NewL(KCRUidSCPLockCode);
+    TInt currentLockStatus = -1;
+    TInt res=-1;
+
+    res = repository->Get(KSCPLockCodeDefaultLockCode , currentLockStatus);
+    #if defined(_DEBUG)
+    RDebug::Printf( "%s %s (%u) res=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, res );
+    RDebug::Printf( "%s %s (%u) currentLockStatus=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, currentLockStatus );
+    #endif
+    delete repository;
+    if(res==0 && currentLockStatus==1)
+        {
+        // code is the default one; no need to request it.
+        return ETrue;
+        }
+    /* end check for default code */
+
     // Destructor sets thisDestroyed to ETrue
     TBool thisDestroyed( EFalse );
     iDestroyedPtr = &thisDestroyed;