phoneapp/phoneuiview/src/cphoneviewcontroller.cpp
branchRCL_3
changeset 44 3c221667e687
parent 39 b8d67d6176f5
child 57 94dc1107e8b2
--- a/phoneapp/phoneuiview/src/cphoneviewcontroller.cpp	Wed Jun 09 09:41:11 2010 +0300
+++ b/phoneapp/phoneuiview/src/cphoneviewcontroller.cpp	Mon Jun 21 15:39:45 2010 +0300
@@ -34,6 +34,7 @@
 #include "tphonecommandparam.h"
 #include "cphonebubblewrapper.h"
 #include "tphonecmdparamcallstatedata.h"
+#include "tphonecmdparamKeycapture.h"
 #include "tphonecmdparaminteger.h"
 #include "tphonecmdparamboolean.h"
 #include "tphonecmdparamstring.h"
@@ -2187,11 +2188,16 @@
     iToolbarController->DimToolbar( aIsEnabled );			
 	iPhoneView->SetSecurityMode( aIsEnabled );
 	iMenuController->SetSecurityMode( aIsEnabled );
+	
+	TBool securityModeChanged = ( iSecurityMode != aIsEnabled );
+	
+	iSecurityMode = aIsEnabled;
+	
 	if ( iDialer )
 		{
         iDialerController->SetRestrictedDialer( aIsEnabled );
 	
-        if ( iDialerActive && iSecurityMode != aIsEnabled )
+        if ( iDialerActive && securityModeChanged )
             {
             CDialingExtensionInterface* easyDialing = iDialer->GetEasyDialingInterface();
             if ( easyDialing )
@@ -2231,14 +2237,26 @@
                         ResolveResourceID( EPhoneNumberAcqCBA ) );
                 }
             TRAP_IGNORE( ExecuteCommandL( EPhoneViewUpdateCba, &integerParam ) );
+            
+            if ( !aIsEnabled )
+                {
+                TRAP_IGNORE( SwitchLayoutToFlatStatusPaneL( ETrue ) );
+                }
             }
 		}
-    if ( iSecurityMode != aIsEnabled )
+    if ( securityModeChanged )
         {
         // Update status pane dimming
         iStatusPane->StatusPane().SetDimmed( aIsEnabled );
+
+        // Uncapture the App key for sure
+        TPhoneCmdParamKeyCapture appKeyCaptureParam;
+        appKeyCaptureParam.SetKey( EStdKeyApplication0 );
+        appKeyCaptureParam.SetKeyCode( EKeyApplication0 );
+        appKeyCaptureParam.SetCaptureType( EPhoneKeyAllEvents );
+
+        iKeyCaptureController->StopCapturingKey( &appKeyCaptureParam );
         }
-	iSecurityMode = aIsEnabled;
 	}
 
 // ---------------------------------------------------------------------------
@@ -3690,7 +3708,7 @@
 
     if ( aSwitch )
         {
-        SwapEmptyIndicatorPaneInSecureStateL( ETrue );
+        SwapEmptyIndicatorPaneL( ETrue );
         if ( !Layout_Meta_Data::IsLandscapeOrientation() )
             {
             iStatusPane->StatusPane().SwitchLayoutL
@@ -3704,7 +3722,7 @@
         }
     else
         {
-        SwapEmptyIndicatorPaneInSecureStateL( EFalse );
+        SwapEmptyIndicatorPaneL( EFalse );
         if ( !Layout_Meta_Data::IsLandscapeOrientation() )
             {
             iStatusPane->StatusPane().SwitchLayoutL
@@ -3723,14 +3741,14 @@
     }
 
 // ---------------------------------------------------------------------------
-// CPhoneViewController::SwapEmptyIndicatorPaneInSecureStateL
+// CPhoneViewController::SwapEmptyIndicatorPaneL
 // ---------------------------------------------------------------------------
 //
-void CPhoneViewController::SwapEmptyIndicatorPaneInSecureStateL(
+void CPhoneViewController::SwapEmptyIndicatorPaneL(
                                     const TBool aSwapEmpty )
     {
     __LOGMETHODSTARTEND(EPhoneUIView,
-        "CPhoneViewController::SwapEmptyIndicatorPaneInSecureStateL()" );
+        "CPhoneViewController::SwapEmptyIndicatorPaneL()" );
     if ( iSecurityMode )
         {
         if ( aSwapEmpty )
@@ -3752,6 +3770,17 @@
             TUid::Uid( EEikStatusPaneUidIndic ), iPreviousIndicatorControl );
             }
         }
+    else if ( iPreviousIndicatorControl 
+              && iIndiContainer
+              && ( iIndiContainer ==
+                      iStatusPane->StatusPane().ControlL(
+                              TUid::Uid( EEikStatusPaneUidIndic ) ) ) )
+        {
+        //Restore previous indicator control if security mode is not on anymore 
+        // and empty indicator pane is still in status pane.
+        iStatusPane->StatusPane().SwapControlL(
+        TUid::Uid( EEikStatusPaneUidIndic ), iPreviousIndicatorControl );
+        }
     }