phoneapp/phoneuicontrol/src/cphonestate.cpp
branchRCL_3
changeset 15 2a26698d78ba
parent 14 24062c24fe38
child 17 38529f706030
equal deleted inserted replaced
14:24062c24fe38 15:2a26698d78ba
   102 #include "cphonemediatorsender.h"
   102 #include "cphonemediatorsender.h"
   103 #include "cphonereleasecommand.h"
   103 #include "cphonereleasecommand.h"
   104 #include "cphonecontinueemergencycallcommand.h"
   104 #include "cphonecontinueemergencycallcommand.h"
   105 #include "cphonecallheadermanager.h"
   105 #include "cphonecallheadermanager.h"
   106 #include "cphonenumberentrymanager.h"
   106 #include "cphonenumberentrymanager.h"
   107 #include "mphonestorage.h"
       
   108 #include "easydialingcommands.hrh"
   107 #include "easydialingcommands.hrh"
   109 
   108 
   110 
   109 
   111 // ================= MEMBER FUNCTIONS =======================
   110 // ================= MEMBER FUNCTIONS =======================
   112 
   111 
  4095     
  4094     
  4096     CPhonePubSubProxy::Instance()->ChangePropertyValue(
  4095     CPhonePubSubProxy::Instance()->ChangePropertyValue(
  4097                     KPSUidScreenSaver,
  4096                     KPSUidScreenSaver,
  4098                     KScreenSaverAllowScreenSaver,
  4097                     KScreenSaverAllowScreenSaver,
  4099                     EPhoneScreensaverAllowed );
  4098                     EPhoneScreensaverAllowed );
  4100 
       
  4101     // Restore keylock if phone has been locked before call.
       
  4102     if ( iStateMachine->PhoneStorage()->NeedToEnableKeylock() )
       
  4103         {
       
  4104         iViewCommandHandle->ExecuteCommandL( EPhoneViewEnableKeyLock );
       
  4105         iStateMachine->PhoneStorage()->SetNeedToEnableKeylock( EFalse );
       
  4106         }
       
  4107     }
  4099     }
  4108 
  4100 
  4109 // -----------------------------------------------------------
  4101 // -----------------------------------------------------------
  4110 // CPhoneState::GetVolumeLevel
  4102 // CPhoneState::GetVolumeLevel
  4111 // -----------------------------------------------------------
  4103 // -----------------------------------------------------------
  4742             {
  4734             {
  4743             SetTouchPaneButtonDisabled( EPhoneCallComingCmdSilent );
  4735             SetTouchPaneButtonDisabled( EPhoneCallComingCmdSilent );
  4744             }
  4736             }
  4745         }
  4737         }
  4746     }
  4738     }
  4747 
       
  4748 // -----------------------------------------------------------
       
  4749 // CPhoneState::GetBlockedKeyList
       
  4750 // -----------------------------------------------------------
       
  4751 //
       
  4752 EXPORT_C const RArray<TInt>& CPhoneState::GetBlockedKeyList() const
       
  4753     {
       
  4754     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::GetBlockedKeyList( ) ");
       
  4755     return iStateMachine->PhoneStorage()->GetBlockedKeyList();
       
  4756     }
       
  4757 
       
  4758 // -----------------------------------------------------------
       
  4759 // CPhoneState::DisableHWKeysL
       
  4760 // -----------------------------------------------------------
       
  4761 //
       
  4762 EXPORT_C void CPhoneState::DisableHWKeysL()
       
  4763     {
       
  4764     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::DisableHWKeysL( ) ");
       
  4765 
       
  4766     if( iStateMachine->PhoneStorage()->IsBlockedKeysListEmpty() )
       
  4767         {
       
  4768         __PHONELOG( EBasic, EPhoneControl, " CPhoneState::DisableHWKeysL HW Keys Disabled " );
       
  4769 
       
  4770         iStateMachine->PhoneStorage()->AppendBlockedKeysListL( EStdKeyNo );
       
  4771         iStateMachine->PhoneStorage()->AppendBlockedKeysListL( EStdKeyYes );
       
  4772         }
       
  4773     }
       
  4774 
       
  4775 // -----------------------------------------------------------
       
  4776 // CPhoneState::DisableCallUIL
       
  4777 // -----------------------------------------------------------
       
  4778 //
       
  4779 EXPORT_C void CPhoneState::DisableCallUIL()
       
  4780     {
       
  4781     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::DisableCallUIL( ) ");
       
  4782 
       
  4783     // Set Call UI state to storage
       
  4784     if( !iStateMachine->PhoneStorage()->IsScreenLocked() )
       
  4785         {
       
  4786         __PHONELOG( EBasic, EPhoneControl, " CPhoneState::DisableCallUIL CallUI Disabled " );
       
  4787 
       
  4788         // Show keys locked note
       
  4789         TPhoneCmdParamNote noteParam;
       
  4790         noteParam.SetType( EPhoneNoteUIDisabled );
       
  4791         noteParam.SetResourceId( CPhoneMainResourceResolver::Instance()->
       
  4792             ResolveResourceID( EPhoneInformationNote ) );
       
  4793     
       
  4794         HBufC* noteText = StringLoader::LoadLC( 
       
  4795             CPhoneMainResourceResolver::Instance()->
       
  4796                 ResolveResourceID( EPhoneIncomingCallKeysLocked ) );
       
  4797         noteParam.SetText( *noteText );
       
  4798     
       
  4799         iViewCommandHandle->ExecuteCommandL( EPhoneViewShowNote, &noteParam );
       
  4800         CleanupStack::PopAndDestroy( noteText );
       
  4801     
       
  4802         // Start capturing the key guard key
       
  4803         TPhoneCmdParamKeyCapture appKeyCaptureParam;
       
  4804         appKeyCaptureParam.SetKey( EStdKeyDevice7 );
       
  4805         appKeyCaptureParam.SetKeyCode( EKeyDeviceF );
       
  4806         appKeyCaptureParam.SetCaptureType( EPhoneKeyAllEvents );
       
  4807         iViewCommandHandle->ExecuteCommandL( EPhoneViewStartCapturingKey, &appKeyCaptureParam );
       
  4808         
       
  4809         // Set Call UI state to storage
       
  4810         iStateMachine->PhoneStorage()->SetScreenLocked( ETrue );
       
  4811         }
       
  4812     }
       
  4813 
       
  4814 // -----------------------------------------------------------
       
  4815 // CPhoneState::EnableCallUIL
       
  4816 // -----------------------------------------------------------
       
  4817 //
       
  4818 EXPORT_C void CPhoneState::EnableCallUIL()
       
  4819     {
       
  4820     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::EnableCallUIL( ) ");
       
  4821 
       
  4822     if( iStateMachine->PhoneStorage()->IsScreenLocked() )
       
  4823         {
       
  4824         __PHONELOG( EBasic, EPhoneControl, " CPhoneState::EnableCallUIL CallUI Enabled " );
       
  4825 
       
  4826         iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNote );
       
  4827         iViewCommandHandle->ExecuteCommandL( EPhoneViewDisableKeyLockWithoutNote );
       
  4828 
       
  4829         // Stop capturing the key guard key
       
  4830         TPhoneCmdParamKeyCapture appKeyCaptureParam;
       
  4831         appKeyCaptureParam.SetKey( EStdKeyDevice7 );
       
  4832         appKeyCaptureParam.SetKeyCode( EKeyDeviceF );
       
  4833         appKeyCaptureParam.SetCaptureType( EPhoneKeyAllEvents );
       
  4834         iViewCommandHandle->ExecuteCommandL( EPhoneViewStopCapturingKey, &appKeyCaptureParam );
       
  4835         
       
  4836         iStateMachine->PhoneStorage()->SetScreenLocked( EFalse );
       
  4837         }
       
  4838     }
       
  4839 
       
  4840 // -----------------------------------------------------------
       
  4841 // CPhoneState::CheckDisableHWKeysAndCallUIL
       
  4842 // -----------------------------------------------------------
       
  4843 //
       
  4844 EXPORT_C void CPhoneState::CheckDisableHWKeysAndCallUIL()
       
  4845     {
       
  4846     __LOGMETHODSTARTEND( EPhoneUIStates, "CPhoneState::CheckDisableHWKeysAndCallUIL( ) ");
       
  4847 
       
  4848     if( IsKeyLockOn() || IsAutoLockOn() )
       
  4849         {
       
  4850         // Disable HW keys if needed
       
  4851         if( CPhoneCenRepProxy::Instance()->
       
  4852                 IsTelephonyFeatureSupported( KTelephonyLVFlagDisableCallControlHardKeysWhileLocked ) )
       
  4853             {
       
  4854             DisableHWKeysL();
       
  4855             }
       
  4856 
       
  4857         // Disable Call UI if needed
       
  4858         if( FeatureManager::FeatureSupported( KFeatureIdFfTouchUnlockStroke )
       
  4859                 && !CPhoneCenRepProxy::Instance()->
       
  4860                 IsTelephonyFeatureSupported( KTelephonyLVFlagAllowUnlockOnIncoming ) )
       
  4861             {
       
  4862             DisableCallUIL();
       
  4863             iStateMachine->PhoneStorage()->SetNeedToEnableKeylock( ETrue );
       
  4864             }
       
  4865         }
       
  4866     }
       
  4867 
       
  4868 // -----------------------------------------------------------
       
  4869 // CPhoneState::HandleHoldSwitchL
       
  4870 // -----------------------------------------------------------
       
  4871 //
       
  4872 EXPORT_C void CPhoneState::HandleHoldSwitchL()
       
  4873     {
       
  4874     __LOGMETHODSTARTEND( EPhoneUIStates, "CPhoneState::HandleHoldSwitchL( ) ");
       
  4875 
       
  4876     if( CPhoneCenRepProxy::Instance()->
       
  4877             IsTelephonyFeatureSupported( KTelephonyLVFlagDisableCallControlHardKeysWhileLocked ) )
       
  4878         {
       
  4879         if( iStateMachine->PhoneStorage()->IsBlockedKeysListEmpty() )
       
  4880             {
       
  4881             // Disable HW Keys if needed
       
  4882             DisableHWKeysL();
       
  4883             }
       
  4884         else
       
  4885             {
       
  4886             // Reset blocked keys list
       
  4887             iStateMachine->PhoneStorage()->ResetBlockedKeysList();
       
  4888             }
       
  4889         }
       
  4890     
       
  4891     if( FeatureManager::FeatureSupported( KFeatureIdFfTouchUnlockStroke ) 
       
  4892             && !CPhoneCenRepProxy::Instance()->
       
  4893             IsTelephonyFeatureSupported( KTelephonyLVFlagAllowUnlockOnIncoming ) )
       
  4894         {
       
  4895         if( iStateMachine->PhoneStorage()->IsScreenLocked() )
       
  4896             {
       
  4897             // Enable Call
       
  4898             EnableCallUIL();
       
  4899             }
       
  4900         else
       
  4901             {
       
  4902             // Set keylock enabled
       
  4903             iViewCommandHandle->ExecuteCommandL( EPhoneViewEnableKeyLockWithoutNote );
       
  4904             // Disable Call
       
  4905             DisableCallUIL();
       
  4906             }
       
  4907         }
       
  4908         
       
  4909         // Stop ringingtone
       
  4910         iViewCommandHandle->ExecuteCommandL( EPhoneViewStopRingTone );
       
  4911     }
       
  4912 
       
  4913 // -----------------------------------------------------------
       
  4914 // CPhoneState::RetainPreviousKeylockStateL
       
  4915 // -----------------------------------------------------------
       
  4916 //
       
  4917 EXPORT_C void CPhoneState::RetainPreviousKeylockStateL()
       
  4918     {
       
  4919     // Lock keypad, if keylock was enabled before incoming call.
       
  4920     // Also reset PhoneStorage keylock status.
       
  4921     if ( FeatureManager::FeatureSupported( KFeatureIdFfTouchUnlockStroke ) &&
       
  4922         iStateMachine->PhoneStorage()->NeedToEnableKeylock() )
       
  4923         {
       
  4924         iStateMachine->PhoneStorage()->SetNeedToEnableKeylock( EFalse );
       
  4925         iViewCommandHandle->ExecuteCommandL( EPhoneViewEnableKeyLockWithoutNote ); 
       
  4926         }
       
  4927     }
       
  4928 
       
  4929 // ---------------------------------------------------------
       
  4930 // CPhoneState::HandleKeyLockEnabledL
       
  4931 // ---------------------------------------------------------
       
  4932 //
       
  4933 EXPORT_C void CPhoneState::HandleKeyLockEnabled( TBool aKeylockEnabled )
       
  4934     {
       
  4935     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::HandleKeyLockEnabledL( ) ");
       
  4936     if( !FeatureManager::FeatureSupported( KFeatureIdFfTouchUnlockStroke )
       
  4937 		&& CPhoneCenRepProxy::Instance()->
       
  4938 			IsTelephonyFeatureSupported( KTelephonyLVFlagDisableCallControlHardKeysWhileLocked ) )
       
  4939 		{
       
  4940     	if( !aKeylockEnabled )
       
  4941 	        {
       
  4942 	        // Keylock disabled
       
  4943             // Reset blocked keys list
       
  4944             iStateMachine->PhoneStorage()->ResetBlockedKeysList();
       
  4945 	        }
       
  4946 		}
       
  4947     }
       
  4948 	
  4739 	
  4949 // ---------------------------------------------------------
  4740 // ---------------------------------------------------------
  4950 // CPhoneState::SetToolbarDimming
  4741 // CPhoneState::SetToolbarDimming
  4951 // ---------------------------------------------------------
  4742 // ---------------------------------------------------------
  4952 //
  4743 //