phoneapp/phoneuicontrol/src/cphonestateidle.cpp
changeset 45 6b911d05207e
parent 37 ba76fc04e6c2
child 46 bc5a64e5bc3c
equal deleted inserted replaced
37:ba76fc04e6c2 45:6b911d05207e
    26 #include <apgcli.h>
    26 #include <apgcli.h>
    27 #include <telephonyvariant.hrh>
    27 #include <telephonyvariant.hrh>
    28 #include <featmgr.h>
    28 #include <featmgr.h>
    29 #include <settingsinternalcrkeys.h>
    29 #include <settingsinternalcrkeys.h>
    30 #include <mpeengineinfo.h>
    30 #include <mpeengineinfo.h>
    31 #include <activeidle2domainpskeys.h>
       
    32 #include <mpeclientinformation.h>
    31 #include <mpeclientinformation.h>
    33 #include <bldvariant.hrh>
    32 #include <bldvariant.hrh>
    34 
    33 
    35 #include "cphonepubsubproxy.h"
    34 #include "cphonepubsubproxy.h"
    36 #include "cphonecenrepproxy.h"
    35 #include "cphonecenrepproxy.h"
    37 #include "cphonestateidle.h"
    36 #include "cphonestateidle.h"
    38 #include "tphonecmdparaminteger.h"
    37 #include "tphonecmdparaminteger.h"
    39 #include "tphonecmdparamboolean.h"
    38 #include "tphonecmdparamboolean.h"
    40 #include "tphonecmdparamglobalnote.h"
    39 #include "tphonecmdparamglobalnote.h"
    41 #include "tphonecmdparamstring.h"
    40 #include "tphonecmdparamstring.h"
    42 #include "tphonecmdparamspeeddial.h"
       
    43 #include "tphonecmdparamboolean.h"
    41 #include "tphonecmdparamboolean.h"
    44 #include "mphonestatemachine.h"
    42 #include "mphonestatemachine.h"
    45 #include "phonestatedefinitions.h"
    43 #include "phonestatedefinitions.h"
    46 #include "tphonecmdparamappinfo.h"
    44 #include "tphonecmdparamappinfo.h"
    47 #include "cphonekeys.h"
    45 #include "cphonekeys.h"
   277                 {
   275                 {
   278                 LaunchApplicationL();
   276                 LaunchApplicationL();
   279                 }
   277                 }
   280             break;
   278             break;
   281             
   279             
   282         // number key
       
   283         case KPhoneDtmf1Character:
       
   284         case KPhoneDtmf2Character:
       
   285         case KPhoneDtmf3Character:
       
   286         case KPhoneDtmf4Character:
       
   287         case KPhoneDtmf5Character:
       
   288         case KPhoneDtmf6Character:
       
   289         case KPhoneDtmf7Character:
       
   290         case KPhoneDtmf8Character:
       
   291         case KPhoneDtmf9Character:
       
   292             if ( aMessage == EPhoneKeyLongPress && IsSimOk() )
       
   293                 {
       
   294                 HandleNumberLongKeyPressL();
       
   295                 }
       
   296             break;
       
   297 
       
   298 #ifdef RD_INTELLIGENT_TEXT_INPUT   
   280 #ifdef RD_INTELLIGENT_TEXT_INPUT   
   299         case EKeyEnter:
   281         case EKeyEnter:
   300             if ( IsNumberEntryVisibleL() )
   282             if ( IsNumberEntryVisibleL() )
   301                 {
   283                 {
   302                 HandleCommandL( EPhoneCmdOptions );
   284                 HandleCommandL( EPhoneCmdOptions );
   438     {
   420     {
   439     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateIdle::HandleDialingL( ) ");
   421     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateIdle::HandleDialingL( ) ");
   440 
   422 
   441     BeginTransEffectLC( ENumberEntryClose );
   423     BeginTransEffectLC( ENumberEntryClose );
   442     BeginUiUpdateLC();
   424     BeginUiUpdateLC();
   443     
       
   444     SetNumberEntryVisibilityL(EFalse);
       
   445 
   425 
   446     // Display call setup 
   426     // Display call setup 
   447     DisplayCallSetupL( aCallId );  
   427     DisplayCallSetupL( aCallId );  
   448     
   428     
   449     // Show call setup buttons
   429     // Show call setup buttons
   534                 EPhoneViewMenuBarOpen, &integerParam );
   514                 EPhoneViewMenuBarOpen, &integerParam );
   535             break;
   515             break;
   536             }
   516             }
   537         
   517         
   538         case EPhoneNumberAcqCmdCall:
   518         case EPhoneNumberAcqCmdCall:
   539             HandleVoiceCallCommandL( EFalse );
   519             HandleVoiceCallCommandL();
   540             break;
   520             break;
   541         case EPhoneNumberAcqCmdSendCommand:
   521         case EPhoneNumberAcqCmdSendCommand:
   542             HandleSendCommandL();
   522             HandleSendCommandL();
   543             break;
   523             break;
   544             
   524             
   686             SendExitCommandL();
   666             SendExitCommandL();
   687             }
   667             }
   688         else
   668         else
   689 #endif // _DEBUG
   669 #endif // _DEBUG
   690             {
   670             {
   691             if ( IsSpeedDialNumber( (*phoneNumber) ) )
   671             // call the number
   692                 {
   672             iStateMachine->PhoneEngineInfo()->SetPhoneNumber( *phoneNumber );
   693                 // Handle speed dial
   673             DialMultimediaCallL();
   694                 SpeedDialL( (*phoneNumber)[0], EDialMethodMenuSelection );
       
   695                 }
       
   696             else
       
   697                 {
       
   698                 // call the number
       
   699                 iStateMachine->PhoneEngineInfo()->SetPhoneNumber( *phoneNumber );
       
   700                 DialMultimediaCallL();
       
   701                 }
       
   702 
   674 
   703             CleanupStack::PopAndDestroy( phoneNumber );
   675             CleanupStack::PopAndDestroy( phoneNumber );
   704             }
   676             }
   705         }       
   677         }       
   706     }
   678     }
   856     iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNumberEntry );    
   828     iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNumberEntry );    
   857 
   829 
   858     // Remove all notes and dialogs
   830     // Remove all notes and dialogs
   859     iViewCommandHandle->ExecuteCommandL( EPhoneViewRemovePhoneDialogs );    
   831     iViewCommandHandle->ExecuteCommandL( EPhoneViewRemovePhoneDialogs );    
   860     }
   832     }
   861  
       
   862 // -----------------------------------------------------------
       
   863 // CPhoneStateIdle::SpeedDialL
       
   864 // -----------------------------------------------------------
       
   865 //   
       
   866 EXPORT_C void CPhoneStateIdle::SpeedDialL( const TUint& aDigit, 
       
   867         TDialInitiationMethod aDialMethod )
       
   868     {
       
   869     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateIdle::SpeedDialL( ) ");
       
   870     
       
   871     iStateMachine->SendPhoneEngineMessage( MPEPhoneModel::EPEMessageEndDTMF );
       
   872     
       
   873     TPhoneCmdParamSpeedDial speedDialParam;
       
   874     HBufC* phoneNumber = NumberForSpeedDialLocationL( aDigit, speedDialParam );
       
   875 
       
   876     // Store serviceId received from vmbx handler
       
   877     iStateMachine->PhoneEngineInfo()->SetServiceIdCommand( speedDialParam.ServiceId() );
       
   878     CleanupStack::PushL( phoneNumber );
       
   879     
       
   880     if ( NULL != phoneNumber && KNullDesC() != *phoneNumber )
       
   881         {
       
   882 
       
   883 
       
   884         DialL( *phoneNumber, speedDialParam.NumberType(), aDialMethod );
       
   885         
       
   886         if ( IsNumberEntryUsedL()  ) 
       
   887             {
       
   888             BeginTransEffectLC( ENumberEntryClose ); 
       
   889             
       
   890             iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNumberEntry );
       
   891             
       
   892             // Set Idle background, if still idle
       
   893             if ( iStateMachine->State() == this )
       
   894                 {
       
   895                 SetupIdleScreenInBackgroundL();
       
   896                 }
       
   897             
       
   898             EndTransEffect();
       
   899             }
       
   900         }
       
   901     else
       
   902         {
       
   903         // User cancelled dialog or didn't give a valid number
       
   904         SpeedDialCanceledL( aDigit );
       
   905         }
       
   906     
       
   907     CleanupStack::PopAndDestroy( phoneNumber );
       
   908     }
       
   909 
       
   910 // -----------------------------------------------------------
       
   911 // CPhoneStateIdle:SpeedDialCanceledL
       
   912 // -----------------------------------------------------------
       
   913 //
       
   914 EXPORT_C void CPhoneStateIdle::SpeedDialCanceledL( const TUint& aDigit )
       
   915 
       
   916     {
       
   917     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateIdle::SpeedDialCanceledL( ) ");
       
   918     if ( IsNumberEntryUsedL() )
       
   919         {
       
   920         if ( aDigit == KPhoneDtmf1Character || 
       
   921                   ( aDigit == KPhoneDtmf2Character && 
       
   922                     iViewCommandHandle->HandleCommandL( 
       
   923                      EPhoneViewIsStraightCallToVideoMailBox ) == EPhoneViewResponseSuccess ) ) 
       
   924             {
       
   925             // Remove number entry and set idle background on non-touch products
       
   926             if ( !FeatureManager::FeatureSupported( KFeatureIdTouchCallHandling ) )
       
   927                 {
       
   928                 iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNumberEntry );
       
   929                 
       
   930                 // Set Idle background, if still idle ( f.e not incoming call arrived )
       
   931                 if ( iStateMachine->State() == this )
       
   932                     {
       
   933                     // idle screen in the background
       
   934                     SetupIdleScreenInBackgroundL();
       
   935                     }
       
   936                 }
       
   937             }
       
   938         }        
       
   939     }
       
   940 
       
   941 // -----------------------------------------------------------
       
   942 // CPhoneStateIdle::HandleNumberLongKeyPressL()
       
   943 // -----------------------------------------------------------
       
   944 //
       
   945 EXPORT_C void CPhoneStateIdle::HandleNumberLongKeyPressL()
       
   946     {
       
   947     __LOGMETHODSTARTEND(EPhoneControl, 
       
   948         "CPhoneStateIdle::HandleNumberLongKeyPressL( ) ");
       
   949     
       
   950     HBufC* phoneNumber = PhoneNumberFromEntryLC();
       
   951     
       
   952     if ( phoneNumber && IsSpeedDialNumber ( *phoneNumber ) )
       
   953         {
       
   954         SpeedDialL( (*phoneNumber)[0], EDialMethodOneKeyDialing );
       
   955         }
       
   956     
       
   957     CleanupStack::PopAndDestroy( phoneNumber );
       
   958     }
       
   959 
       
   960 // -----------------------------------------------------------
       
   961 // CPhoneStateIdle::IsSpeedDialNumber()
       
   962 // -----------------------------------------------------------
       
   963 //
       
   964 EXPORT_C TBool CPhoneStateIdle::IsSpeedDialNumber( 
       
   965         const TDesC& aNumber ) const
       
   966     {
       
   967     return ( aNumber.Length() == KPhoneDtmfSpeedDialPrefixLength 
       
   968             && aNumber[0] >= KPhoneDtmf1Character 
       
   969             && aNumber[0] <= KPhoneDtmf9Character );
       
   970     }
       
   971 
   833 
   972 // -----------------------------------------------------------
   834 // -----------------------------------------------------------
   973 // CPhoneStateIdle::HandleSendCommandL()
   835 // CPhoneStateIdle::HandleSendCommandL()
   974 // -----------------------------------------------------------
   836 // -----------------------------------------------------------
   975 //
   837 //
   976 EXPORT_C void CPhoneStateIdle::HandleSendCommandL()
   838 EXPORT_C void CPhoneStateIdle::HandleSendCommandL()
   977     {
   839     {
   978     __LOGMETHODSTARTEND(
   840     __LOGMETHODSTARTEND(
   979         EPhoneControl, "CPhoneStateIdle::HandleSendCommandL()" );
   841         EPhoneControl, "CPhoneStateIdle::HandleSendCommandL()" );
   980     
   842     
   981     HandleVoiceCallCommandL( ETrue );
   843     HandleVoiceCallCommandL();
   982     }
   844     }
   983 
   845 
   984 // -----------------------------------------------------------
   846 // -----------------------------------------------------------
   985 // CPhoneStateIdle::LaunchApplicationL()
   847 // CPhoneStateIdle::LaunchApplicationL()
   986 // -----------------------------------------------------------
   848 // -----------------------------------------------------------
  1316     CleanupStack::PopAndDestroy( appParam );
  1178     CleanupStack::PopAndDestroy( appParam );
  1317     return valuesFetched;
  1179     return valuesFetched;
  1318     }
  1180     }
  1319 
  1181 
  1320 // -----------------------------------------------------------
  1182 // -----------------------------------------------------------
  1321 // CPhoneStateIdle::NumberForSpeedDialLocationL
       
  1322 // -----------------------------------------------------------
       
  1323 // 
       
  1324 HBufC* CPhoneStateIdle::NumberForSpeedDialLocationL( 
       
  1325         const TUint& aDigit,
       
  1326         TPhoneCmdParamSpeedDial& aSpeedDialParam ) const
       
  1327     {
       
  1328     // Set the speed dial location from the digit in buffer. Character
       
  1329     // '1' means location 1, and so on.
       
  1330     const TInt location = aDigit - KPhoneDtmf1Character + 1;
       
  1331     aSpeedDialParam.SetLocation( location );
       
  1332     
       
  1333     // Get the number and type from the speed dial location.
       
  1334     HBufC* phoneNumber = HBufC::NewLC( KPhoneNumberEntryBufferSize );
       
  1335     
       
  1336     TPtr ptr( phoneNumber->Des() );
       
  1337     aSpeedDialParam.SetPhoneNumber( &ptr );
       
  1338     iViewCommandHandle->HandleCommandL( 
       
  1339         EPhoneViewGetNumberFromSpeedDialLocation, &aSpeedDialParam );
       
  1340 
       
  1341     CleanupStack::Pop( phoneNumber );
       
  1342     return phoneNumber;
       
  1343     }
       
  1344 
       
  1345 // -----------------------------------------------------------
       
  1346 // CPhoneStateIdle::HandleVoiceCallCommandL()
  1183 // CPhoneStateIdle::HandleVoiceCallCommandL()
  1347 // -----------------------------------------------------------
  1184 // -----------------------------------------------------------
  1348 //
  1185 //
  1349 void CPhoneStateIdle::HandleVoiceCallCommandL( TBool aSendKey )
  1186 void CPhoneStateIdle::HandleVoiceCallCommandL()
  1350     {
  1187     {
  1351     __LOGMETHODSTARTEND(
  1188     __LOGMETHODSTARTEND(
  1352         EPhoneControl, "CPhoneStateIdle::HandleVoiceCallCommandL()" );
  1189         EPhoneControl, "CPhoneStateIdle::HandleVoiceCallCommandL()" );
  1353     
  1190     
  1354     if ( IsNumberEntryUsedL() )
  1191     if ( IsNumberEntryUsedL() )
  1372             SendExitCommandL();
  1209             SendExitCommandL();
  1373             }
  1210             }
  1374         else
  1211         else
  1375 #endif // _DEBUG
  1212 #endif // _DEBUG
  1376             {
  1213             {
  1377             if ( IsSpeedDialNumber( *phoneNumber ) )
  1214             // call the number
  1378                 {
  1215             iStateMachine->PhoneEngineInfo()->SetPhoneNumber( *phoneNumber );
  1379                 // Handle speed dial
  1216             DialVoiceCallL();
  1380                 SpeedDialL( (*phoneNumber)[0], aSendKey ? EDialMethodSendCommand : EDialMethodMenuSelection );
       
  1381                 }
       
  1382             else
       
  1383                 {
       
  1384                 // call the number
       
  1385                 iStateMachine->PhoneEngineInfo()->SetPhoneNumber( *phoneNumber );
       
  1386                 DialVoiceCallL();
       
  1387                 }
       
  1388             
       
  1389             CleanupStack::PopAndDestroy( phoneNumber );
  1217             CleanupStack::PopAndDestroy( phoneNumber );
  1390             }
  1218             }
  1391         }    
  1219         }    
  1392     }
  1220     }
  1393 
  1221