phoneapp/phoneuicontrol/src/cphonestateidle.cpp
changeset 21 92ab7f8d0eab
parent 4 c84cf270c54f
child 22 6bb1b21d2484
equal deleted inserted replaced
4:c84cf270c54f 21:92ab7f8d0eab
    54 #include "cphonemainresourceresolver.h"
    54 #include "cphonemainresourceresolver.h"
    55 #include "cphonecenrepproxy.h"
    55 #include "cphonecenrepproxy.h"
    56 #include "cphonepubsubproxy.h"
    56 #include "cphonepubsubproxy.h"
    57 #include "phonelogger.h"
    57 #include "phonelogger.h"
    58 #include "phoneui.pan"
    58 #include "phoneui.pan"
    59 #include "phoneconstants.h"
    59 // <-- QT PHONE START --> 
       
    60 //#include "phoneconstants.h"
       
    61 //#include <activeidle2domainpskeys.h>
       
    62 // <-- QT PHONE END --> 
    60 #include "mphonecustomization.h"
    63 #include "mphonecustomization.h"
    61 
    64 
    62 //CONSTANTS
    65 //CONSTANTS
    63 const TInt  KMaxParamLength = 1024;
    66 const TInt  KMaxParamLength = 1024;
    64 
    67 
    93     TPhoneCmdParamBoolean boolean;
    96     TPhoneCmdParamBoolean boolean;
    94     boolean.SetBoolean( ETrue );
    97     boolean.SetBoolean( ETrue );
    95     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetSendKeyDialerActivationFlag, 
    98     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetSendKeyDialerActivationFlag, 
    96                 &boolean );
    99                 &boolean );
    97     
   100     
    98     iViewCommandHandle->ExecuteCommandL( EPhoneViewCreatePhoneBookServices ); 
   101     iViewCommandHandle->ExecuteCommandL( EPhoneViewCreatePhoneBookServices );
    99     }
   102     }
   100 
   103 
   101 // -----------------------------------------------------------
   104 // -----------------------------------------------------------
   102 // CPhoneStateIdle::NewL()
   105 // CPhoneStateIdle::NewL()
   103 // -----------------------------------------------------------
   106 // -----------------------------------------------------------
   127     {
   130     {
   128     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateIdle::HandleKeyEventL( ) ");
   131     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateIdle::HandleKeyEventL( ) ");
   129     // Security mode check
   132     // Security mode check
   130     TPhoneCmdParamBoolean isSecurityMode;      
   133     TPhoneCmdParamBoolean isSecurityMode;      
   131     iViewCommandHandle->ExecuteCommandL( EPhoneViewGetSecurityModeStatus, &isSecurityMode );  
   134     iViewCommandHandle->ExecuteCommandL( EPhoneViewGetSecurityModeStatus, &isSecurityMode );  
   132     
       
   133  
       
   134     // Number entry is blocked, if active Query
   135     // Number entry is blocked, if active Query
   135     if ( !IsAnyQueryActiveL() )
   136     if ( !IsAnyQueryActiveL() )
   136         {
   137         {
   137         // Handle numeric keys when key events are received in idle state
   138         // Handle numeric keys when key events are received in idle state
   138         HandleNumericKeyEventL( aKeyEvent, aEventCode );  
   139         HandleNumericKeyEventL( aKeyEvent, aEventCode );  
   186     TKeyCode aCode )
   187     TKeyCode aCode )
   187     {
   188     {
   188     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateIdle::HandleKeyMessageL( ) ");
   189     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateIdle::HandleKeyMessageL( ) ");
   189 
   190 
   190     if( aMessage == EPhoneKeyLongPress && CheckAppLaunchingL( aCode ) )
   191     if( aMessage == EPhoneKeyLongPress && CheckAppLaunchingL( aCode ) )
   191     	{
   192         {
   192         return;
   193         return;
   193     	}
   194         }
   194 
   195 
   195     switch ( aCode )
   196     switch ( aCode )
   196         {
   197         {
   197         case EKeyEnd:
   198         case EKeyEnd:
   198             // This key even occur only in idle state, behaviour for this should
   199             // This key even occur only in idle state, behaviour for this should
   263                 }
   264                 }
   264             break;
   265             break;
   265             
   266             
   266         case EKeyApplication0:
   267         case EKeyApplication0:
   267             {
   268             {
   268             // Security mode
       
   269             TPhoneCmdParamBoolean isSecurityMode;      
       
   270             iViewCommandHandle->ExecuteCommandL( EPhoneViewGetSecurityModeStatus, &isSecurityMode );
       
   271             	
       
   272             // If dialer is not open but phone is in foreground and phone receives
   269             // If dialer is not open but phone is in foreground and phone receives
   273             // applicaion-key event we have to open emergency dialer. 
   270             // applicaion-key event we have to open emergency dialer. No need own
   274             // Securitymode check because Applicationkey only open dialer in securitymode.
   271             // securitymode check because Applicationkey only captured in securitymode.
   275             if ( isSecurityMode.Boolean() && !IsNumberEntryUsedL() )
   272             if ( !IsNumberEntryUsedL() )
   276                 {
   273                 {
   277                 HandleCommandL(EPhoneNumberAcqSecurityDialer);
   274                 HandleCommandL(EPhoneNumberAcqSecurityDialer);
   278                 }           
   275                 }           
   279             }
   276             }
   280             break;
   277             break;
   411         {
   408         {
   412         SetNumberEntryVisibilityL(EFalse);    
   409         SetNumberEntryVisibilityL(EFalse);    
   413         }
   410         }
   414      
   411      
   415     // Close fast swap window if it's displayed
   412     // Close fast swap window if it's displayed
   416     CEikonEnv::Static()->DismissTaskList();
   413 // <-- QT PHONE START --> 
   417 
   414 //    CEikonEnv::Static()->DismissTaskList();
       
   415 
       
   416 
       
   417     // Display incoming call
       
   418     DisplayIncomingCallL( aCallId );
       
   419     
   418     // Show incoming call buttons
   420     // Show incoming call buttons
   419     SetTouchPaneButtons( EPhoneIncomingCallButtons );
   421     SetTouchPaneButtons( EPhoneIncomingCallButtons );
   420     SetTouchPaneButtonEnabled( EPhoneCallComingCmdSilent );
   422     
   421     
   423 // <-- QT PHONE END --> 
   422     // Display incoming call
       
   423     DisplayIncomingCallL( aCallId );
       
   424 
   424 
   425     // Disable HW keys and Call UI if needed
   425     // Disable HW keys and Call UI if needed
   426     CheckDisableHWKeysAndCallUIL();
   426     CheckDisableHWKeysAndCallUIL();
   427     
   427     
   428     EndUiUpdate();
   428     EndUiUpdate();
   456     BeginTransEffectLC( ENumberEntryClose );
   456     BeginTransEffectLC( ENumberEntryClose );
   457     BeginUiUpdateLC();
   457     BeginUiUpdateLC();
   458     
   458     
   459     SetNumberEntryVisibilityL(EFalse);
   459     SetNumberEntryVisibilityL(EFalse);
   460 
   460 
       
   461     // <-- QT PHONE START -->
       
   462     // Display call setup 
       
   463     DisplayCallSetupL( aCallId );  
       
   464     
   461     // Show call setup buttons
   465     // Show call setup buttons
   462     SetTouchPaneButtons( EPhoneCallSetupButtons );
   466     SetTouchPaneButtons( EPhoneCallSetupButtons );          
   463 
   467     // <-- QT PHONE END -->
   464     // Display call setup 
       
   465     DisplayCallSetupL( aCallId );            
       
   466     
   468     
   467     EndUiUpdate();
   469     EndUiUpdate();
   468     
   470     
   469     // Remove any phone dialogs if they are displayed
   471     // Remove any phone dialogs if they are displayed
   470     iViewCommandHandle->ExecuteCommandL( EPhoneViewRemovePhoneDialogs );
   472     iViewCommandHandle->ExecuteCommandL( EPhoneViewRemovePhoneDialogs );
   591            integerParam.SetInteger( 
   593            integerParam.SetInteger( 
   592                CPhoneMainResourceResolver::Instance()->
   594                CPhoneMainResourceResolver::Instance()->
   593                ResolveResourceID( EPhoneNumberAcqOkMenubar ) );
   595                ResolveResourceID( EPhoneNumberAcqOkMenubar ) );
   594            iViewCommandHandle->ExecuteCommandL( 
   596            iViewCommandHandle->ExecuteCommandL( 
   595                EPhoneViewMenuBarOpen, &integerParam );
   597                EPhoneViewMenuBarOpen, &integerParam );
   596 	       commandStatus = ETrue;
   598            commandStatus = ETrue;
   597            }
   599            }
   598            break;       
   600            break;       
   599            
   601            
   600        default:
   602        default:
   601            commandStatus = CPhoneState::ProcessCommandL( aCommand );
   603            commandStatus = CPhoneState::ProcessCommandL( aCommand );
   837 // CPhoneStateIdle::HandlePhoneForegroundEventL
   839 // CPhoneStateIdle::HandlePhoneForegroundEventL
   838 // -----------------------------------------------------------
   840 // -----------------------------------------------------------
   839 
   841 
   840 EXPORT_C void CPhoneStateIdle::HandlePhoneForegroundEventL()
   842 EXPORT_C void CPhoneStateIdle::HandlePhoneForegroundEventL()
   841     {
   843     {
   842     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateIdle::HandlePhoneForegroundEventL( ) ");
   844 // <-- QT PHONE START --> 
       
   845     /*__LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateIdle::HandlePhoneForegroundEventL( ) ");
   843     
   846     
   844     TPhoneCmdParamBoolean isSecurityMode;      
   847     TPhoneCmdParamBoolean isSecurityMode;      
   845     iViewCommandHandle->ExecuteCommandL( EPhoneViewGetSecurityModeStatus, &isSecurityMode );
   848     iViewCommandHandle->ExecuteCommandL( EPhoneViewGetSecurityModeStatus, &isSecurityMode );
   846 
   849 
   847     TBool activatePhone = CPhonePubSubProxy::Instance()->Value(
   850     TBool activatePhone = CPhonePubSubProxy::Instance()->Value(
   873         }
   876         }
   874     else if ( !IsNumberEntryUsedL() && !isSecurityMode.Boolean() )
   877     else if ( !IsNumberEntryUsedL() && !isSecurityMode.Boolean() )
   875         {
   878         {
   876         // Bring Idle app to the foreground
   879         // Bring Idle app to the foreground
   877         iViewCommandHandle->ExecuteCommandL( EPhoneViewBringIdleToForeground );
   880         iViewCommandHandle->ExecuteCommandL( EPhoneViewBringIdleToForeground );
   878 		}
   881         }*/
       
   882 // <-- QT PHONE END --> 
   879     }
   883     }
   880 
   884 
   881 // -----------------------------------------------------------
   885 // -----------------------------------------------------------
   882 // CPhoneStateIdle::HandlePhoneFocusLostEventL
   886 // CPhoneStateIdle::HandlePhoneFocusLostEventL
   883 // -----------------------------------------------------------
   887 // -----------------------------------------------------------
   929     iStateMachine->PhoneEngineInfo()->SetServiceIdCommand( speedDialParam.ServiceId() );
   933     iStateMachine->PhoneEngineInfo()->SetServiceIdCommand( speedDialParam.ServiceId() );
   930     CleanupStack::PushL( phoneNumber );
   934     CleanupStack::PushL( phoneNumber );
   931     
   935     
   932     if ( NULL != phoneNumber && KNullDesC() != *phoneNumber )
   936     if ( NULL != phoneNumber && KNullDesC() != *phoneNumber )
   933         {
   937         {
       
   938 
       
   939 
   934         DialL( *phoneNumber, speedDialParam.NumberType(), aDialMethod );
   940         DialL( *phoneNumber, speedDialParam.NumberType(), aDialMethod );
   935         
   941         
   936         if ( IsNumberEntryUsedL()  ) 
   942         if ( IsNumberEntryUsedL()  ) 
   937             {
   943             {
   938             BeginTransEffectLC( ENumberEntryClose ); 
   944             BeginTransEffectLC( ENumberEntryClose ); 
  1081     keyEvent.iScanCode = EEikCmdExit;
  1087     keyEvent.iScanCode = EEikCmdExit;
  1082     keyEvent.iModifiers = 0;
  1088     keyEvent.iModifiers = 0;
  1083     keyEvent.iRepeats = 0;
  1089     keyEvent.iRepeats = 0;
  1084     wsSession.SimulateKeyEvent( keyEvent );
  1090     wsSession.SimulateKeyEvent( keyEvent );
  1085     wsSession.Flush();  
  1091     wsSession.Flush();  
       
  1092 
       
  1093 // <-- QT PHONE START -->     
       
  1094     iViewCommandHandle->ExecuteCommandL( EPhoneAppShutDown );
       
  1095 // <-- QT PHONE END --> 
  1086     }
  1096     }
  1087 
  1097 
  1088 // -----------------------------------------------------------
  1098 // -----------------------------------------------------------
  1089 // CPhoneStateIdle::HandleEndKeyPressL
  1099 // CPhoneStateIdle::HandleEndKeyPressL
  1090 // -----------------------------------------------------------
  1100 // -----------------------------------------------------------
  1159                     
  1169                     
  1160                     // Remove number entry from screen
  1170                     // Remove number entry from screen
  1161                     iViewCommandHandle->ExecuteCommandL( 
  1171                     iViewCommandHandle->ExecuteCommandL( 
  1162                         EPhoneViewRemoveNumberEntry );
  1172                         EPhoneViewRemoveNumberEntry );
  1163                     } 
  1173                     } 
  1164 			    // Bring Idle app to the foreground
  1174                 // Bring Idle app to the foreground
  1165                 iViewCommandHandle->ExecuteCommandL( EPhoneViewBringIdleToForeground );
  1175                 iViewCommandHandle->ExecuteCommandL( EPhoneViewBringIdleToForeground );
  1166                 }
  1176                 }
  1167             }
  1177             }
  1168         else if ( IsNumberEntryUsedL() )
  1178         else if ( IsNumberEntryUsedL() )
  1169             {
  1179             {
  1305 // -----------------------------------------------------------------------------
  1315 // -----------------------------------------------------------------------------
  1306 // CPhoneStateIdle::CheckAppLaunchingL
  1316 // CPhoneStateIdle::CheckAppLaunchingL
  1307 // -----------------------------------------------------------------------------
  1317 // -----------------------------------------------------------------------------
  1308 //
  1318 //
  1309 TBool CPhoneStateIdle::CheckAppLaunchingL( const TKeyCode aCode )
  1319 TBool CPhoneStateIdle::CheckAppLaunchingL( const TKeyCode aCode )
  1310 	{
  1320     {
  1311 	TBool valuesFetched( EFalse );
  1321     TBool valuesFetched( EFalse );
  1312 	
  1322     
  1313 	if( !IsSimOk() )
  1323     if( !IsSimOk() )
  1314 	    {
  1324         {
  1315 	    return valuesFetched;
  1325         return valuesFetched;
  1316 	    }
  1326         }
  1317 	
  1327     
  1318 	TPhoneCmdParamAppInfo appInfo;
  1328     TPhoneCmdParamAppInfo appInfo;
  1319 	HBufC8* appParam = HBufC8::NewL( KMaxParamLength );
  1329     HBufC8* appParam = HBufC8::NewL( KMaxParamLength );
  1320 	CleanupStack::PushL( appParam );
  1330     CleanupStack::PushL( appParam );
  1321 
  1331 
  1322     TPhoneCmdParamInteger numberEntryCount;
  1332     TPhoneCmdParamInteger numberEntryCount;
  1323     iViewCommandHandle->ExecuteCommandL( EPhoneViewGetNumberEntryCount,
  1333     iViewCommandHandle->ExecuteCommandL( EPhoneViewGetNumberEntryCount,
  1324         &numberEntryCount );
  1334         &numberEntryCount );
  1325     
  1335     
  1338     
  1348     
  1339     if ( isValidAppLaunchingKeyEvent )
  1349     if ( isValidAppLaunchingKeyEvent )
  1340         {
  1350         {
  1341         TRAPD( err, 
  1351         TRAPD( err, 
  1342             CPhoneCenRepProxy::Instance()->FetchValuesFromCenRepL( 
  1352             CPhoneCenRepProxy::Instance()->FetchValuesFromCenRepL( 
  1343         	appInfo, aCode, appParam, valuesFetched ) );
  1353             appInfo, aCode, appParam, valuesFetched ) );
  1344         
  1354         
  1345         if ( KErrNone == err && valuesFetched )
  1355         if ( KErrNone == err && valuesFetched )
  1346             {
  1356             {
  1347             // Remove the number entry window
  1357             // Remove the number entry window
  1348             iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNumberEntry );
  1358             iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNumberEntry );
  1349 
  1359 
  1350         	// Stop playing DTMF tone
  1360             // Stop playing DTMF tone
  1351         	iStateMachine->SendPhoneEngineMessage( MPEPhoneModel::EPEMessageEndDTMF );
  1361             iStateMachine->SendPhoneEngineMessage( MPEPhoneModel::EPEMessageEndDTMF );
  1352 
  1362 
  1353             TPhoneCommandParam* phoneCommandParam = 
  1363             TPhoneCommandParam* phoneCommandParam = 
  1354                 static_cast<TPhoneCommandParam*>( &appInfo );
  1364                 static_cast<TPhoneCommandParam*>( &appInfo );
  1355         	iViewCommandHandle->ExecuteCommandL( 
  1365             iViewCommandHandle->ExecuteCommandL( 
  1356         				EPhoneViewActivateAppViewConventional,
  1366                         EPhoneViewActivateAppViewConventional,
  1357         				phoneCommandParam ); 
  1367                         phoneCommandParam ); 
  1358             
  1368             
  1359             // Continue displaying current app but set up the 
  1369             // Continue displaying current app but set up the 
  1360             // idle screen in the background
  1370             // idle screen in the background
  1361             SetupIdleScreenInBackgroundL();
  1371             SetupIdleScreenInBackgroundL();
  1362             }
  1372             }
  1363         }
  1373         }
  1364     CleanupStack::PopAndDestroy( appParam );
  1374     CleanupStack::PopAndDestroy( appParam );
  1365     return valuesFetched;
  1375     return valuesFetched;
  1366 	}
  1376     }
  1367 
  1377 
  1368 // -----------------------------------------------------------
  1378 // -----------------------------------------------------------
  1369 // CPhoneStateIdle::NumberForSpeedDialLocationL
  1379 // CPhoneStateIdle::NumberForSpeedDialLocationL
  1370 // -----------------------------------------------------------
  1380 // -----------------------------------------------------------
  1371 // 
  1381 //