coreapplicationuis/SysAp/Src/hbdevicepowermenusymbian.cpp
changeset 56 11a052f4b02e
parent 48 2222076f5c60
child 81 676b6116ca93
equal deleted inserted replaced
49:76883296a0d5 56:11a052f4b02e
    16  */
    16  */
    17 
    17 
    18 #include <hbdevicedialogsymbian.h>
    18 #include <hbdevicedialogsymbian.h>
    19 #include <hbsymbianvariant.h>
    19 #include <hbsymbianvariant.h>
    20 #include <coreapplicationuisdomainpskeys.h>
    20 #include <coreapplicationuisdomainpskeys.h>
       
    21 #include <CoreApplicationUIsSDKCRKeys.h>
    21 #include "hbdevicepowermenusymbian.h"
    22 #include "hbdevicepowermenusymbian.h"
    22 
    23 
    23 
    24 
    24 //These Keys will be used in CHbSymbianVariantMap
    25 //These Keys will be used in CHbSymbianVariantMap
    25 //Donot Change these strings
    26 //Donot Change these strings
   245 		{
   246 		{
   246         TRACES( RDebug::Print( _L("CHbDevicePowerMenuPrivate::DataReceived: OfflineVariant::Start") ) );
   247         TRACES( RDebug::Print( _L("CHbDevicePowerMenuPrivate::DataReceived: OfflineVariant::Start") ) );
   247 		TBool* OfflineValue = OfflineVariant->Value<TBool>();
   248 		TBool* OfflineValue = OfflineVariant->Value<TBool>();
   248 		if(OfflineValue)
   249 		if(OfflineValue)
   249 			{
   250 			{
   250 			iOfflineEnable = *OfflineValue;
   251                         iOfflineEnable = *OfflineValue;
   251 			User::LeaveIfError( iPowerMenuManager->iCenrepOffline->Set(  KSettingsAirplaneMode, iOfflineEnable )  ); 
   252                         // negate the value before storing in cen rep as the n/w conn allowed key is complement of offline mode
       
   253                         User::LeaveIfError( iPowerMenuManager->iCenrepOffline->Set(KCoreAppUIsNetworkConnectionAllowed, !iOfflineEnable )  );
   252 			}
   254 			}
   253         TRACES( RDebug::Print( _L("CHbDevicePowerMenuPrivate::DataReceived: OfflineVariant::End") ) );
   255         TRACES( RDebug::Print( _L("CHbDevicePowerMenuPrivate::DataReceived: OfflineVariant::End") ) );
   254 		}
   256 		}
   255 	
   257 	
   256 	//5.shutdown
   258 	//5.shutdown
   403 */
   405 */
   404 void CHbDevicePowerMenuSymbian::ConstructL()
   406 void CHbDevicePowerMenuSymbian::ConstructL()
   405     {
   407     {
   406     TRACES( RDebug::Print( _L("CHbDevicePowerMenuSymbian::ConstructL: START") ) ); 
   408     TRACES( RDebug::Print( _L("CHbDevicePowerMenuSymbian::ConstructL: START") ) ); 
   407     iProfileEngine = ::CreateProfileEngineExtended2L();
   409     iProfileEngine = ::CreateProfileEngineExtended2L();
   408     iCenrepOffline = CRepository::NewL( KCRUidCommunicationSettings );
   410     iCenrepOffline = CRepository::NewL( KCRUidCoreApplicationUIs );
   409     iCenrepProfile = CRepository::NewL( KCRUidProfileEngine );
   411     iCenrepProfile = CRepository::NewL( KCRUidProfileEngine );
   410 	iPowerMenuPrivate = CHbDevicePowerMenuPrivate::NewL(this);
   412 	iPowerMenuPrivate = CHbDevicePowerMenuPrivate::NewL(this);
   411 
   413 
   412     //To Sync with Contro panel 
   414     //To Sync with Contro panel 
   413 	TBool airplaneMode(0);
   415     TBool networkConnectionAllowed(EFalse);
   414 	User::LeaveIfError( iCenrepOffline->Get( KSettingsAirplaneMode, airplaneMode ) );
   416     TInt error = iCenrepOffline->Get( KCoreAppUIsNetworkConnectionAllowed, networkConnectionAllowed );
   415 	SetOfflineMode(airplaneMode);
   417     TRACES( RDebug::Print( _L("CSysApAppUi::ConstructL: KCoreAppUIsNetworkConnectionAllowed = %d"), error ) );    
       
   418  
       
   419     // The value of KCoreAppUIsNetworkConnectionAllowed is Inverted status of Offline mode
       
   420     // Hence negate the value and use as Offline mode
       
   421     SetOfflineMode(!networkConnectionAllowed);
   416 	
   422 	
   417 	TInt masterVolume(0);
   423 	TInt masterVolume(0);
   418 	User::LeaveIfError( iCenrepProfile->Get( KProEngMasterVolume, masterVolume ) );
   424     error = iCenrepProfile->Get( KProEngMasterVolume, masterVolume );
   419 	SetVolume(masterVolume);
   425     TRACES( RDebug::Print( _L("CSysApAppUi::ConstructL: KProEngMasterVolume = %d"), error ) );    
       
   426     SetVolume(masterVolume);
   420 	
   427 	
   421 	TBool masterVibrate(0);
   428 	TBool masterVibrate(0);
   422 	User::LeaveIfError( iCenrepProfile->Get( KProEngMasterVibra, masterVibrate ) );
   429     error = iCenrepProfile->Get( KProEngMasterVibra, masterVibrate );
       
   430     TRACES( RDebug::Print( _L("CSysApAppUi::ConstructL: KProEngMasterVibra = %d"), error ) );	
   423 	SetVibrationEnabled(masterVibrate);
   431 	SetVibrationEnabled(masterVibrate);
   424 	
   432 	
   425 	TBool silenceMode(EFalse);
   433 	TBool silenceMode(EFalse);
   426 	User::LeaveIfError( iCenrepProfile->Get( KProEngSilenceMode, silenceMode ) );
   434     error = iCenrepProfile->Get( KProEngSilenceMode, silenceMode );
       
   435     TRACES( RDebug::Print( _L("CSysApAppUi::ConstructL: KProEngSilenceMode = %d"), error ) );   
   427 	SetSilenceMode(silenceMode);
   436 	SetSilenceMode(silenceMode);
   428 	
   437 	
   429 	//Cypheroff is True when No encryption/Decryption is happening
   438 	//Cypheroff is True when No encryption/Decryption is happening
   430 	TBool cypherOff(!(iSysApServer.IsEncryptionOperationOngoingL()));
   439 	TBool cypherOff(!(iSysApServer.IsEncryptionOperationOngoingL()));
   431 	SetPowerOffEnabled(cypherOff);
   440 	SetPowerOffEnabled(cypherOff);