tsrc/centralrepositorystub/src/centralrepositorystub.cpp
branchRCL_3
changeset 22 73a1feb507fb
parent 0 f0cf47e981f9
child 23 bc78a40cd63c
--- a/tsrc/centralrepositorystub/src/centralrepositorystub.cpp	Thu Aug 19 09:51:39 2010 +0300
+++ b/tsrc/centralrepositorystub/src/centralrepositorystub.cpp	Tue Aug 31 15:12:07 2010 +0300
@@ -37,6 +37,8 @@
 TBool CRepository::iStaticWriteAvcKeysToStaticData = EFalse;
 TInt CRepository::iForceFailWithCode = KErrNone;
 TInt CRepository::iStaticEncoderUid = 0;
+CRepository::TCenRepStubKeyValueEntry CRepository::iGlobalKeyVals[ KCenRepStubGlobalKeyValueMaxLen ];
+TInt CRepository::iGlobalKeyValsTop = 0;
 
 
 // -----------------------------------------------------------------------------
@@ -101,6 +103,7 @@
         User::LeaveIfError( 
                 self->Set ( MusSettingsKeys::KSipProfileId,
                             0 /*default profile*/ ) );                    
+    
         User::LeaveIfError( 
                 self->Set ( MusSettingsKeys::KUiOrientation,
                             MusSettingsKeys::EPortrait ) );                    
@@ -123,9 +126,9 @@
 //
 EXPORT_C CRepository::~CRepository()
     {
-    iKeys.Reset();
-    iValues.Reset();
-    iDesC8Keys.Reset();
+    iKeys.Close();
+    iValues.Close();
+    iDesC8Keys.Close();
     delete iDesC8Values;   
     }
 
@@ -203,7 +206,17 @@
                 }
             }
         }
-    
+    if ( iGlobalKeyValsTop >= 0 && iGlobalKeyValsTop < KCenRepStubGlobalKeyValueMaxLen )
+        {
+        for ( TInt i = 0; i < iGlobalKeyValsTop; i++ )
+            {
+            if ( iGlobalKeyVals[ i ].iKey == aKey )
+                {
+                aValue = CRepository::iGlobalKeyVals[ i ].iVal;
+                return KErrNone;
+                }
+            }
+        }
     return err;
     }
 
@@ -478,8 +491,32 @@
     delete iStaticAvcConfigKeys;
     iStaticAvcConfigKeys = NULL;
     }
-  
+
+void CRepository::ResetStubGlobal()
+    {
+    iGlobalKeyValsTop = 0;
+    }
+
+TInt CRepository::SetStubGlobal(TUint32 aKey, TInt aValue)
+    {
+    for ( TInt i = 0; i < iGlobalKeyValsTop; i++ )
+        {
+        if ( iGlobalKeyVals[ i ].iKey == aKey )
+            {
+            iGlobalKeyVals[ i ].iVal = aValue;
+            return KErrNone;
+            }
+        }
     
+    if ( iGlobalKeyValsTop >= KCenRepStubGlobalKeyValueMaxLen )
+        {
+        return KErrNoMemory;
+        }
+    iGlobalKeyVals[ iGlobalKeyValsTop ].iKey = aKey;
+    iGlobalKeyVals[ iGlobalKeyValsTop ].iVal = aValue;
+    iGlobalKeyValsTop++;
+    return KErrNone;
+    }
 // -----------------------------------------------------------------------------
 //
 // -----------------------------------------------------------------------------
@@ -487,6 +524,7 @@
 CRepository::CRepository( TUid aRepositoryUid )
     :iRepositoryUid( aRepositoryUid )
     {
+    
     }