--- a/phoneapp/phoneuistates/src/cphonestatemachinegsm.cpp Tue Aug 31 15:14:29 2010 +0300
+++ b/phoneapp/phoneuistates/src/cphonestatemachinegsm.cpp Wed Sep 01 12:30:10 2010 +0100
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -40,8 +40,13 @@
#include "cphoneemergency.h"
#include "cphoneconferenceandwaitingandcallsetup.h"
#include "cphoneidle.h"
+#include "cphonestartup.h"
#include "cphoneincoming.h"
-#include "cphonestartup.h"
+#include "cphonestartupsimlockui.h"
+#include "cphonepubsubproxy.h"
+#include <startupdomainpskeys.h>
+#include "phoneconstants.h"
+#include <featmgr.h>
// ================= MEMBER FUNCTIONS =======================
@@ -67,10 +72,10 @@
{
__LOGMETHODSTARTEND( EPhoneUIStates, "CPhoneStateMachineGSM::~CPhoneStateMachineGSM() ");
if( iEmergencyState )
- {
- delete iEmergencyState;
- iEmergencyState = NULL;
- }
+ {
+ delete iEmergencyState;
+ iEmergencyState = NULL;
+ }
Dll::FreeTls();
}
@@ -99,7 +104,7 @@
// Possible that derived class has been deleted iState,
// so this delete statement may be useless.
delete iState;
- iState = NULL;
+ iState = NULL;
}
// State transition need to be made - construct new state and
@@ -108,163 +113,174 @@
{
case EPhoneStateCallSetup:
TRAP( err, iState = CPhoneCallSetup::NewL(
- this, iViewCommandHandle, iCustomization ));
+ this, iViewCommandHandle, iCustomization ));
__ASSERT_ALWAYS( KErrNone == err, User::Invariant() );
madeStateTransition = ETrue;
break;
case EPhoneStateAlerting:
TRAP( err, iState = CPhoneAlerting::NewL(
- this, iViewCommandHandle, iCustomization ));
+ this, iViewCommandHandle, iCustomization ));
__ASSERT_ALWAYS( KErrNone == err, User::Invariant() );
madeStateTransition = ETrue;
break;
case EPhoneStateSingle:
TRAP( err, iState = CPhoneSingleCall::NewL(
- this, iViewCommandHandle, iCustomization ));
+ this, iViewCommandHandle, iCustomization ));
__ASSERT_ALWAYS( KErrNone == err, User::Invariant() );
madeStateTransition = ETrue;
break;
case EPhoneStateWaitingInSingle:
TRAP( err, iState = CPhoneSingleAndWaiting::NewL(
- this, iViewCommandHandle, iCustomization ));
+ this, iViewCommandHandle, iCustomization ));
__ASSERT_ALWAYS( KErrNone == err, User::Invariant() );
madeStateTransition = ETrue;
break;
case EPhoneStateTwoSingles:
TRAP( err, iState = CPhoneTwoSingles::NewL(
- this, iViewCommandHandle, iCustomization ));
+ this, iViewCommandHandle, iCustomization ));
__ASSERT_ALWAYS( KErrNone == err, User::Invariant() );
madeStateTransition = ETrue;
break;
case EPhoneStateCallSetupInSingle:
TRAP( err, iState = CPhoneSingleAndCallSetup::NewL(
- this, iViewCommandHandle, iCustomization ));
+ this, iViewCommandHandle, iCustomization ));
__ASSERT_ALWAYS( KErrNone == err, User::Invariant() );
madeStateTransition = ETrue;
break;
case EPhoneStateAlertingInSingle:
TRAP( err, iState = CPhoneSingleAndAlerting::NewL(
- this, iViewCommandHandle, iCustomization ));
+ this, iViewCommandHandle, iCustomization ));
__ASSERT_ALWAYS( KErrNone == err, User::Invariant() );
madeStateTransition = ETrue;
break;
case EPhoneStateConference:
TRAP( err, iState = CPhoneConference::NewL(
- this, iViewCommandHandle, iCustomization ));
+ this, iViewCommandHandle, iCustomization ));
__ASSERT_ALWAYS( KErrNone == err, User::Invariant() );
madeStateTransition = ETrue;
break;
case EPhoneStateConferenceAndCallSetup:
TRAP( err, iState = CPhoneConferenceAndCallSetup::NewL(
- this, iViewCommandHandle, iCustomization ) );
+ this, iViewCommandHandle, iCustomization ) );
__ASSERT_ALWAYS( KErrNone == err, User::Invariant() );
madeStateTransition = ETrue;
break;
case EPhoneStateConferenceAndSingle:
TRAP( err, iState = CPhoneConferenceAndSingle::NewL(
- this, iViewCommandHandle, iCustomization ) );
+ this, iViewCommandHandle, iCustomization ) );
__ASSERT_ALWAYS( KErrNone == err, User::Invariant() );
madeStateTransition = ETrue;
break;
case EPhoneStateConferenceAndWaiting:
TRAP( err, iState = CPhoneConferenceAndWaiting::NewL(
- this, iViewCommandHandle, iCustomization ) );
+ this, iViewCommandHandle, iCustomization ) );
__ASSERT_ALWAYS( KErrNone == err, User::Invariant() );
madeStateTransition = ETrue;
break;
case EPhoneStateSingleAndCallSetupAndWaiting:
TRAP( err, iState = CPhoneSingleAndCallSetupAndWaiting::NewL(
- this, iViewCommandHandle, iCustomization ) );
+ this, iViewCommandHandle, iCustomization ) );
__ASSERT_ALWAYS( KErrNone == err, User::Invariant() );
madeStateTransition = ETrue;
break;
case EPhoneStateCallSetupAndWaiting:
TRAP( err, iState = CPhoneCallSetupAndWaiting::NewL(
- this, iViewCommandHandle, iCustomization ) );
+ this, iViewCommandHandle, iCustomization ) );
__ASSERT_ALWAYS( KErrNone == err, User::Invariant() );
madeStateTransition = ETrue;
break;
case EPhoneStateTwoSinglesAndWaiting:
TRAP( err, iState = CPhoneTwoSinglesAndWaiting::NewL(
- this, iViewCommandHandle, iCustomization ) );
+ this, iViewCommandHandle, iCustomization ) );
__ASSERT_ALWAYS( KErrNone == err, User::Invariant() );
madeStateTransition = ETrue;
break;
case EPhoneStateConferenceAndSingleAndWaiting:
TRAP( err, iState = CPhoneConferenceAndSingleAndWaiting::NewL(
- this, iViewCommandHandle, iCustomization ));
+ this, iViewCommandHandle, iCustomization ));
__ASSERT_ALWAYS( KErrNone == err, User::Invariant() );
madeStateTransition = ETrue;
break;
case EPhoneStateEmergency:
if( !iEmergencyStateConstructed )
- {
- TRAP( err, iEmergencyState = CPhoneEmergency::NewL(
- this, iViewCommandHandle, iCustomization ) );
- __ASSERT_ALWAYS( KErrNone == err, User::Invariant() );
- iEmergencyStateConstructed = ETrue;
- }
+ {
+ TRAP( err, iEmergencyState = CPhoneEmergency::NewL(
+ this, iViewCommandHandle, iCustomization ) );
+ __ASSERT_ALWAYS( KErrNone == err, User::Invariant() );
+ iEmergencyStateConstructed = ETrue;
+ }
static_cast< CPhoneEmergency* >( iEmergencyState )->
SetStartupInterrupted( iOldStateId == EPhoneStateStartup );
- iState = iEmergencyState;
+ iState = iEmergencyState;
madeStateTransition = ETrue;
break;
case EPhoneStateConferenceAndWaitingAndCallSetup:
TRAP( err, iState =
- CPhoneConferenceAndWaitingAndCallSetup::NewL(
- this, iViewCommandHandle, iCustomization ) );
+ CPhoneConferenceAndWaitingAndCallSetup::NewL(
+ this, iViewCommandHandle, iCustomization ) );
__ASSERT_ALWAYS( KErrNone == err, User::Invariant() );
madeStateTransition = ETrue;
break;
case EPhoneStateIdle:
- if ( iOldStateId != EPhoneStateEmergency )
- {
+ if ( iOldStateId != EPhoneStateEmergency )
+ {
if( !iEmergencyStateConstructed )
- {
- TRAP( err, iEmergencyState = CPhoneEmergency::NewL(
- this, iViewCommandHandle, iCustomization ) );
- __ASSERT_ALWAYS( KErrNone == err, User::Invariant() );
- iEmergencyStateConstructed = ETrue;
- }
- }
- if( iIdleState == NULL )
- {
- TRAP( err, iIdleState =
- CPhoneIdle::NewL( this, iViewCommandHandle, iCustomization ) );
- __ASSERT_ALWAYS( KErrNone == err, User::Invariant() );
- }
- iState = iIdleState;
+ {
+ TRAP( err, iEmergencyState = CPhoneEmergency::NewL(
+ this, iViewCommandHandle, iCustomization ) );
+ __ASSERT_ALWAYS( KErrNone == err, User::Invariant() );
+ iEmergencyStateConstructed = ETrue;
+ }
+ }
+ if( iIdleState == NULL )
+ {
+ TRAP( err, iIdleState =
+ CPhoneIdle::NewL( this, iViewCommandHandle, iCustomization ) );
+ __ASSERT_ALWAYS( KErrNone == err, User::Invariant() );
+ }
+ iState = iIdleState;
madeStateTransition = ETrue;
break;
case EPhoneStateIncoming:
TRAP( err, iState =
- CPhoneIncoming::NewL( this, iViewCommandHandle, iCustomization ) );
+ CPhoneIncoming::NewL( this, iViewCommandHandle, iCustomization ) );
__ASSERT_ALWAYS( KErrNone == err, User::Invariant() );
madeStateTransition = ETrue;
break;
case EPhoneStateStartup:
- TRAP( err, iState =
- CPhoneStartup::NewL( this, iViewCommandHandle,
- iOldStateId == EPhoneStateEmergency ) );
+
+ if( IsSimlockStartupStateCreated() )
+ {
+ TRAP( err, iState =
+ CPhoneStartupSimlockUi::NewL( this, iViewCommandHandle,
+ iOldStateId == EPhoneStateEmergency ) );
+ }
+ else
+ {
+ TRAP( err, iState =
+ CPhoneStartup::NewL( this, iViewCommandHandle,
+ iOldStateId == EPhoneStateEmergency ) );
+ }
+
__ASSERT_ALWAYS( KErrNone == err, User::Invariant() );
madeStateTransition = ETrue;
break;
@@ -279,11 +295,37 @@
{
__PHONELOGSTATECHANGE( iOldStateId, iNewStateId );
iOldStateId = iNewStateId;
+
+ // Needs to be set or any attempts to access eikon env handle
+ // will fail
+ iState->SetEikonEnv( EikonEnv() );
}
return iState;
}
+
+// -----------------------------------------------------------
+// CPhoneStateMachineGSM::IsSimlockStartupStateCreated
+// -----------------------------------------------------------
+//
+TBool CPhoneStateMachineGSM::IsSimlockStartupStateCreated() const
+ {
+ if ( FeatureManager::FeatureSupported( KFeatureIdFfSimlockUi ) )
+ {
+ TInt securityStatus =
+ CPhonePubSubProxy::Instance()->Value(
+ KPSUidStartup, KStartupSimSecurityStatus );
+ if ( securityStatus == ESimUnaccepted )
+ {
+ return ETrue;
+ }
+ }
+
+ return EFalse;
+ }
+
+
// -----------------------------------------------------------
// CPhoneStateMachineGSM::NewL()
// Constructor