tsrc/centralrepositorystub/src/centralrepositorystub.cpp
branchRCL_3
changeset 22 73a1feb507fb
parent 0 f0cf47e981f9
child 23 bc78a40cd63c
equal deleted inserted replaced
21:33a5d2bbf6fc 22:73a1feb507fb
    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;
    40 
    42 
    41 
    43 
    42 // -----------------------------------------------------------------------------
    44 // -----------------------------------------------------------------------------
    43 //
    45 //
    44 // -----------------------------------------------------------------------------
    46 // -----------------------------------------------------------------------------
    99                 self->Set ( MusSettingsKeys::KAutoRecord,
   101                 self->Set ( MusSettingsKeys::KAutoRecord,
   100                             MusSettingsKeys::EAutoRecordOn ) );       
   102                             MusSettingsKeys::EAutoRecordOn ) );       
   101         User::LeaveIfError( 
   103         User::LeaveIfError( 
   102                 self->Set ( MusSettingsKeys::KSipProfileId,
   104                 self->Set ( MusSettingsKeys::KSipProfileId,
   103                             0 /*default profile*/ ) );                    
   105                             0 /*default profile*/ ) );                    
       
   106     
   104         User::LeaveIfError( 
   107         User::LeaveIfError( 
   105                 self->Set ( MusSettingsKeys::KUiOrientation,
   108                 self->Set ( MusSettingsKeys::KUiOrientation,
   106                             MusSettingsKeys::EPortrait ) );                    
   109                             MusSettingsKeys::EPortrait ) );                    
   107         User::LeaveIfError( 
   110         User::LeaveIfError( 
   108                 self->Set ( MusSettingsKeys::KCapabilityQuery,
   111                 self->Set ( MusSettingsKeys::KCapabilityQuery,
   121 //
   124 //
   122 // -----------------------------------------------------------------------------
   125 // -----------------------------------------------------------------------------
   123 //
   126 //
   124 EXPORT_C CRepository::~CRepository()
   127 EXPORT_C CRepository::~CRepository()
   125     {
   128     {
   126     iKeys.Reset();
   129     iKeys.Close();
   127     iValues.Reset();
   130     iValues.Close();
   128     iDesC8Keys.Reset();
   131     iDesC8Keys.Close();
   129     delete iDesC8Values;   
   132     delete iDesC8Values;   
   130     }
   133     }
   131 
   134 
   132 
   135 
   133 // -----------------------------------------------------------------------------
   136 // -----------------------------------------------------------------------------
   201                 aValue = iValues[i];
   204                 aValue = iValues[i];
   202                 return KErrNone;
   205                 return KErrNone;
   203                 }
   206                 }
   204             }
   207             }
   205         }
   208         }
   206     
   209     if ( iGlobalKeyValsTop >= 0 && iGlobalKeyValsTop < KCenRepStubGlobalKeyValueMaxLen )
       
   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         }
   207     return err;
   220     return err;
   208     }
   221     }
   209 
   222 
   210 // -----------------------------------------------------------------------------
   223 // -----------------------------------------------------------------------------
   211 //
   224 //
   476 void CRepository::DeleteStubAvcConfigKeys()
   489 void CRepository::DeleteStubAvcConfigKeys()
   477     {
   490     {
   478     delete iStaticAvcConfigKeys;
   491     delete iStaticAvcConfigKeys;
   479     iStaticAvcConfigKeys = NULL;
   492     iStaticAvcConfigKeys = NULL;
   480     }
   493     }
   481   
   494 
   482     
   495 void CRepository::ResetStubGlobal()
       
   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     }
   483 // -----------------------------------------------------------------------------
   520 // -----------------------------------------------------------------------------
   484 //
   521 //
   485 // -----------------------------------------------------------------------------
   522 // -----------------------------------------------------------------------------
   486 //
   523 //
   487 CRepository::CRepository( TUid aRepositoryUid )
   524 CRepository::CRepository( TUid aRepositoryUid )
   488     :iRepositoryUid( aRepositoryUid )
   525     :iRepositoryUid( aRepositoryUid )
   489     {
   526     {
       
   527     
   490     }    
   528     }    
   491 
   529 
   492 
   530