tsrc/centralrepositorystub/src/centralrepositorystub.cpp
branchRCL_3
changeset 33 bc78a40cd63c
parent 32 73a1feb507fb
equal deleted inserted replaced
32:73a1feb507fb 33:bc78a40cd63c
    35 TBool CRepository::iEmulateSawfishRepository = EFalse;
    35 TBool CRepository::iEmulateSawfishRepository = EFalse;
    36 HBufC8* CRepository::iStaticAvcConfigKeys = NULL;
    36 HBufC8* CRepository::iStaticAvcConfigKeys = NULL;
    37 TBool CRepository::iStaticWriteAvcKeysToStaticData = EFalse;
    37 TBool CRepository::iStaticWriteAvcKeysToStaticData = EFalse;
    38 TInt CRepository::iForceFailWithCode = KErrNone;
    38 TInt CRepository::iForceFailWithCode = KErrNone;
    39 TInt CRepository::iStaticEncoderUid = 0;
    39 TInt CRepository::iStaticEncoderUid = 0;
    40 CRepository::TCenRepStubKeyValueEntry CRepository::iGlobalKeyVals[ KCenRepStubGlobalKeyValueMaxLen ];
       
    41 TInt CRepository::iGlobalKeyValsTop = 0;
       
    42 
    40 
    43 
    41 
    44 // -----------------------------------------------------------------------------
    42 // -----------------------------------------------------------------------------
    45 //
    43 //
    46 // -----------------------------------------------------------------------------
    44 // -----------------------------------------------------------------------------
   101                 self->Set ( MusSettingsKeys::KAutoRecord,
    99                 self->Set ( MusSettingsKeys::KAutoRecord,
   102                             MusSettingsKeys::EAutoRecordOn ) );       
   100                             MusSettingsKeys::EAutoRecordOn ) );       
   103         User::LeaveIfError( 
   101         User::LeaveIfError( 
   104                 self->Set ( MusSettingsKeys::KSipProfileId,
   102                 self->Set ( MusSettingsKeys::KSipProfileId,
   105                             0 /*default profile*/ ) );                    
   103                             0 /*default profile*/ ) );                    
   106     
       
   107         User::LeaveIfError( 
   104         User::LeaveIfError( 
   108                 self->Set ( MusSettingsKeys::KUiOrientation,
   105                 self->Set ( MusSettingsKeys::KUiOrientation,
   109                             MusSettingsKeys::EPortrait ) );                    
   106                             MusSettingsKeys::EPortrait ) );                    
   110         User::LeaveIfError( 
   107         User::LeaveIfError( 
   111                 self->Set ( MusSettingsKeys::KCapabilityQuery,
   108                 self->Set ( MusSettingsKeys::KCapabilityQuery,
   124 //
   121 //
   125 // -----------------------------------------------------------------------------
   122 // -----------------------------------------------------------------------------
   126 //
   123 //
   127 EXPORT_C CRepository::~CRepository()
   124 EXPORT_C CRepository::~CRepository()
   128     {
   125     {
   129     iKeys.Close();
   126     iKeys.Reset();
   130     iValues.Close();
   127     iValues.Reset();
   131     iDesC8Keys.Close();
   128     iDesC8Keys.Reset();
   132     delete iDesC8Values;   
   129     delete iDesC8Values;   
   133     }
   130     }
   134 
   131 
   135 
   132 
   136 // -----------------------------------------------------------------------------
   133 // -----------------------------------------------------------------------------
   204                 aValue = iValues[i];
   201                 aValue = iValues[i];
   205                 return KErrNone;
   202                 return KErrNone;
   206                 }
   203                 }
   207             }
   204             }
   208         }
   205         }
   209     if ( iGlobalKeyValsTop >= 0 && iGlobalKeyValsTop < KCenRepStubGlobalKeyValueMaxLen )
   206     
   210         {
       
   211         for ( TInt i = 0; i < iGlobalKeyValsTop; i++ )
       
   212             {
       
   213             if ( iGlobalKeyVals[ i ].iKey == aKey )
       
   214                 {
       
   215                 aValue = CRepository::iGlobalKeyVals[ i ].iVal;
       
   216                 return KErrNone;
       
   217                 }
       
   218             }
       
   219         }
       
   220     return err;
   207     return err;
   221     }
   208     }
   222 
   209 
   223 // -----------------------------------------------------------------------------
   210 // -----------------------------------------------------------------------------
   224 //
   211 //
   489 void CRepository::DeleteStubAvcConfigKeys()
   476 void CRepository::DeleteStubAvcConfigKeys()
   490     {
   477     {
   491     delete iStaticAvcConfigKeys;
   478     delete iStaticAvcConfigKeys;
   492     iStaticAvcConfigKeys = NULL;
   479     iStaticAvcConfigKeys = NULL;
   493     }
   480     }
   494 
   481   
   495 void CRepository::ResetStubGlobal()
   482     
   496     {
       
   497     iGlobalKeyValsTop = 0;
       
   498     }
       
   499 
       
   500 TInt CRepository::SetStubGlobal(TUint32 aKey, TInt aValue)
       
   501     {
       
   502     for ( TInt i = 0; i < iGlobalKeyValsTop; i++ )
       
   503         {
       
   504         if ( iGlobalKeyVals[ i ].iKey == aKey )
       
   505             {
       
   506             iGlobalKeyVals[ i ].iVal = aValue;
       
   507             return KErrNone;
       
   508             }
       
   509         }
       
   510     
       
   511     if ( iGlobalKeyValsTop >= KCenRepStubGlobalKeyValueMaxLen )
       
   512         {
       
   513         return KErrNoMemory;
       
   514         }
       
   515     iGlobalKeyVals[ iGlobalKeyValsTop ].iKey = aKey;
       
   516     iGlobalKeyVals[ iGlobalKeyValsTop ].iVal = aValue;
       
   517     iGlobalKeyValsTop++;
       
   518     return KErrNone;
       
   519     }
       
   520 // -----------------------------------------------------------------------------
   483 // -----------------------------------------------------------------------------
   521 //
   484 //
   522 // -----------------------------------------------------------------------------
   485 // -----------------------------------------------------------------------------
   523 //
   486 //
   524 CRepository::CRepository( TUid aRepositoryUid )
   487 CRepository::CRepository( TUid aRepositoryUid )
   525     :iRepositoryUid( aRepositoryUid )
   488     :iRepositoryUid( aRepositoryUid )
   526     {
   489     {
   527     
       
   528     }    
   490     }    
   529 
   491 
   530 
   492