phoneapp/phoneuicontrol/src/cphonestateidle.cpp
branchRCL_3
changeset 17 38529f706030
parent 15 2a26698d78ba
child 25 91c2fb4b78df
equal deleted inserted replaced
15:2a26698d78ba 17:38529f706030
    57 #include "phonelogger.h"
    57 #include "phonelogger.h"
    58 #include "phoneui.pan"
    58 #include "phoneui.pan"
    59 #include "phoneconstants.h"
    59 #include "phoneconstants.h"
    60 #include "mphonecustomization.h"
    60 #include "mphonecustomization.h"
    61 #include <easydialingcommands.hrh>
    61 #include <easydialingcommands.hrh>
       
    62 #include "mphonesecuritymodeobserver.h"
    62 
    63 
    63 //CONSTANTS
    64 //CONSTANTS
    64 const TInt  KMaxParamLength = 1024;
    65 const TInt  KMaxParamLength = 1024;
    65 
    66 
    66 // ================= MEMBER FUNCTIONS =======================
    67 // ================= MEMBER FUNCTIONS =======================
   125 EXPORT_C void CPhoneStateIdle::HandleKeyEventL( 
   126 EXPORT_C void CPhoneStateIdle::HandleKeyEventL( 
   126     const TKeyEvent& aKeyEvent, 
   127     const TKeyEvent& aKeyEvent, 
   127     TEventCode aEventCode )
   128     TEventCode aEventCode )
   128     {
   129     {
   129     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateIdle::HandleKeyEventL( ) ");
   130     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateIdle::HandleKeyEventL( ) ");
   130     // Security mode check
   131     
   131     TPhoneCmdParamBoolean isSecurityMode;      
       
   132     iViewCommandHandle->ExecuteCommandL( EPhoneViewGetSecurityModeStatus, &isSecurityMode );  
       
   133     
       
   134  
       
   135     // Number entry is blocked, if active Query
   132     // Number entry is blocked, if active Query
   136     if ( !IsAnyQueryActiveL() )
   133     if ( !IsAnyQueryActiveL() )
   137         {
   134         {
   138         // Handle numeric keys when key events are received in idle state
   135         // Handle numeric keys when key events are received in idle state
   139         HandleNumericKeyEventL( aKeyEvent, aEventCode );  
   136         HandleNumericKeyEventL( aKeyEvent, aEventCode );  
   140         }
   137         }
   141     else if ( isSecurityMode.Boolean() && CPhoneKeys::IsNumericKey( 
   138     else if ( iStateMachine->SecurityMode()->IsSecurityMode()
   142         aKeyEvent, aEventCode ) )
   139     	&& CPhoneKeys::IsNumericKey( aKeyEvent, aEventCode ) )
   143         {
   140         {
   144         iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNote );
   141         iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNote );
   145         // Handle numeric keys when key events are received in single state
   142         // Handle numeric keys when key events are received in single state
   146         HandleNumericKeyEventL( aKeyEvent, aEventCode );  
   143         HandleNumericKeyEventL( aKeyEvent, aEventCode );  
   147         }
   144         }
   211             
   208             
   212             if ( iOnScreenDialer )
   209             if ( iOnScreenDialer )
   213                 {
   210                 {
   214                 if ( IsNumberEntryUsedL() )
   211                 if ( IsNumberEntryUsedL() )
   215                     {
   212                     {
   216                     // Security mode check
   213                    
   217                     TPhoneCmdParamBoolean isSecurityMode;      
       
   218                     iViewCommandHandle->ExecuteCommandL( EPhoneViewGetSecurityModeStatus, &isSecurityMode );
       
   219 
       
   220                     TPhoneCmdParamInteger numberEntryCountParam;
   214                     TPhoneCmdParamInteger numberEntryCountParam;
   221                     iViewCommandHandle->ExecuteCommandL( EPhoneViewGetNumberEntryCount,
   215                     iViewCommandHandle->ExecuteCommandL( EPhoneViewGetNumberEntryCount,
   222                     &numberEntryCountParam );
   216                     &numberEntryCountParam );
   223                     TInt neLength( numberEntryCountParam.Integer() );
   217                     TInt neLength( numberEntryCountParam.Integer() );
   224                     
   218                     
   231                         {
   225                         {
   232                         iViewCommandHandle->ExecuteCommandL( EPhoneViewMenuBarClose );
   226                         iViewCommandHandle->ExecuteCommandL( EPhoneViewMenuBarClose );
   233                         return;
   227                         return;
   234                         }
   228                         }
   235                     
   229                     
   236                     else if ( neLength == 0 && !isSecurityMode.Boolean())
   230                     else if ( neLength == 0 && !iStateMachine->SecurityMode()->IsSecurityMode() )
   237                         {
   231                         {
   238                         // start logs
   232                         // start logs
   239                         iViewCommandHandle->HandleCommandL( 
   233                         iViewCommandHandle->HandleCommandL( 
   240                         EPhoneDialerCmdLog );
   234                         EPhoneDialerCmdLog );
   241                         return;
   235                         return;
   243                     HandleSendCommandL();
   237                     HandleSendCommandL();
   244                     }
   238                     }
   245                 // If dialer is not open but phone is in foreground and phone receives
   239                 // If dialer is not open but phone is in foreground and phone receives
   246                 // send-key event we have to check if security mode is true and if it
   240                 // send-key event we have to check if security mode is true and if it
   247                 // is then open emergency dialer.
   241                 // is then open emergency dialer.
   248                 else if ( !IsNumberEntryUsedL() )
   242                 else if ( !IsNumberEntryUsedL() ) 
   249                     {
   243                     {
   250                     // Security mode check
   244                    if ( iStateMachine->SecurityMode()->IsSecurityMode() )
   251                     TPhoneCmdParamBoolean isSecurityMode;      
   245 						{
   252                     iViewCommandHandle->ExecuteCommandL( EPhoneViewGetSecurityModeStatus, &isSecurityMode );
   246 						iViewCommandHandle->HandleCommandL( EPhoneViewOpenNumberEntry );
   253 
   247 						}
   254                     if ( isSecurityMode.Boolean())
       
   255                         {
       
   256                         // launch dialer.
       
   257                         HandleCommandL(EPhoneNumberAcqSecurityDialer);
       
   258                         }
       
   259                     }           
   248                     }           
   260                 }
   249                 }
   261             else // iOnScreenDialer false, non-touch.
   250             else // iOnScreenDialer false, non-touch.
   262                 {
   251                 {
   263                 HandleSendCommandL();
   252                 HandleSendCommandL();
   264                 }
   253                 }
   265             break;
   254             break;
   266             
   255             
   267         case EKeyApplication0:
   256         case EKeyApplication0:
   268             {
   257             {
   269             // Security mode
       
   270             TPhoneCmdParamBoolean isSecurityMode;      
       
   271             iViewCommandHandle->ExecuteCommandL( EPhoneViewGetSecurityModeStatus, &isSecurityMode );
       
   272             	
       
   273             // If dialer is not open but phone is in foreground and phone receives
   258             // If dialer is not open but phone is in foreground and phone receives
   274             // applicaion-key event we have to open emergency dialer. 
   259             // applicaion-key event we have to open emergency dialer. 
   275             // Securitymode check because Applicationkey only open dialer in securitymode.
   260             // Securitymode check because Applicationkey only open dialer in securitymode.
   276             if ( isSecurityMode.Boolean() && !IsNumberEntryUsedL() )
   261             if ( iStateMachine->SecurityMode()->IsSecurityMode() && !IsNumberEntryUsedL() )
   277                 {
   262                 {
   278                 HandleCommandL(EPhoneNumberAcqSecurityDialer);
   263                 iViewCommandHandle->HandleCommandL( EPhoneViewOpenNumberEntry );
   279                 }           
   264                 }           
   280             }
   265             }
   281             break;
   266             break;
   282             
   267             
   283         // "O" key
   268         // "O" key
   599                ResolveResourceID( EPhoneNumberAcqOkMenubar ) );
   584                ResolveResourceID( EPhoneNumberAcqOkMenubar ) );
   600            iViewCommandHandle->ExecuteCommandL( 
   585            iViewCommandHandle->ExecuteCommandL( 
   601                EPhoneViewMenuBarOpen, &integerParam );
   586                EPhoneViewMenuBarOpen, &integerParam );
   602            commandStatus = ETrue;
   587            commandStatus = ETrue;
   603            }
   588            }
   604            break;  
   589            break;       
   605                      
       
   606        case EPhoneViewOpenNumberEntry:	
       
   607            BeginTransEffectLC( ENumberEntryOpen );
       
   608            commandStatus = CPhoneState::ProcessCommandL( aCommand );
       
   609            EndTransEffect();
       
   610            break;
       
   611            
   590            
   612        default:
   591        default:
   613            commandStatus = CPhoneState::ProcessCommandL( aCommand );
   592            commandStatus = CPhoneState::ProcessCommandL( aCommand );
   614            break;
   593            break;
   615        }
   594        }
   846 
   825 
   847 EXPORT_C void CPhoneStateIdle::HandlePhoneForegroundEventL()
   826 EXPORT_C void CPhoneStateIdle::HandlePhoneForegroundEventL()
   848     {
   827     {
   849     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateIdle::HandlePhoneForegroundEventL( ) ");
   828     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateIdle::HandlePhoneForegroundEventL( ) ");
   850     
   829     
   851     TPhoneCmdParamBoolean isSecurityMode;      
       
   852     iViewCommandHandle->ExecuteCommandL( EPhoneViewGetSecurityModeStatus, &isSecurityMode );
       
   853 
       
   854     TBool activatePhone = CPhonePubSubProxy::Instance()->Value(
   830     TBool activatePhone = CPhonePubSubProxy::Instance()->Value(
   855                     KPSUidAiInformation, KActiveIdleState ) == EPSAiNumberEntry;
   831                     KPSUidAiInformation, KActiveIdleState ) == EPSAiNumberEntry;
   856     
   832     
   857     if ( activatePhone )
   833     if ( activatePhone )
   858         {
   834         {
   876             }
   852             }
   877         
   853         
   878         // If dialer is open add icon to FSW list.
   854         // If dialer is open add icon to FSW list.
   879         iViewCommandHandle->ExecuteCommandL( EPhoneViewUpdateFSW );
   855         iViewCommandHandle->ExecuteCommandL( EPhoneViewUpdateFSW );
   880         }
   856         }
   881     else if ( !IsNumberEntryUsedL() && !isSecurityMode.Boolean() )
   857     else if ( !IsNumberEntryUsedL() && !iStateMachine->SecurityMode()->IsSecurityMode() )
   882         {
   858         {
   883         // Bring Idle app to the foreground
   859         // Bring Idle app to the foreground
   884         iViewCommandHandle->ExecuteCommandL( EPhoneViewBringIdleToForeground );
   860         iViewCommandHandle->ExecuteCommandL( EPhoneViewBringIdleToForeground );
   885 		}
   861 		}
   886     }
   862     }