--- a/phoneapp/phoneuistates/src/cphoneemergency.cpp Tue Aug 31 15:14:29 2010 +0300
+++ b/phoneapp/phoneuistates/src/cphoneemergency.cpp Wed Sep 01 12:30:10 2010 +0100
@@ -31,7 +31,6 @@
#include "tphonecmdparamboolean.h"
#include "tphonecmdparamemergencycallheaderdata.h"
#include "tphonecmdparamcallheaderdata.h"
-#include "tphonecmdparamkeycapture.h"
#include "mphonestatemachine.h"
#include "phonestatedefinitionsgsm.h"
#include "phoneviewcommanddefinitions.h"
@@ -42,12 +41,14 @@
#include "cphonepubsubproxy.h"
#include "cphonekeys.h"
#include "tphonecmdparamaudiooutput.h"
-#include "phoneresourceids.h"
+#include "cphonesecuritymodeobserver.h"
// ================= MEMBER FUNCTIONS =======================
+// -----------------------------------------------------------
// C++ default constructor can NOT contain any code, that
// might leave.
+// -----------------------------------------------------------
//
CPhoneEmergency::CPhoneEmergency(
MPhoneStateMachine* aStateMachine,
@@ -63,7 +64,7 @@
// Destructor
// (other items were commented in a header).
// -----------------------------------------------------------
-
+//
CPhoneEmergency::~CPhoneEmergency()
{
}
@@ -173,13 +174,21 @@
CPhoneGsmInCall::HandlePhoneEngineMessageL( aMessage, aCallId );
if ( iStateMachine->PhoneEngineInfo()->CallState( KPEEmergencyCallId ) == EPEStateDialing )
{
- UpdateSetupCbaL();
- }
+ TPhoneCmdParamBoolean isNoteVisible;
+ iViewCommandHandle->ExecuteCommandL( EPhoneViewGetIsNoteVisible,
+ &isNoteVisible );
+
+ if ( !isNoteVisible.Boolean() )
+ {
+ ShowNoteL( EPhoneEmergencyConnectWaitNote );
+ UpdateSetupCbaL();
+ }
+ }
break;
-
+
case MEngineMonitor::EPEMessageColpNumberAvailable:
//Don't show COLP note during emergency call.
- break;
+ break;
default:
CPhoneGsmInCall::HandlePhoneEngineMessageL(
@@ -203,16 +212,20 @@
iViewCommandHandle->ExecuteCommandL( EPhoneViewSetGlobalNotifiersDisabled,
&globalNotifierParam );
+ if ( iOnScreenDialer && IsDTMFEditorVisibleL() )
+ {
+ CloseDTMFEditorL();
+ }
+
if ( aCallId == KEmergencyCallId )
{
iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveCallHeader, aCallId );
+ // Make sure that toolbar is not shown any more
+ iViewCommandHandle->ExecuteCommandL( EPhoneViewHideToolbar );
// Remove emergency connecting note if still there
iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNote );
-
- TPhoneCmdParamKeyCapture captureParam;
- captureParam.SetKeyCode( EKeyNo );
- iViewCommandHandle->ExecuteCommand(
- EPhoneViewStopCapturingKey, &captureParam );
+ // Close menu bar, if it is displayed
+ iViewCommandHandle->ExecuteCommandL( EPhoneViewMenuBarClose );
const TBool isSimStateNotPresentWithSecurityMode = IsSimStateNotPresentWithSecurityModeEnabled();
@@ -223,15 +236,23 @@
}
else
{
- if ( !TopAppIsDisplayedL() || iDeviceLockOn )
+ if ( !TopAppIsDisplayedL() || iStateMachine->SecurityMode()->IsAutolockEnabled() )
{
// Continue displaying current app but set up the
// idle screen in the background
SetupIdleScreenInBackgroundL();
+ // Update toolbar
+ iViewCommandHandle->ExecuteCommandL( EPhoneViewUpdateToolbar );
}
else if ( iOnScreenDialer && IsNumberEntryContentStored() )
{
+ if ( !IsNumberEntryUsedL() )
+ {
+ CreateNumberEntryL();
+ }
+ // Restore the number entry content from cache
+ RestoreNumberEntryContentL();
SetNumberEntryVisibilityL(ETrue);
}
@@ -239,6 +260,8 @@
{
// Show the number entry if it exists
SetNumberEntryVisibilityL(ETrue);
+ // Update toolbar
+ iViewCommandHandle->ExecuteCommandL( EPhoneViewUpdateToolbar );
}
else
@@ -267,24 +290,22 @@
{
SetDefaultFlagsL();
}
-
- // As long as security note is not shown with feature flag
+
+ // As long as security note is not shown with feature flag
// KFeatureIdFfSimlessOfflineSupport undef it is ok to do SetupIdleScreenInBackgroundL.
- if ( ( !IsNumberEntryUsedL() ) &&
- !( IsSimStateNotPresentWithSecurityModeEnabled() &&
+ if ( ( !IsNumberEntryUsedL() ) &&
+ !( IsSimStateNotPresentWithSecurityModeEnabled() &&
!FeatureManager::FeatureSupported( KFeatureIdFfSimlessOfflineSupport ) ) )
{
UpdateCbaL( EPhoneEmptyCBA );
-
- TPhoneCmdParamBoolean securityMode;
- iViewCommandHandle->ExecuteCommandL( EPhoneViewGetSecurityModeStatus, &securityMode );
- if ( !securityMode.Boolean() )
+
+ if ( !iStateMachine->SecurityMode()->IsSecurityMode() )
{
// Setup idle as next active app.
SetupIdleScreenInBackgroundL();
}
}
-
+
iStateMachine->ChangeState( EPhoneStateIdle );
}
}
@@ -311,8 +332,23 @@
if ( aCallId == KPEEmergencyCallId )
{
+ if ( !IsSimOk() || IsSimStateNotPresentWithSecurityModeEnabled() )
+ {
+ TPhoneCmdParamBoolean visibleMode;
+ visibleMode.SetBoolean( ETrue );
+ iViewCommandHandle->ExecuteCommandL( EPhoneViewSetStatusPaneVisible, &visibleMode );
+ }
- iDeviceLockOn = IsAutoLockOn();
+ // Close menu bar, if it is displayed
+ iViewCommandHandle->ExecuteCommandL( EPhoneViewMenuBarClose );
+
+ // Dim toolbar items
+ SetToolbarDimming( ETrue );
+
+ // Request that dimmed toolbar is visible.
+ // Do it already here. Otherwice a white/black toolbar area is shortly shown and
+ // a white screen can be a result when touching it.
+ iViewCommandHandle->HandleCommandL( EPhoneViewShowToolbar );
// Disable global notes when the phone is dialling
TPhoneCmdParamBoolean globalNotifierParam;
@@ -321,21 +357,13 @@
EPhoneViewSetGlobalNotifiersDisabled,
&globalNotifierParam );
- TPhoneCmdParamKeyCapture captureParam;
- captureParam.SetKeyCode( EKeyNo );
- iViewCommandHandle->ExecuteCommand( EPhoneViewStartCapturingKey, &captureParam );
-
// Capture keys when the phone is dialling
CaptureKeysDuringCallNotificationL( ETrue );
// Indicate that the Phone needs to be sent to the background if
// an application other than the top application is in the foreground
- TPhoneCmdParamBoolean booleanParam;
- booleanParam.SetBoolean( !TopAppIsDisplayedL() );
- iViewCommandHandle->ExecuteCommandL(
- EPhoneViewSetNeedToSendToBackgroundStatus,
- &booleanParam );
-
+ SetNeedToReturnToForegroundAppStatusL( !TopAppIsDisplayedL() );
+
// Bring Phone app in the foreground
TPhoneCmdParamInteger uidParam;
uidParam.SetInteger( KUidPhoneApplication.iUid );
@@ -355,52 +383,14 @@
// Remove exit emergency mode query, if it exists
iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveQuery );
-
- BeginUiUpdateLC();
-
- TPhoneCmdParamEmergencyCallHeaderData emergencyHeaderParam;
- // Set call header
- TBuf<KPhoneCallHeaderLabelMaxLength> headerText( KNullDesC );
- StringLoader::Load(
- headerText,
- CPhoneMainResourceResolver::Instance()->ResolveResourceID(
- EPhoneEmergencyCallHeader ),
- CCoeEnv::Static() );
- emergencyHeaderParam.SetHeaderText( headerText );
- // Set call header ciphering status
- emergencyHeaderParam.SetCiphering(
- iStateMachine->PhoneEngineInfo()->IsSecureCall( aCallId ) );
- emergencyHeaderParam.SetCipheringIndicatorAllowed(
- iStateMachine->PhoneEngineInfo()->SecureSpecified() );
-
- // Notify the view
- iViewCommandHandle->ExecuteCommandL(
- EPhoneViewCreateEmergencyCallHeader,
- aCallId,
- &emergencyHeaderParam );
-
- TPhoneCmdParamCallHeaderData headerParam;
- headerParam.SetCallState( EPEStateDialing );
-
- StringLoader::Load(
- headerText,
- CPhoneMainResourceResolver::Instance()->ResolveResourceID(
- EPhoneAttemptingEmergencyText ),
- CCoeEnv::Static() );
- headerParam.SetLabelText( headerText );
-
- iViewCommandHandle->ExecuteCommandL(
- EPhoneViewUpdateBubble,
- aCallId,
- &headerParam );
+ // Enable the volume display
+ iViewCommandHandle->ExecuteCommandL( EPhoneViewShowNaviPaneAudioVolume );
SetTouchPaneButtons( EPhoneEmergencyCallButtons );
- SetBackButtonActive(EFalse);
-
- EndUiUpdate();
- // ShowNoteL( EPhoneEmergencyConnectWaitNote );
+ ShowNoteL( EPhoneEmergencyConnectWaitNote );
+
UpdateSetupCbaL();
}
}
@@ -430,21 +420,39 @@
CaptureKeysDuringCallNotificationL( EFalse );
}
}
- else if ( !iDeviceLockOn && SimState() == EPESimUsable )
+ else if ( !iStateMachine->SecurityMode()->IsAutolockEnabled() && SimState() == EPESimUsable )
{
// Stop capturing keys
CaptureKeysDuringCallNotificationL( EFalse );
}
- // Keep Phone in the foreground
- TPhoneCmdParamBoolean booleanParam;
- booleanParam.SetBoolean( EFalse );
- iViewCommandHandle->ExecuteCommandL(
- EPhoneViewSetNeedToSendToBackgroundStatus, &booleanParam );
-
// Remove emergency connecting note
iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNote );
+ TPhoneCmdParamEmergencyCallHeaderData emergencyHeaderParam;
+ // Set call header
+ TBuf<KPhoneCallHeaderLabelMaxLength> headerText( KNullDesC );
+ StringLoader::Load(
+ headerText,
+ CPhoneMainResourceResolver::Instance()->ResolveResourceID(
+ EPhoneEmergencyCallHeader ),
+ CCoeEnv::Static() );
+ emergencyHeaderParam.SetHeaderText( headerText );
+
+ // Set call header ciphering status
+ emergencyHeaderParam.SetCiphering(
+ iStateMachine->PhoneEngineInfo()->IsSecureCall( aCallId ) );
+ emergencyHeaderParam.SetCipheringIndicatorAllowed(
+ iStateMachine->PhoneEngineInfo()->SecureSpecified() );
+
+ BeginUiUpdateLC();
+
+ // Notify the view
+ iViewCommandHandle->ExecuteCommandL(
+ EPhoneViewCreateEmergencyCallHeader,
+ aCallId,
+ &emergencyHeaderParam );
+
TPhoneCmdParamCallHeaderData headerParam;
headerParam.SetCallState( EPEStateConnecting );
// Notify the view
@@ -453,7 +461,7 @@
aCallId,
&headerParam );
- SetToolbarButtonLoudspeakerEnabled();
+ EndUiUpdate();
UpdateInCallCbaL();
}
@@ -476,13 +484,43 @@
aCallId,
&emergencyHeaderParam );
- SetBackButtonActive(ETrue);
-
EndUiUpdate();
+ SetToolbarDimming( ETrue );
UpdateInCallCbaL();
}
// -----------------------------------------------------------
+// CPhoneEmergency::OpenMenuBarL
+// -----------------------------------------------------------
+//
+void CPhoneEmergency::OpenMenuBarL()
+ {
+ __LOGMETHODSTARTEND(EPhoneUIStates, "CPhoneEmergency::OpenMenuBarL() ");
+ TInt resourceId;
+
+ if ( iOnScreenDialer && IsDTMFEditorVisibleL() )
+ {
+ resourceId = EPhoneDtmfDialerMenubar;
+ }
+ else if ( IsNumberEntryVisibleL() )
+ {
+ resourceId = EPhoneCallHandlingEmergencyMenubarWithNumberEntry;
+ }
+ else
+ {
+ resourceId = EPhoneCallHandlingEmergencyMenubar;
+ }
+
+ TPhoneCmdParamInteger integerParam;
+ integerParam.SetInteger(
+ CPhoneMainResourceResolver::Instance()->
+ ResolveResourceID( resourceId ) );
+ iViewCommandHandle->ExecuteCommandL( EPhoneViewMenuBarOpen,
+ &integerParam );
+ }
+
+
+// -----------------------------------------------------------
// CPhoneEmergency::UpdateInCallCbaL
// -----------------------------------------------------------
//
@@ -490,6 +528,64 @@
{
__LOGMETHODSTARTEND(EPhoneUIStates, "CPhoneEmergency::UpdateInCallCbaL() ");
TInt resourceId = EPhoneCallHandlingEmergencyCBA;
+ const TPEAudioOutput audioOutput =
+ iStateMachine->PhoneEngineInfo()->AudioOutput();
+ const TBool btAvailable =
+ iStateMachine->PhoneEngineInfo()->AudioOutputAvailable( EPEBTAudioAccessory );
+
+ __PHONELOG2( EOnlyFatal, EPhoneUIStates,
+ "CPhoneEmergency - AudioOutput: %d, BTAvailable: %d",
+ audioOutput, btAvailable );
+
+ if ( IsNumberEntryVisibleL() )
+ {
+ if ( IsDTMFEditorVisibleL() )
+ {
+ resourceId = EPhoneDtmfDialerCBA;
+ }
+ else
+ {
+ resourceId = EPhoneInCallNumberAcqCBA;
+ }
+ }
+ else if ( iStateMachine->SecurityMode()->IsAutolockEnabled()
+ || SimState() != EPESimUsable
+ || iStartupInterrupted )
+ {
+ if ( TouchCallHandlingSupported() )
+ {
+ resourceId = EPhoneCallHandlingEmergencyInCallNoOptions;
+ }
+ else if ( audioOutput == EPEWiredAudioAccessory || IsSwivelClosed())
+ {
+ resourceId = EPhoneCallHandlingEmergencyNoOptionsNoIhfCBA;
+ }
+ else if ( audioOutput == EPELoudspeaker )
+ {
+ resourceId = EPhoneCallHandlingEmergencyNoOptionsHandsetCBA;
+ }
+ else
+ {
+ resourceId = EPhoneCallHandlingEmergencyNoOptionsCBA;
+ }
+ }
+ else
+ {
+ if ( UseEmergencyNoIhfCBA( audioOutput ) )
+ {
+ resourceId = EPhoneCallHandlingEmergencyNoIhfCBA;
+ }
+ else if ( UseHandsetEmergencyCBA( audioOutput ) )
+ {
+ resourceId = EPhoneCallHandlingEmergencyHandsetCBA;
+ }
+ else if ( ( audioOutput == EPEHandset )
+ && ( btAvailable ) )
+ {
+ resourceId = EPhoneCallHandlingInCallBtaaCBA;
+ }
+ }
+
iCbaManager->SetCbaL( resourceId );
}
@@ -508,6 +604,10 @@
// end-key
case EKeyNo:
// handle end key
+ if ( iOnScreenDialer && IsDTMFEditorVisibleL() )
+ {
+ CloseDTMFEditorL();
+ }
DisconnectEmergencyCallL();
break;
@@ -522,7 +622,7 @@
if ( neLength )
{
// Show not allowed note
- SendGlobalErrorNoteL( EPhoneNoteTextNotAllowed, ETrue );
+ SendGlobalErrorNoteL( EPhoneNoteTextNotAllowed );
}
else
{
@@ -533,7 +633,7 @@
else
{
// Show not allowed note
- SendGlobalErrorNoteL( EPhoneNoteTextNotAllowed, ETrue );
+ SendGlobalErrorNoteL( EPhoneNoteTextNotAllowed );
}
break;
@@ -541,9 +641,10 @@
{
if ( TouchCallHandlingSupported() )
{
- CPhoneGsmInCall::HandleKeyMessageL( aMessage, aCode );
+ CPhoneGsmInCall::HandleKeyMessageL( aMessage, aCode );
}
- else if ( !iDeviceLockOn && SimState() == EPESimUsable )
+ else if ( !iStateMachine->SecurityMode()->IsAutolockEnabled()
+ && SimState() == EPESimUsable )
{
// do base operation
CPhoneGsmInCall::HandleKeyMessageL( aMessage, aCode );
@@ -564,22 +665,22 @@
switch( aCommand )
{
- case EPhoneInCallCmdDtmfManualQuery:
- if ( iStateMachine->PhoneEngineInfo()->CallState( KPEEmergencyCallId ) == EPEStateDialing )
- {
- // Remove emergency connecting note
- iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNote );
- }
- commandStatus = CPhoneGsmInCall::HandleCommandL( aCommand );
- break;
-
case EPhoneDtmfDialerExit: // fall through
case EPhoneDtmfDialerCancel:
{
if ( iStateMachine->PhoneEngineInfo()->CallState( KPEEmergencyCallId ) == EPEStateDialing )
{
+ CloseDTMFEditorL();
- UpdateSetupCbaL();
+ TPhoneCmdParamBoolean isNoteVisible;
+ iViewCommandHandle->ExecuteCommandL( EPhoneViewGetIsNoteVisible,
+ &isNoteVisible );
+
+ if ( !isNoteVisible.Boolean() )
+ {
+ ShowNoteL( EPhoneEmergencyConnectWaitNote );
+ UpdateSetupCbaL();
+ }
}
else
{
@@ -593,6 +694,10 @@
DisconnectEmergencyCallL();
break;
+ case EPhoneCmdUpdateEmergencyCba:
+ UpdateInCallCbaL();
+ break;
+
default:
commandStatus = CPhoneGsmInCall::HandleCommandL( aCommand );
break;
@@ -642,7 +747,7 @@
case ECCPErrorCCNoChannelAvailable:
case ECCPErrorNetworkBusy:
case ECCPEmergencyFailed:
- SendGlobalErrorNoteL( EPhoneNoteNoNetworkCallEmergency, ETrue );
+ SendGlobalErrorNoteL( EPhoneNoteNoNetworkCallEmergency );
break;
default:
@@ -665,14 +770,15 @@
TEventCode aEventCode )
{
__LOGMETHODSTARTEND(EPhoneUIStates, "CPhoneEmergency::HandleKeyEventL( ) ");
-
+
if ( TouchCallHandlingSupported() )
{
CPhoneState::HandleKeyEventL( aKeyEvent, aEventCode );
}
else
{
- if ( iDeviceLockOn && CPhoneKeys::IsNumericKey( aKeyEvent, aEventCode ) )
+ if ( iStateMachine->SecurityMode()->IsAutolockEnabled()
+ && CPhoneKeys::IsNumericKey( aKeyEvent, aEventCode ) )
{
// Send the key event to the phone engine
SendKeyEventL( aKeyEvent, aEventCode );
@@ -746,8 +852,7 @@
iStateMachine->PhoneEngineInfo()->AudioOutput();
UpdateSetupCbaL();
- SetTouchPaneButtons(0);
-
+
// view update
outputParam.SetAudioOutput( audioOutput );
iViewCommandHandle->ExecuteCommandL( EPhoneViewActivateAudioPathUIChanges,
@@ -771,10 +876,52 @@
void CPhoneEmergency::UpdateSetupCbaL()
{
__LOGMETHODSTARTEND(EPhoneUIStates, "CPhoneEmergency::UpdateSetupCbaL() ");
- TInt resourceId = EPhoneCallHandlingEmergencyCBA;
- iCbaManager->SetCbaL( resourceId );
+
+ TInt resourceId = EPhoneCallHandlingCallSetupCBA;
+
+ const TPEAudioOutput audioOutput =
+ iStateMachine->PhoneEngineInfo()->AudioOutput();
+
+ if ( !( TouchCallHandlingSupported() )
+ && iCallSetup && audioOutput != EPENotActive )
+ {
+ if ( audioOutput == EPELoudspeaker )
+ {
+ resourceId = EPhoneCallHandlingCallSetupToHandsetCBA;
+ }
+ else if ( audioOutput == EPEHandset )
+ {
+ resourceId = EPhoneCallHandlingCallSetupToIhfCBA;
+ }
+ else
+ {
+ resourceId = EPhoneCallHandlingCallSetupCBA;
+ }
+ TPhoneCmdParamInteger integerParam;
+ integerParam.SetInteger(
+ CPhoneMainResourceResolver::Instance()->
+ ResolveResourceID( resourceId ) );
+
+ iViewCommandHandle->ExecuteCommandL( EPhoneViewUpdateNoteSoftkeys,
+ &integerParam );
+ }
}
+// ---------------------------------------------------------
+// CPhoneEmergency::HandleCreateNumberEntryL
+//
+// ---------------------------------------------------------
+//
+void CPhoneEmergency::HandleCreateNumberEntryL( const TKeyEvent& aKeyEvent,
+ TEventCode aEventCode )
+ {
+ __LOGMETHODSTARTEND( EPhoneControl, "CPhoneEmergency::HandleCreateNumberEntryL() ");
+ if ( !iCallSetup && !iStartupInterrupted )
+ {
+ CPhoneGsmInCall::HandleCreateNumberEntryL( aKeyEvent, aEventCode );
+ }
+
+ }
// -----------------------------------------------------------------------------
// CPhoneEmergency::HandleRemConCommandL
@@ -787,7 +934,7 @@
TBool handled = EFalse;
__LOGMETHODSTARTEND(EPhoneControl, "CPhoneEmergency::MrccatoCommand() ");
-
+
switch ( aOperationId )
{
case ERemConCoreApiMute:
@@ -811,7 +958,7 @@
{
return ETrue;
}
- else
+ else
{
return EFalse;
}
@@ -823,12 +970,12 @@
//
TBool CPhoneEmergency::UseEmergencyNoIhfCBA( const TPEAudioOutput& aAudioOutput ) const
{
- if ( !( TouchCallHandlingSupported() )
+ if ( !( TouchCallHandlingSupported() )
&& ( ( aAudioOutput == EPEWiredAudioAccessory ) || ( IsSwivelClosed() ) ) )
{
return ETrue;
}
- else
+ else
{
return EFalse;
}
@@ -839,16 +986,26 @@
// --------------------------------------------------------------
//
TBool CPhoneEmergency::UseHandsetEmergencyCBA( const TPEAudioOutput& aAudioOutput ) const
-{
- if ( !( TouchCallHandlingSupported() )
+ {
+ if ( !( TouchCallHandlingSupported() )
&& ( ( aAudioOutput == EPELoudspeaker ) || ( aAudioOutput == EPEBTAudioAccessory ) ) )
{
return ETrue;
}
- else
+ else
{
return EFalse;
}
-}
+ }
+
+// --------------------------------------------------------------
+// CPhoneEmergency::HandlePhoneStartupL
+// --------------------------------------------------------------
+//
+void CPhoneEmergency::HandlePhoneStartupL()
+ {
+ __LOGMETHODSTARTEND(EPhoneControl, "CPhoneEmergency::HandlePhoneStartupL( ) ");
+ iStartupInterrupted = EFalse;
+ }
// End of File