phoneapp/phoneuicontrol/src/cphonestateidle.cpp
branchGCC_SURGE
changeset 51 f39ed5e045e0
parent 22 6bb1b21d2484
parent 46 bc5a64e5bc3c
equal deleted inserted replaced
40:bab96b7ed1a4 51:f39ed5e045e0
    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"
       
    40 #include "tphonecmdparamkeycapture.h"
    41 #include "tphonecmdparamstring.h"
    41 #include "tphonecmdparamstring.h"
    42 #include "tphonecmdparamspeeddial.h"
       
    43 #include "tphonecmdparamboolean.h"
    42 #include "tphonecmdparamboolean.h"
    44 #include "mphonestatemachine.h"
    43 #include "mphonestatemachine.h"
    45 #include "phonestatedefinitions.h"
    44 #include "phonestatedefinitions.h"
    46 #include "tphonecmdparamappinfo.h"
    45 #include "tphonecmdparamappinfo.h"
    47 #include "cphonekeys.h"
    46 #include "cphonekeys.h"
   277                 {
   276                 {
   278                 LaunchApplicationL();
   277                 LaunchApplicationL();
   279                 }
   278                 }
   280             break;
   279             break;
   281             
   280             
   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   
   281 #ifdef RD_INTELLIGENT_TEXT_INPUT   
   299         case EKeyEnter:
   282         case EKeyEnter:
   300             if ( IsNumberEntryVisibleL() )
   283             if ( IsNumberEntryVisibleL() )
   301                 {
   284                 {
   302                 HandleCommandL( EPhoneCmdOptions );
   285                 HandleCommandL( EPhoneCmdOptions );
   359         case MEngineMonitor::EPEMessageIdle:
   342         case MEngineMonitor::EPEMessageIdle:
   360             HandleIdleL( aCallId );
   343             HandleIdleL( aCallId );
   361             break;
   344             break;
   362             
   345             
   363         case MEngineMonitor::EPEMessageInValidEmergencyNumber:                
   346         case MEngineMonitor::EPEMessageInValidEmergencyNumber:                
   364             SendGlobalWarningNoteL( EPhoneEmergencyCallsOnly );                           
   347             SendGlobalWarningNoteL( EPhoneEmergencyCallsOnly, ETrue );                           
   365             break;
   348             break;
   366             
   349             
   367         case MEngineMonitor::EPEMessageValidEmergencyNumber:
   350         case MEngineMonitor::EPEMessageValidEmergencyNumber:
   368             DialVoiceCallL();
   351             DialVoiceCallL();
   369             break; 
   352             break; 
   438     {
   421     {
   439     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateIdle::HandleDialingL( ) ");
   422     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateIdle::HandleDialingL( ) ");
   440 
   423 
   441     BeginTransEffectLC( ENumberEntryClose );
   424     BeginTransEffectLC( ENumberEntryClose );
   442     BeginUiUpdateLC();
   425     BeginUiUpdateLC();
   443     
       
   444     SetNumberEntryVisibilityL(EFalse);
       
   445 
   426 
   446     // Display call setup 
   427     // Display call setup 
   447     DisplayCallSetupL( aCallId );  
   428     DisplayCallSetupL( aCallId );  
   448     
   429     
   449     // Show call setup buttons
   430     // Show call setup buttons
   534                 EPhoneViewMenuBarOpen, &integerParam );
   515                 EPhoneViewMenuBarOpen, &integerParam );
   535             break;
   516             break;
   536             }
   517             }
   537         
   518         
   538         case EPhoneNumberAcqCmdCall:
   519         case EPhoneNumberAcqCmdCall:
   539             HandleVoiceCallCommandL( EFalse );
   520             HandleVoiceCallCommandL();
   540             break;
   521             break;
   541         case EPhoneNumberAcqCmdSendCommand:
   522         case EPhoneNumberAcqCmdSendCommand:
   542             HandleSendCommandL();
   523             HandleSendCommandL();
   543             break;
   524             break;
   544             
   525             
   686             SendExitCommandL();
   667             SendExitCommandL();
   687             }
   668             }
   688         else
   669         else
   689 #endif // _DEBUG
   670 #endif // _DEBUG
   690             {
   671             {
   691             if ( IsSpeedDialNumber( (*phoneNumber) ) )
   672             // call the number
   692                 {
   673             iStateMachine->PhoneEngineInfo()->SetPhoneNumber( *phoneNumber );
   693                 // Handle speed dial
   674             DialMultimediaCallL();
   694                 SpeedDialL( (*phoneNumber)[0], EDialMethodMenuSelection );
       
   695                 }
       
   696             else
       
   697                 {
       
   698                 // call the number
       
   699                 iStateMachine->PhoneEngineInfo()->SetPhoneNumber( *phoneNumber );
       
   700                 DialMultimediaCallL();
       
   701                 }
       
   702 
   675 
   703             CleanupStack::PopAndDestroy( phoneNumber );
   676             CleanupStack::PopAndDestroy( phoneNumber );
   704             }
   677             }
   705         }       
   678         }       
   706     }
   679     }
   718     iViewCommandHandle->ExecuteCommandL( EPhoneViewMenuBarClose );
   691     iViewCommandHandle->ExecuteCommandL( EPhoneViewMenuBarClose );
   719 
   692 
   720     // Remove any phone dialogs if they are displayed
   693     // Remove any phone dialogs if they are displayed
   721     iViewCommandHandle->ExecuteCommandL( EPhoneViewRemovePhoneDialogs );
   694     iViewCommandHandle->ExecuteCommandL( EPhoneViewRemovePhoneDialogs );
   722 
   695 
       
   696     TPhoneCmdParamKeyCapture captureParam;
       
   697     captureParam.SetKeyCode( EKeyNo );
       
   698     iViewCommandHandle->ExecuteCommand( EPhoneViewStartCapturingKey, &captureParam );
       
   699     
   723     // Capture keys when there is an incoming call
   700     // Capture keys when there is an incoming call
   724     CaptureKeysDuringCallNotificationL( ETrue );
   701     CaptureKeysDuringCallNotificationL( ETrue );
   725 
   702 
   726     // Indicate that the Phone needs to be sent to the background if
   703     // Indicate that the Phone needs to be sent to the background if
   727     // an application other than the top application is in the foreground
   704     // an application other than the top application is in the foreground
   762     __ASSERT_DEBUG( aCallId > KErrNotFound, Panic( EPhoneCtrlParameterNotInitialized ) );
   739     __ASSERT_DEBUG( aCallId > KErrNotFound, Panic( EPhoneCtrlParameterNotInitialized ) );
   763     
   740     
   764     // Close menu bar, if it is displayed
   741     // Close menu bar, if it is displayed
   765     iViewCommandHandle->ExecuteCommandL( EPhoneViewMenuBarClose );
   742     iViewCommandHandle->ExecuteCommandL( EPhoneViewMenuBarClose );
   766 
   743 
       
   744     TPhoneCmdParamKeyCapture captureParam;
       
   745     captureParam.SetKeyCode( EKeyNo );
       
   746     iViewCommandHandle->ExecuteCommand( EPhoneViewStartCapturingKey, &captureParam );
       
   747     
   767     // Capture keys when the phone is dialling
   748     // Capture keys when the phone is dialling
   768     CaptureKeysDuringCallNotificationL( ETrue );
   749     CaptureKeysDuringCallNotificationL( ETrue );
   769 
   750 
   770     // Indicate that the Phone needs to be sent to the background if
   751     // Indicate that the Phone needs to be sent to the background if
   771     // an application other than the top application is in the foreground
   752     // an application other than the top application is in the foreground
   856     iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNumberEntry );    
   837     iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNumberEntry );    
   857 
   838 
   858     // Remove all notes and dialogs
   839     // Remove all notes and dialogs
   859     iViewCommandHandle->ExecuteCommandL( EPhoneViewRemovePhoneDialogs );    
   840     iViewCommandHandle->ExecuteCommandL( EPhoneViewRemovePhoneDialogs );    
   860     }
   841     }
   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 
   842 
   972 // -----------------------------------------------------------
   843 // -----------------------------------------------------------
   973 // CPhoneStateIdle::HandleSendCommandL()
   844 // CPhoneStateIdle::HandleSendCommandL()
   974 // -----------------------------------------------------------
   845 // -----------------------------------------------------------
   975 //
   846 //
   976 EXPORT_C void CPhoneStateIdle::HandleSendCommandL()
   847 EXPORT_C void CPhoneStateIdle::HandleSendCommandL()
   977     {
   848     {
   978     __LOGMETHODSTARTEND(
   849     __LOGMETHODSTARTEND(
   979         EPhoneControl, "CPhoneStateIdle::HandleSendCommandL()" );
   850         EPhoneControl, "CPhoneStateIdle::HandleSendCommandL()" );
   980     
   851     
   981     HandleVoiceCallCommandL( ETrue );
   852     HandleVoiceCallCommandL();
   982     }
   853     }
   983 
   854 
   984 // -----------------------------------------------------------
   855 // -----------------------------------------------------------
   985 // CPhoneStateIdle::LaunchApplicationL()
   856 // CPhoneStateIdle::LaunchApplicationL()
   986 // -----------------------------------------------------------
   857 // -----------------------------------------------------------
  1155 // CPhoneStateIdle::ChangeMannerModeL
  1026 // CPhoneStateIdle::ChangeMannerModeL
  1156 // ---------------------------------------------------------
  1027 // ---------------------------------------------------------
  1157 //
  1028 //
  1158 void CPhoneStateIdle::ChangeMannerModeL()
  1029 void CPhoneStateIdle::ChangeMannerModeL()
  1159     {
  1030     {
  1160     __LOGMETHODSTARTEND( EPhoneControl, "CPhoneStateIdle::ChangeMannerModeL( ) ");
  1031     __LOGMETHODSTARTEND( EPhoneControl, "CPhoneStateIdle::ChangeMannerModeL( ) ");         
  1161 
       
  1162     // Get the profile information
       
  1163     const TInt profileId = 
       
  1164         iStateMachine->PhoneEngineInfo()->ProfileId();
       
  1165     TInt newProfile;
       
  1166     
       
  1167     if ( profileId == EProfileSilentId )
       
  1168         {
       
  1169         newProfile = EProfileGeneralId;
       
  1170         }
       
  1171     else
       
  1172         {
       
  1173         newProfile = EProfileSilentId;    
       
  1174         }
       
  1175         
       
  1176     if ( !iEngine )
       
  1177         {
       
  1178         iEngine = CreateProfileEngineL();
       
  1179         }
       
  1180 
       
  1181     iEngine->SetActiveProfileL( newProfile );
       
  1182     
       
  1183     // Stop playing DTMF tone
       
  1184     iStateMachine->SendPhoneEngineMessage( MPEPhoneModel::EPEMessageEndDTMF ); 
       
  1185     
       
  1186     if ( !iOnScreenDialer )
       
  1187         {
       
  1188         // Remove the number entry
       
  1189         iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNumberEntry );        
       
  1190         }
       
  1191     else
       
  1192         {
       
  1193         NumberEntryClearL();
       
  1194         }
       
  1195     
       
  1196     iCbaManager->UpdateCbaL( EPhoneEmptyCBA );
       
  1197  
       
  1198      // Bring Idle app to the top app
       
  1199     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetIdleTopApplication );            
       
  1200     }
  1032     }
  1201 
  1033 
  1202 // -----------------------------------------------------------
  1034 // -----------------------------------------------------------
  1203 // CPhoneStateIdle::DialMultimediaCallL
  1035 // CPhoneStateIdle::DialMultimediaCallL
  1204 // -----------------------------------------------------------
  1036 // -----------------------------------------------------------
  1316     CleanupStack::PopAndDestroy( appParam );
  1148     CleanupStack::PopAndDestroy( appParam );
  1317     return valuesFetched;
  1149     return valuesFetched;
  1318     }
  1150     }
  1319 
  1151 
  1320 // -----------------------------------------------------------
  1152 // -----------------------------------------------------------
  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()
  1153 // CPhoneStateIdle::HandleVoiceCallCommandL()
  1347 // -----------------------------------------------------------
  1154 // -----------------------------------------------------------
  1348 //
  1155 //
  1349 void CPhoneStateIdle::HandleVoiceCallCommandL( TBool aSendKey )
  1156 void CPhoneStateIdle::HandleVoiceCallCommandL()
  1350     {
  1157     {
  1351     __LOGMETHODSTARTEND(
  1158     __LOGMETHODSTARTEND(
  1352         EPhoneControl, "CPhoneStateIdle::HandleVoiceCallCommandL()" );
  1159         EPhoneControl, "CPhoneStateIdle::HandleVoiceCallCommandL()" );
  1353     
  1160     
  1354     if ( IsNumberEntryUsedL() )
  1161     if ( IsNumberEntryUsedL() )
  1372             SendExitCommandL();
  1179             SendExitCommandL();
  1373             }
  1180             }
  1374         else
  1181         else
  1375 #endif // _DEBUG
  1182 #endif // _DEBUG
  1376             {
  1183             {
  1377             if ( IsSpeedDialNumber( *phoneNumber ) )
  1184             // call the number
  1378                 {
  1185             iStateMachine->PhoneEngineInfo()->SetPhoneNumber( *phoneNumber );
  1379                 // Handle speed dial
  1186             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 );
  1187             CleanupStack::PopAndDestroy( phoneNumber );
  1390             }
  1188             }
  1391         }    
  1189         }    
  1392     }
  1190     }
  1393 
  1191