diff -r 40a3f856b14d -r 41a7f70b3818 phoneapp/phoneuicontrol/src/cphonestatemachine.cpp --- a/phoneapp/phoneuicontrol/src/cphonestatemachine.cpp Thu Aug 19 09:54:27 2010 +0300 +++ b/phoneapp/phoneuicontrol/src/cphonestatemachine.cpp Tue Aug 31 15:14:29 2010 +0300 @@ -29,8 +29,8 @@ #include "cphonestateincall.h" #include "phonestatedefinitions.h" #include "phonelogger.h" -#include "mphonesecuritymodeobserver.h" -#include "mphonesecuritymessagehandler.h" +#include "cphonestorage.h" +#include "mphonestorage.h" // ================= MEMBER FUNCTIONS ======================= @@ -41,11 +41,10 @@ MPhoneViewCommandHandle* aViewCommandHandle ) : iOldStateId( EPhoneStateNull ), iNewStateId( EPhoneStateNull ), - iViewCommandHandle( aViewCommandHandle ), - iEnv( CEikonEnv::Static() ) // codescanner::eikonenvstatic + iViewCommandHandle( aViewCommandHandle ) { __ASSERT_ALWAYS( aViewCommandHandle, - Panic( EPhoneCtrlParameterNotInitialized ) ); + Panic( EPhoneCtrlParameterNotInitialized ) ); } // ----------------------------------------------------------- @@ -56,16 +55,36 @@ // EXPORT_C CPhoneStateMachine::~CPhoneStateMachine() { - if( iState == iIdleState ) - { - // Avoid deleting idle state instance twice. - // If state is idle, iState points to idle state instance. - iIdleState = NULL; - } - delete iState; - delete iIdleState; - delete iPhoneEngine; - } + if( iState == iIdleState ) + { + delete iState; + iState = NULL; + iIdleState = NULL; + } + else + { + if( iState ) + { + delete iState; + iState = NULL; + } + if( iIdleState ) + { + delete iIdleState; + iIdleState = NULL; + } + } + if( iPhoneEngine ) + { + delete iPhoneEngine; + iPhoneEngine = NULL; + } + if( iPhoneStorage ) + { + delete iPhoneStorage; + iPhoneStorage = NULL; + } + } // --------------------------------------------------------- // CPhoneStateMachine::SetPhoneEngine @@ -76,7 +95,7 @@ { __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateMachine::SetPhoneEngine "); __ASSERT_ALWAYS( aPhoneEngine, - Panic( EPhoneCtrlParameterNotInitialized ) ); + Panic( EPhoneCtrlParameterNotInitialized ) ); iPhoneEngine = aPhoneEngine; } @@ -164,75 +183,19 @@ PhoneEngineInfo()->SetCallId( aCallId ); } - // ----------------------------------------------------------- -// CPhoneStateMachine::SecurityMode -// ----------------------------------------------------------- -// -EXPORT_C MPhoneSecurityModeObserver* CPhoneStateMachine::SecurityMode() - { - return iSecurityModeObserver; - } - -// ----------------------------------------------------------- -// CPhoneStateMachine::SetSecurityModeObserver -// ----------------------------------------------------------- -// -EXPORT_C void CPhoneStateMachine::SetSecurityModeObserver( MPhoneSecurityModeObserver* aObserver ) - { - iSecurityModeObserver = aObserver; - } - -// ----------------------------------------------------------- -// CPhoneStateMachine::SetSecurityMessageHandler -// ----------------------------------------------------------- -// -EXPORT_C void CPhoneStateMachine::SetSecurityMessageHandler( MPhoneSecurityMessageHandler* aHandler ) - { - iSecurityMessageHandler = aHandler; - } - -// ----------------------------------------------------------- -// CPhoneStateMachine::HandlePhoneEngineMessageL +// CPhoneStateMachine::PhoneStorage // ----------------------------------------------------------- // -EXPORT_C void CPhoneStateMachine::HandlePhoneEngineMessageL(const TInt aMessage, - TInt aCallId ) - { - // Forward engine messages to security mode state and current phone state - // instance. - if ( iSecurityMessageHandler ) - { - iSecurityMessageHandler->HandlePhoneEngineMessageL( aMessage, aCallId ); - } - - State()->HandlePhoneEngineMessageL( aMessage, aCallId ); - } +EXPORT_C MPhoneStorage* CPhoneStateMachine::PhoneStorage() + { + if ( iPhoneStorage == NULL ) + { + TInt err( KErrNone ); + TRAP( err, iPhoneStorage = CPhoneStorage::NewL()); + __ASSERT_ALWAYS( KErrNone == err, User::Invariant() ); + } + return iPhoneStorage; + } -// ----------------------------------------------------------- -// CPhoneStateMachine::HandlePropertyChangedL -// ----------------------------------------------------------- -// -EXPORT_C void CPhoneStateMachine::HandlePropertyChangedL(const TUid& aCategory, - const TUint aKey, - const TInt aValue ) - { - // Forward P&S key changes to security mode state and current phone state - // instance. - if ( iSecurityMessageHandler ) - { - iSecurityMessageHandler->HandlePropertyChangedL( aCategory, aKey, aValue ); - } - State()->HandlePropertyChangedL( aCategory, aKey, aValue ); - } - -// ----------------------------------------------------------- -// CPhoneStateMachine::EikonEnv -// ----------------------------------------------------------- -// -EXPORT_C CEikonEnv* CPhoneStateMachine::EikonEnv() const - { - return iEnv; - } - // End of File