phoneapp/phoneuicontrol/src/cphonestateidle.cpp
branchRCL_3
changeset 9 8871b09be73b
parent 4 c84cf270c54f
child 14 24062c24fe38
equal deleted inserted replaced
4:c84cf270c54f 9:8871b09be73b
    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 #include "phoneconstants.h"
    60 #include "mphonecustomization.h"
    60 #include "mphonecustomization.h"
       
    61 #include <easydialingcommands.hrh>
    61 
    62 
    62 //CONSTANTS
    63 //CONSTANTS
    63 const TInt  KMaxParamLength = 1024;
    64 const TInt  KMaxParamLength = 1024;
    64 
    65 
    65 // ================= MEMBER FUNCTIONS =======================
    66 // ================= MEMBER FUNCTIONS =======================
   305 
   306 
   306 #ifdef RD_INTELLIGENT_TEXT_INPUT   
   307 #ifdef RD_INTELLIGENT_TEXT_INPUT   
   307         case EKeyEnter:
   308         case EKeyEnter:
   308             if ( IsNumberEntryVisibleL() )
   309             if ( IsNumberEntryVisibleL() )
   309                 {
   310                 {
   310                 HandleCommandL( EPhoneCmdOptions );
   311                 if ( IsDialingExtensionInFocusL() )
       
   312                     {
       
   313                     HandleCommandL( EEasyDialingEnterKeyAction );
       
   314                     }
       
   315                 else
       
   316                     {
       
   317                     HandleCommandL( EPhoneCmdOptions );
       
   318                     }               
   311                 }
   319                 }
   312             break;
   320             break;
   313 #endif
   321 #endif
   314             
   322             
   315         default:
   323         default:
   539         case EPhoneCmdOptions:
   547         case EPhoneCmdOptions:
   540             {
   548             {
   541             // Open number entry menubar
   549             // Open number entry menubar
   542             TPhoneCmdParamInteger integerParam;  
   550             TPhoneCmdParamInteger integerParam;  
   543                       
   551                       
   544             integerParam.SetInteger( 
   552             TInt menuId( GetNumberAcqMenuIdL() );
   545              CPhoneMainResourceResolver::Instance()->
   553             integerParam.SetInteger( menuId );   
   546                 ResolveResourceID( EPhoneNumberAcqMenubar ) );               
       
   547 
   554 
   548             iViewCommandHandle->ExecuteCommandL( 
   555             iViewCommandHandle->ExecuteCommandL( 
   549                 EPhoneViewMenuBarOpen, &integerParam );
   556                 EPhoneViewMenuBarOpen, &integerParam );
   550             break;
   557             break;
   551             }
   558             }
   561             DialVideoCallL();
   568             DialVideoCallL();
   562             break;
   569             break;
   563             
   570             
   564         case EPhoneCmdBack:
   571         case EPhoneCmdBack:
   565             HandleBackCommandL();
   572             HandleBackCommandL();
   566             break;            
   573             break;      
       
   574      
       
   575         case EPhoneViewOpenNumberEntry:    
       
   576             BeginTransEffectLC( ENumberEntryCreate );
       
   577             commandStatus = CPhoneState::HandleCommandL( aCommand );
       
   578             EndTransEffect();        
       
   579             break; 
   567             
   580             
   568         default:
   581         default:
   569             commandStatus = CPhoneState::HandleCommandL( aCommand );
   582             commandStatus = CPhoneState::HandleCommandL( aCommand );
   570             break;
   583             break;
   571         }
   584         }
   647 // -----------------------------------------------------------
   660 // -----------------------------------------------------------
   648 //
   661 //
   649 void CPhoneStateIdle::HandleBackCommandL()
   662 void CPhoneStateIdle::HandleBackCommandL()
   650     {
   663     {
   651     TBool previousApp(EFalse);
   664     TBool previousApp(EFalse);
       
   665 
   652     // If previous app activation is true then open
   666     // If previous app activation is true then open
   653     // previous application.
   667     // previous application.
   654     if ( iOnScreenDialer && 
   668     if ( iOnScreenDialer && 
   655         IsSimOk() )
   669         IsSimOk() )
   656         {
   670         {
   657         TPhoneCmdParamBoolean booleanParam;
   671         TPhoneCmdParamBoolean booleanParam;
   658         iViewCommandHandle->ExecuteCommandL( 
   672         iViewCommandHandle->ExecuteCommandL( 
   659             EPhoneViewGetActivatePreviousApp, &booleanParam );
   673             EPhoneViewGetActivatePreviousApp, &booleanParam );
   660         
   674         
       
   675 
   661         if ( booleanParam.Boolean() )
   676         if ( booleanParam.Boolean() )
   662             {
   677             {
   663             // Open previous app.
   678             // Open previous app.
   664             iViewCommandHandle->ExecuteCommandL( 
   679             iViewCommandHandle->ExecuteCommandL( 
   665                 EPhoneViewActivatePreviousApp );
   680                 EPhoneViewActivatePreviousApp );
   666 
   681 
       
   682             BeginTransEffectLC( ENumberEntryClose ); 
       
   683 
   667             // Remove number entry from screen
   684             // Remove number entry from screen
   668             iViewCommandHandle->ExecuteCommandL( 
   685             iViewCommandHandle->ExecuteCommandL( 
   669                 EPhoneViewRemoveNumberEntry ); 
   686                 EPhoneViewRemoveNumberEntry ); 
   670 
   687 
       
   688             EndTransEffect(); 
       
   689 
   671             iViewCommandHandle->ExecuteCommandL( EPhoneViewUpdateFSW ); 
   690             iViewCommandHandle->ExecuteCommandL( EPhoneViewUpdateFSW ); 
   672             previousApp = ETrue;   
   691             previousApp = ETrue;   
   673             }
   692             }        
   674         }
   693         }
   675         
   694         
   676     if ( !previousApp )
   695     if ( !previousApp )
   677         {
   696         {
       
   697         BeginTransEffectLC( ENumberEntryClose ); 
       
   698 
   678         // Remove number entry from screen
   699         // Remove number entry from screen
   679         iViewCommandHandle->ExecuteCommandL( 
   700         iViewCommandHandle->ExecuteCommandL( 
   680             EPhoneViewRemoveNumberEntry );
   701             EPhoneViewRemoveNumberEntry );
       
   702         
       
   703         EndTransEffect();
       
   704         
   681         // Do state-specific operation when number entry is cleared
   705         // Do state-specific operation when number entry is cleared
   682         HandleNumberEntryClearedL();
   706         HandleNumberEntryClearedL();
   683         }    
   707         }  
       
   708  
   684     }
   709     }
   685 
   710 
   686 // -----------------------------------------------------------
   711 // -----------------------------------------------------------
   687 // CPhoneStateIdle::DialVideoCallL
   712 // CPhoneStateIdle::DialVideoCallL
   688 // -----------------------------------------------------------
   713 // -----------------------------------------------------------
  1146                 HandleNumberEntryClearedL();
  1171                 HandleNumberEntryClearedL();
  1147                 }
  1172                 }
  1148             else if ( !TopAppIsDisplayedL() )
  1173             else if ( !TopAppIsDisplayedL() )
  1149                 {
  1174                 {
  1150                 // Phone might not be the topmost app since it has
  1175                 // Phone might not be the topmost app since it has
  1151                 // some dialog/query open therefore we need to check this
  1176                 // some dialog/query open therefore we need to remove dialog/phone.
  1152                 // and remove dialog/phone.
  1177             
  1153                 if ( IsAnyQueryActiveL()  )
  1178                 if ( !IsSimStateNotPresentWithSecurityModeEnabled() )
  1154                     {
  1179                     {
  1155                     if ( !IsSimStateNotPresentWithSecurityModeEnabled() )
  1180                     iViewCommandHandle->ExecuteCommandL( EPhoneViewRemovePhoneDialogs );
  1156                         {
  1181                     }
  1157                         iViewCommandHandle->ExecuteCommandL( EPhoneViewRemovePhoneDialogs );
  1182                 // Remove number entry from screen
  1158                         }
  1183                 iViewCommandHandle->ExecuteCommandL( 
       
  1184                         EPhoneViewRemoveNumberEntry );
  1159                     
  1185                     
  1160                     // Remove number entry from screen
  1186                 // Bring Idle app to the foreground
  1161                     iViewCommandHandle->ExecuteCommandL( 
       
  1162                         EPhoneViewRemoveNumberEntry );
       
  1163                     } 
       
  1164 			    // Bring Idle app to the foreground
       
  1165                 iViewCommandHandle->ExecuteCommandL( EPhoneViewBringIdleToForeground );
  1187                 iViewCommandHandle->ExecuteCommandL( EPhoneViewBringIdleToForeground );
       
  1188                 
       
  1189                 // Updates Task list
       
  1190                 iViewCommandHandle->ExecuteCommandL( EPhoneViewUpdateFSW );
       
  1191 
  1166                 }
  1192                 }
  1167             }
  1193             }
  1168         else if ( IsNumberEntryUsedL() )
  1194         else if ( IsNumberEntryUsedL() )
  1169             {
  1195             {
  1170             // Remove number entry from screen
  1196             // Remove number entry from screen
  1305 // -----------------------------------------------------------------------------
  1331 // -----------------------------------------------------------------------------
  1306 // CPhoneStateIdle::CheckAppLaunchingL
  1332 // CPhoneStateIdle::CheckAppLaunchingL
  1307 // -----------------------------------------------------------------------------
  1333 // -----------------------------------------------------------------------------
  1308 //
  1334 //
  1309 TBool CPhoneStateIdle::CheckAppLaunchingL( const TKeyCode aCode )
  1335 TBool CPhoneStateIdle::CheckAppLaunchingL( const TKeyCode aCode )
  1310 	{
  1336     {
  1311 	TBool valuesFetched( EFalse );
  1337     TBool valuesFetched( EFalse );
  1312 	
  1338     
  1313 	if( !IsSimOk() )
  1339     if( !IsSimOk() )
  1314 	    {
  1340         {
  1315 	    return valuesFetched;
  1341         return valuesFetched;
  1316 	    }
  1342         }
  1317 	
  1343     
  1318 	TPhoneCmdParamAppInfo appInfo;
  1344     TPhoneCmdParamAppInfo appInfo;
  1319 	HBufC8* appParam = HBufC8::NewL( KMaxParamLength );
  1345     HBufC8* appParam = HBufC8::NewL( KMaxParamLength );
  1320 	CleanupStack::PushL( appParam );
  1346     CleanupStack::PushL( appParam );
  1321 
  1347 
  1322     TPhoneCmdParamInteger numberEntryCount;
  1348     TBool isValidAppLaunchingKeyEvent = ETrue;
  1323     iViewCommandHandle->ExecuteCommandL( EPhoneViewGetNumberEntryCount,
  1349     
  1324         &numberEntryCount );
  1350     // By-pass checking of number entry length in case of #-character.
  1325     
  1351     // #-character is handled differently from other keys, and number 
  1326     TBool isValidAppLaunchingKeyEvent = EFalse;
  1352     // entry length has been checked earlier. Checking number entry length
  1327     if ( iCustomization && iCustomization->AllowAlphaNumericMode() &&
  1353     // for #-character is difficult here, because we cannot know if FEP
  1328          TKeyCode( KPhoneDtmfHashCharacter ) == aCode )
  1354     // has removed the long-# from number entry or not.
  1329         {
  1355     if ( TKeyCode( KPhoneDtmfHashCharacter ) != aCode )
  1330         // If alphanumeric mode is supported FEP changes text input mode with
  1356         {
  1331         // long hash and removes hash from number entry.
  1357         TPhoneCmdParamInteger numberEntryCount;
  1332         isValidAppLaunchingKeyEvent = ( numberEntryCount.Integer() == 0 );
  1358         iViewCommandHandle->ExecuteCommandL( EPhoneViewGetNumberEntryCount,
  1333         }
  1359             &numberEntryCount );
  1334     else
  1360     
  1335         {
       
  1336         isValidAppLaunchingKeyEvent = ( numberEntryCount.Integer() == 1 );
  1361         isValidAppLaunchingKeyEvent = ( numberEntryCount.Integer() == 1 );
  1337         }
  1362         }
  1338     
  1363     
  1339     if ( isValidAppLaunchingKeyEvent )
  1364     if ( isValidAppLaunchingKeyEvent )
  1340         {
  1365         {
  1341         TRAPD( err, 
  1366         TRAPD( err, 
  1342             CPhoneCenRepProxy::Instance()->FetchValuesFromCenRepL( 
  1367             CPhoneCenRepProxy::Instance()->FetchValuesFromCenRepL( 
  1343         	appInfo, aCode, appParam, valuesFetched ) );
  1368             appInfo, aCode, appParam, valuesFetched ) );
  1344         
  1369         
  1345         if ( KErrNone == err && valuesFetched )
  1370         if ( KErrNone == err && valuesFetched )
  1346             {
  1371             {
  1347             // Remove the number entry window
  1372             // Remove the number entry window
  1348             iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNumberEntry );
  1373             iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNumberEntry );
  1349 
  1374 
  1350         	// Stop playing DTMF tone
  1375             // Stop playing DTMF tone
  1351         	iStateMachine->SendPhoneEngineMessage( MPEPhoneModel::EPEMessageEndDTMF );
  1376             iStateMachine->SendPhoneEngineMessage( MPEPhoneModel::EPEMessageEndDTMF );
  1352 
  1377 
  1353             TPhoneCommandParam* phoneCommandParam = 
  1378             TPhoneCommandParam* phoneCommandParam = 
  1354                 static_cast<TPhoneCommandParam*>( &appInfo );
  1379                 static_cast<TPhoneCommandParam*>( &appInfo );
  1355         	iViewCommandHandle->ExecuteCommandL( 
  1380             iViewCommandHandle->ExecuteCommandL( 
  1356         				EPhoneViewActivateAppViewConventional,
  1381                         EPhoneViewActivateAppViewConventional,
  1357         				phoneCommandParam ); 
  1382                         phoneCommandParam ); 
  1358             
  1383             
  1359             // Continue displaying current app but set up the 
  1384             // Continue displaying current app but set up the 
  1360             // idle screen in the background
  1385             // idle screen in the background
  1361             SetupIdleScreenInBackgroundL();
  1386             SetupIdleScreenInBackgroundL();
  1362             }
  1387             }
  1363         }
  1388         }
  1364     CleanupStack::PopAndDestroy( appParam );
  1389     CleanupStack::PopAndDestroy( appParam );
  1365     return valuesFetched;
  1390     return valuesFetched;
  1366 	}
  1391     }
  1367 
  1392 
  1368 // -----------------------------------------------------------
  1393 // -----------------------------------------------------------
  1369 // CPhoneStateIdle::NumberForSpeedDialLocationL
  1394 // CPhoneStateIdle::NumberForSpeedDialLocationL
  1370 // -----------------------------------------------------------
  1395 // -----------------------------------------------------------
  1371 // 
  1396 // 
  1420             SendExitCommandL();
  1445             SendExitCommandL();
  1421             }
  1446             }
  1422         else
  1447         else
  1423 #endif // _DEBUG
  1448 #endif // _DEBUG
  1424             {
  1449             {
  1425             if ( IsSpeedDialNumber( *phoneNumber ) )
  1450             if ( IsDialingExtensionInFocusL() )
       
  1451                 {
       
  1452                 CPhoneState::HandleCommandL( EEasyDialingVoiceCall );
       
  1453                 }
       
  1454             
       
  1455             else if ( IsSpeedDialNumber( *phoneNumber ) )
  1426                 {
  1456                 {
  1427                 // Handle speed dial
  1457                 // Handle speed dial
  1428                 SpeedDialL( (*phoneNumber)[0], aSendKey ? EDialMethodSendCommand : EDialMethodMenuSelection );
  1458                 SpeedDialL( (*phoneNumber)[0], aSendKey ? EDialMethodSendCommand : EDialMethodMenuSelection );
  1429                 }
  1459                 }
  1430             else
  1460             else
  1437             CleanupStack::PopAndDestroy( phoneNumber );
  1467             CleanupStack::PopAndDestroy( phoneNumber );
  1438             }
  1468             }
  1439         }    
  1469         }    
  1440     }
  1470     }
  1441 
  1471 
       
  1472 // -----------------------------------------------------------
       
  1473 // CPhoneStateIdle::HandleVoiceCallCommandL()
       
  1474 // -----------------------------------------------------------
       
  1475 //
       
  1476 TInt CPhoneStateIdle::GetNumberAcqMenuIdL()
       
  1477     {
       
  1478     TInt menuId = CPhoneMainResourceResolver::Instance()->
       
  1479             ResolveResourceID( EPhoneNumberAcqMenubar );
       
  1480     
       
  1481     // Use easy dialing menu id, if easydialing is in focus.
       
  1482     // Otherwise use number acquisition menu id.
       
  1483     if ( IsDialingExtensionInFocusL() )
       
  1484         {
       
  1485         // Fetch easydialing menu id, check its validity and assign to menuId
       
  1486         TPhoneCmdParamInteger integerParam;  
       
  1487         iViewCommandHandle->ExecuteCommandL(
       
  1488                 EPhoneViewGetEasyDialingMenuId, &integerParam );
       
  1489         if ( integerParam.Integer() ) 
       
  1490             {
       
  1491             menuId = integerParam.Integer();
       
  1492             }
       
  1493         }
       
  1494     return menuId;
       
  1495     }
       
  1496 
  1442 // End of File
  1497 // End of File