phoneapp/phoneuicontrol/src/cphonestate.cpp
branchRCL_3
changeset 61 41a7f70b3818
parent 58 40a3f856b14d
child 62 5266b1f337bd
--- a/phoneapp/phoneuicontrol/src/cphonestate.cpp	Thu Aug 19 09:54:27 2010 +0300
+++ b/phoneapp/phoneuicontrol/src/cphonestate.cpp	Tue Aug 31 15:14:29 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2005-2009 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"
@@ -32,23 +32,20 @@
 #include <AknUtils.h>
 #include <telephonyvariant.hrh>
 #include <aknsoundsystem.h>
-#include <cphcntprofileengine.h>
 #include <wlaninternalpskeys.h>
 #include <btengdomainpskeys.h>
 #include <btengdomaincrkeys.h>
 #include <settingsinternalcrkeys.h>
 #include <starterclient.h>
-#include <RSSSettings.h>
+#include <rsssettings.h>
 #include <UikonInternalPSKeys.h>
 #include <telephonydomainpstypes.h>
 #include <telinformationpskeys.h>
-#include <activeidle2domainpskeys.h>
 #include <coreapplicationuisdomainpskeys.h>
 #include <mccecall.h>
 #include <ccpdefs.h>
 #include <LogsDomainCRKeys.h>
 #include <spsettings.h>
-#include <ScreensaverInternalPSKeys.h>
 #include <startupdomainpskeys.h>
 #include <MediatorDomainUIDs.h>
 #include <videotelcontrolmediatorapi.h>
@@ -68,11 +65,10 @@
 #include "tphonecmdparamcallheaderdata.h"
 #include "tphonecmdparamincallindicatordata.h"
 #include "tphonecmdparamnote.h"
-#include "tphonecmdparamKeycapture.h"
+#include "tphonecmdparamkeycapture.h"
 #include "tphonecmdparamglobalnote.h"
 #include "tphonecmdparamquery.h"
 #include "tphonecmdparamstring.h"
-#include "tphonecmdparammessageeditor.h"
 #include "tphonecmdparamcallstatedata.h"
 #include "tphonecmdparambitmap.h"
 #include "tphonecmdparamaudiooutput.h"
@@ -105,9 +101,10 @@
 #include "cphonecontinueemergencycallcommand.h"
 #include "cphonecallheadermanager.h"
 #include "cphonenumberentrymanager.h"
-#include "mphonesecuritymodeobserver.h"
-#include "easydialingcommands.hrh"
-
+#include "tphonecmdparamsfidata.h" 
+#include "mphonestorage.h"
+#include "phoneconstants.h"
+#include "cphoneclearblacklist.h"
 
 // ================= MEMBER FUNCTIONS =======================
 
@@ -117,7 +114,8 @@
     MPhoneCustomization* aCustomization) :
     iStateMachine( aStateMachine ),
     iViewCommandHandle( aViewCommandHandle ),
-    iCustomization( aCustomization )
+    iCustomization( aCustomization ),
+    iEnv( *CEikonEnv::Static() )
     {
     // Need to get current SimState for inherited classis
     iPreviousSimState = SimState();
@@ -191,6 +189,7 @@
             HandleAudioOutputChangedL();
             // Go to current state implementation
             iCbaManager->UpdateInCallCbaL();
+            SetTouchPaneButtons(0);
             break;
 
         case MEngineMonitor::EPEMessageAvailableAudioOutputsChanged:
@@ -199,6 +198,7 @@
                 {
                 // Go to current state implementation
                 iCbaManager->UpdateInCallCbaL();
+                SetTouchPaneButtons(0);
                 }
             break;
 
@@ -211,34 +211,23 @@
             break;
 
         case MEngineMonitor::EPEMessageCallWaiting:
-            SendGlobalInfoNoteL( EPhoneWaitingText );
+            // No need to send waiting notification for user.
+            //SendGlobalInfoNoteL( EPhoneWaitingText, ETrue );
             break;
 
         case MEngineMonitor::EPEMessageProfileChanged:
             {
-            TPhoneCmdParamBoolean keypadVolumeParam;
-            if ( iStateMachine->PhoneEngineInfo()->KeypadVolume() == 0 )
-                {
-                iViewCommandHandle->ExecuteCommandL( EPhoneViewKeypadAudioDisabled );
-                }
-            else
-                {
-                iViewCommandHandle->ExecuteCommandL( EPhoneViewKeypadAudioEnabled );
-                }
-            UpdateProfileDisplayL();
             }
             break;
 
         case MEngineMonitor::EPEMessageRemoteTerminated:
-            // Close menu bar, if it is displayed, for call ending note
-            iViewCommandHandle->ExecuteCommandL( EPhoneViewMenuBarClose );
             /* Flow through */
         case MEngineMonitor::EPEMessageDisconnecting:
             HandleDisconnectingL( aCallId );
             break;
 
         case MEngineMonitor::EPEMessageTransferDone:
-            SendGlobalInfoNoteL( EPhoneInCallTransferred );
+            SendGlobalInfoNoteL( EPhoneInCallTransferred, ETrue );
             break;
 
        case MEngineMonitor::EPEMessageInitiatedEmergencyCall:
@@ -249,22 +238,15 @@
            HandleInitiatedEmergencyWhileActiveVideoL();
            break;
 
-        case MEngineMonitor::EPEMessageShowIMEI:
-            // Stop playing DTMF tone
-            iStateMachine->SendPhoneEngineMessage( MPEPhoneModel::EPEMessageEndDTMF );
-            HandleShowImeiL();
-            break;
-
-        case MEngineMonitor::EPEMessageCallSecureStatusChanged:
-            HandleCallSecureStatusChangeL( aCallId );
-            ForwardPEMessageToPhoneCustomizationL( aMessage, aCallId );
-            break;
-
-        case MEngineMonitor::EPEMessageActivateWarrantyMode:
-            // Stop playing DTMF tone
-            iStateMachine->SendPhoneEngineMessage( MPEPhoneModel::EPEMessageEndDTMF );
-            HandleShowLifeTimerL();
-            break;
+       case MEngineMonitor::EPEMessageCallSecureStatusChanged:
+           HandleCallSecureStatusChangeL( aCallId );
+
+           if ( iCustomization )
+               {
+               iCustomization->HandlePhoneEngineMessageL( aMessage,
+                   aCallId );
+               }
+           break;
 
         case MEngineMonitor::EPEMessageIssuingUSSDRequest:
             {
@@ -363,22 +345,16 @@
             HandleCugInUseNoteL();
             break;
 
-        // *#2873#
-        case MEngineMonitor::EPEMessageBTDebugMode:
-            accessoryBtHandler = CPhoneAccessoryBTHandler::NewLC(
-                iViewCommandHandle, iStateMachine, this );
-            accessoryBtHandler->SetBTDebugModeL();
-            CleanupStack::PopAndDestroy( accessoryBtHandler );
-            break;
-        
-        case MEngineMonitor::EPEMessageInitiatedMoCall:
-            // Message should be only handled by CPhoneStateIdle, 
-            // if state is something else than idle then do nothing.
-            break;
-
         default:
+
             TBool handled( EFalse );
-            handled = ForwardPEMessageToPhoneCustomizationL( aMessage, aCallId );
+
+            if ( iCustomization )
+                {
+                handled = iCustomization->HandlePhoneEngineMessageL(
+                                aMessage, aCallId );
+                }
+
             if ( EFalse == handled )
                 {
                 MPhoneMediatorMessage* mediatorMessage = CPhoneMediatorFactory::Instance()->MediatorMessage( aMessage, aCallId );
@@ -411,6 +387,8 @@
     booleanParam.SetBoolean( audioMute );
     iViewCommandHandle->ExecuteCommandL( EPhoneViewActivateMuteUIChanges,
         &booleanParam );
+    
+    SetTouchPaneButtons(0);
     }
 
 // -----------------------------------------------------------
@@ -454,8 +432,7 @@
         CPhoneBtaaDisconnectHandler::InstanceL()->HandleConnectionLostL();
         }
     else if ( audioOutput == EPEBTAudioAccessory && 
-    		previousOutput > EPENotActive && 
-    		previousOutput != EPEBTAudioAccessory &&
+            previousOutput != EPEBTAudioAccessory &&
             btAvailable )
         {
         CPhoneAccessoryBTHandler* bt = CPhoneAccessoryBTHandler::NewLC(
@@ -471,7 +448,7 @@
     else if ( RouteParameters.iShowNote && audioOutput == EPELoudspeaker )
         {
         CAknKeySoundSystem* keySounds =
-               static_cast<CAknAppUi*>( EikonEnv()->EikAppUi() )->KeySounds();
+               static_cast<CAknAppUi*>( iEnv.EikAppUi() )->KeySounds();
         keySounds->PlaySound( EAvkonSIDIHFActive );
         }
     }
@@ -524,8 +501,7 @@
                 __PHONELOG( EBasic, EPhoneControl, "SIM card was removed" );
 
                 TPhoneCmdParamGlobalNote globalNoteParam;
-                globalNoteParam.SetType( EAknGlobalInformationNote );
-                globalNoteParam.SetTone( EAvkonSIDNoSound );
+                globalNoteParam.SetType( EPhoneMessageBoxInformation );
 
                 globalNoteParam.SetTextResourceId(
                     CPhoneMainResourceResolver::Instance()->
@@ -618,16 +594,6 @@
 TBool CPhoneState::IsTouchDTmfDialerOn() const
     {
     TBool status( EFalse );
-    if ( IsOnScreenDialerSupported() )
-        {
-        TBool isDialerVisible( EFalse );
-        TRAP_IGNORE( isDialerVisible = IsDTMFEditorVisibleL() );
-
-        if ( isDialerVisible )
-            {
-            status = ETrue;
-            }
-        }
     return status;
     }
 // -----------------------------------------------------------------------------
@@ -643,42 +609,19 @@
     {
 
     if ( !IsTouchDTmfDialerOn()
-        && !IsAnyQueryActiveL()
-        && !IsMenuBarVisibleL() )
+        && !IsAnyQueryActiveL() )
         {
-        if( IsKeyEventFurtherProcessedL( aKeyEvent ))
-            {
-            // Send the key event to the phone engine.
-            SendKeyEventL( aKeyEvent, aEventCode );
-            }
+        // Send the key event to the phone engine.
+        SendKeyEventL( aKeyEvent, aEventCode );
         }
-
     }
 
 // -----------------------------------------------------------------------------
 // CPhoneState::IsKeyEventFurtherProcessed
 // -----------------------------------------------------------------------------
 //
-TBool CPhoneState::IsKeyEventFurtherProcessedL( const TKeyEvent& aKeyEvent ) const
+TBool CPhoneState::IsKeyEventFurtherProcessedL( const TKeyEvent& /*aKeyEvent*/ ) const
     {
-    // While being in some special keyboard mode (Full Screen&mini QWERTY,
-    // handwriting mode) FEP sends only EEventKey -event and thus manual
-    // DTMFs can not be played with the user specified tone lengths. Also,
-    // in general, DTMFs are tried to play only in numeric mode.
-    TBool numericMode = iViewCommandHandle->HandleCommandL(
-      EPhoneViewIsNumberEntryNumericMode ) == EPhoneViewResponseSuccess;
-
-    // Key presses simulated by dialer are played even if in alphanumeric mode.
-    const TBool simulatedByDialer = 
-        ( ( aKeyEvent.iModifiers & ( EModifierNumLock | EModifierKeypad ) ) 
-                == ( EModifierNumLock | EModifierKeypad ) );
-
-
-    if ( ( ( aKeyEvent.iModifiers & EModifierSpecial ) != 0 || !numericMode ) && !simulatedByDialer )
-        {
-        return EFalse;
-        }
-
     return ETrue;
     }
 
@@ -701,12 +644,6 @@
         aErrorInfo.iCallId );
 
 
-    // Sets touch buttons to correct status if error has occured.
-    if ( FeatureManager::FeatureSupported( KFeatureIdTouchCallHandling ) )
-        {
-        iViewCommandHandle->ExecuteCommand( EPhoneResetTouchButtons );
-        }
-
     // Do the common error handling (display proper notes etc)
     CPhoneMainErrorMessagesHandler::Instance()->ShowErrorSpecificNoteL( aErrorInfo );
 
@@ -739,40 +676,35 @@
             }
             break;
 
-        case ECCPErrorCCServiceNotAvailable:
-            {
-            if( IsVideoCall( aErrorInfo.iCallId ) )
+            case ECCPErrorCCServiceNotAvailable:
                 {
-                CPhoneReconnectQuery::InstanceL()->ShowReconnectQueryL( EFalse );
+                if( IsVideoCall( aErrorInfo.iCallId ) )
+                    {
+                    CPhoneReconnectQuery::InstanceL()->ShowReconnectQueryL( EFalse );
+                    }
                 }
-            }
-            break;
-
-        case ECCPErrorBadRequest:
-            {
-            TPECallType callType =
-                iStateMachine->PhoneEngineInfo()->CallTypeCommand();
-
-            if( callType == EPECallTypeVideo )
+                break;
+
+            case ECCPErrorBadRequest:
                 {
-                    // Dialling MO video call cannot reach 3G network.
-                    __PHONELOG1( EBasic, EPhoneControl,
-                        "PhoneUIControl: CPhoneState::HandleErrorL - ShowReconnectQueryL vid 2, callid%d ",
-                        aErrorInfo.iCallId );
-                    CPhoneReconnectQuery::InstanceL()->ShowReconnectQueryL( ETrue );
+                TPECallType callType =
+                    iStateMachine->PhoneEngineInfo()->CallTypeCommand();
+
+                if( callType == EPECallTypeVideo )
+                    {
+                        // Dialling MO video call cannot reach 3G network.
+                        __PHONELOG1( EBasic, EPhoneControl,
+                            "PhoneUIControl: CPhoneState::HandleErrorL - ShowReconnectQueryL vid 2, callid%d ",
+                            aErrorInfo.iCallId );
+                        CPhoneReconnectQuery::InstanceL()->ShowReconnectQueryL( ETrue );
+                    }
                 }
-            }
-            break;
-
-        case ECCPErrorVideoCallNotSupportedByNetwork: // Flow trough
+                break;
+
+        case ECCPErrorVideoCallNotSupportedByNetwork:
         case ECCPErrorVideoCallSetupFailed:
         case ECCPErrorNotReached:
-        case ECCPErrorCCBearerCapabilityNotCurrentlyAvailable:
-        case ECCPErrorCCBearerCapabilityNotAuthorised:
-        case ECCPErrorServiceSettingError:
-        case ECCPErrorNoAnswerForVideo:
-            {
-            // If call id found and seems to be Video Call
+           // If call id found and seems to be Video Call
             if ( IsVideoCall( aErrorInfo.iCallId ) )
                 {
                 // Get active call count
@@ -794,7 +726,6 @@
                               ECCPErrorNotReached == aErrorInfo.iErrorCode );
                     }
                 }
-            }
             break;
 
         case ECCPErrorNoService:
@@ -806,12 +737,7 @@
             {
             // check, that there really was a call established before completing SAT request
             if( aErrorInfo.iCallId != KPECallIdNotUsed )
-                {                
-                // Complete sat request
-                if ( iStateMachine->PhoneEngineInfo()->CallOrigin( aErrorInfo.iCallId ) == EPECallOriginSAT )
-                    {
-                    CompleteSatRequestL( aErrorInfo.iCallId );
-                    }
+                {
                 }
 
             // remove number entry
@@ -830,6 +756,7 @@
         default:
             break;
         }
+
     // clear call blacklist if call failure occurs
     CPhoneClearBlacklist::Instance()->ClearBlackListOnNextKey();
     }
@@ -853,29 +780,14 @@
     if ( ret || isDisplayOn )
         {
         // Get the call duration
-        TTime time( 0 );
-        TTimeIntervalSeconds timeInterval =
+        TTimeIntervalSeconds seconds =
             iStateMachine->PhoneEngineInfo()->CallDuration( aCallId );
-        time += timeInterval;
-        
-        // Read format string from AVKON resource
-        TBuf<KPhoneMaxCharsInNote> timeDurationFormatString( KNullDesC );
-        LoadResource( timeDurationFormatString, EPhoneCallDurationFormatString );
-        
-        // Format the time
-        TBuf<KPhoneMaxTimeDisplayTextLength> timeString( KNullDesC );
-        time.FormatL( timeString, timeDurationFormatString );
-        
-        // Localize time format
-        AknTextUtils::LanguageSpecificNumberConversion( timeString );
-        
-        // update the call header call duration
-        iViewCommandHandle->ExecuteCommandL(
-            EPhoneViewUpdateCallHeaderCallDuration,
-            aCallId,
-            timeString );
+
+        TPhoneCmdParamInteger time;
+        time.SetInteger(seconds.Int());
+        iViewCommandHandle->ExecuteCommandL(EPhoneViewUpdateCallHeaderCallDuration, aCallId, &time);
         }
-    }
+    }	
 
 // -----------------------------------------------------------------------------
 // CPhoneState::HandleRemoteBusyL
@@ -884,8 +796,13 @@
 void CPhoneState::HandleRemoteBusyL( TInt aCallId )
     {
     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::HandleRemoteBusyL( ) ");
-    ShowNumberBusyNoteL();
-
+
+    TPEErrorInfo info;
+    info.iCallId = aCallId;
+    info.iErrorCode = ECCPErrorBusy;
+    info.iErrorType = EPECcp;
+    CPhoneMainErrorMessagesHandler::Instance()->ShowErrorSpecificNoteL( info );
+    
     const TPECallType callType =
         iStateMachine->PhoneEngineInfo()->CallTypeCommand();
 
@@ -897,14 +814,6 @@
                 aCallId );
         CPhoneReconnectQuery::InstanceL()->ShowReconnectQueryL( ETrue );
         }
-    else
-        {        
-        // Complete sat request
-        if ( iStateMachine->PhoneEngineInfo()->CallOrigin( aCallId ) == EPECallOriginSAT )
-            {
-            CompleteSatRequestL( aCallId );
-            }
-        }
     }
 
 // -----------------------------------------------------------
@@ -914,15 +823,6 @@
 EXPORT_C void CPhoneState::HandleDisconnectingL( TInt aCallId )
     {
     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::HandleDisconnectingL( ) ");
-    // If there is no call in connected state then EPhoneDtmfTextQuery and EPhoneDtmfListQueryDialog
-    // must be dismmissed from UI, therefore we must set EPhoneViewSetNoConnectedCalls to ETrue this
-    // way we can ensure that CPhoneQueryController doesnt relaunch EPhoneDtmfListQueryDialog.
-    if ( !IsAnyConnectedCalls() )
-        {
-        TPhoneCmdParamBoolean booleanParam;
-        booleanParam.SetBoolean(ETrue);
-        iViewCommandHandle->ExecuteCommandL( EPhoneViewSetNoConnectedCalls, &booleanParam );
-        }
 
     TPhoneCmdParamCallHeaderData callHeaderParam;
     callHeaderParam.SetCallState( EPEStateDisconnecting );
@@ -935,7 +835,7 @@
     iViewCommandHandle->ExecuteCommandL( EPhoneViewStopRingTone );
 
     iViewCommandHandle->ExecuteCommandL( EPhoneViewUpdateBubble, aCallId,
-        &callHeaderParam );
+        &callHeaderParam );    
 
     CPhoneClearBlacklist::Instance()->ClearBlackListOnNextKey();
     }
@@ -1040,53 +940,15 @@
     }
 
 // -----------------------------------------------------------
-// CPhoneState::IsNoteVisibleL
-// -----------------------------------------------------------
-//
-EXPORT_C TBool CPhoneState::IsNoteVisibleL()
-    {
-    __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::IsNoteVisibleL( ) ");
-    TPhoneCmdParamBoolean booleanParam;
-    iViewCommandHandle->ExecuteCommandL(
-        EPhoneViewGetIsNoteVisible, &booleanParam );
-    return booleanParam.Boolean();
-    }
-
-// -----------------------------------------------------------
-// CPhoneState::IsMenuBarVisibleL
-// -----------------------------------------------------------
-//
-EXPORT_C TBool CPhoneState::IsMenuBarVisibleL() const
-    {
-    __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::IsMenuBarVisibleL( ) ");
-    return iViewCommandHandle->HandleCommandL(
-        EPhoneViewIsMenuBarVisible ) ==
-        EPhoneViewResponseSuccess;
-    }
-
-// -----------------------------------------------------------
 // CPhoneState::HandleNumericKeyEventL
 // -----------------------------------------------------------
 //
 EXPORT_C void CPhoneState::HandleNumericKeyEventL(
-    const TKeyEvent& aKeyEvent,
-    TEventCode aEventCode )
+    const TKeyEvent& /*aKeyEvent*/,
+    TEventCode /*aEventCode*/ )
     {
     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::HandleNumericKeyEventL( ) ");
 
-    TBool numberEntryUsed = IsNumberEntryUsedL();
-
-    if ( numberEntryUsed && ( aKeyEvent.iRepeats == 0 ||
-              aKeyEvent.iScanCode == EStdKeyBackspace ||
-              aKeyEvent.iScanCode == EStdKeyLeftArrow ||
-              aKeyEvent.iScanCode == EStdKeyUpArrow   ||
-              aKeyEvent.iScanCode == EStdKeyDownArrow ||
-              aKeyEvent.iScanCode == EStdKeyRightArrow ))
-        {
-        // Number entry exists but may be hidden
-        KeyEventForExistingNumberEntryL( aKeyEvent, aEventCode );
-        }
-
     }
 
 // -----------------------------------------------------------------------------
@@ -1149,38 +1011,6 @@
     }
 
 // -----------------------------------------------------------
-// CPhoneState::IsDialingExtensionInFocusL
-// -----------------------------------------------------------
-//
-EXPORT_C TBool CPhoneState::IsDialingExtensionInFocusL() const
-    {
-    __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::IsDialingExtensionInFocusL( ) ");
-    return iViewCommandHandle->HandleCommandL(
-        EPhoneViewGetEasyDialingInFocusStatus ) ==
-        EPhoneViewResponseSuccess;
-    }
-
-// -----------------------------------------------------------
-// CPhoneState::EikonEnv
-// -----------------------------------------------------------
-//
-EXPORT_C CEikonEnv* CPhoneState::EikonEnv() const
-    {
-    __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::EikonEnv( ) ");
-    return iEnv;
-    }
-
-// -----------------------------------------------------------
-// CPhoneState::SetEikonEnv
-// -----------------------------------------------------------
-//
-EXPORT_C void CPhoneState::SetEikonEnv( CEikonEnv* aEnv )
-    {
-    __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::SetEikonEnv( ) ");
-    iEnv = aEnv;
-    }
-
-// -----------------------------------------------------------
 // CPhoneState::SendKeyEventL
 // -----------------------------------------------------------
 //
@@ -1230,7 +1060,7 @@
             {
             HBufC* phoneNumber = PhoneNumberFromEntryLC();
             // Save the phone number
-            __PHONELOG1( EBasic, EPhoneControl, "SetPhoneNumber: %S ", &phoneNumber->Des() );
+            __PHONELOG1( EBasic, EPhoneControl, "SetPhoneNumber: %S ", phoneNumber );
             iStateMachine->PhoneEngineInfo()->SetPhoneNumber( *phoneNumber );
 
             // Convert key code to western.
@@ -1259,66 +1089,6 @@
 
 // <------------------------------ SYSTEM EVENTS ----------------------------->
 
-// -----------------------------------------------------------
-// CPhoneState::DynInitMenuPaneL
-// -----------------------------------------------------------
-//
-EXPORT_C void CPhoneState::DynInitMenuPaneL(
-    TInt aResourceId,
-    CEikMenuPane* aMenuPane )
-    {
-    __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::DynInitMenuPaneL( ) ");
-    __ASSERT_DEBUG( aMenuPane && aResourceId,
-        Panic( EPhoneCtrlParameterNotInitialized ) );
-
-    // Save the number of digits in the number entry before processing
-    // the menu pane
-    if ( IsNumberEntryUsedL() )
-        {
-        TPhoneCmdParamBoolean serviceCodeParam;
-            serviceCodeParam.SetBoolean(
-            iStateMachine->PhoneEngineInfo()->PhoneNumberIsServiceCode() );
-        iViewCommandHandle->ExecuteCommandL( EPhoneViewSetServiceCodeFlag,
-            &serviceCodeParam );
-        }
-
-    // Process the menu pane
-    TPhoneCmdParamDynMenu dynMenuPane;
-    dynMenuPane.SetResourceId( aResourceId );
-    dynMenuPane.SetDynMenu( aMenuPane );
-    iViewCommandHandle->ExecuteCommandL( EPhoneViewMenuPane, &dynMenuPane );
-
-    if ( iCustomization )
-        {
-        // Menu pane is customized after default items are decided
-        iCustomization->CustomizeMenuPaneL(aResourceId, aMenuPane);
-        }
-    }
-
-// -----------------------------------------------------------
-// CPhoneState::DynInitMenuBarL
-// -----------------------------------------------------------
-//
-EXPORT_C void CPhoneState::DynInitMenuBarL(
-    TInt aResourceId,
-    CEikMenuBar* aMenuBar )
-    {
-    __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::DynInitMenuBarL( ) ");
-    __ASSERT_DEBUG( aMenuBar && aResourceId,
-        Panic( EPhoneCtrlParameterNotInitialized ) );
-
-    TPhoneCmdParamDynMenu dynMenuBar;
-    dynMenuBar.SetResourceId( aResourceId );
-    dynMenuBar.SetDynMenu( aMenuBar );
-    iViewCommandHandle->ExecuteCommandL( EPhoneViewMenuBar, &dynMenuBar );
-
-    if ( iCustomization )
-        {
-        // Menu bar is customized after default items are decided
-        iCustomization->CustomizeMenuBarL(aResourceId, aMenuBar);
-        }
-
-    }
 
 // -----------------------------------------------------------
 // CPhoneState::HandleSystemEventL
@@ -1350,51 +1120,7 @@
 //
 EXPORT_C void CPhoneState::HandlePhoneForegroundEventL()
     {
-    __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::HandlePhoneForegroundEventL( ) ");
-
-    // Force Idle to the foreground if a foreground event is received,
-    // but Idle is the top application
-
-    const TBool idleIsTopApp = iViewCommandHandle->HandleCommandL(
-        EPhoneViewIsIdleTopApp ) ==
-        EPhoneViewResponseSuccess ;
-
-    if ( !IsOnScreenDialerSupported() && idleIsTopApp )
-        {
-        TBool activatePhone = CPhonePubSubProxy::Instance()->Value(
-            KPSUidAiInformation, KActiveIdleState ) == EPSAiNumberEntry;
-        if ( activatePhone )
-            {
-            // Set Phone as the top application
-            TPhoneCmdParamInteger uidParam;
-            uidParam.SetInteger( KUidPhoneApplication.iUid );
-            iViewCommandHandle->ExecuteCommandL( EPhoneViewSetTopApplication,
-                &uidParam );
-            NumberEntryManagerL()->CreateNumberEntryL();
-            SetNumberEntryVisibilityL(ETrue);
-            }
-
-        else
-            {
-            if ( !iStateMachine->SecurityMode()->IsSecurityMode() )
-                {
-                __PHONELOG( EBasic, EPhoneControl,
-                  "CPhoneState::HandlePhoneForegroundEventL - Force Idle to the foreground" );
-                // Bring Idle app to the foreground
-                iViewCommandHandle->ExecuteCommandL( EPhoneViewBringIdleToForeground );
-                }
-            }
-        }
-
-    if( NumberEntryManagerL()->IsNumberEntryUsedL() )
-        {
-        iViewCommandHandle->ExecuteCommandL( EPhoneViewSetIncallBubbleTrue );
-        }
-    else
-        {
-        iViewCommandHandle->ExecuteCommandL( EPhoneViewSetIncallBubbleFalse );
-        }
-     }
+    }
 
 // -----------------------------------------------------------
 // CPhoneState::HandlePhoneFocusLostEventL
@@ -1406,17 +1132,6 @@
     // See implementation in CPhoneAppUI::HandleWsEventL
 
     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::HandlePhoneFocusLostEventL( ) ");
-    // Phone app focus lost -> close Dtmf dialer when visible
-    if ( IsOnScreenDialerSupported() && IsDTMFEditorVisibleL() )
-        {
-        CloseDTMFEditorL();
-        }
-    else if ( IsOnScreenDialerSupported() && IsCustomizedDialerVisibleL() )
-        {
-        CloseCustomizedDialerL();
-        }
-
-    iViewCommandHandle->ExecuteCommandL( EPhoneViewSetIncallBubbleTrue );
     }
 // ---------------------------------------------------------
 // CPhoneState::HandleIdleForegroundEventL
@@ -1472,18 +1187,7 @@
             "CPhoneState::HandlePropertyChangedL - aKey= %d", aKey  );
     __PHONELOG1( EBasic, EPhoneControl,
             "CPhoneState::HandlePropertyChangedL - aValue= %d", aValue  );
-    if ( aCategory == KPSUidCtsyCallInformation )
-        {
-        // Call state event
-        if ( aKey == KCTsyCallState )
-            {
-            // Update the incall indicator
-            UpdateIncallIndicatorL( aValue );
-            }
-        }
-
-    // Telephony information category
-    else if ( aCategory == KPSUidTelInformation
+    if ( aCategory == KPSUidTelInformation
               && SimState() == EPESimUsable )
         {
         // Telephony display event
@@ -1497,9 +1201,7 @@
     else if ( aCategory == KPSUidStartup && aKey == KStartupSimSecurityStatus )
         {
         // Show security note, SIM is not valid.
-        if ( aValue == ESimRejected 
-                || aValue == ESimUnaccepted 
-                || aValue == ESimInvalid )
+        if ( aValue == ESimRejected ||  aValue == ESimUnaccepted )
             {
             __PHONELOG( EBasic, EPhoneControl, "CPhoneStateStartup::HandlePropertyChangedL - SimSecurity status received" );
             StartShowSecurityNoteL();
@@ -1523,13 +1225,13 @@
     }
 
 // -----------------------------------------------------------
-// CPhoneState::NeedToReturnToForegroundAppL
+// CPhoneState::NeedToSendToBackgroundL
 // -----------------------------------------------------------
 //
-EXPORT_C TBool CPhoneState::NeedToReturnToForegroundAppL() const
+EXPORT_C TBool CPhoneState::NeedToSendToBackgroundL() const
     {
     return iViewCommandHandle->HandleCommandL(
-        EPhoneViewGetNeedToReturnToForegroundAppStatus ) ==
+        EPhoneViewGetNeedToSendToBackgroundStatus ) ==
         EPhoneViewResponseSuccess;
     }
 
@@ -1545,18 +1247,6 @@
         EPhoneViewResponseSuccess;
     }
 
-// -----------------------------------------------------------
-// CPhoneState::TitlePaneIsVisibleL
-// -----------------------------------------------------------
-//
-TBool CPhoneState::TitlePaneIsVisibleL() const
-    {
-    __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::TitlePaneIsVisibleL( ) ");
-    return iViewCommandHandle->HandleCommandL(
-        EPhoneViewGetTitlePaneIsVisibleStatus ) ==
-        EPhoneViewResponseSuccess;
-    }
-
 // <---------------------------- MENU AND CBA EVENTS ------------------------->
 
 EXPORT_C TBool CPhoneState::HandleCommandL( TInt aCommand )
@@ -1566,39 +1256,27 @@
     switch( aCommand )
         {
         case EPhoneEmergencyCmdExit:
+            {
+            }
             // this should be bypasses?
         case EPhoneDialerCallHandling:
         case EPhoneCmdBack:
-            CloseClearNumberEntryAndLoadEffectL( ECallUiAppear );
+            // Remove number entry from screen
+            iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNumberEntry );
+            // Do state-specific behaviour if number entry is cleared
+            HandleNumberEntryClearedL();
             break;
 
         case EPhoneDialerCmdTouchInput:
-            OpenVkbL();
             break;
 
         case EPhoneNumberAcqCmdSendMessage:
-            // Open the mms editor
-            iViewCommandHandle->ExecuteCommandL(
-                EPhoneViewSendMessage );
-            if ( !IsOnScreenDialerSupported() )
-                {
-                // Remove number entry from screen
-                iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNumberEntry );
-                // Do state-specific behaviour if number entry is cleared
-                HandleNumberEntryClearedL();
-                }
             break;
 
         case EPhoneNumberAcqCmdSave:
-            // Open Create contact
-            iViewCommandHandle->ExecuteCommandL(
-                EPhoneViewAddContact );
             break;
 
         case EPhoneNumberAcqCmdAddToName:
-            // Open the message editor
-            iViewCommandHandle->ExecuteCommandL(
-                EPhoneViewUpdateContact );
             break;
 
         case EPhoneNumberAcqCmdAddToContacts:
@@ -1671,37 +1349,24 @@
 
         case EPhoneInCallCmdActivatEPhonebook:
             {
-            // Launch Phonebook application
-            TPhoneCmdParamAppInfo appInfoParam;
-            appInfoParam.SetAppUid( KPhoneUidAppPhonebook );
-            iViewCommandHandle->ExecuteCommandL(
-                EPhoneViewActivateApp, &appInfoParam );
             }
             break;
 
-        case EPhoneViewYesSingleItemFetch:
+        case EPhoneNumberAcqSecurityDialer:
             {
-            if ( IsOnScreenDialerSupported() )
-                {
-                TBuf<KPhoneNumberEntryBufferSize> fetchContent;
-                fetchContent = iViewCommandHandle->FetchContent();
-                if ( fetchContent.Length() )
-                    {
-                    iViewCommandHandle->ExecuteCommandL(
-                                            EPhoneViewSetNumberEntryContent,
-                                            0,
-                                            fetchContent );
-
-                    CallFromNumberEntryL();
-                    }
-                }
+
             }
             break;
+
+        case EPhoneDialerCmdContacts:
+            {
+            }
+            break;
+
         case EPhoneNumberAcqCmdToggleNeAlphaMode:
         case EPhoneNumberAcqCmdToggleNeNumericMode:
             {
-            // Toggle mode
-            NumberEntryManagerL()->NumberEntryToggleAlphaNumericModeL();
+
             }
             break;
 
@@ -1715,7 +1380,7 @@
                 // Show the number entry if it exists
                 SetNumberEntryVisibilityL(ETrue);
                 }
-            else if ( NeedToReturnToForegroundAppL() )
+            else if ( NeedToSendToBackgroundL() )
                 {
                 // Continue displaying current app but set up the
                 // idle screen in the background
@@ -1736,46 +1401,35 @@
             }
             break;
 
-        case EPhoneDialerCmdHelp:
-            if ( FeatureManager::FeatureSupported( KFeatureIdHelp ) )
-                {
-                TPtrC contextName;
-                contextName.Set( KDATA_DIALER_HLP_MAIN() );
-                iViewCommandHandle->ExecuteCommandL(
-                    EPhoneViewLaunchHelpApplication, 0, contextName );
-                }
-            break;
-
         case EPhoneCmdVideoCallOutOfMemory:
             ShowVideoCallOutOfMemoryNoteL();
             DisconnectCallL();
             break;
-
-        case EPhoneCmdUpdateCba:
-        case EPhoneDialerValidNumber:
-        case EPhoneDialerInvalidNumber:
-        case EPhoneCmdBlockingDialogLaunched:
-        case EPhoneCmdBlockingDialogClosed:
-            {
-            // these command ids are sent by easydialing to communicate to phone app
-            HandleEasyDialingCommandsL( aCommand );
-            }
+            
+        case EPhoneCallComingCmdSoftReject:
+            // Open Soft reject message editor
+            OpenSoftRejectMessageEditorL();
             break;
-                
+            
+        case EPhoneInCallCmdContacts:
+            iViewCommandHandle->ExecuteCommand( EPhoneViewOpenContacts );
+            break;
+            
         default:
-            if ( IsOnScreenDialerSupported() )
+
+            /*if ( IsOnScreenDialerSupported() )
                 {
                 // Offer command to view.
-                // Easydialing commands are handled in view, too.
                 TPhoneViewResponseId resId =
                             iViewCommandHandle->HandleCommandL( aCommand );
 
                 if( resId == EPhoneViewResponseFailed )
                     {
-                     commandStatus = EFalse;
+                    commandStatus = EFalse;
                     }
                 }
-            else
+            else*/
+
                 {
                 commandStatus = EFalse;
                 }
@@ -1796,7 +1450,7 @@
 //
 EXPORT_C TBool CPhoneState::ProcessCommandL( TInt /*aCommand*/ )
     {
-    __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::ProcessCommandL() ");
+    __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateIdle::ProcessCommandL() ");
     // no implementation.
     return EFalse;
     }
@@ -1862,7 +1516,7 @@
      __PHONELOG1( EBasic, EPhoneControl, "CPhoneState::DecreaseAudioVolumeL - audio output =%d", output );
     if( output == EPETTY )
         {
-        SendGlobalInfoNoteL( EPhoneNoteTTYNoAudioControl );
+        SendGlobalInfoNoteL( EPhoneNoteTTYNoAudioControl, ETrue );
         }
     else
         {
@@ -1886,7 +1540,7 @@
      __PHONELOG1( EBasic, EPhoneControl, "CPhoneState::IncreaseAudioVolumeL - audio output =%d", output );
     if( output == EPETTY )
         {
-        SendGlobalInfoNoteL( EPhoneNoteTTYNoAudioControl );
+        SendGlobalInfoNoteL( EPhoneNoteTTYNoAudioControl, ETrue );
         }
     else
         {
@@ -1916,27 +1570,8 @@
         iStateMachine->SendPhoneEngineMessage(
             MPEPhoneModel::EPEMessageSetAudioVolume );
         }
-    else
-        {
-        CAknKeySoundSystem* keySounds =
-            static_cast<CAknAppUi*>( EikonEnv()->EikAppUi() )
-                ->KeySounds();
-
-        if ( aLevel < KPhoneVolumeMinValue )
-            {
-            // Set the volume value to volume control
-            valueToControl = KPhoneVolumeMinValue;
-            keySounds->PlaySound( EAvkonSIDVolumeMinTone );
-            }
-        else // aLevel > KPhoneVolumeMaxValue
-            {
-            // Set the volume value to volume control
-            valueToControl = KPhoneVolumeMaxValue;
-            keySounds->PlaySound( EAvkonSIDVolumeMaxTone );
-            }
-        }
-
-    if ( aUpdateControl )
+        
+    if ( aUpdateControl )        
         {
         // Update the volume display.
         // Upper max (11) and under min (-1)
@@ -1973,12 +1608,13 @@
     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::DialVoiceCallL() ");
     __ASSERT_DEBUG( iStateMachine->PhoneEngineInfo(),
         Panic( EPhoneCtrlInvariant ) );
+
     // Disable global notes
     TPhoneCmdParamBoolean globalNotifierParam;
     globalNotifierParam.SetBoolean( ETrue );
     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetGlobalNotifiersDisabled,
             &globalNotifierParam );
-    iStateMachine->PhoneEngineInfo()->SetCallTypeCommand( EPECallTypeCSVoice );
+   iStateMachine->PhoneEngineInfo()->SetCallTypeCommand( EPECallTypeCSVoice );
     iStateMachine->SendPhoneEngineMessage( MPEPhoneModel::EPEMessageDial );
     }
 
@@ -1986,60 +1622,28 @@
 // CPhoneState::DisconnectCallL
 // -----------------------------------------------------------
 //
-EXPORT_C void CPhoneState::DisconnectCallL()
+EXPORT_C TBool CPhoneState::DisconnectCallL()
     {
     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::DisconnectCallL( ) ");
-    // Fetch active call's id from view
-    TPhoneCmdParamCallStateData callStateData;
-    callStateData.SetCallState( EPEStateConnected );
-    iViewCommandHandle->HandleCommandL(
-        EPhoneViewGetCallIdByState, &callStateData );
-
-    if( callStateData.CallId() == KErrNotFound )
-        {
-        // No connected call, find the hold call
-        callStateData.SetCallState( EPEStateHeld );
-        iViewCommandHandle->HandleCommandL(
-            EPhoneViewGetCallIdByState, &callStateData );
-
-        if( callStateData.CallId() == KErrNotFound )
-            {
-            // No hold call, find the dialing call
-            callStateData.SetCallState( EPEStateDialing );
-            iViewCommandHandle->HandleCommandL(
-                EPhoneViewGetCallIdByState, &callStateData );
-            }
-
-        if( callStateData.CallId() == KErrNotFound )
-            {
-            // No dialing call, find the outgoing call
-            callStateData.SetCallState( EPEStateConnecting );
-            iViewCommandHandle->HandleCommandL(
-                EPhoneViewGetCallIdByState, &callStateData );
-            }
-
-        if( callStateData.CallId() == KErrNotFound )
-            {
-            // No active call, find the disconnectinging call
-            callStateData.SetCallState( EPEStateDisconnecting );
-            iViewCommandHandle->HandleCommandL(
-                EPhoneViewGetCallIdByState, &callStateData );
-            }
-        }
-
-    if( callStateData.CallId() > KErrNotFound )
+    TPhoneCmdParamInteger callIdParam;
+    iViewCommandHandle->ExecuteCommandL( 
+            EPhoneViewGetExpandedBubbleCallId, &callIdParam );
+
+    TBool ret = EFalse;
+    if( callIdParam.Integer() > KErrNotFound )
         {
         // Release the call
-        iStateMachine->SetCallId( callStateData.CallId() );
-        if( IsVideoCall( callStateData.CallId() ) )
+        iStateMachine->SetCallId( callIdParam.Integer() );
+
+        if( IsVideoCall( callIdParam.Integer() ) )
             {
             // Video call can be released only after we get response to VT Shutdown Command
             CPhoneMediatorFactory::Instance()->Sender()->IssueCommand( KMediatorVideoTelephonyDomain,
-			                                                           			 KCatPhoneToVideotelCommands,
-			                                                           			 EVtCmdReleaseDataport,
+                                                                                 KCatPhoneToVideotelCommands,
+                                                                                 EVtCmdReleaseDataport,
                                                                        TVersion( KPhoneToVideotelCmdVersionMajor,
-                              	                                                 KPhoneToVideotelCmdVersionMinor,
-                              	                                                 KPhoneToVideotelCmdVersionBuild ),
+                                                                                 KPhoneToVideotelCmdVersionMinor,
+                                                                                 KPhoneToVideotelCmdVersionBuild ),
                                                                        KNullDesC8,
                                                                        CPhoneReleaseCommand::NewL( *iStateMachine ) );
             }
@@ -2049,13 +1653,16 @@
             iStateMachine->SendPhoneEngineMessage(
                 MPEPhoneModel::EPEMessageRelease );
             }
+        ret = ETrue;
         }
     else
         {
         __PHONELOG( EOnlyFatal, EPhoneControl,
             "CPhoneState::DisconnectCallL has negative call id!" );
-        }   
-   }
+        }
+
+    return ret;
+    }
 
 // -----------------------------------------------------------
 // CPhoneState::DisplayIdleScreenL
@@ -2088,13 +1695,16 @@
     // Don't remove reconnect query if it's shown
     if( !CPhoneReconnectQuery::InstanceL()->IsDisplayingQuery() )
         {
+        // Remove dialogs if necessary
         iViewCommandHandle->ExecuteCommandL( EPhoneViewRemovePhoneDialogs );
         }
     // Return phone to the background
     iViewCommandHandle->ExecuteCommandL( EPhoneViewSendToBackground );
-    // Set Idle app as the top app to PS key this way we know if need to 
-    // bring idle to fore in next phone acitvation event.
+
+    // Set Idle app as the top app
     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetIdleTopApplication );
+
+    // Set Empty CBA
     iCbaManager->SetCbaL( EPhoneEmptyCBA );
     }
 
@@ -2110,8 +1720,7 @@
 
     if ( IsOnScreenDialerSupported() )
         {
-        if ( IsDTMFEditorVisibleL() ||
-             IsCustomizedDialerVisibleL() )
+        if ( IsCustomizedDialerVisibleL() )
             {
             return;
             }
@@ -2123,11 +1732,6 @@
                 {
                 return;
                 }
-            else if ( IsMenuBarVisibleL() )
-                {
-                iViewCommandHandle->ExecuteCommandL( EPhoneViewMenuBarClose );
-                return;
-                }
             // Open recent calls list when the number entry is empty
             TPhoneCmdParamInteger numberEntryCountParam;
             iViewCommandHandle->ExecuteCommandL( EPhoneViewGetNumberEntryCount,
@@ -2143,36 +1747,30 @@
                 }
             }
         }
-    
-    // If easydialing has focus, call should be initiated to focused contact.
-    if ( IsDialingExtensionInFocusL() )
+
+    // Get the number entry contents
+    HBufC* phoneNumber = PhoneNumberFromEntryLC();
+
+    // Call the number
+    iStateMachine->PhoneEngineInfo()->SetPhoneNumber( *phoneNumber );
+
+    if ( phoneNumber->Des().Length() < KPhoneValidPhoneNumberLength )
         {
-        iViewCommandHandle->HandleCommandL( EEasyDialingVoiceCall );
+        iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNumberEntry );
+
+        HandleNumberEntryClearedL();
         }
-    else
-        {  
-        // Get the number entry contents
-        HBufC* phoneNumber = PhoneNumberFromEntryLC();
-        
-        // Call the number
-        iStateMachine->PhoneEngineInfo()->SetPhoneNumber( *phoneNumber );
-    
-        if ( phoneNumber->Des().Length() < KPhoneValidPhoneNumberLength )
-            {
-            CloseClearNumberEntryAndLoadEffectL( ECallUiAppear );
-            }
-    
-        CleanupStack::PopAndDestroy( phoneNumber );        
-    
-        if ( !iCustomization || 
-             !iCustomization->HandleCallFromNumberEntryL() )
-            {
-            // Customization didn't handle call. Dial voice call
-            // as normally
-            DialVoiceCallL();
-            }
+
+    CleanupStack::PopAndDestroy( phoneNumber );
+
+    if ( !iCustomization ||
+         !iCustomization->HandleCallFromNumberEntryL() )
+        {
+        // Customization didn't handle call. Dial voice call
+        // as normally
+        DialVoiceCallL();
         }
-    
+
     }
 
 // -----------------------------------------------------------
@@ -2218,12 +1816,12 @@
 EXPORT_C void CPhoneState::UpdateSingleActiveCallL( TInt aCallId )
     {
     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::UpdateSingleActiveCallL( ) ");
+
     // Stop capturing keys
     CaptureKeysDuringCallNotificationL( EFalse );
+
     BeginUiUpdateLC();
 
-    SetTouchPaneButtonEnabled( EPhoneInCallCmdHold );
-
     // Update call state
     TPhoneCmdParamCallHeaderData callHeaderParam;
     callHeaderParam.SetCallState( EPEStateConnected );
@@ -2234,6 +1832,8 @@
     UpdateRemoteInfoDataL( aCallId );
 
     // Create call duration label if enabled
+    // This key will be moved to some other area, but since key
+    // is supported we can still use it.
     TBool callDuration( EFalse );
     CPhoneCenRepProxy::Instance()->GetInt(
             KCRUidLogs, KLogsShowCallDuration, callDuration );
@@ -2248,31 +1848,15 @@
      // Go to current state implementation
     iCbaManager->UpdateInCallCbaL();
 
-    //Update state of switch to video or voice call touch button.
-    TPECallType type = iStateMachine->PhoneEngineInfo()->CallType( aCallId );
-
-    if( type == EPECallTypeVideo )
-        {
-        TPhoneCmdParamBoolean booleanParam;
-        booleanParam.SetBoolean( ETrue );
-        iViewCommandHandle->ExecuteCommandL( EPhoneViewSetVideoCallFlag, &booleanParam );
-        }
-    else
+    // Go to background if necessary
+    if ( NeedToSendToBackgroundL() ||  IsAutoLockOn() )
         {
-        TPhoneCmdParamBoolean booleanParam;
-        booleanParam.SetBoolean( EFalse );
-        iViewCommandHandle->ExecuteCommandL( EPhoneViewSetVideoCallFlag, &booleanParam );
         }
-
-    // Check if application and number entry was open before incoming call. If so give control to number entry 
-	// to prevent flickering
-    if ( NeedToReturnToForegroundAppL() ||  IsAutoLockOn() )
+    // If there is no need to send back ground and number entry is used then
+    // we must show number entry.
+    else if ( !NeedToSendToBackgroundL() && IsNumberEntryUsedL() )
         {
-        // If number entry is used set control and visibility.
-        if ( IsNumberEntryUsedL() )
-           {
-           iViewCommandHandle->ExecuteCommandL( EPhoneViewSetControlAndVisibility );
-           }
+        SetNumberEntryVisibilityL(ETrue);
         }
     }
 
@@ -2281,20 +1865,11 @@
 // -----------------------------------------------------------
 //
 EXPORT_C void CPhoneState::CaptureKeysDuringCallNotificationL(
-    TBool aCaptured )
+    TBool /*aCaptured*/ )
     {
     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::CaptureKeysDuringCallNotificationL( ) ");
-
-    if ( AknLayoutUtils::PenEnabled() )
-        {
-        //Capture pointer events
-        TPhoneCmdParamBoolean booleanParam;
-        booleanParam.SetBoolean( aCaptured );
-        iViewCommandHandle->ExecuteCommandL( EPhoneViewSetPointerCapture, &booleanParam );
-        }
-
     // Determine which view command to execute based on the capture status
-    const TInt viewCommandId = aCaptured ?
+    /*const TInt viewCommandId = aCaptured ?
         EPhoneViewStartCapturingKey :
         EPhoneViewStopCapturingKey;
 
@@ -2314,7 +1889,7 @@
         cameraKeyCaptureParam.SetCaptureType( EPhoneKeyAllEvents );
         iViewCommandHandle->ExecuteCommandL( viewCommandId,
             &cameraKeyCaptureParam );
-        }
+        }*/
     }
 
 // -----------------------------------------------------------
@@ -2349,8 +1924,7 @@
     if( iCustomization )
         {
         TBuf<KCntMaxTextFieldLength> inCallNumberText( KNullDesC );
-        // incall number text could be 'Call 1', 'Call 2', ...
-        CallheaderManagerL()->GetInCallNumberTextL( aCallId, inCallNumberText );
+
         // to check if we have VoIP call in question and fix
         // parameters if needed
         iCustomization->ModifyCallHeaderTexts( aCallId, &callHeaderParam,
@@ -2370,7 +1944,7 @@
 // -----------------------------------------------------------
 //
 EXPORT_C void CPhoneState::SetCallHeaderType(
-    const CBubbleManager::TPhoneCallTypeFlags aCallHeaderType )
+    TInt aCallHeaderType )
     {
     __LOGMETHODSTARTEND( EPhoneControl, "CPhoneState::SetCallHeaderType() ");
     TRAP_IGNORE( CallheaderManagerL()->SetCallHeaderType( aCallHeaderType ) );
@@ -2411,7 +1985,6 @@
        if( activeCallCount.Integer() == ENoActiveCalls )
             {
             iCbaManager->UpdateIncomingCbaL( incomingCall );
-            UpdateSilenceButtonDimming();
             }
         else
             {
@@ -2447,55 +2020,6 @@
 
 // <-------------------------- CONTEXT MENU ------------------------->
 
-// -----------------------------------------------------------------------------
-// CPhoneState::SetContextMenu
-// -----------------------------------------------------------------------------
-//
-EXPORT_C void CPhoneState::SetContextMenuL( TInt aResourceId )
-    {
-    __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::SetContextMenuL() ");
-
-    TPhoneCmdParamInteger integerParam;
-    TInt resId( CPhoneMainResourceResolver::Instance()->
-                            ResolveResourceID( aResourceId ) );
-    integerParam.SetInteger( resId );
-    __PHONELOG1( EBasic, EPhoneControl,
-                  "CPhoneState::SetContextMenuL : resId =%d",resId );
-
-    iViewCommandHandle->ExecuteCommandL( EPhoneViewUpdateContextMenu,
-                                      &integerParam );
-    }
-// -----------------------------------------------------------------------------
-// CPhoneState::UpdateInCallContextMenuL
-// -----------------------------------------------------------------------------
-//
-EXPORT_C void CPhoneState::UpdateInCallContextMenuL()
-    {
-    __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::UpdateInCallContextMenuL() ");
-
-    SetContextMenuL( EPhoneNumberAcqMenubar );
-
-    }
-
-// -----------------------------------------------------------------------------
-// CPhoneState::UpdateIncomingContextMenuL
-// -----------------------------------------------------------------------------
-//
-EXPORT_C void CPhoneState::UpdateIncomingContextMenuL( TInt aCallId )
-    {
-    __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::UpdateIncomingContextMenuL() ");
-
-    if( CPhoneState::IsVideoCall ( aCallId ) )
-        {
-        SetContextMenuL( EPhoneIncomingVideoCallMenubar );
-        }
-    else
-        {
-        SetContextMenuL( EPhoneIncomingCallMenubar );
-        }
-
-    }
-
 // -----------------------------------------------------------
 // CPhoneState::ShowNoteL
 // -----------------------------------------------------------
@@ -2600,9 +2124,9 @@
         noteText.Append( timeString );
 
         TPhoneCmdParamGlobalNote globalNoteParam;
-        globalNoteParam.SetType( EAknGlobalInformationNote );
+        globalNoteParam.SetType( EPhoneMessageBoxInformation );
         globalNoteParam.SetText( noteText );
-        globalNoteParam.SetTone( CAknNoteDialog::ENoTone );
+
         iViewCommandHandle->ExecuteCommandL(
             EPhoneViewShowGlobalNote, &globalNoteParam );
         }
@@ -2612,7 +2136,8 @@
 // CPhoneState::SendGlobalInfoNoteL
 // ---------------------------------------------------------
 //
-EXPORT_C void CPhoneState::SendGlobalInfoNoteL( TInt aResourceId )
+EXPORT_C void CPhoneState::SendGlobalInfoNoteL( 
+        TInt aResourceId, TBool aNotificationDialog )
     {
     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::SendGlobalInfoNoteL( ) ");
     __ASSERT_DEBUG( aResourceId, Panic( EPhoneCtrlParameterNotInitialized ) );
@@ -2626,13 +2151,15 @@
             &globalNotifierParam );
 
         TPhoneCmdParamGlobalNote globalNoteParam;
-
-        globalNoteParam.SetType( EAknGlobalInformationNote );
+        PhoneNotificationType type = aNotificationDialog ? 
+            EPhoneNotificationDialog : EPhoneMessageBoxInformation;
+        globalNoteParam.SetType( type );
         globalNoteParam.SetTextResourceId(
             CPhoneMainResourceResolver::Instance()->
             ResolveResourceID( aResourceId ) );
-        globalNoteParam.SetTone( EAvkonSIDInformationTone );
-
+
+        globalNoteParam.SetNotificationDialog( aNotificationDialog );
+        
         iViewCommandHandle->ExecuteCommandL(
             EPhoneViewShowGlobalNote, &globalNoteParam );
         }
@@ -2642,7 +2169,8 @@
 //  CPhoneUIController::SendGlobalWarningNoteL
 // ---------------------------------------------------------
 //
-EXPORT_C void CPhoneState::SendGlobalWarningNoteL( TInt aResourceId )
+EXPORT_C void CPhoneState::SendGlobalWarningNoteL( 
+        TInt aResourceId, TBool aNotificationDialog )
     {
     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::SendGlobalWarningNoteL( ) ");
     __ASSERT_DEBUG( aResourceId, Panic( EPhoneCtrlParameterNotInitialized ) );
@@ -2657,12 +2185,15 @@
             &globalNotifierParam );
 
         TPhoneCmdParamGlobalNote globalNoteParam;
-        globalNoteParam.SetType( EAknGlobalWarningNote );
+        PhoneNotificationType type = aNotificationDialog ? 
+                    EPhoneNotificationDialog : EPhoneMessageBoxWarning;
+        globalNoteParam.SetType( type );
         globalNoteParam.SetTextResourceId(
             CPhoneMainResourceResolver::Instance()->
             ResolveResourceID( aResourceId ) );
-        globalNoteParam.SetTone( EAvkonSIDWarningTone );
-
+  
+        globalNoteParam.SetNotificationDialog( aNotificationDialog );
+        
         iViewCommandHandle->ExecuteCommandL(
             EPhoneViewShowGlobalNote, &globalNoteParam );
         }
@@ -2672,7 +2203,8 @@
 //  CPhoneUIController::SendGlobalErrorNoteL
 // ---------------------------------------------------------
 //
-EXPORT_C void CPhoneState::SendGlobalErrorNoteL( TInt aResourceId )
+EXPORT_C void CPhoneState::SendGlobalErrorNoteL( 
+        TInt aResourceId, TBool aNotificationDialog )
     {
     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::SendGlobalErrorNoteL( ) ");
     __ASSERT_DEBUG( aResourceId, Panic( EPhoneCtrlParameterNotInitialized ) );
@@ -2686,11 +2218,14 @@
             &globalNotifierParam );
 
         TPhoneCmdParamGlobalNote globalNoteParam;
-        globalNoteParam.SetType( EAknGlobalErrorNote );
+        PhoneNotificationType type = aNotificationDialog ? 
+                    EPhoneNotificationDialog : EPhoneMessageBoxInformation;
+        globalNoteParam.SetType( type );
+        
         globalNoteParam.SetTextResourceId(
             CPhoneMainResourceResolver::Instance()->
             ResolveResourceID( aResourceId ) );
-        globalNoteParam.SetTone( CAknNoteDialog::EErrorTone );
+        globalNoteParam.SetNotificationDialog( aNotificationDialog );
 
         iViewCommandHandle->ExecuteCommandL(
             EPhoneViewShowGlobalNote, &globalNoteParam );
@@ -2708,7 +2243,7 @@
         iViewCommandHandle, iStateMachine, this );
     if ( !bt->SetHandsfreeModeL( aHandsfreeMode ))
         {
-        SendGlobalErrorNoteL( EPhoneNoteTextNotAllowed );
+        SendGlobalErrorNoteL( EPhoneNoteTextNotAllowed, ETrue );
         }
     CleanupStack::PopAndDestroy( bt );
     }
@@ -2724,7 +2259,7 @@
         iViewCommandHandle, iStateMachine, this );
     if ( !bt->SetBTHandsfreeModeL( aHandsfreeMode ))
         {
-        SendGlobalErrorNoteL( EPhoneNoteTextNotAllowed );
+        SendGlobalErrorNoteL( EPhoneNoteTextNotAllowed, ETrue );
         }
     CleanupStack::PopAndDestroy( bt );
     }
@@ -2732,298 +2267,13 @@
 // <-------------------------- INTERNAL FUNCTIONS ------------------------>
 
 // -----------------------------------------------------------
-// CPhoneState::UpdateIncallIndicatorL
-// -----------------------------------------------------------
-//
-void CPhoneState::UpdateIncallIndicatorL( TInt aCallState )
-    {
-    __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::UpdateIncallIndicatorL( ) ");
-    TPhoneCmdParamIncallIndicatorData incallIndicatorParam;
-    // Set the state.
-    incallIndicatorParam.SetCallState( aCallState );
-
-    if((aCallState == EPSCTsyCallStateUninitialized) || 
-       (aCallState == EPSCTsyCallStateNone))
-        {
-        incallIndicatorParam.SetLittleBubbleVisible( EFalse );
-        }
-    else
-        {
-        SetLittleBubbleVisibilityL(&incallIndicatorParam);
-        }
-    
-    // Set mode
-    incallIndicatorParam.SetMode(
-       CPhonePubSubProxy::Instance()->Value(
-            KPSUidCtsyCallInformation,
-            KCTsyCallType ) );
-            
-    TInt activeCallId = GetActiveCallIdL();
-    if ( activeCallId > KErrNone )
-        {
-        if ( iStateMachine->PhoneEngineInfo()->CallALSLine( activeCallId )
-             == CCCECallParameters::ECCELineTypeAux )
-            {
-            incallIndicatorParam.SetLine2( ETrue );
-            }
-        }
-
-    // Set the mute status
-    const TBool audioMute = iStateMachine->PhoneEngineInfo()->AudioMute();
-    incallIndicatorParam.SetMute( audioMute );
-
-    // Set the voice privacy status
-    if ( activeCallId > KErrNotFound && activeCallId != KConferenceCallId  )
-        {
-        incallIndicatorParam.SetCiphering(
-            iStateMachine->PhoneEngineInfo()->IsSecureCall( activeCallId ) );
-        }
-    else
-        {
-        incallIndicatorParam.SetCiphering( ETrue );
-        }
-
-    incallIndicatorParam.SetCipheringIndicatorAllowed(
-        iStateMachine->PhoneEngineInfo()->SecureSpecified() );
-
-    // Set the emergency status
-    if( EPEStateIdle != iStateMachine->PhoneEngineInfo()->CallState( KPEEmergencyCallId ) )
-        {
-        incallIndicatorParam.SetEmergency( ETrue );
-        }
-    
-    // Update the in-call indicator
-    iViewCommandHandle->ExecuteCommandL( EPhoneViewUpdateIncallIndicator,
-        &incallIndicatorParam );
-    }
-
-// -----------------------------------------------------------
 // CPhoneState::UpdateProfileDisplayL
 // -----------------------------------------------------------
 //
 void CPhoneState::UpdateProfileDisplayL()
     {
-    __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::UpdateProfileDisplayL( ) ");
-    // Get the profile information
-    const TInt profileId =
-        iStateMachine->PhoneEngineInfo()->ProfileId();
-    TPEProfileName profileName =
-        iStateMachine->PhoneEngineInfo()->ProfileName();
-
-    HBufC* profileString = HBufC::NewLC( profileName.Length() +
-        KPhoneMaxDateDisplayTextLength );
-
-    TPtr profileNameBuf = profileString->Des();
-    profileNameBuf.Zero();
-    profileNameBuf.Append( profileName );
-
-    if ( ( profileId == EProfileGeneralId ) ||
-        ( profileId == EProfileOffLineId ) )
-        {
-        // Show date instead of profile name on navi pane
-        HBufC* buffer = HBufC::NewLC( KPhoneMaxDateDisplayTextLength );
-        TPtr dateString( buffer->Des() );
-
-        TTime time;
-        time.HomeTime();
-
-        // Get date string
-        CCoeEnv* coeEnv = CCoeEnv::Static();
-
-        HBufC* dateFormatString =
-            StringLoader::LoadLC( R_QTN_DATE_USUAL_WITH_ZERO, coeEnv );
-        time.FormatL( dateString, *dateFormatString );
-        CleanupStack::PopAndDestroy( dateFormatString );
-
-        // To arabic
-        AknTextUtils::DisplayTextLanguageSpecificNumberConversion(
-            dateString );
-
-        //Get week day abbreviation
-        TDayNameAbb wkDayAbb = TDayNameAbb();
-        wkDayAbb.Set(time.DayNoInWeek());
-
-        //Get time format string
-        HBufC* timeFormat = StringLoader::LoadLC(
-            CPhoneMainResourceResolver::Instance()->
-                ResolveResourceID( EPhoneIdleTimeFormat ),
-            coeEnv );
-
-        //Set date and weekdays to time format
-        profileNameBuf.Zero();
-
-        StringLoader::Format(
-            profileNameBuf,
-            *timeFormat,
-            1, // date
-            dateString );
-
-        dateString.Copy( profileNameBuf );
-
-        StringLoader::Format(
-            profileNameBuf,
-            dateString,
-            0, // weekday
-            wkDayAbb );
-
-        CleanupStack::PopAndDestroy( timeFormat );
-        CleanupStack::PopAndDestroy( buffer );
-        }
-
-    // Set silence indicator based on the ringing profile
-    const TProfileRingingType ringingType =
-        iStateMachine->PhoneEngineInfo()->RingingType();
-    if ( ringingType == EProfileRingingTypeSilent )
-        {
-        TBuf< 1 > silent;
-        silent.Append( KPuaCodeSilentSymbol );
-        profileNameBuf.Insert( 0, silent );
-        }
-
-    // Update the profile display on the navi pane
-    iViewCommandHandle->ExecuteCommandL( EPhoneViewSetNaviPaneContent, 0,
-        profileNameBuf );
-
-    if ( profileId == EProfileOffLineId )
-        {
-        iViewCommandHandle->ExecuteCommandL(
-            EPhoneViewSetTitlePaneContent,
-            0,
-            profileName );
-        }
-    else
-        {
-        UpdateOperatorDisplayL();
-        }
-
-    CleanupStack::PopAndDestroy( profileString );
     }
 
-// -----------------------------------------------------------
-// CPhoneState::UpdateOperatorDisplayL
-// -----------------------------------------------------------
-//
-void CPhoneState::UpdateOperatorDisplayL()
-    {
-    __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::UpdateOperatorDisplayL( ) ");
-    __PHONELOG( EBasic, EPhoneControl, "CPhoneState::UpdateOperatorDisplayL" );
-    // Get current title pane content.
-    TTelTitleDisplay titleContent;
-    titleContent.iDisplayTag.Zero();
-    titleContent.iLogoHandle = 0;
-    TPckg<TTelTitleDisplay> titlePckg( titleContent );
-
-    RProperty::Get(
-        KPSUidTelInformation,
-        KTelDisplayInfo,
-        titlePckg );
-
-    if ( TitlePaneIsVisibleL() )
-        {
-        // There is a title pane icon.
-        if ( titleContent.iLogoHandle != 0 )
-            {
-            // Set new logo.
-            __PHONELOG( EBasic, EPhoneControl,
-                "CPhoneState::UpdateOperatorDisplayL - logo found" );
-
-            if( iLogoHandle != titleContent.iLogoHandle )
-                {
-                 __PHONELOG( EBasic, EPhoneControl,
-                  "CPhoneState::UpdateOperatorDisplayL - set new logo" );
-
-                 TPhoneCmdParamBitmap bitmapParam;
-
-                 // Duplicate bitmap from handle.
-                 CFbsBitmap* bitmap = new (ELeave) CFbsBitmap;
-                 CleanupStack::PushL( bitmap );
-                 User::LeaveIfError(
-                         bitmap->Duplicate( titleContent.iLogoHandle ) );
-                 bitmapParam.SetBitmap( bitmap );
-
-                 // Duplicate and set bitmap mask if needed
-                 CFbsBitmap* maskBitmap = NULL;
-                 if( titleContent.iLogoMaskHandle != 0 )
-                     {
-                     maskBitmap = new( ELeave )CFbsBitmap;
-                     CleanupStack::PushL( maskBitmap );
-                     User::LeaveIfError( maskBitmap->Duplicate(
-                             titleContent.iLogoMaskHandle ) );
-                     bitmapParam.SetMaskBitmap( maskBitmap );
-                     }
-
-                 iViewCommandHandle->ExecuteCommandL(
-                         EPhoneViewSetTitlePanePicture,
-                         &bitmapParam );
-
-                 // The title pane takes ownership of the bitmaps so no need
-                 // to destroy it here.
-                 if( maskBitmap )
-                     {
-                     // Pop maskBitmap only, if it has been created
-                     CleanupStack::Pop( maskBitmap );
-                     }
-                 CleanupStack::Pop( bitmap );
-                }
-            }
-        else
-            {
-            __PHONELOG1( EBasic, EPhoneControl,
-            "CPhoneState::UpdateOperatorDisplayL - set text=%S", &titleContent.iDisplayTag );
-            iLogoHandle = titleContent.iLogoHandle;
-
-            iViewCommandHandle->ExecuteCommandL(
-                EPhoneViewSetTitlePaneContent,
-                0,
-                titleContent.iDisplayTag );
-            }
-        }
-
-    // Check background image.
-    TPhoneCmdParamBitmap savedBitmapParam;
-    iViewCommandHandle->ExecuteCommandL(
-        EPhoneViewGetBackgroundImageBitmap,
-        &savedBitmapParam );
-
-    if ( titleContent.iBackgroundImageHandle !=
-        savedBitmapParam.Bitmap()->Handle() )
-        {
-        __PHONELOG2( EBasic, EPhoneControl,
-        "CPhoneState::UpdateOperatorDisplayL - update background image since different titleContent(%d), saved(%d)",
-            titleContent.iBackgroundImageHandle, savedBitmapParam.Bitmap()->Handle() );
-        // Background image has changed. Duplicate bitmap from handle if
-        // available; otherwise reset the background image
-        CFbsBitmap* bitmap = new (ELeave) CFbsBitmap;
-        CleanupStack::PushL( bitmap );
-        TInt err = KErrNone;
-        if ( titleContent.iBackgroundImageHandle != 0 )
-            {
-            err = bitmap->Duplicate( titleContent.iBackgroundImageHandle );
-            }
-        else
-            {
-            bitmap->Reset();
-            }
-
-        if ( err == KErrNone )
-            {
-            iBitmapRedrawCounter = titleContent.iBackgroundImageRedrawCounter;
-            TPhoneCmdParamBitmap bitmapParam;
-            bitmapParam.SetBitmap( bitmap );
-            iViewCommandHandle->ExecuteCommandL(
-                EPhoneViewSetBackgroundImageBitmap,
-                &bitmapParam );
-            }
-
-        CleanupStack::PopAndDestroy( bitmap );
-        }
-    else if ( titleContent.iBackgroundImageRedrawCounter !=
-                  iBitmapRedrawCounter  )
-        {
-        iBitmapRedrawCounter = titleContent.iBackgroundImageRedrawCounter;
-        iViewCommandHandle->ExecuteCommandL( EPhoneViewUpdateView );
-        }
-    }
 
 // -----------------------------------------------------------
 // CPhoneState::HandleInitiatedEmergencyCallL
@@ -3045,9 +2295,6 @@
     holdFlag.SetBoolean( EFalse );
     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetHoldFlag, &holdFlag );
 
-    // Undim Answer button for sure.
-    SetTouchPaneButtonEnabled( EPhoneCallComingCmdAnswer );
-
     // Go to emergency call state
     // No need update cba
     iStateMachine->ChangeState( EPhoneStateEmergency );
@@ -3063,57 +2310,14 @@
 
     // We have existing video call so need to release dataport before continuing
     // emergency call. Otherwise we will face problems with dataport use later.
-    CPhoneMediatorFactory::Instance()->Sender()->IssueCommand( 
-            KMediatorVideoTelephonyDomain,
-            KCatPhoneToVideotelCommands,
-            EVtCmdReleaseDataport,
-            TVersion( KPhoneToVideotelCmdVersionMajor,
-                    KPhoneToVideotelCmdVersionMinor,
-                    KPhoneToVideotelCmdVersionBuild ),
-            KNullDesC8,
-            CPhoneContinueEmergencyCallCommand::NewL( *iStateMachine ) );
-    }
-
-// -----------------------------------------------------------
-// CPhoneState::HandleShowImeiL
-// -----------------------------------------------------------
-//
-void CPhoneState::HandleShowImeiL()
-    {
-    __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::HandleShowImeiL( ) ");
-
-    if ( IsOnScreenDialerSupported() )
-        {
-        NumberEntryClearL();
-        }
-    else
-        {
-        // Remove number entry from screen
-        iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNumberEntry );
-        }
-
-    // Fetch IMEI
-    TBuf<RMobilePhone::KPhoneSerialNumberSize> serialNumber;
-    TPEPhoneIdentityParameters phoneIdentityParameters = iStateMachine->
-        PhoneEngineInfo()->PhoneIdentityParameters();
-    serialNumber = phoneIdentityParameters.iSerialNumber;
-
-    // Add it to the resource string
-    HBufC* buf = StringLoader::LoadLC(
-        CPhoneMainResourceResolver::Instance()->
-        ResolveResourceID(
-        EPhonePhoneImeiString ), serialNumber );
-
-    TPhoneCmdParamNote noteParam;
-    noteParam.SetType( EPhoneNoteCustom );
-    noteParam.SetResourceId( CPhoneMainResourceResolver::Instance()->
-        ResolveResourceID( EPhoneInformationWaitNote ) );
-    noteParam.SetText( *buf );
-
-    // Display note
-    iViewCommandHandle->ExecuteCommandL( EPhoneViewShowNote, &noteParam );
-
-    CleanupStack::PopAndDestroy( buf );
+    CPhoneMediatorFactory::Instance()->Sender()->IssueCommand( KMediatorVideoTelephonyDomain,
+                                                                     KCatPhoneToVideotelCommands,
+                                                                     EVtCmdReleaseDataport,
+                                                               TVersion( KPhoneToVideotelCmdVersionMajor,
+                                                                         KPhoneToVideotelCmdVersionMinor,
+                                                                         KPhoneToVideotelCmdVersionBuild ),
+                                                               KNullDesC8,
+                                                               CPhoneContinueEmergencyCallCommand::NewL( *iStateMachine ) );
     }
 
 // -----------------------------------------------------------
@@ -3144,61 +2348,6 @@
         &callHeaderParam );
     }
 
-// -----------------------------------------------------------
-// CPhoneState::HandleShowLifeTimerL
-// -----------------------------------------------------------
-//
-void CPhoneState::HandleShowLifeTimerL()
-   {
-    __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::HandleShowLifeTimerL( ) ");
-    if ( IsOnScreenDialerSupported() )
-        {
-        NumberEntryClearL();
-        }
-    else
-        {
-        // Remove number entry from screen
-        iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNumberEntry );
-        }
-
-    // Fetch LifeTime
-    TPELifeTimeData lifeTimeData = iStateMachine->
-        PhoneEngineInfo()->LifeTimerData();
-
-    TLocale locale;
-    TBuf<KTimerTextLength> lifetimerText;
-    lifetimerText.NumFixedWidth(
-        lifeTimeData.iHours,
-        EDecimal,
-        KPhoneLifeTimerHoursLength );
-
-    lifetimerText.Append(locale.TimeSeparator( KTimerMinuteSeparator ) );   // minute seperator
-
-    TBuf<KPhoneLifeTimerMinutesLength> mins;
-    mins.NumFixedWidth(
-        lifeTimeData.iMinutes,
-        EDecimal,
-        KPhoneLifeTimerMinutesLength );
-
-    lifetimerText.Append(mins);
-
-    // Add it to the resource string
-    HBufC* buf = StringLoader::LoadLC(
-        CPhoneMainResourceResolver::Instance()->
-        ResolveResourceID(
-        EPhoneLifeTimeFormat ), lifetimerText );
-    TPhoneCmdParamNote noteParam;
-    noteParam.SetType( EPhoneNoteCustom );
-    noteParam.SetResourceId( CPhoneMainResourceResolver::Instance()->
-        ResolveResourceID( EPhoneInformationWaitNote ) );
-    noteParam.SetText( *buf );
-
-    // Display note
-    iViewCommandHandle->ExecuteCommandL( EPhoneViewShowNote, &noteParam );
-
-    CleanupStack::PopAndDestroy( buf );
-    }
-
 // ---------------------------------------------------------
 // CPhoneState::IsVideoCall
 // ---------------------------------------------------------
@@ -3346,7 +2495,6 @@
             {
             case ESimRejected:
             case ESimUnaccepted:
-            case ESimInvalid:
                 retVal = EFalse;
                 break;
 
@@ -3365,7 +2513,9 @@
 //
 EXPORT_C TBool CPhoneState::IsSimStateNotPresentWithSecurityModeEnabled()
     {
-    if ( SimState() == EPESimNotPresent && iStateMachine->SecurityMode()->IsSecurityMode() )
+    TPhoneCmdParamBoolean isSecurityMode;
+    TRAP_IGNORE( iViewCommandHandle->ExecuteCommandL( EPhoneViewGetSecurityModeStatus, &isSecurityMode ) );
+    if ( SimState() == EPESimNotPresent && isSecurityMode.Boolean() )
         {
         return ETrue;
         }
@@ -3376,6 +2526,16 @@
     }
 
 // ---------------------------------------------------------
+// CPhoneState::SetDivertIndication
+// ---------------------------------------------------------
+//
+EXPORT_C void CPhoneState::SetDivertIndication( const TBool aDivertIndication )
+    {
+    __LOGMETHODSTARTEND( EPhoneControl, "CPhoneState::SetDivertIndication()");
+    TRAP_IGNORE( CallheaderManagerL()->SetDivertIndication( aDivertIndication ) );
+    }
+
+// ---------------------------------------------------------
 // CPhoneState::StartAlsLineChangeTimerL
 // ---------------------------------------------------------
 //
@@ -3410,12 +2570,13 @@
     {
     __LOGMETHODSTARTEND( EPhoneControl, "CPhoneState::StartShowSecurityNoteL ");
 
+    // Set security mode on.
+    TPhoneCmdParamBoolean securityMode;
+    securityMode.SetBoolean( ETrue );
+    iViewCommandHandle->ExecuteCommandL( EPhoneViewSetSecurityMode, &securityMode );
+
     // Remove number entry from screen
     iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNumberEntry );
-
-    TPhoneCmdParamBoolean visibleMode;
-    visibleMode.SetBoolean( EFalse );
-    iViewCommandHandle->ExecuteCommandL( EPhoneViewSetStatusPaneVisible, &visibleMode );
     
     iCbaManager->UpdateCbaL( EPhoneEmptyCBA );
 
@@ -3431,38 +2592,21 @@
 
     TInt resourceId ( KErrNone );
 
-
-    switch( SimSecurityStatus() )
+    if ( SimSecurityStatus() == ESimRejected )
+        {
+        resourceId = CPhoneMainResourceResolver::Instance()->
+            ResolveResourceID( EPhoneSimRejected );
+        }
+    else if ( SimState() == EPESimNotPresent )
         {
-			  case ESimRejected:
-			      {
-			      resourceId = CPhoneMainResourceResolver::Instance()->
-              ResolveResourceID( EPhoneSimRejected );
-            break;
-			      }
-			  case ESimUnaccepted:
-			      {
-			      // insert sim card -note
-            resourceId = CPhoneMainResourceResolver::Instance()->
-              ResolveResourceID( EPhoneSimUnaccepted );	
-			      break;
-			      }
-			  case ESimInvalid:
-			      {
-			      resourceId = CPhoneMainResourceResolver::Instance()->
-              ResolveResourceID( EPhoneSIMInvalidUICC );
-			      break;
-			      }
-        default:
-	          {
-	          if ( SimState() == EPESimNotPresent )
-                {
-                // insert sim card -note
-                resourceId = CPhoneMainResourceResolver::Instance()->
-                    ResolveResourceID( EPhoneSimRemoved );
-                }
-	          break;	
-	          }
+        // insert sim card -note
+        resourceId = CPhoneMainResourceResolver::Instance()->
+            ResolveResourceID( EPhoneSimRemoved );
+        }
+    else if ( SimSecurityStatus() == ESimUnaccepted )
+        {
+        resourceId = CPhoneMainResourceResolver::Instance()->
+            ResolveResourceID( EPhoneSimUnaccepted );
         }
 
     if ( resourceId != KErrNone )
@@ -3678,13 +2822,14 @@
         resource = iCustomization->CustomizeBusyNoteText();
         }
 
-    // Show number busy note
+    // Show number busy notification
     TPhoneCmdParamGlobalNote globalNoteParam;
-    globalNoteParam.SetType( EAknGlobalInformationNote );
+    globalNoteParam.SetType( EPhoneNotificationDialog );
     globalNoteParam.SetTextResourceId(
         CPhoneMainResourceResolver::Instance()->
         ResolveResourceID( resource ) );
-    globalNoteParam.SetTone( EAvkonSIDInformationTone );
+    
+    globalNoteParam.SetNotificationDialog( ETrue );
     iViewCommandHandle->ExecuteCommandL( EPhoneViewShowGlobalNote,
         &globalNoteParam );
     }
@@ -3701,6 +2846,11 @@
                 KPSUidCoreApplicationUIs,
                 KCoreAppUIsAutolockStatus ) > EAutolockOff;
 
+    __PHONELOG1( EBasic,
+            EPhoneControl,
+            "CPhoneState::IsAutoLockOn() Status: %d",
+            phoneIsLocked );
+    
     return phoneIsLocked;
     }
 
@@ -3741,28 +2891,37 @@
 // CPhoneState::SetTouchPaneButtons
 // ---------------------------------------------------------
 //
-EXPORT_C void CPhoneState::SetTouchPaneButtons( TInt aResourceId )
+EXPORT_C void CPhoneState::SetTouchPaneButtons( TInt /*aResourceId*/ )
     {
     if ( FeatureManager::FeatureSupported( KFeatureIdTouchCallHandling ) )
         {
-        // Display Video Share button instead of Hold Button if
-        // the feature is enabled and video sharing is currently available.
-        if ( aResourceId == EPhoneIncallButtons &&
-             FeatureManager::FeatureSupported( KFeatureIdFfEntryPointForVideoShare ) &&
-             CPhonePubSubProxy::Instance()->Value
-                ( KPSUidCoreApplicationUIs, KCoreAppUIsVideoSharingIndicator )
-                == ECoreAppUIsVideoSharingIndicatorOn )
-            {
-            aResourceId = EPhoneIncallVideoShareButtons;
-            }
-        TPhoneCmdParamInteger integerParam;
-        integerParam.SetInteger( CPhoneMainResourceResolver::Instance()->
-                                 ResolveResourceID( aResourceId ) );
+        TPhoneCmdParamBoolean muteParam;
+        muteParam.SetBoolean( iStateMachine->PhoneEngineInfo()->AudioMute() );
+        iViewCommandHandle->ExecuteCommand(EPhoneViewSetMuteFlag,&muteParam);
+        
+        const TPEAudioOutput audioOutput =
+            iStateMachine->PhoneEngineInfo()->AudioOutput();
+
+        TBool btAvailable = iStateMachine->PhoneEngineInfo()->AudioOutputAvailable(
+            EPEBTAudioAccessory );
+        
+        TPhoneCmdParamBoolean btParam;
+        btParam.SetBoolean( audioOutput == EPEBTAudioAccessory );        
+        iViewCommandHandle->ExecuteCommand(EPhoneViewSetBlueToothFlag,&btParam);
+
+        TPhoneCmdParamBoolean btAvailableParam;
+        btAvailableParam.SetBoolean( btAvailable );        
+        iViewCommandHandle->ExecuteCommand(
+                EPhoneViewSetBluetoothAvailableFlag,&btAvailableParam);
+               
+        TBool emergency( EPEStateIdle != 
+            iStateMachine->PhoneEngineInfo()->CallState( KPEEmergencyCallId ) );
+        TPhoneCmdParamBoolean booleanParam;
+        booleanParam.SetBoolean( emergency );
+
         TRAP_IGNORE( iViewCommandHandle->ExecuteCommandL(
                      EPhoneViewSetTouchPaneButtons,
-                     &integerParam ) );
-
-        SetTouchPaneVisible( ETrue );
+                     &booleanParam ) );
         }
     }
 
@@ -3774,60 +2933,10 @@
     {
     if ( FeatureManager::FeatureSupported( KFeatureIdTouchCallHandling ) )
         {
-        TPhoneCmdParamInteger integerParam;
-        integerParam.SetInteger( 0 );
+        TPhoneCmdParamBoolean boolParam;
         TRAP_IGNORE( iViewCommandHandle->ExecuteCommandL(
                         EPhoneViewSetTouchPaneButtons,
-                        &integerParam ) );
-
-        SetTouchPaneVisible( EFalse );
-        }
-    }
-
-// ---------------------------------------------------------
-// CPhoneState::SetTouchPaneVisible
-// ---------------------------------------------------------
-//
-EXPORT_C void CPhoneState::SetTouchPaneVisible( TBool aVisible )
-    {
-    if ( FeatureManager::FeatureSupported( KFeatureIdTouchCallHandling ) )
-        {
-        TPhoneCmdParamBoolean booleanParam;
-        booleanParam.SetBoolean( aVisible );
-        TRAP_IGNORE( iViewCommandHandle->ExecuteCommandL(
-                        EPhoneViewSetTouchPaneVisible,
-                        &booleanParam ) );
-        }
-    }
-
-// ----------------------------------------------------------------------------
-// CPhoneState::SetTouchButtonEnabled
-// ----------------------------------------------------------------------------
-//
-EXPORT_C void CPhoneState::SetTouchPaneButtonEnabled( TInt aCommandId )
-    {
-    if ( FeatureManager::FeatureSupported( KFeatureIdTouchCallHandling ) )
-        {
-        TPhoneCmdParamInteger commandParam;
-        commandParam.SetInteger( aCommandId );
-        iViewCommandHandle->ExecuteCommand( EPhoneViewEnableTouchButton,
-                                            &commandParam );
-        }
-    }
-
-// ----------------------------------------------------------------------------
-// CPhoneState::SetTouchButtonDisabled
-// ----------------------------------------------------------------------------
-//
-EXPORT_C void CPhoneState::SetTouchPaneButtonDisabled( TInt aCommandId )
-    {
-    if ( FeatureManager::FeatureSupported( KFeatureIdTouchCallHandling ) )
-        {
-        TPhoneCmdParamInteger commandParam;
-        commandParam.SetInteger( aCommandId );
-
-        iViewCommandHandle->ExecuteCommand( EPhoneViewDisableTouchButton,
-                                            &commandParam );
+                        &boolParam ) );
         }
     }
 
@@ -3839,28 +2948,6 @@
     {
     __LOGMETHODSTARTEND( EPhoneControl, "CPhoneState::HandleLongHashL() ");
 
-    TPhoneCmdParamInteger numberEntryCountParam;
-    iViewCommandHandle->ExecuteCommandL( EPhoneViewGetNumberEntryCount,
-            &numberEntryCountParam );
-    TInt neLength( numberEntryCountParam.Integer() );
-
-    if( neLength == 1 )
-        {
-         if ( !iStateMachine->SecurityMode()->IsSecurityMode() )
-            {
-            OnlyHashInNumberEntryL();
-            }
-        }
-    }
-
-// -----------------------------------------------------------
-// CPhoneState::OpenVKBL
-// -----------------------------------------------------------
-//
-void CPhoneState::OpenVkbL()
-    {
-    __LOGMETHODSTARTEND( EPhoneControl, "CPhoneState::OpenVKB() ");
-    iViewCommandHandle->ExecuteCommandL( EPhoneViewOpenVirtualKeyBoard );
     }
 
 // -----------------------------------------------------------
@@ -3869,7 +2956,9 @@
 //
 EXPORT_C void CPhoneState::BeginUiUpdateLC()
     {
+
     iViewCommandHandle->ExecuteCommand( EPhoneViewBeginUpdate );
+
     TCleanupItem operation( UiUpdateCleanup, this );
     CleanupStack::PushL( operation );
     }
@@ -3880,53 +2969,7 @@
 //
 EXPORT_C void CPhoneState::EndUiUpdate()
     {
-     CleanupStack::PopAndDestroy(); // Call UiUpdateCleanup
-    }
-	
-// -----------------------------------------------------------
-// CPhoneState::BeginTransEffectLC
-// -----------------------------------------------------------
-//
-EXPORT_C void CPhoneState::BeginTransEffectLC( TStateTransEffectType aType )
-    {
-    __LOGMETHODSTARTEND( EPhoneControl, "CPhoneState::BeginTransEffectLC( ) ");
-    TPhoneCmdParamTransEffect effectParam;
-    switch ( aType )
-        {
-        case ENumberEntryOpen:
-            effectParam.SetType( EPhoneTransEffectDialerOpen );
-            break;
-        case ENumberEntryClose:
-            effectParam.SetType( EPhoneTransEffectDialerClose );
-            break;
-        case ENumberEntryCreate:
-            effectParam.SetType( EPhoneTransEffectDialerCreate );
-            break;
-        case ECallUiAppear:
-            effectParam.SetType( EPhoneTransEffectCallUiAppear );
-            break;
-        case ECallUiDisappear:
-            effectParam.SetType( EPhoneTransEffectCallUiDisappear );
-            break;
-        default:
-            effectParam.SetType( EPhoneTransEffectNone );
-        }
-    effectParam.SetAppUid( KUidPhoneApplication );
-    iViewCommandHandle->ExecuteCommand( 
-            EPhoneViewBeginTransEffect, 
-            &effectParam );
-    // Always put the cleanup item into stack as expected by the caller.
-    TCleanupItem operation( EffectCleanup, this );
-    CleanupStack::PushL( operation );
-    }
-
-// -----------------------------------------------------------
-// CPhoneState::EndTransEffect
-// -----------------------------------------------------------
-//
-EXPORT_C void CPhoneState::EndTransEffect()
-    {
-    CleanupStack::PopAndDestroy(); // Call EffectCleanup
+    CleanupStack::PopAndDestroy(); // Call UiUpdateCleanup
     }
 
 // -----------------------------------------------------------
@@ -3976,58 +3019,6 @@
         EPhoneViewEndUpdate );
     }
 
-// -----------------------------------------------------------------------------
-// CPhoneState::EffectCleanup
-// -----------------------------------------------------------------------------
-//
-void CPhoneState::EffectCleanup(TAny* aThis )
-    {
-    TPhoneCmdParamTransEffect effectParam;
-    effectParam.SetType( EPhoneTransEffectStop );
-    // won't do anything if effect wasn't started
-    static_cast<CPhoneState*>( aThis )->iViewCommandHandle->ExecuteCommand(
-        EPhoneViewEndTransEffect, &effectParam );
-    }
-
-// -----------------------------------------------------------------------------
-// CPhoneState::IsDTMFEditorVisibleL
-// -----------------------------------------------------------------------------
-//
-EXPORT_C TBool CPhoneState::IsDTMFEditorVisibleL() const
-    {
-    __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::IsDTMFEditorVisibleL( ) ");
-    return iViewCommandHandle->HandleCommandL(
-        EPhoneViewIsDTMFEditorVisible ) ==
-        EPhoneViewResponseSuccess;
-    }
-
-// -----------------------------------------------------------------------------
-// CPhoneState::CloseDTMFEditorL
-// -----------------------------------------------------------------------------
-//
-EXPORT_C void CPhoneState::CloseDTMFEditorL()
-    {
-    __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::CloseDTMFEditorL()");
-    if ( iOnScreenDialer ) // Touch
-        {
-        TPhoneCmdParamBoolean booleanParam;
-        booleanParam.SetBoolean( EFalse );
-        iViewCommandHandle->ExecuteCommandL( 
-                EPhoneViewSetDtmfDialerViewVisible,
-                &booleanParam );
-        CloseClearNumberEntryAndLoadEffectL( ECallUiAppear );
-        }
-    else // Non-Touch
-        {
-        // If dtmf query is visible then remove number entry
-        // because it should not be shown if user has pressed end key.
-        iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNumberEntry );
-        iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveQuery );
-        // Do state-specific behaviour if number entry is cleared
-        HandleNumberEntryClearedL();
-        }
-    }
-
 // -----------------------------------------------------------
 // CPhoneState::SetDefaultFlagsL()
 // -----------------------------------------------------------
@@ -4054,15 +3045,19 @@
         &globalNotifierParam );
 
     // uncapture App and Camera keys if not security mode
-    if ( !iStateMachine->SecurityMode()->IsSecurityMode() )
+    TPhoneCmdParamBoolean isSecurityMode;
+    iViewCommandHandle->ExecuteCommandL( EPhoneViewGetSecurityModeStatus, &isSecurityMode );
+    if ( !isSecurityMode.Boolean() )
         {
         CaptureKeysDuringCallNotificationL( EFalse );
         }
-    
-    CPhonePubSubProxy::Instance()->ChangePropertyValue(
-                    KPSUidScreenSaver,
-                    KScreenSaverAllowScreenSaver,
-                    EPhoneScreensaverAllowed );
+
+    // Restore keylock if phone has been locked before call.
+    if ( iStateMachine->PhoneStorage()->NeedToEnableKeylock() )
+        {
+        iViewCommandHandle->ExecuteCommandL( EPhoneViewEnableKeyLock );
+        iStateMachine->PhoneStorage()->SetNeedToEnableKeylock( EFalse );
+        }
     }
 
 // -----------------------------------------------------------
@@ -4124,8 +3119,6 @@
     ESimSecurityStatusUninitialized = KStartupEnumerationFirstValue,
     ESimRejected,   // The PUK code has been entered incorrectly, so the card is rejected.
     ESimUnaccepted  // The SIM lock is on, so the card is unaccepted.
-    ESimInvalid     // The Sim inserted is not same as the one provided by the
-                    // operator, so card is invalid.
     */
     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::SimSecurityStatus()" );
     return CPhonePubSubProxy::Instance()->Value(
@@ -4171,18 +3164,19 @@
 
         TPhoneCmdParamGlobalNote globalNoteParam;
         globalNoteParam.SetText( callText );
-        globalNoteParam.SetType( EAknGlobalInformationNote );
-        globalNoteParam.SetTone( EAvkonSIDInformationTone );
+        globalNoteParam.SetType( EPhoneNotificationDialog );
+
         globalNoteParam.SetTextResourceId(
             CPhoneMainResourceResolver::Instance()->
             ResolveResourceID( EPhoneCallWaitingWithLabel ) );
-
+        globalNoteParam.SetNotificationDialog( ETrue );
+        
         iViewCommandHandle->ExecuteCommandL(
                 EPhoneViewShowGlobalNote, &globalNoteParam );
         }
     else
         {
-        SendGlobalInfoNoteL( EPhoneCallWaitingWithoutLabel );
+        SendGlobalInfoNoteL( EPhoneCallWaitingWithoutLabel, ETrue );
         }
     }
 
@@ -4311,14 +3305,13 @@
             EPhoneInfoCugInUse ), cugIndex );
 
         TPhoneCmdParamGlobalNote globalNoteParam;
-	    globalNoteParam.SetText( *buf );
-	    globalNoteParam.SetType( EAknGlobalInformationNote );
-	    globalNoteParam.SetTone( EAvkonSIDInformationTone );
-
-	    iViewCommandHandle->ExecuteCommandL(
-	            EPhoneViewShowGlobalNote, &globalNoteParam );
-
-	    CleanupStack::PopAndDestroy( buf );
+        globalNoteParam.SetText( *buf );
+        globalNoteParam.SetType( EPhoneMessageBoxInformation );
+   
+        iViewCommandHandle->ExecuteCommandL(
+                EPhoneViewShowGlobalNote, &globalNoteParam );
+
+        CleanupStack::PopAndDestroy( buf );
         }
     }
 
@@ -4339,128 +3332,13 @@
     return iCallHeaderManager;
     }
 
-// -----------------------------------------------------------------------------
-// CPhoneState::CloseCustomizedDialerL
-// -----------------------------------------------------------------------------
-//
-EXPORT_C void CPhoneState::CloseCustomizedDialerL()
-    {
-    __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::CloseCustomizedDialerL( ) ");
-    // Set dialer back to default mode.
-    iViewCommandHandle->HandleCommandL( EPhoneViewHideCustomizedDialer );
-    CloseClearNumberEntryAndLoadEffectL( ENumberEntryClose );
-    }
-
-// -----------------------------------------------------------------------------
-// CPhoneState::CustomizedDialerMenuResourceId
-// -----------------------------------------------------------------------------
-//
-EXPORT_C TInt CPhoneState::CustomizedDialerMenuResourceIdL()
-    {
-    __LOGMETHODSTARTEND(EPhoneControl,
-        "CPhoneState::CustomizedDialerMenuResourceId( ) ");
-    // Get and return customized dialer menu resource id
-    TPhoneCmdParamInteger integerParam;
-    iViewCommandHandle->HandleCommandL(
-        EPhoneViewGetCustomizedDialerMenuResourceId,
-        &integerParam );
-    return integerParam.Integer();
-    }
-
-// -----------------------------------------------------------------------------
-// CPhoneState::CustomizedDialerCbaResourceId
-// -----------------------------------------------------------------------------
-//
-EXPORT_C TInt CPhoneState::CustomizedDialerCbaResourceIdL()
-    {
-    __LOGMETHODSTARTEND(EPhoneControl,
-           "CPhoneState::CustomizedDialerCbaResourceId( ) ");
-    // Get and return customized dialer CBA resource id
-    TPhoneCmdParamInteger integerParam;
-    iViewCommandHandle->HandleCommandL(
-            EPhoneViewGetCustomizedDialerCbaResourceId,
-        &integerParam );
-    return integerParam.Integer();
-    }
-
-// -----------------------------------------------------------
-// CPhoneState::ShowDtmfDialerL
-// -----------------------------------------------------------
-//
-void CPhoneState::ShowDtmfDialerL()
-    {
-    __LOGMETHODSTARTEND(EPhoneControl,
-        "CPhoneState::ShowDtmfDialerL()" );
-
-    // Set dialer to DTMF mode.
-    TPhoneCmdParamBoolean booleanParam;
-    booleanParam.SetBoolean( ETrue );
-    iViewCommandHandle->ExecuteCommandL( EPhoneViewSetDtmfDialerViewVisible,
-                                         &booleanParam );
-    BeginTransEffectLC( ECallUiDisappear );
-    if ( IsNumberEntryUsedL() )
-        {
-        // Store the number entry content to cache
-        if ( !IsNumberEntryContentStored() )
-            {
-            StoreNumberEntryContentL();
-            }
-        // Clear and display DTMF dialer
-        NumberEntryClearL();
-        SetNumberEntryVisibilityL(ETrue);
-        }
-    else
-        {
-        // Create and display DTMF dialer
-        NumberEntryManagerL()->CreateNumberEntryL();
-        }
-    EndTransEffect();
-
-    // Update CBA
-    iCbaManager->UpdateInCallCbaL();
-    
-    if( EPSCTsyCallStateDialling == 
-        CPhonePubSubProxy::Instance()->Value(KPSUidCtsyCallInformation, KCTsyCallState ) )
-        {
-        // Call indicator update to ensure that small call 
-        // bubble is shown in dtmf dialer during dialing
-        // call this needs to be done because when call is 
-        // initialized small call bubble visibility is set to false.
-        UpdateIncallIndicatorL(EPSCTsyCallStateDialling);
-        }
-    }
-
 // -----------------------------------------------------------
 // CPhoneState::CheckIfRestoreNEContentAfterDtmfDialer
 // -----------------------------------------------------------
 //
 EXPORT_C void CPhoneState::CheckIfRestoreNEContentAfterDtmfDialer()
     {
-    if ( IsOnScreenDialerSupported() )
-        {
-        TBool isDialerVisible( EFalse );
-        TRAP_IGNORE( isDialerVisible = IsDTMFEditorVisibleL() );
-
-         if ( isDialerVisible )
-             {
-             TRAP_IGNORE( CloseDTMFEditorL() );
-             }
-
-         // if the DTMF dialer is used before the idle message, we have to
-         // restore the original content of the number entry
-         if ( IsNumberEntryContentStored() )
-             {
-             TBool isNumberEntryUsed( EFalse );
-             TRAP_IGNORE( isNumberEntryUsed = IsNumberEntryUsedL() );
-
-             if ( !isNumberEntryUsed )
-                 {
-                 TRAP_IGNORE( NumberEntryManagerL()->CreateNumberEntryL() );
-                 }
-             // Restore the number entry content from cache
-             TRAP_IGNORE( RestoreNumberEntryContentL() );
-             }
-         }
+
     }
 
 // -----------------------------------------------------------
@@ -4482,7 +3360,7 @@
     __PHONELOG1( EBasic, EPhoneControl, "CPhoneState::LoadResource - aResource: %d", aResource );
     StringLoader::Load(  aData,
                          CPhoneMainResourceResolver::Instance()->ResolveResourceID( aResource ),
-                         EikonEnv() );
+                         &iEnv  );
     }
 
 // -----------------------------------------------------------
@@ -4552,17 +3430,6 @@
     }
 
 // -----------------------------------------------------------
-// CPhoneState::KeyEventForExistingNumberEntryL
-// -----------------------------------------------------------
-//
-void CPhoneState::KeyEventForExistingNumberEntryL( const TKeyEvent& aKeyEvent,
-    TEventCode aEventCode )
-    {
-    __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::KeyEventForExistingNumberEntryL( ) ");
-    NumberEntryManagerL()->KeyEventForExistingNumberEntryL( aKeyEvent, aEventCode );
-    }
-
-// -----------------------------------------------------------
 // CPhoneState::HandleNumberEntryClearedL
 // -----------------------------------------------------------
 //
@@ -4588,17 +3455,6 @@
     NumberEntryManagerL()->SetNumberEntryVisibilityL( booleanParam );
     }
 
-// ---------------------------------------------------------
-// CPhoneState::HandleCreateNumberEntryL
-// ---------------------------------------------------------
-//
-EXPORT_C void CPhoneState::HandleCreateNumberEntryL(
-        const TKeyEvent& /*aKeyEvent*/,
-        TEventCode /*aEventCode*/ )
-    {
-    NumberEntryManagerL()->HandleCreateNumberEntryL();
-    }
-
 // -----------------------------------------------------------
 // CPhoneState::IsNumberEntryContentStored
 // -----------------------------------------------------------
@@ -4620,15 +3476,6 @@
     }
 
 // -----------------------------------------------------------
-// CPhoneState::RestoreNumberEntryContentL
-// -----------------------------------------------------------
-//
-EXPORT_C void CPhoneState::RestoreNumberEntryContentL()
-    {
-    NumberEntryManagerL()->RestoreNumberEntryContentL();
-    }
-
-// -----------------------------------------------------------
 // CPhoneState::ClearNumberEntryContentCache
 // -----------------------------------------------------------
 //
@@ -4637,16 +3484,6 @@
     TRAP_IGNORE( NumberEntryManagerL()->ClearNumberEntryContentCache() );
     }
 
-// -----------------------------------------------------------
-// CPhoneState::HandleNumberEntryEdited
-// -----------------------------------------------------------
-//
-EXPORT_C void CPhoneState::HandleNumberEntryEdited()
-    {
-    __LOGMETHODSTARTEND( EPhoneControl, "CPhoneState::HandleNumberEntryEdited() ");
-    TRAP_IGNORE( NumberEntryManagerL()->HandleNumberEntryEdited() );
-    }
-
 // -----------------------------------------------------------------------------
 // CPhoneState::IsAlphanumericSupportedAndCharInput
 // -----------------------------------------------------------------------------
@@ -4679,45 +3516,205 @@
     {
     NumberEntryManagerL()->NumberEntryClearL();
     }
-	
+
+// -----------------------------------------------------------
+// CPhoneState::GetBlockedKeyList
+// -----------------------------------------------------------
+//
+EXPORT_C const RArray<TInt>& CPhoneState::GetBlockedKeyList() const
+    {
+    __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::GetBlockedKeyList( ) ");
+    return iStateMachine->PhoneStorage()->GetBlockedKeyList();
+    }
+
+// -----------------------------------------------------------
+// CPhoneState::DisableHWKeysL
 // -----------------------------------------------------------
-// CPhoneState::UpdateSilenceButtonDimming
+//
+EXPORT_C void CPhoneState::DisableHWKeysL()
+    {
+    __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::DisableHWKeysL( ) ");
+
+    if( iStateMachine->PhoneStorage()->IsBlockedKeysListEmpty() )
+        {
+        __PHONELOG( EBasic, EPhoneControl, " CPhoneState::DisableHWKeysL HW Keys Disabled " );
+
+        iStateMachine->PhoneStorage()->AppendBlockedKeysListL( EStdKeyNo );
+        iStateMachine->PhoneStorage()->AppendBlockedKeysListL( EStdKeyYes );
+        }
+    }
+
+// -----------------------------------------------------------
+// CPhoneState::DisableCallUIL
 // -----------------------------------------------------------
 //
-EXPORT_C void CPhoneState::UpdateSilenceButtonDimming()
+EXPORT_C void CPhoneState::DisableCallUIL()
     {
-    if ( FeatureManager::FeatureSupported( KFeatureIdTouchCallHandling ) )
+    __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::DisableCallUIL( ) ");
+
+    // Set Call UI state to storage
+    if( !iStateMachine->PhoneStorage()->IsScreenLocked() )
         {
-        const TProfileRingingType ringingType =
-            iStateMachine->PhoneEngineInfo()->RingingType();
+        __PHONELOG( EBasic, EPhoneControl, " CPhoneState::DisableCallUIL CallUI Disabled " );
+
+        // Show keys locked note
+        TPhoneCmdParamNote noteParam;
+        noteParam.SetType( EPhoneNoteUIDisabled );
+        noteParam.SetResourceId( CPhoneMainResourceResolver::Instance()->
+            ResolveResourceID( EPhoneInformationNote ) );
+    
+        HBufC* noteText = StringLoader::LoadLC( 
+            CPhoneMainResourceResolver::Instance()->
+                ResolveResourceID( EPhoneIncomingCallKeysLocked ) );
+        noteParam.SetText( *noteText );
+    
+        iViewCommandHandle->ExecuteCommandL( EPhoneViewShowNote, &noteParam );
+        CleanupStack::PopAndDestroy( noteText );
+    
+        // Start capturing the key guard key
+        TPhoneCmdParamKeyCapture appKeyCaptureParam;
+        appKeyCaptureParam.SetKey( EStdKeyDevice7 );
+        appKeyCaptureParam.SetKeyCode( EKeyDeviceF );
+        appKeyCaptureParam.SetCaptureType( EPhoneKeyAllEvents );
+        iViewCommandHandle->ExecuteCommandL( EPhoneViewStartCapturingKey, &appKeyCaptureParam );
         
-        TBool callIsAlerting =
-                !(( ringingType == EProfileRingingTypeSilent ) ||
-                  ( ringingType == EProfileRingingTypeBeepOnce ));
-
-        if ( !callIsAlerting )
+        // Set Call UI state to storage
+        iStateMachine->PhoneStorage()->SetScreenLocked( ETrue );
+        }
+    }
+
+// -----------------------------------------------------------
+// CPhoneState::EnableCallUIL
+// -----------------------------------------------------------
+//
+EXPORT_C void CPhoneState::EnableCallUIL()
+    {
+    __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::EnableCallUIL( ) ");
+
+    if( iStateMachine->PhoneStorage()->IsScreenLocked() )
+        {
+        __PHONELOG( EBasic, EPhoneControl, " CPhoneState::EnableCallUIL CallUI Enabled " );
+
+        iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNote );
+        iViewCommandHandle->ExecuteCommandL( EPhoneViewDisableKeyLockWithoutNote );
+
+        // Stop capturing the key guard key
+        TPhoneCmdParamKeyCapture appKeyCaptureParam;
+        appKeyCaptureParam.SetKey( EStdKeyDevice7 );
+        appKeyCaptureParam.SetKeyCode( EKeyDeviceF );
+        appKeyCaptureParam.SetCaptureType( EPhoneKeyAllEvents );
+        iViewCommandHandle->ExecuteCommandL( EPhoneViewStopCapturingKey, &appKeyCaptureParam );
+        
+        iStateMachine->PhoneStorage()->SetScreenLocked( EFalse );
+        }
+    }
+
+// -----------------------------------------------------------
+// CPhoneState::CheckDisableHWKeysAndCallUIL
+// -----------------------------------------------------------
+//
+EXPORT_C void CPhoneState::CheckDisableHWKeysAndCallUIL()
+    {
+    __LOGMETHODSTARTEND( EPhoneUIStates, "CPhoneState::CheckDisableHWKeysAndCallUIL( ) ");
+
+    if( IsKeyLockOn() || IsAutoLockOn() )
+        {
+        // Disable HW keys if needed
+        if( CPhoneCenRepProxy::Instance()->
+                IsTelephonyFeatureSupported( KTelephonyLVFlagDisableCallControlHardKeysWhileLocked ) )
             {
-            SetTouchPaneButtonDisabled( EPhoneCallComingCmdSilent );
+            DisableHWKeysL();
+            }
+
+        // Disable Call UI if needed
+        if( FeatureManager::FeatureSupported( KFeatureIdFfTouchUnlockStroke )
+                && !CPhoneCenRepProxy::Instance()->
+                IsTelephonyFeatureSupported( KTelephonyLVFlagAllowUnlockOnIncoming ) )
+            {
+            DisableCallUIL();
+            iStateMachine->PhoneStorage()->SetNeedToEnableKeylock( ETrue );
             }
         }
     }
-	
+
+// -----------------------------------------------------------
+// CPhoneState::HandleHoldSwitchL
+// -----------------------------------------------------------
+//
+EXPORT_C void CPhoneState::HandleHoldSwitchL()
+    {
+    __LOGMETHODSTARTEND( EPhoneUIStates, "CPhoneState::HandleHoldSwitchL( ) ");
+
+    if( CPhoneCenRepProxy::Instance()->
+            IsTelephonyFeatureSupported( KTelephonyLVFlagDisableCallControlHardKeysWhileLocked ) )
+        {
+        if( iStateMachine->PhoneStorage()->IsBlockedKeysListEmpty() )
+            {
+            // Disable HW Keys if needed
+            DisableHWKeysL();
+            }
+        else
+            {
+            // Reset blocked keys list
+            iStateMachine->PhoneStorage()->ResetBlockedKeysList();
+            }
+        }
+    
+    if( FeatureManager::FeatureSupported( KFeatureIdFfTouchUnlockStroke ) 
+            && !CPhoneCenRepProxy::Instance()->
+            IsTelephonyFeatureSupported( KTelephonyLVFlagAllowUnlockOnIncoming ) )
+        {
+        if( iStateMachine->PhoneStorage()->IsScreenLocked() )
+            {
+            // Enable Call
+            EnableCallUIL();
+            }
+        else
+            {
+            // Set keylock enabled
+            iViewCommandHandle->ExecuteCommandL( EPhoneViewEnableKeyLockWithoutNote );
+            // Disable Call
+            DisableCallUIL();
+            }
+        }
+        
+        // Stop ringingtone
+        iViewCommandHandle->ExecuteCommandL( EPhoneViewStopRingTone );
+    }
+
+// -----------------------------------------------------------
+// CPhoneState::RetainPreviousKeylockStateL
+// -----------------------------------------------------------
+//
+EXPORT_C void CPhoneState::RetainPreviousKeylockStateL()
+    {
+    // Lock keypad, if keylock was enabled before incoming call.
+    // Also reset PhoneStorage keylock status.
+    if ( FeatureManager::FeatureSupported( KFeatureIdFfTouchUnlockStroke ) &&
+        iStateMachine->PhoneStorage()->NeedToEnableKeylock() )
+        {
+        iStateMachine->PhoneStorage()->SetNeedToEnableKeylock( EFalse );
+        iViewCommandHandle->ExecuteCommandL( EPhoneViewEnableKeyLockWithoutNote ); 
+        }
+    }
+
 // ---------------------------------------------------------
-// CPhoneState::SetToolbarDimming
+// CPhoneState::HandleKeyLockEnabledL
 // ---------------------------------------------------------
 //
-EXPORT_C void CPhoneState::SetToolbarDimming( TBool aDimmed )
+EXPORT_C void CPhoneState::HandleKeyLockEnabled( TBool aKeylockEnabled )
     {
-	if ( FeatureManager::FeatureSupported( KFeatureIdTouchCallHandling ) )
+    __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::HandleKeyLockEnabledL( ) ");
+    if( !FeatureManager::FeatureSupported( KFeatureIdFfTouchUnlockStroke )
+        && CPhoneCenRepProxy::Instance()->
+            IsTelephonyFeatureSupported( KTelephonyLVFlagDisableCallControlHardKeysWhileLocked ) )
         {
-		// Check that we are not undimming toolbar in security mode
-		if ( !( !aDimmed && iStateMachine->SecurityMode()->IsSecurityMode() ) )
-			{
-			TPhoneCmdParamBoolean booleanParam;
-			booleanParam.SetBoolean( aDimmed );
-			TRAP_IGNORE( iViewCommandHandle->ExecuteCommandL(
-				EPhoneViewSetToolbarDimming, &booleanParam ));
-			}
+        if( !aKeylockEnabled )
+            {
+            // Keylock disabled
+            // Reset blocked keys list
+            iStateMachine->PhoneStorage()->ResetBlockedKeysList();
+            }
         }
     }
 
@@ -4731,207 +3728,75 @@
         {
         TPhoneCmdParamInteger integerParam;
         integerParam.SetInteger( EPhoneInCallCmdActivateIhf );
-        iViewCommandHandle->ExecuteCommand(
-            EPhoneViewEnableToolbarButton, &integerParam );
-        }
-    }
-
-// ---------------------------------------------------------
-// CPhoneState::SetToolbarButtonHandsetEnabled
-// ---------------------------------------------------------
-//
-EXPORT_C void CPhoneState::SetToolbarButtonHandsetEnabled()
-    {
-    if ( FeatureManager::FeatureSupported( KFeatureIdTouchCallHandling ) )
-        {
-        TPhoneCmdParamInteger integerParam;
-        integerParam.SetInteger( EPhoneInCallCmdHandset );
-        iViewCommandHandle->ExecuteCommand(
-            EPhoneViewEnableToolbarButton, &integerParam );
-        }
-    }
-
-// ---------------------------------------------------------
-// CPhoneState::SetToolbarButtonBTHFEnabled
-// ---------------------------------------------------------
-//
-EXPORT_C void CPhoneState::SetToolbarButtonBTHFEnabled()
-    {
-    if ( FeatureManager::FeatureSupported( KFeatureIdTouchCallHandling ) )
-        {
-        TPhoneCmdParamInteger integerParam;
-        integerParam.SetInteger( EPhoneInCallCmdBtHandsfree );
-        iViewCommandHandle->ExecuteCommand(
-            EPhoneViewEnableToolbarButton, &integerParam );
+        TRAP_IGNORE( iViewCommandHandle->ExecuteCommandL(
+            EPhoneViewEnableToolbarButton, &integerParam ));
         }
     }
 
 // ---------------------------------------------------------
-// CPhoneState::HandleEasyDialingCommandsL
+// CPhoneState::SetBackButtonActive
 // ---------------------------------------------------------
 //
-void CPhoneState::HandleEasyDialingCommandsL( TInt aCommandId )
+EXPORT_C void CPhoneState::SetBackButtonActive( TBool aActive )
     {
-    switch ( aCommandId )
+    if(IsAutoLockOn() && aActive) {
+        // keep back button dimmed device lock case
+        return;
+    }
+    
+    if ( FeatureManager::FeatureSupported( KFeatureIdTouchCallHandling ) )
         {
-        case EPhoneCmdUpdateCba:
-            iCbaManager->UpdateInCallCbaL();
-            break;
-                
-        case EPhoneDialerValidNumber:
-            {
-            TPhoneCmdParamBoolean command;
-            command.SetBoolean( EFalse );
-            iViewCommandHandle->ExecuteCommandL( EPhoneViewSetInvalidCsPhoneNumberFlag, &command );           
-            }
-            break;
-                
-        case EPhoneDialerInvalidNumber:
-            {
-            TPhoneCmdParamBoolean command;
-            command.SetBoolean( ETrue );
-            iViewCommandHandle->ExecuteCommandL( EPhoneViewSetInvalidCsPhoneNumberFlag, &command );
-            }
-            break;
-            
-        case EPhoneCmdBlockingDialogLaunched:
-            {
-            TPhoneCmdParamBoolean param;
-            param.SetBoolean( ETrue );
-            iViewCommandHandle->ExecuteCommandL( EPhoneViewSetBlockingDialogStatus, &param );
-            }
-            break;
-            
-        case EPhoneCmdBlockingDialogClosed:
-            {
-            TPhoneCmdParamBoolean param;
-            param.SetBoolean( EFalse );
-            iViewCommandHandle->ExecuteCommandL( EPhoneViewSetBlockingDialogStatus, &param );
-            }
-            break;
-            
-        default:
-            break;
+        TPhoneCmdParamBoolean booleanParam;
+        booleanParam.SetBoolean( aActive );
+        iViewCommandHandle->ExecuteCommand(
+            EPhoneViewBackButtonActive, &booleanParam );
         }
     }
 
 // -----------------------------------------------------------
-// CPhoneState::ForwardPEMessageToPhoneCustomizationL
-// Forward Phone Engine messages to Phone customization
-// (other items were commented in a header).
-// -----------------------------------------------------------
-//
-EXPORT_C TBool CPhoneState::ForwardPEMessageToPhoneCustomizationL(
-    const TInt aMessage,
-    TInt aCallId )
-    {
-    __LOGMETHODSTARTEND( EPhoneControl, "CPhoneState::ForwardPEMessageToPhoneCustomizationL() " );
-    TBool handled = EFalse;
-    
-    if ( iCustomization )
-       {
-       handled = iCustomization->HandlePhoneEngineMessageL( aMessage, aCallId );
-       }
-    return handled;
-    }
-
-// -----------------------------------------------------------
-// CPhoneState::SetLittleBubbleVisibilityL
-// -----------------------------------------------------------
-//
-void CPhoneState::SetLittleBubbleVisibilityL(
-        TPhoneCommandParam* aCommandParam)
-    {
-    __LOGMETHODSTARTEND( EPhoneControl, "CPhoneState::SetLittleBubbleVisibilityL() " );
-    // If user has opened dtmfeditor(dtmfdialer) then do not make any changes 
-    // to SetLittleBubbleVisible value. SetLittleBubbleVisible value is true by default.
-    if( !IsDTMFEditorVisibleL() )
-        {
-        TPhoneCmdParamIncallIndicatorData* incallIndicatorParam =
-                   static_cast<TPhoneCmdParamIncallIndicatorData*>( aCommandParam );
-        TInt activeCallId = GetActiveCallIdL();
-        switch( incallIndicatorParam->CallState() )
-           {
-           case EPSCTsyCallStateRinging:
-           case EPSCTsyCallStateDialling:
-               {
-               // If we have single ringing or dialling call then it is ok
-               // to set visibility to false.
-               if ( activeCallId < KErrNone )
-                   {
-                   incallIndicatorParam->SetLittleBubbleVisible( EFalse );
-                   }
-               }
-               break;
-           default:
-               incallIndicatorParam->SetLittleBubbleVisible( ETrue );
-               break;
-           }
-        } 
-    }
-
-// -----------------------------------------------------------
-// CPhoneState::DisplayCallSetupL
+// CPhoneState::OpenSoftRejectMessageEditorL
 // -----------------------------------------------------------
 //
-EXPORT_C void CPhoneState::DisplayCallSetupL( TInt aCallId )
-    {
-    __LOGMETHODSTARTEND( EPhoneControl, "CPhoneState::DisplayCallSetupL() ");
-    BeginTransEffectLC( ECallUiAppear );
-    BeginUiUpdateLC();
-    SetNumberEntryVisibilityL( EFalse );
-    CaptureKeysDuringCallNotificationL( ETrue );
-    iViewCommandHandle->ExecuteCommandL( EPhoneViewMenuBarClose );
-    iViewCommandHandle->ExecuteCommandL( EPhoneViewRemovePhoneDialogs );
-    TPhoneCmdParamInteger uidParam;
-    uidParam.SetInteger( KUidPhoneApplication.iUid );
-    iViewCommandHandle->ExecuteCommandL( EPhoneViewBringAppToForeground,
-        &uidParam );
-    // Do state-specific operations.
-    DoStateSpecificCallSetUpDefinitionsL();
-    DisplayHeaderForOutgoingCallL(aCallId);
-    EndUiUpdate();
-    EndTransEffect();
-    iCbaManager->UpdateCbaL(EPhoneCallHandlingCallSetupCBA);
-    }
-
-// -----------------------------------------------------------
-// Sends command to viewcontroller to store the flag
-// -----------------------------------------------------------
-//
-EXPORT_C void CPhoneState::SetNeedToReturnToForegroundAppStatusL( 
-    TBool aNeedToReturn )
+EXPORT_C void CPhoneState::OpenSoftRejectMessageEditorL()
     {
-    TPhoneCmdParamBoolean booleanParam;
-    booleanParam.SetBoolean( aNeedToReturn );
-    iViewCommandHandle->ExecuteCommandL( 
-        EPhoneViewSetNeedToReturnToForegroundAppStatus,
-        &booleanParam );
-    }
-
-// -----------------------------------------------------------
-// CPhoneState::DoStateSpecificCallSetUpDefinitionsL
-// -----------------------------------------------------------
-//
-EXPORT_C void CPhoneState::DoStateSpecificCallSetUpDefinitionsL()
-    {
-    // do nothing
-    }
-
-// -----------------------------------------------------------
-// CPhoneState::CloseClearNumberEntryAndLoadEffect
-// -----------------------------------------------------------
-//
-EXPORT_C void CPhoneState::CloseClearNumberEntryAndLoadEffectL( 
-        TStateTransEffectType aType )
-    {
-    __LOGMETHODSTARTEND( EPhoneControl, 
-            "CPhoneState::CloseClearNumberEntryAndLoadEffectL() ");
-    BeginTransEffectLC( aType );
-    iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNumberEntry );
-    EndTransEffect();
-    // Do state-specific operation when number entry is cleared
-    HandleNumberEntryClearedL();
+    __LOGMETHODSTARTEND(EPhoneControl,
+        "CPhoneState::OpenSoftRejectMessageEditorL ()" );
+
+    // Fetch incoming call's id from view
+    TPhoneCmdParamCallStateData callStateData;
+    callStateData.SetCallState( EPEStateRinging );
+    iViewCommandHandle->HandleCommandL(
+        EPhoneViewGetCallIdByState, &callStateData );
+
+    TInt ringingCallId( KErrNotFound );
+    // Do nothing if negative incoming call id
+    if( callStateData.CallId() > KErrNotFound  )
+        {
+        iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveQuery );
+        
+        ringingCallId = callStateData.CallId();
+        }
+    
+    
+    TPhoneCmdParamSfiData sfiDataParam;
+
+    if (KErrNotFound != ringingCallId) 
+        {
+        if ( iStateMachine->PhoneEngineInfo()->RemoteName( ringingCallId ).Length() )
+            {
+            // store both the name and the number
+            sfiDataParam.SetNumber( iStateMachine->PhoneEngineInfo()->RemotePhoneNumber( ringingCallId ) );
+            sfiDataParam.SetName( iStateMachine->PhoneEngineInfo()->RemoteName( ringingCallId ) );
+            }
+        else
+            {
+            // store the number
+            sfiDataParam.SetNumber( iStateMachine->PhoneEngineInfo()->RemotePhoneNumber( ringingCallId ) );
+            }
+        }
+
+    iViewCommandHandle->ExecuteCommandL(
+        EPhoneViewOpenSoftRejectEditor, &sfiDataParam );
     }
 
 //  End of File