phoneapp/phoneuicontrol/src/cphonestate.cpp
changeset 56 5bcb308bd24d
parent 46 bc5a64e5bc3c
child 72 c76a0b1755b9
equal deleted inserted replaced
46:bc5a64e5bc3c 56:5bcb308bd24d
   215             //SendGlobalInfoNoteL( EPhoneWaitingText, ETrue );
   215             //SendGlobalInfoNoteL( EPhoneWaitingText, ETrue );
   216             break;
   216             break;
   217 
   217 
   218         case MEngineMonitor::EPEMessageProfileChanged:
   218         case MEngineMonitor::EPEMessageProfileChanged:
   219             {
   219             {
   220             TPhoneCmdParamBoolean keypadVolumeParam;
       
   221             if ( iStateMachine->PhoneEngineInfo()->KeypadVolume() == 0 )
       
   222                 {
       
   223                 iViewCommandHandle->ExecuteCommandL( EPhoneViewKeypadAudioDisabled );
       
   224                 }
       
   225             else
       
   226                 {
       
   227                 iViewCommandHandle->ExecuteCommandL( EPhoneViewKeypadAudioEnabled );
       
   228                 }
       
   229             UpdateProfileDisplayL();
       
   230             }
   220             }
   231             break;
   221             break;
   232 
   222 
   233         case MEngineMonitor::EPEMessageRemoteTerminated:
   223         case MEngineMonitor::EPEMessageRemoteTerminated:
   234             // Close menu bar, if it is displayed, for call ending note
       
   235             iViewCommandHandle->ExecuteCommandL( EPhoneViewMenuBarClose );
       
   236             /* Flow through */
   224             /* Flow through */
   237         case MEngineMonitor::EPEMessageDisconnecting:
   225         case MEngineMonitor::EPEMessageDisconnecting:
   238             HandleDisconnectingL( aCallId );
   226             HandleDisconnectingL( aCallId );
   239             break;
   227             break;
   240 
   228 
   511                  iPreviousSimState == EPESimNotReady )
   499                  iPreviousSimState == EPESimNotReady )
   512                 {
   500                 {
   513                 __PHONELOG( EBasic, EPhoneControl, "SIM card was removed" );
   501                 __PHONELOG( EBasic, EPhoneControl, "SIM card was removed" );
   514 
   502 
   515                 TPhoneCmdParamGlobalNote globalNoteParam;
   503                 TPhoneCmdParamGlobalNote globalNoteParam;
   516                 globalNoteParam.SetType( EAknGlobalInformationNote );
   504                 globalNoteParam.SetType( EPhoneMessageBoxInformation );
   517                 globalNoteParam.SetTone( EAvkonSIDNoSound );
       
   518 
   505 
   519                 globalNoteParam.SetTextResourceId(
   506                 globalNoteParam.SetTextResourceId(
   520                     CPhoneMainResourceResolver::Instance()->
   507                     CPhoneMainResourceResolver::Instance()->
   521                     ResolveResourceID( EPhoneSimRemoved ) );
   508                     ResolveResourceID( EPhoneSimRemoved ) );
   522 
   509 
   605 // -----------------------------------------------------------------------------
   592 // -----------------------------------------------------------------------------
   606 //
   593 //
   607 TBool CPhoneState::IsTouchDTmfDialerOn() const
   594 TBool CPhoneState::IsTouchDTmfDialerOn() const
   608     {
   595     {
   609     TBool status( EFalse );
   596     TBool status( EFalse );
   610     if ( IsOnScreenDialerSupported() )
       
   611         {
       
   612         TBool isDialerVisible( EFalse );
       
   613         TRAP_IGNORE( isDialerVisible = IsDTMFEditorVisibleL() );
       
   614 
       
   615         if ( isDialerVisible )
       
   616             {
       
   617             status = ETrue;
       
   618             }
       
   619         }
       
   620     return status;
   597     return status;
   621     }
   598     }
   622 // -----------------------------------------------------------------------------
   599 // -----------------------------------------------------------------------------
   623 // CPhoneState::SendDtmfKeyEventL
   600 // CPhoneState::SendDtmfKeyEventL
   624 // send dtmf event when,
   601 // send dtmf event when,
   630 void CPhoneState::SendDtmfKeyEventL( const TKeyEvent& aKeyEvent,
   607 void CPhoneState::SendDtmfKeyEventL( const TKeyEvent& aKeyEvent,
   631                TEventCode aEventCode  )
   608                TEventCode aEventCode  )
   632     {
   609     {
   633 
   610 
   634     if ( !IsTouchDTmfDialerOn()
   611     if ( !IsTouchDTmfDialerOn()
   635         && !IsAnyQueryActiveL()
   612         && !IsAnyQueryActiveL() )
   636         && !IsMenuBarVisibleL() )
       
   637         {
   613         {
   638         // Send the key event to the phone engine.
   614         // Send the key event to the phone engine.
   639         SendKeyEventL( aKeyEvent, aEventCode );
   615         SendKeyEventL( aKeyEvent, aEventCode );
   640         }
   616         }
   641     }
   617     }
   642 
   618 
   643 // -----------------------------------------------------------------------------
   619 // -----------------------------------------------------------------------------
   644 // CPhoneState::IsKeyEventFurtherProcessed
   620 // CPhoneState::IsKeyEventFurtherProcessed
   645 // -----------------------------------------------------------------------------
   621 // -----------------------------------------------------------------------------
   646 //
   622 //
   647 TBool CPhoneState::IsKeyEventFurtherProcessedL( const TKeyEvent& aKeyEvent ) const
   623 TBool CPhoneState::IsKeyEventFurtherProcessedL( const TKeyEvent& /*aKeyEvent*/ ) const
   648     {
   624     {
   649     // While being in some special keyboard mode (Full Screen&mini QWERTY,
       
   650     // handwriting mode) FEP sends only EEventKey -event and thus manual
       
   651     // DTMFs can not be played with the user specified tone lengths. Also,
       
   652     // in general, DTMFs are tried to play only in numeric mode.
       
   653     TBool numericMode = iViewCommandHandle->HandleCommandL(
       
   654       EPhoneViewIsNumberEntryNumericMode ) == EPhoneViewResponseSuccess;
       
   655 
       
   656     if ( ( aKeyEvent.iModifiers & EModifierSpecial ) != 0 || !numericMode )
       
   657         {
       
   658         return EFalse;
       
   659         }
       
   660 
       
   661     return ETrue;
   625     return ETrue;
   662     }
   626     }
   663 
   627 
   664 // -----------------------------------------------------------
   628 // -----------------------------------------------------------
   665 // CPhoneState::HandleErrorL
   629 // CPhoneState::HandleErrorL
   677 
   641 
   678     __PHONELOG1( EBasic, EPhoneControl,
   642     __PHONELOG1( EBasic, EPhoneControl,
   679         "PhoneUIControl: CPhoneState::HandleErrorL - aErrorInfo.iCallId =%d ",
   643         "PhoneUIControl: CPhoneState::HandleErrorL - aErrorInfo.iCallId =%d ",
   680         aErrorInfo.iCallId );
   644         aErrorInfo.iCallId );
   681 
   645 
   682 
       
   683     // Sets touch buttons to correct status if error has occured.
       
   684     if ( FeatureManager::FeatureSupported( KFeatureIdTouchCallHandling ) )
       
   685         {
       
   686         iViewCommandHandle->ExecuteCommand( EPhoneResetTouchButtons );
       
   687         }
       
   688 
   646 
   689     // Do the common error handling (display proper notes etc)
   647     // Do the common error handling (display proper notes etc)
   690     CPhoneMainErrorMessagesHandler::Instance()->ShowErrorSpecificNoteL( aErrorInfo );
   648     CPhoneMainErrorMessagesHandler::Instance()->ShowErrorSpecificNoteL( aErrorInfo );
   691 
   649 
   692     switch( aErrorInfo.iErrorCode )
   650     switch( aErrorInfo.iErrorCode )
   863 // -----------------------------------------------------------
   821 // -----------------------------------------------------------
   864 //
   822 //
   865 EXPORT_C void CPhoneState::HandleDisconnectingL( TInt aCallId )
   823 EXPORT_C void CPhoneState::HandleDisconnectingL( TInt aCallId )
   866     {
   824     {
   867     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::HandleDisconnectingL( ) ");
   825     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::HandleDisconnectingL( ) ");
   868     // If there is no call in connected state then EPhoneDtmfTextQuery and EPhoneDtmfListQueryDialog
       
   869     // must be dismmissed from UI, therefore we must set EPhoneViewSetNoConnectedCalls to ETrue this
       
   870     // way we can ensure that CPhoneQueryController doesnt relaunch EPhoneDtmfListQueryDialog.
       
   871     if ( !IsAnyConnectedCalls() )
       
   872         {
       
   873         TPhoneCmdParamBoolean booleanParam;
       
   874         booleanParam.SetBoolean(ETrue);
       
   875         iViewCommandHandle->ExecuteCommandL( EPhoneViewSetNoConnectedCalls, &booleanParam );
       
   876         }
       
   877 
   826 
   878     TPhoneCmdParamCallHeaderData callHeaderParam;
   827     TPhoneCmdParamCallHeaderData callHeaderParam;
   879     callHeaderParam.SetCallState( EPEStateDisconnecting );
   828     callHeaderParam.SetCallState( EPEStateDisconnecting );
   880 
   829 
   881     TBuf<KPhoneCallHeaderLabelMaxLength> labelText( KNullDesC );
   830     TBuf<KPhoneCallHeaderLabelMaxLength> labelText( KNullDesC );
   989             }
   938             }
   990         }
   939         }
   991     }
   940     }
   992 
   941 
   993 // -----------------------------------------------------------
   942 // -----------------------------------------------------------
   994 // CPhoneState::IsNoteVisibleL
       
   995 // -----------------------------------------------------------
       
   996 //
       
   997 EXPORT_C TBool CPhoneState::IsNoteVisibleL()
       
   998     {
       
   999     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::IsNoteVisibleL( ) ");
       
  1000     TPhoneCmdParamBoolean booleanParam;
       
  1001     iViewCommandHandle->ExecuteCommandL(
       
  1002         EPhoneViewGetIsNoteVisible, &booleanParam );
       
  1003     return booleanParam.Boolean();
       
  1004     }
       
  1005 
       
  1006 // -----------------------------------------------------------
       
  1007 // CPhoneState::IsMenuBarVisibleL
       
  1008 // -----------------------------------------------------------
       
  1009 //
       
  1010 EXPORT_C TBool CPhoneState::IsMenuBarVisibleL() const
       
  1011     {
       
  1012     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::IsMenuBarVisibleL( ) ");
       
  1013     return iViewCommandHandle->HandleCommandL(
       
  1014         EPhoneViewIsMenuBarVisible ) ==
       
  1015         EPhoneViewResponseSuccess;
       
  1016     }
       
  1017 
       
  1018 // -----------------------------------------------------------
       
  1019 // CPhoneState::HandleNumericKeyEventL
   943 // CPhoneState::HandleNumericKeyEventL
  1020 // -----------------------------------------------------------
   944 // -----------------------------------------------------------
  1021 //
   945 //
  1022 EXPORT_C void CPhoneState::HandleNumericKeyEventL(
   946 EXPORT_C void CPhoneState::HandleNumericKeyEventL(
  1023     const TKeyEvent& aKeyEvent,
   947     const TKeyEvent& /*aKeyEvent*/,
  1024     TEventCode aEventCode )
   948     TEventCode /*aEventCode*/ )
  1025     {
   949     {
  1026     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::HandleNumericKeyEventL( ) ");
   950     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::HandleNumericKeyEventL( ) ");
  1027 
       
  1028     TBool numberEntryUsed = IsNumberEntryUsedL();
       
  1029 
       
  1030     if ( numberEntryUsed && ( aKeyEvent.iRepeats == 0 ||
       
  1031               aKeyEvent.iScanCode == EStdKeyBackspace ||
       
  1032               aKeyEvent.iScanCode ==EStdKeyLeftArrow  ||
       
  1033               aKeyEvent.iScanCode ==EStdKeyRightArrow ))
       
  1034         {
       
  1035         // Number entry exists but may be hidden
       
  1036         KeyEventForExistingNumberEntryL( aKeyEvent, aEventCode );
       
  1037         }
       
  1038 
   951 
  1039     }
   952     }
  1040 
   953 
  1041 // -----------------------------------------------------------------------------
   954 // -----------------------------------------------------------------------------
  1042 // CPhoneState::IsAnyQueryActiveL
   955 // CPhoneState::IsAnyQueryActiveL
  1174         }
  1087         }
  1175     }
  1088     }
  1176 
  1089 
  1177 // <------------------------------ SYSTEM EVENTS ----------------------------->
  1090 // <------------------------------ SYSTEM EVENTS ----------------------------->
  1178 
  1091 
  1179 // -----------------------------------------------------------
       
  1180 // CPhoneState::DynInitMenuPaneL
       
  1181 // -----------------------------------------------------------
       
  1182 //
       
  1183 EXPORT_C void CPhoneState::DynInitMenuPaneL(
       
  1184     TInt aResourceId,
       
  1185     CEikMenuPane* aMenuPane )
       
  1186     {
       
  1187     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::DynInitMenuPaneL( ) ");
       
  1188     __ASSERT_DEBUG( aMenuPane && aResourceId,
       
  1189         Panic( EPhoneCtrlParameterNotInitialized ) );
       
  1190 
       
  1191     // Save the number of digits in the number entry before processing
       
  1192     // the menu pane
       
  1193     if ( IsNumberEntryUsedL() )
       
  1194         {
       
  1195         TPhoneCmdParamBoolean serviceCodeParam;
       
  1196             serviceCodeParam.SetBoolean(
       
  1197             iStateMachine->PhoneEngineInfo()->PhoneNumberIsServiceCode() );
       
  1198         iViewCommandHandle->ExecuteCommandL( EPhoneViewSetServiceCodeFlag,
       
  1199             &serviceCodeParam );
       
  1200         }
       
  1201 
       
  1202     // Process the menu pane
       
  1203     TPhoneCmdParamDynMenu dynMenuPane;
       
  1204     dynMenuPane.SetResourceId( aResourceId );
       
  1205     dynMenuPane.SetDynMenu( aMenuPane );
       
  1206     iViewCommandHandle->ExecuteCommandL( EPhoneViewMenuPane, &dynMenuPane );
       
  1207 
       
  1208     if ( iCustomization )
       
  1209         {
       
  1210         // Menu pane is customized after default items are decided
       
  1211         iCustomization->CustomizeMenuPaneL(aResourceId, aMenuPane);
       
  1212         }
       
  1213     }
       
  1214 
       
  1215 // -----------------------------------------------------------
       
  1216 // CPhoneState::DynInitMenuBarL
       
  1217 // -----------------------------------------------------------
       
  1218 //
       
  1219 EXPORT_C void CPhoneState::DynInitMenuBarL(
       
  1220     TInt aResourceId,
       
  1221     CEikMenuBar* aMenuBar )
       
  1222     {
       
  1223     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::DynInitMenuBarL( ) ");
       
  1224     __ASSERT_DEBUG( aMenuBar && aResourceId,
       
  1225         Panic( EPhoneCtrlParameterNotInitialized ) );
       
  1226 
       
  1227     TPhoneCmdParamDynMenu dynMenuBar;
       
  1228     dynMenuBar.SetResourceId( aResourceId );
       
  1229     dynMenuBar.SetDynMenu( aMenuBar );
       
  1230     iViewCommandHandle->ExecuteCommandL( EPhoneViewMenuBar, &dynMenuBar );
       
  1231 
       
  1232     if ( iCustomization )
       
  1233         {
       
  1234         // Menu bar is customized after default items are decided
       
  1235         iCustomization->CustomizeMenuBarL(aResourceId, aMenuBar);
       
  1236         }
       
  1237 
       
  1238     }
       
  1239 
  1092 
  1240 // -----------------------------------------------------------
  1093 // -----------------------------------------------------------
  1241 // CPhoneState::HandleSystemEventL
  1094 // CPhoneState::HandleSystemEventL
  1242 // -----------------------------------------------------------
  1095 // -----------------------------------------------------------
  1243 //
  1096 //
  1277     {
  1130     {
  1278     // Notify that this method is called always when Idle is brought to foreground
  1131     // Notify that this method is called always when Idle is brought to foreground
  1279     // See implementation in CPhoneAppUI::HandleWsEventL
  1132     // See implementation in CPhoneAppUI::HandleWsEventL
  1280 
  1133 
  1281     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::HandlePhoneFocusLostEventL( ) ");
  1134     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::HandlePhoneFocusLostEventL( ) ");
  1282     // Phone app focus lost -> close Dtmf dialer when visible
       
  1283     if ( IsOnScreenDialerSupported() && IsDTMFEditorVisibleL() )
       
  1284         {
       
  1285         CloseDTMFEditorL();
       
  1286         }
       
  1287     else if ( IsOnScreenDialerSupported() && IsCustomizedDialerVisibleL() )
       
  1288         {
       
  1289         CloseCustomizedDialerL();
       
  1290         }
       
  1291     }
  1135     }
  1292 // ---------------------------------------------------------
  1136 // ---------------------------------------------------------
  1293 // CPhoneState::HandleIdleForegroundEventL
  1137 // CPhoneState::HandleIdleForegroundEventL
  1294 // ---------------------------------------------------------
  1138 // ---------------------------------------------------------
  1295 //
  1139 //
  1341             "CPhoneState::HandlePropertyChangedL - aCategory= %d", aCategory  );
  1185             "CPhoneState::HandlePropertyChangedL - aCategory= %d", aCategory  );
  1342     __PHONELOG1( EBasic, EPhoneControl,
  1186     __PHONELOG1( EBasic, EPhoneControl,
  1343             "CPhoneState::HandlePropertyChangedL - aKey= %d", aKey  );
  1187             "CPhoneState::HandlePropertyChangedL - aKey= %d", aKey  );
  1344     __PHONELOG1( EBasic, EPhoneControl,
  1188     __PHONELOG1( EBasic, EPhoneControl,
  1345             "CPhoneState::HandlePropertyChangedL - aValue= %d", aValue  );
  1189             "CPhoneState::HandlePropertyChangedL - aValue= %d", aValue  );
  1346     if ( aCategory == KPSUidCtsyCallInformation )
  1190     if ( aCategory == KPSUidTelInformation
  1347         {
       
  1348         // Call state event
       
  1349         if ( aKey == KCTsyCallState )
       
  1350             {
       
  1351             // Update the incall indicator
       
  1352             UpdateIncallIndicatorL( aValue );
       
  1353             }
       
  1354         }
       
  1355 
       
  1356     // Telephony information category
       
  1357     else if ( aCategory == KPSUidTelInformation
       
  1358               && SimState() == EPESimUsable )
  1191               && SimState() == EPESimUsable )
  1359         {
  1192         {
  1360         // Telephony display event
  1193         // Telephony display event
  1361         if ( aKey == KTelDisplayInfo )
  1194         if ( aKey == KTelDisplayInfo )
  1362             {
  1195             {
  1412     return iViewCommandHandle->HandleCommandL(
  1245     return iViewCommandHandle->HandleCommandL(
  1413         EPhoneViewGetTopApplicationIsDisplayedStatus ) ==
  1246         EPhoneViewGetTopApplicationIsDisplayedStatus ) ==
  1414         EPhoneViewResponseSuccess;
  1247         EPhoneViewResponseSuccess;
  1415     }
  1248     }
  1416 
  1249 
  1417 // -----------------------------------------------------------
       
  1418 // CPhoneState::TitlePaneIsVisibleL
       
  1419 // -----------------------------------------------------------
       
  1420 //
       
  1421 TBool CPhoneState::TitlePaneIsVisibleL() const
       
  1422     {
       
  1423     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::TitlePaneIsVisibleL( ) ");
       
  1424     return iViewCommandHandle->HandleCommandL(
       
  1425         EPhoneViewGetTitlePaneIsVisibleStatus ) ==
       
  1426         EPhoneViewResponseSuccess;
       
  1427     }
       
  1428 
       
  1429 // <---------------------------- MENU AND CBA EVENTS ------------------------->
  1250 // <---------------------------- MENU AND CBA EVENTS ------------------------->
  1430 
  1251 
  1431 EXPORT_C TBool CPhoneState::HandleCommandL( TInt aCommand )
  1252 EXPORT_C TBool CPhoneState::HandleCommandL( TInt aCommand )
  1432     {
  1253     {
  1433     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::HandleCommandL( ) ");
  1254     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::HandleCommandL( ) ");
  1434     TBool commandStatus = ETrue;
  1255     TBool commandStatus = ETrue;
  1435     switch( aCommand )
  1256     switch( aCommand )
  1436         {
  1257         {
  1437         case EPhoneEmergencyCmdExit:
  1258         case EPhoneEmergencyCmdExit:
  1438             {
  1259             {
  1439             //cancel emergency mode.
       
  1440             TPhoneCmdParamBoolean booleanParam;
       
  1441             booleanParam.SetBoolean( EFalse );
       
  1442             iViewCommandHandle->ExecuteCommandL( EPhoneViewSetRetrictedDialer,&booleanParam );
       
  1443             }
  1260             }
  1444             // this should be bypasses?
  1261             // this should be bypasses?
  1445         case EPhoneDialerCallHandling:
  1262         case EPhoneDialerCallHandling:
  1446         case EPhoneCmdBack:
  1263         case EPhoneCmdBack:
  1447             BeginTransEffectLC( ENumberEntryClose );
       
  1448             // Remove number entry from screen
  1264             // Remove number entry from screen
  1449             iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNumberEntry );
  1265             iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNumberEntry );
  1450             // Do state-specific behaviour if number entry is cleared
  1266             // Do state-specific behaviour if number entry is cleared
  1451             HandleNumberEntryClearedL();
  1267             HandleNumberEntryClearedL();
  1452             EndTransEffect();
       
  1453             break;
  1268             break;
  1454 
  1269 
  1455         case EPhoneDialerCmdTouchInput:
  1270         case EPhoneDialerCmdTouchInput:
  1456             OpenVkbL();
       
  1457             break;
  1271             break;
  1458 
  1272 
  1459         case EPhoneNumberAcqCmdSendMessage:
  1273         case EPhoneNumberAcqCmdSendMessage:
  1460             // Open the mms editor
       
  1461             iViewCommandHandle->ExecuteCommandL(
       
  1462                 EPhoneViewSendMessage );
       
  1463             if ( !IsOnScreenDialerSupported() )
       
  1464                 {
       
  1465                 // Remove number entry from screen
       
  1466                 iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNumberEntry );
       
  1467                 // Do state-specific behaviour if number entry is cleared
       
  1468                 HandleNumberEntryClearedL();
       
  1469                 }
       
  1470             break;
  1274             break;
  1471 
  1275 
  1472         case EPhoneNumberAcqCmdSave:
  1276         case EPhoneNumberAcqCmdSave:
  1473             // Open Create contact
       
  1474             iViewCommandHandle->ExecuteCommandL(
       
  1475                 EPhoneViewAddContact );
       
  1476             break;
  1277             break;
  1477 
  1278 
  1478         case EPhoneNumberAcqCmdAddToName:
  1279         case EPhoneNumberAcqCmdAddToName:
  1479             // Open the message editor
       
  1480             iViewCommandHandle->ExecuteCommandL(
       
  1481                 EPhoneViewUpdateContact );
       
  1482             break;
  1280             break;
  1483 
  1281 
  1484         case EPhoneNumberAcqCmdAddToContacts:
  1282         case EPhoneNumberAcqCmdAddToContacts:
  1485             {
  1283             {
  1486             if ( IsOnScreenDialerSupported() )
  1284             if ( IsOnScreenDialerSupported() )
  1549                  aCommand == EPhoneInCallCmdBtHandsfree );
  1347                  aCommand == EPhoneInCallCmdBtHandsfree );
  1550             break;
  1348             break;
  1551 
  1349 
  1552         case EPhoneInCallCmdActivatEPhonebook:
  1350         case EPhoneInCallCmdActivatEPhonebook:
  1553             {
  1351             {
  1554             // Launch Phonebook application
       
  1555             TPhoneCmdParamAppInfo appInfoParam;
       
  1556             appInfoParam.SetAppUid( KPhoneUidAppPhonebook );
       
  1557             iViewCommandHandle->ExecuteCommandL(
       
  1558                 EPhoneViewActivateApp, &appInfoParam );
       
  1559             }
  1352             }
  1560             break;
  1353             break;
  1561 
  1354 
  1562         case EPhoneNumberAcqSecurityDialer:
  1355         case EPhoneNumberAcqSecurityDialer:
  1563             {
  1356             {
  1564             if ( IsOnScreenDialerSupported() && !IsNumberEntryUsedL() )
  1357 
  1565                 {
       
  1566                 iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNote );
       
  1567                 TPhoneCmdParamBoolean visibleMode;
       
  1568                 visibleMode.SetBoolean( ETrue );
       
  1569                 iViewCommandHandle->ExecuteCommandL(
       
  1570                             EPhoneViewSetStatusPaneVisible, &visibleMode );
       
  1571 
       
  1572 
       
  1573                 // Set emergency CBA, empty - exit
       
  1574                 iCbaManager->SetCbaL( EPhoneEmergencyModeNoteCBA );
       
  1575 
       
  1576                 // Set dialer to restricted mode.
       
  1577                 TPhoneCmdParamBoolean booleanParam;
       
  1578                 booleanParam.SetBoolean( ETrue );
       
  1579                 iViewCommandHandle->ExecuteCommandL( EPhoneViewSetRetrictedDialer,&booleanParam );
       
  1580 
       
  1581                 NumberEntryManagerL()->CreateNumberEntryL();
       
  1582                 }
       
  1583             }
  1358             }
  1584             break;
  1359             break;
  1585 
  1360 
  1586         case EPhoneDialerCmdContacts:
  1361         case EPhoneDialerCmdContacts:
  1587             {
  1362             {
  1588             // Launch Phonebook application
  1363             }
  1589             TPhoneCmdParamAppInfo appInfoParam;
  1364             break;
  1590             appInfoParam.SetAppUid( KPhoneUidAppPhonebook );
  1365 
  1591             iViewCommandHandle->ExecuteCommandL(
       
  1592                 EPhoneViewActivateApp, &appInfoParam );
       
  1593             }
       
  1594             break;
       
  1595 
       
  1596         case EPhoneViewYesSingleItemFetch:
       
  1597             {
       
  1598             if ( IsOnScreenDialerSupported() )
       
  1599                 {
       
  1600                 TBuf<KPhoneNumberEntryBufferSize> fetchContent;
       
  1601                 fetchContent = iViewCommandHandle->FetchContent();
       
  1602                 if ( fetchContent.Length() )
       
  1603                     {
       
  1604                     iViewCommandHandle->ExecuteCommandL(
       
  1605                                             EPhoneViewSetNumberEntryContent,
       
  1606                                             0,
       
  1607                                             fetchContent );
       
  1608 
       
  1609                     CallFromNumberEntryL();
       
  1610                     }
       
  1611                 }
       
  1612             }
       
  1613             break;
       
  1614         case EPhoneNumberAcqCmdToggleNeAlphaMode:
  1366         case EPhoneNumberAcqCmdToggleNeAlphaMode:
  1615         case EPhoneNumberAcqCmdToggleNeNumericMode:
  1367         case EPhoneNumberAcqCmdToggleNeNumericMode:
  1616             {
  1368             {
  1617             // Toggle mode
  1369 
  1618             NumberEntryManagerL()->NumberEntryToggleAlphaNumericModeL();
       
  1619             }
  1370             }
  1620             break;
  1371             break;
  1621 
  1372 
  1622         case EPhoneCmdYesVideoFailedNoMemorySwitchToVoice:
  1373         case EPhoneCmdYesVideoFailedNoMemorySwitchToVoice:
  1623             DialVoiceCallL();
  1374             DialVoiceCallL();
  1648             // value to control (second parameter set false).
  1399             // value to control (second parameter set false).
  1649             ChangeAudioVolumeL( GetVolumeLevel(), EFalse );
  1400             ChangeAudioVolumeL( GetVolumeLevel(), EFalse );
  1650             }
  1401             }
  1651             break;
  1402             break;
  1652 
  1403 
  1653         case EPhoneDialerCmdHelp:
       
  1654             if ( FeatureManager::FeatureSupported( KFeatureIdHelp ) )
       
  1655                 {
       
  1656                 TPtrC contextName;
       
  1657                 contextName.Set( KDATA_DIALER_HLP_MAIN() );
       
  1658                 iViewCommandHandle->ExecuteCommandL(
       
  1659                     EPhoneViewLaunchHelpApplication, 0, contextName );
       
  1660                 }
       
  1661             break;
       
  1662 
       
  1663         case EPhoneCmdVideoCallOutOfMemory:
  1404         case EPhoneCmdVideoCallOutOfMemory:
  1664             ShowVideoCallOutOfMemoryNoteL();
  1405             ShowVideoCallOutOfMemoryNoteL();
  1665             DisconnectCallL();
  1406             DisconnectCallL();
  1666             break;
  1407             break;
  1667             
  1408             
  1977     __ASSERT_DEBUG( iStateMachine->PhoneEngineInfo(),
  1718     __ASSERT_DEBUG( iStateMachine->PhoneEngineInfo(),
  1978         Panic( EPhoneCtrlInvariant ) );
  1719         Panic( EPhoneCtrlInvariant ) );
  1979 
  1720 
  1980     if ( IsOnScreenDialerSupported() )
  1721     if ( IsOnScreenDialerSupported() )
  1981         {
  1722         {
  1982         if ( IsDTMFEditorVisibleL() ||
  1723         if ( IsCustomizedDialerVisibleL() )
  1983              IsCustomizedDialerVisibleL() )
       
  1984             {
  1724             {
  1985             return;
  1725             return;
  1986             }
  1726             }
  1987 
  1727 
  1988         else if( IsNumberEntryUsedL() )
  1728         else if( IsNumberEntryUsedL() )
  1989             {
  1729             {
  1990             // Query on top of dialer
  1730             // Query on top of dialer
  1991             if ( IsAnyQueryActiveL() )
  1731             if ( IsAnyQueryActiveL() )
  1992                 {
  1732                 {
  1993                 return;
       
  1994                 }
       
  1995             else if ( IsMenuBarVisibleL() )
       
  1996                 {
       
  1997                 iViewCommandHandle->ExecuteCommandL( EPhoneViewMenuBarClose );
       
  1998                 return;
  1733                 return;
  1999                 }
  1734                 }
  2000             // Open recent calls list when the number entry is empty
  1735             // Open recent calls list when the number entry is empty
  2001             TPhoneCmdParamInteger numberEntryCountParam;
  1736             TPhoneCmdParamInteger numberEntryCountParam;
  2002             iViewCommandHandle->ExecuteCommandL( EPhoneViewGetNumberEntryCount,
  1737             iViewCommandHandle->ExecuteCommandL( EPhoneViewGetNumberEntryCount,
  2019     // Call the number
  1754     // Call the number
  2020     iStateMachine->PhoneEngineInfo()->SetPhoneNumber( *phoneNumber );
  1755     iStateMachine->PhoneEngineInfo()->SetPhoneNumber( *phoneNumber );
  2021 
  1756 
  2022     if ( phoneNumber->Des().Length() < KPhoneValidPhoneNumberLength )
  1757     if ( phoneNumber->Des().Length() < KPhoneValidPhoneNumberLength )
  2023         {
  1758         {
  2024         // Closing effect is shown when dialer exist.
       
  2025         BeginTransEffectLC( ENumberEntryClose );
       
  2026         iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNumberEntry );
  1759         iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNumberEntry );
  2027         EndTransEffect();
       
  2028 
  1760 
  2029         HandleNumberEntryClearedL();
  1761         HandleNumberEntryClearedL();
  2030         }
  1762         }
  2031 
  1763 
  2032     CleanupStack::PopAndDestroy( phoneNumber );
  1764     CleanupStack::PopAndDestroy( phoneNumber );
  2114     EndUiUpdate();
  1846     EndUiUpdate();
  2115 
  1847 
  2116      // Go to current state implementation
  1848      // Go to current state implementation
  2117     iCbaManager->UpdateInCallCbaL();
  1849     iCbaManager->UpdateInCallCbaL();
  2118 
  1850 
  2119     //Update state of switch to video or voice call touch button.
       
  2120     TPECallType type = iStateMachine->PhoneEngineInfo()->CallType( aCallId );
       
  2121 
       
  2122     if( type == EPECallTypeVideo )
       
  2123         {
       
  2124         TPhoneCmdParamBoolean booleanParam;
       
  2125         booleanParam.SetBoolean( ETrue );
       
  2126         iViewCommandHandle->ExecuteCommandL( EPhoneViewSetVideoCallFlag, &booleanParam );
       
  2127         }
       
  2128     else
       
  2129         {
       
  2130         TPhoneCmdParamBoolean booleanParam;
       
  2131         booleanParam.SetBoolean( EFalse );
       
  2132         iViewCommandHandle->ExecuteCommandL( EPhoneViewSetVideoCallFlag, &booleanParam );
       
  2133         }
       
  2134 
       
  2135     // Go to background if necessary
  1851     // Go to background if necessary
  2136     if ( NeedToSendToBackgroundL() ||  IsAutoLockOn() )
  1852     if ( NeedToSendToBackgroundL() ||  IsAutoLockOn() )
  2137         {
  1853         {
  2138         // If number entry is used set control and visibility.
       
  2139         if ( IsNumberEntryUsedL() )
       
  2140            {
       
  2141            iViewCommandHandle->ExecuteCommandL( EPhoneViewSetControlAndVisibility );
       
  2142            }
       
  2143         }
  1854         }
  2144     // If there is no need to send back ground and number entry is used then
  1855     // If there is no need to send back ground and number entry is used then
  2145     // we must show number entry.
  1856     // we must show number entry.
  2146     else if ( !NeedToSendToBackgroundL() && IsNumberEntryUsedL() )
  1857     else if ( !NeedToSendToBackgroundL() && IsNumberEntryUsedL() )
  2147         {
  1858         {
  2272     if ( incomingCall > KErrNotFound )
  1983     if ( incomingCall > KErrNotFound )
  2273         {
  1984         {
  2274        if( activeCallCount.Integer() == ENoActiveCalls )
  1985        if( activeCallCount.Integer() == ENoActiveCalls )
  2275             {
  1986             {
  2276             iCbaManager->UpdateIncomingCbaL( incomingCall );
  1987             iCbaManager->UpdateIncomingCbaL( incomingCall );
  2277             UpdateSilenceButtonDimming();
       
  2278             }
  1988             }
  2279         else
  1989         else
  2280             {
  1990             {
  2281             iCbaManager->UpdateCbaL( EPhoneCallHandlingCallWaitingCBA );
  1991             iCbaManager->UpdateCbaL( EPhoneCallHandlingCallWaitingCBA );
  2282             }
  1992             }
  2307         return EFalse;
  2017         return EFalse;
  2308         }
  2018         }
  2309     }
  2019     }
  2310 
  2020 
  2311 // <-------------------------- CONTEXT MENU ------------------------->
  2021 // <-------------------------- CONTEXT MENU ------------------------->
  2312 
       
  2313 // -----------------------------------------------------------------------------
       
  2314 // CPhoneState::SetContextMenu
       
  2315 // -----------------------------------------------------------------------------
       
  2316 //
       
  2317 EXPORT_C void CPhoneState::SetContextMenuL( TInt aResourceId )
       
  2318     {
       
  2319     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::SetContextMenuL() ");
       
  2320 
       
  2321     TPhoneCmdParamInteger integerParam;
       
  2322     TInt resId( CPhoneMainResourceResolver::Instance()->
       
  2323                             ResolveResourceID( aResourceId ) );
       
  2324     integerParam.SetInteger( resId );
       
  2325     __PHONELOG1( EBasic, EPhoneControl,
       
  2326                   "CPhoneState::SetContextMenuL : resId =%d",resId );
       
  2327 
       
  2328     iViewCommandHandle->ExecuteCommandL( EPhoneViewUpdateContextMenu,
       
  2329                                       &integerParam );
       
  2330     }
       
  2331 // -----------------------------------------------------------------------------
       
  2332 // CPhoneState::UpdateInCallContextMenuL
       
  2333 // -----------------------------------------------------------------------------
       
  2334 //
       
  2335 EXPORT_C void CPhoneState::UpdateInCallContextMenuL()
       
  2336     {
       
  2337     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::UpdateInCallContextMenuL() ");
       
  2338 
       
  2339     SetContextMenuL( EPhoneNumberAcqMenubar );
       
  2340 
       
  2341     }
       
  2342 
       
  2343 // -----------------------------------------------------------------------------
       
  2344 // CPhoneState::UpdateIncomingContextMenuL
       
  2345 // -----------------------------------------------------------------------------
       
  2346 //
       
  2347 EXPORT_C void CPhoneState::UpdateIncomingContextMenuL( TInt aCallId )
       
  2348     {
       
  2349     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::UpdateIncomingContextMenuL() ");
       
  2350 
       
  2351     if( CPhoneState::IsVideoCall ( aCallId ) )
       
  2352         {
       
  2353         SetContextMenuL( EPhoneIncomingVideoCallMenubar );
       
  2354         }
       
  2355     else
       
  2356         {
       
  2357         SetContextMenuL( EPhoneIncomingCallMenubar );
       
  2358         }
       
  2359 
       
  2360     }
       
  2361 
  2022 
  2362 // -----------------------------------------------------------
  2023 // -----------------------------------------------------------
  2363 // CPhoneState::ShowNoteL
  2024 // CPhoneState::ShowNoteL
  2364 // -----------------------------------------------------------
  2025 // -----------------------------------------------------------
  2365 //
  2026 //
  2461         AknTextUtils::DisplayTextLanguageSpecificNumberConversion( timeString );
  2122         AknTextUtils::DisplayTextLanguageSpecificNumberConversion( timeString );
  2462 
  2123 
  2463         noteText.Append( timeString );
  2124         noteText.Append( timeString );
  2464 
  2125 
  2465         TPhoneCmdParamGlobalNote globalNoteParam;
  2126         TPhoneCmdParamGlobalNote globalNoteParam;
  2466         globalNoteParam.SetType( EAknGlobalInformationNote );
  2127         globalNoteParam.SetType( EPhoneMessageBoxInformation );
  2467         globalNoteParam.SetText( noteText );
  2128         globalNoteParam.SetText( noteText );
  2468         globalNoteParam.SetTone( CAknNoteDialog::ENoTone );
  2129 
  2469         iViewCommandHandle->ExecuteCommandL(
  2130         iViewCommandHandle->ExecuteCommandL(
  2470             EPhoneViewShowGlobalNote, &globalNoteParam );
  2131             EPhoneViewShowGlobalNote, &globalNoteParam );
  2471         }
  2132         }
  2472     }
  2133     }
  2473 
  2134 
  2488         globalNotifierParam.SetBoolean( EFalse );
  2149         globalNotifierParam.SetBoolean( EFalse );
  2489         iViewCommandHandle->ExecuteCommandL( EPhoneViewSetGlobalNotifiersDisabled,
  2150         iViewCommandHandle->ExecuteCommandL( EPhoneViewSetGlobalNotifiersDisabled,
  2490             &globalNotifierParam );
  2151             &globalNotifierParam );
  2491 
  2152 
  2492         TPhoneCmdParamGlobalNote globalNoteParam;
  2153         TPhoneCmdParamGlobalNote globalNoteParam;
  2493 
  2154         PhoneNotificationType type = aNotificationDialog ? 
  2494         globalNoteParam.SetType( EAknGlobalInformationNote );
  2155             EPhoneNotificationDialog : EPhoneMessageBoxInformation;
       
  2156         globalNoteParam.SetType( type );
  2495         globalNoteParam.SetTextResourceId(
  2157         globalNoteParam.SetTextResourceId(
  2496             CPhoneMainResourceResolver::Instance()->
  2158             CPhoneMainResourceResolver::Instance()->
  2497             ResolveResourceID( aResourceId ) );
  2159             ResolveResourceID( aResourceId ) );
  2498         globalNoteParam.SetTone( EAvkonSIDInformationTone );
  2160 
  2499         globalNoteParam.SetNotificationDialog( aNotificationDialog );
  2161         globalNoteParam.SetNotificationDialog( aNotificationDialog );
  2500         
  2162         
  2501         iViewCommandHandle->ExecuteCommandL(
  2163         iViewCommandHandle->ExecuteCommandL(
  2502             EPhoneViewShowGlobalNote, &globalNoteParam );
  2164             EPhoneViewShowGlobalNote, &globalNoteParam );
  2503         }
  2165         }
  2521         globalNotifierParam.SetBoolean( EFalse );
  2183         globalNotifierParam.SetBoolean( EFalse );
  2522         iViewCommandHandle->ExecuteCommandL( EPhoneViewSetGlobalNotifiersDisabled,
  2184         iViewCommandHandle->ExecuteCommandL( EPhoneViewSetGlobalNotifiersDisabled,
  2523             &globalNotifierParam );
  2185             &globalNotifierParam );
  2524 
  2186 
  2525         TPhoneCmdParamGlobalNote globalNoteParam;
  2187         TPhoneCmdParamGlobalNote globalNoteParam;
  2526         globalNoteParam.SetType( EAknGlobalWarningNote );
  2188         PhoneNotificationType type = aNotificationDialog ? 
       
  2189                     EPhoneNotificationDialog : EPhoneMessageBoxWarning;
       
  2190         globalNoteParam.SetType( type );
  2527         globalNoteParam.SetTextResourceId(
  2191         globalNoteParam.SetTextResourceId(
  2528             CPhoneMainResourceResolver::Instance()->
  2192             CPhoneMainResourceResolver::Instance()->
  2529             ResolveResourceID( aResourceId ) );
  2193             ResolveResourceID( aResourceId ) );
  2530         globalNoteParam.SetTone( EAvkonSIDWarningTone );
  2194   
  2531         globalNoteParam.SetNotificationDialog( aNotificationDialog );
  2195         globalNoteParam.SetNotificationDialog( aNotificationDialog );
  2532         
  2196         
  2533         iViewCommandHandle->ExecuteCommandL(
  2197         iViewCommandHandle->ExecuteCommandL(
  2534             EPhoneViewShowGlobalNote, &globalNoteParam );
  2198             EPhoneViewShowGlobalNote, &globalNoteParam );
  2535         }
  2199         }
  2552         globalNotifierParam.SetBoolean( EFalse );
  2216         globalNotifierParam.SetBoolean( EFalse );
  2553         iViewCommandHandle->ExecuteCommandL( EPhoneViewSetGlobalNotifiersDisabled,
  2217         iViewCommandHandle->ExecuteCommandL( EPhoneViewSetGlobalNotifiersDisabled,
  2554             &globalNotifierParam );
  2218             &globalNotifierParam );
  2555 
  2219 
  2556         TPhoneCmdParamGlobalNote globalNoteParam;
  2220         TPhoneCmdParamGlobalNote globalNoteParam;
  2557         globalNoteParam.SetType( EAknGlobalErrorNote );
  2221         PhoneNotificationType type = aNotificationDialog ? 
       
  2222                     EPhoneNotificationDialog : EPhoneMessageBoxInformation;
       
  2223         globalNoteParam.SetType( type );
       
  2224         
  2558         globalNoteParam.SetTextResourceId(
  2225         globalNoteParam.SetTextResourceId(
  2559             CPhoneMainResourceResolver::Instance()->
  2226             CPhoneMainResourceResolver::Instance()->
  2560             ResolveResourceID( aResourceId ) );
  2227             ResolveResourceID( aResourceId ) );
  2561         globalNoteParam.SetTone( CAknNoteDialog::EErrorTone );
       
  2562         globalNoteParam.SetNotificationDialog( aNotificationDialog );
  2228         globalNoteParam.SetNotificationDialog( aNotificationDialog );
  2563 
  2229 
  2564         iViewCommandHandle->ExecuteCommandL(
  2230         iViewCommandHandle->ExecuteCommandL(
  2565             EPhoneViewShowGlobalNote, &globalNoteParam );
  2231             EPhoneViewShowGlobalNote, &globalNoteParam );
  2566         }
  2232         }
  2599     }
  2265     }
  2600 
  2266 
  2601 // <-------------------------- INTERNAL FUNCTIONS ------------------------>
  2267 // <-------------------------- INTERNAL FUNCTIONS ------------------------>
  2602 
  2268 
  2603 // -----------------------------------------------------------
  2269 // -----------------------------------------------------------
  2604 // CPhoneState::UpdateIncallIndicatorL
       
  2605 // -----------------------------------------------------------
       
  2606 //
       
  2607 void CPhoneState::UpdateIncallIndicatorL( TInt aCallState )
       
  2608     {
       
  2609     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::UpdateIncallIndicatorL( ) ");
       
  2610     TPhoneCmdParamIncallIndicatorData incallIndicatorParam;
       
  2611 
       
  2612     // Set the state
       
  2613     incallIndicatorParam.SetCallState( aCallState );
       
  2614 
       
  2615     // Set mode
       
  2616     incallIndicatorParam.SetMode(
       
  2617        CPhonePubSubProxy::Instance()->Value(
       
  2618             KPSUidCtsyCallInformation,
       
  2619             KCTsyCallType ) );
       
  2620 
       
  2621     TInt activeCallId = GetActiveCallIdL();
       
  2622     if ( activeCallId > KErrNotFound )
       
  2623         {
       
  2624         if ( iStateMachine->PhoneEngineInfo()->CallALSLine( activeCallId )
       
  2625              == CCCECallParameters::ECCELineTypeAux )
       
  2626             {
       
  2627             incallIndicatorParam.SetLine2( ETrue );
       
  2628             }
       
  2629         }
       
  2630 
       
  2631     // Set the mute status
       
  2632     const TBool audioMute = iStateMachine->PhoneEngineInfo()->AudioMute();
       
  2633     incallIndicatorParam.SetMute( audioMute );
       
  2634 
       
  2635     // Set the voice privacy status
       
  2636     if ( activeCallId > KErrNotFound &&
       
  2637          activeCallId != KConferenceCallId  )
       
  2638         {
       
  2639         incallIndicatorParam.SetCiphering(
       
  2640             iStateMachine->PhoneEngineInfo()->IsSecureCall( activeCallId ) );
       
  2641         }
       
  2642     else
       
  2643         {
       
  2644         incallIndicatorParam.SetCiphering( ETrue );
       
  2645         }
       
  2646 
       
  2647     incallIndicatorParam.SetCipheringIndicatorAllowed(
       
  2648         iStateMachine->PhoneEngineInfo()->SecureSpecified() );
       
  2649 
       
  2650     // Set the emergency status
       
  2651     if( EPEStateIdle != iStateMachine->PhoneEngineInfo()->CallState( KPEEmergencyCallId ) )
       
  2652         {
       
  2653         incallIndicatorParam.SetEmergency( ETrue );
       
  2654         }
       
  2655 
       
  2656     if( aCallState == EPSCTsyCallStateDisconnecting )
       
  2657         {
       
  2658         if ( TopAppIsDisplayedL() )
       
  2659             {
       
  2660             if ( ( !IsOnScreenDialerSupported() ) ||
       
  2661                  ( IsOnScreenDialerSupported() && !IsNumberEntryVisibleL() ) )
       
  2662                 {
       
  2663                 // Phone application is in the foreground so we don't need to
       
  2664                 // display the little bubble. If we don't hide it here then
       
  2665                 // it will appear for a short time. We don't want that.
       
  2666                 incallIndicatorParam.SetLittleBubbleVisible( EFalse );
       
  2667                 }
       
  2668             }
       
  2669         }
       
  2670 
       
  2671     // Update the in-call indicator
       
  2672     iViewCommandHandle->ExecuteCommandL( EPhoneViewUpdateIncallIndicator,
       
  2673         &incallIndicatorParam );
       
  2674     }
       
  2675 
       
  2676 // -----------------------------------------------------------
       
  2677 // CPhoneState::UpdateProfileDisplayL
  2270 // CPhoneState::UpdateProfileDisplayL
  2678 // -----------------------------------------------------------
  2271 // -----------------------------------------------------------
  2679 //
  2272 //
  2680 void CPhoneState::UpdateProfileDisplayL()
  2273 void CPhoneState::UpdateProfileDisplayL()
  2681     {
  2274     {
  2682     }
  2275     }
  2683 
  2276 
  2684 // -----------------------------------------------------------
       
  2685 // CPhoneState::UpdateOperatorDisplayL
       
  2686 // -----------------------------------------------------------
       
  2687 //
       
  2688 void CPhoneState::UpdateOperatorDisplayL()
       
  2689     {
       
  2690     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::UpdateOperatorDisplayL( ) ");
       
  2691     __PHONELOG( EBasic, EPhoneControl, "CPhoneState::UpdateOperatorDisplayL" );
       
  2692     // Get current title pane content.
       
  2693     TTelTitleDisplay titleContent;
       
  2694     titleContent.iDisplayTag.Zero();
       
  2695     titleContent.iLogoHandle = 0;
       
  2696     TPckg<TTelTitleDisplay> titlePckg( titleContent );
       
  2697 
       
  2698     RProperty::Get(
       
  2699         KPSUidTelInformation,
       
  2700         KTelDisplayInfo,
       
  2701         titlePckg );
       
  2702 
       
  2703     if ( TitlePaneIsVisibleL() )
       
  2704         {
       
  2705         // There is a title pane icon.
       
  2706         if ( titleContent.iLogoHandle != 0 )
       
  2707             {
       
  2708             // Set new logo.
       
  2709             __PHONELOG( EBasic, EPhoneControl,
       
  2710                 "CPhoneState::UpdateOperatorDisplayL - logo found" );
       
  2711 
       
  2712             if( iLogoHandle != titleContent.iLogoHandle )
       
  2713                 {
       
  2714                  __PHONELOG( EBasic, EPhoneControl,
       
  2715                   "CPhoneState::UpdateOperatorDisplayL - set new logo" );
       
  2716 
       
  2717                  TPhoneCmdParamBitmap bitmapParam;
       
  2718 
       
  2719                  // Duplicate bitmap from handle.
       
  2720                  CFbsBitmap* bitmap = new (ELeave) CFbsBitmap;
       
  2721                  CleanupStack::PushL( bitmap );
       
  2722                  User::LeaveIfError(
       
  2723                          bitmap->Duplicate( titleContent.iLogoHandle ) );
       
  2724                  bitmapParam.SetBitmap( bitmap );
       
  2725 
       
  2726                  // Duplicate and set bitmap mask if needed
       
  2727                  CFbsBitmap* maskBitmap = NULL;
       
  2728                  if( titleContent.iLogoMaskHandle != 0 )
       
  2729                      {
       
  2730                      maskBitmap = new( ELeave )CFbsBitmap;
       
  2731                      CleanupStack::PushL( maskBitmap );
       
  2732                      User::LeaveIfError( maskBitmap->Duplicate(
       
  2733                              titleContent.iLogoMaskHandle ) );
       
  2734                      bitmapParam.SetMaskBitmap( maskBitmap );
       
  2735                      }
       
  2736 
       
  2737                  iViewCommandHandle->ExecuteCommandL(
       
  2738                          EPhoneViewSetTitlePanePicture,
       
  2739                          &bitmapParam );
       
  2740 
       
  2741                  // The title pane takes ownership of the bitmaps so no need
       
  2742                  // to destroy it here.
       
  2743                  if( maskBitmap )
       
  2744                      {
       
  2745                      // Pop maskBitmap only, if it has been created
       
  2746                      CleanupStack::Pop( maskBitmap );
       
  2747                      }
       
  2748                  CleanupStack::Pop( bitmap );
       
  2749                 }
       
  2750             }
       
  2751         else
       
  2752             {
       
  2753             __PHONELOG1( EBasic, EPhoneControl,
       
  2754             "CPhoneState::UpdateOperatorDisplayL - set text=%S", &titleContent.iDisplayTag );
       
  2755             iLogoHandle = titleContent.iLogoHandle;
       
  2756 
       
  2757             iViewCommandHandle->ExecuteCommandL(
       
  2758                 EPhoneViewSetTitlePaneContent,
       
  2759                 0,
       
  2760                 titleContent.iDisplayTag );
       
  2761             }
       
  2762         }
       
  2763 
       
  2764     // Check background image.
       
  2765     TPhoneCmdParamBitmap savedBitmapParam;
       
  2766     iViewCommandHandle->ExecuteCommandL(
       
  2767         EPhoneViewGetBackgroundImageBitmap,
       
  2768         &savedBitmapParam );
       
  2769 
       
  2770     if ( titleContent.iBackgroundImageHandle !=
       
  2771         savedBitmapParam.Bitmap()->Handle() )
       
  2772         {
       
  2773         __PHONELOG2( EBasic, EPhoneControl,
       
  2774         "CPhoneState::UpdateOperatorDisplayL - update background image since different titleContent(%d), saved(%d)",
       
  2775             titleContent.iBackgroundImageHandle, savedBitmapParam.Bitmap()->Handle() );
       
  2776         // Background image has changed. Duplicate bitmap from handle if
       
  2777         // available; otherwise reset the background image
       
  2778         CFbsBitmap* bitmap = new (ELeave) CFbsBitmap;
       
  2779         CleanupStack::PushL( bitmap );
       
  2780         TInt err = KErrNone;
       
  2781         if ( titleContent.iBackgroundImageHandle != 0 )
       
  2782             {
       
  2783             err = bitmap->Duplicate( titleContent.iBackgroundImageHandle );
       
  2784             }
       
  2785         else
       
  2786             {
       
  2787             bitmap->Reset();
       
  2788             }
       
  2789 
       
  2790         if ( err == KErrNone )
       
  2791             {
       
  2792             iBitmapRedrawCounter = titleContent.iBackgroundImageRedrawCounter;
       
  2793             TPhoneCmdParamBitmap bitmapParam;
       
  2794             bitmapParam.SetBitmap( bitmap );
       
  2795             iViewCommandHandle->ExecuteCommandL(
       
  2796                 EPhoneViewSetBackgroundImageBitmap,
       
  2797                 &bitmapParam );
       
  2798             }
       
  2799 
       
  2800         CleanupStack::PopAndDestroy( bitmap );
       
  2801         }
       
  2802     else if ( titleContent.iBackgroundImageRedrawCounter !=
       
  2803                   iBitmapRedrawCounter  )
       
  2804         {
       
  2805         iBitmapRedrawCounter = titleContent.iBackgroundImageRedrawCounter;
       
  2806         iViewCommandHandle->ExecuteCommandL( EPhoneViewUpdateView );
       
  2807         }
       
  2808     }
       
  2809 
  2277 
  2810 // -----------------------------------------------------------
  2278 // -----------------------------------------------------------
  2811 // CPhoneState::HandleInitiatedEmergencyCallL
  2279 // CPhoneState::HandleInitiatedEmergencyCallL
  2812 // Default handling for EPEMessageInitiatedEmergencyCallL message
  2280 // Default handling for EPEMessageInitiatedEmergencyCallL message
  2813 // (other items were commented in a header).
  2281 // (other items were commented in a header).
  2824 
  2292 
  2825     // Reset Hold flag to view
  2293     // Reset Hold flag to view
  2826     TPhoneCmdParamBoolean holdFlag;
  2294     TPhoneCmdParamBoolean holdFlag;
  2827     holdFlag.SetBoolean( EFalse );
  2295     holdFlag.SetBoolean( EFalse );
  2828     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetHoldFlag, &holdFlag );
  2296     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetHoldFlag, &holdFlag );
  2829 
       
  2830     // Undim Answer button for sure.
       
  2831     SetTouchPaneButtonEnabled( EPhoneCallComingCmdAnswer );
       
  2832 
  2297 
  2833     // Go to emergency call state
  2298     // Go to emergency call state
  2834     // No need update cba
  2299     // No need update cba
  2835     iStateMachine->ChangeState( EPhoneStateEmergency );
  2300     iStateMachine->ChangeState( EPhoneStateEmergency );
  2836     }
  2301     }
  3110     securityMode.SetBoolean( ETrue );
  2575     securityMode.SetBoolean( ETrue );
  3111     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetSecurityMode, &securityMode );
  2576     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetSecurityMode, &securityMode );
  3112 
  2577 
  3113     // Remove number entry from screen
  2578     // Remove number entry from screen
  3114     iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNumberEntry );
  2579     iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNumberEntry );
  3115 
       
  3116     TPhoneCmdParamBoolean visibleMode;
       
  3117     visibleMode.SetBoolean( EFalse );
       
  3118     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetStatusPaneVisible, &visibleMode );
       
  3119     
  2580     
  3120     iCbaManager->UpdateCbaL( EPhoneEmptyCBA );
  2581     iCbaManager->UpdateCbaL( EPhoneEmptyCBA );
  3121 
  2582 
  3122     TPhoneCmdParamInteger uidParam;
  2583     TPhoneCmdParamInteger uidParam;
  3123     // Bring Phone app in the foreground
  2584     // Bring Phone app in the foreground
  3359         {
  2820         {
  3360         // Get customized text resource for busy note
  2821         // Get customized text resource for busy note
  3361         resource = iCustomization->CustomizeBusyNoteText();
  2822         resource = iCustomization->CustomizeBusyNoteText();
  3362         }
  2823         }
  3363 
  2824 
  3364     // Show number busy note
  2825     // Show number busy notification
  3365     TPhoneCmdParamGlobalNote globalNoteParam;
  2826     TPhoneCmdParamGlobalNote globalNoteParam;
  3366     globalNoteParam.SetType( EAknGlobalInformationNote );
  2827     globalNoteParam.SetType( EPhoneNotificationDialog );
  3367     globalNoteParam.SetTextResourceId(
  2828     globalNoteParam.SetTextResourceId(
  3368         CPhoneMainResourceResolver::Instance()->
  2829         CPhoneMainResourceResolver::Instance()->
  3369         ResolveResourceID( resource ) );
  2830         ResolveResourceID( resource ) );
  3370     globalNoteParam.SetTone( EAvkonSIDInformationTone );
  2831     
  3371     globalNoteParam.SetNotificationDialog( ETrue );
  2832     globalNoteParam.SetNotificationDialog( ETrue );
  3372     iViewCommandHandle->ExecuteCommandL( EPhoneViewShowGlobalNote,
  2833     iViewCommandHandle->ExecuteCommandL( EPhoneViewShowGlobalNote,
  3373         &globalNoteParam );
  2834         &globalNoteParam );
  3374     }
  2835     }
  3375 
  2836 
  3459         booleanParam.SetBoolean( emergency );
  2920         booleanParam.SetBoolean( emergency );
  3460 
  2921 
  3461         TRAP_IGNORE( iViewCommandHandle->ExecuteCommandL(
  2922         TRAP_IGNORE( iViewCommandHandle->ExecuteCommandL(
  3462                      EPhoneViewSetTouchPaneButtons,
  2923                      EPhoneViewSetTouchPaneButtons,
  3463                      &booleanParam ) );
  2924                      &booleanParam ) );
  3464         SetTouchPaneVisible( ETrue );
       
  3465         }
  2925         }
  3466     }
  2926     }
  3467 
  2927 
  3468 // ---------------------------------------------------------
  2928 // ---------------------------------------------------------
  3469 // CPhoneState::DeleteTouchPaneButtons
  2929 // CPhoneState::DeleteTouchPaneButtons
  3475         {
  2935         {
  3476         TPhoneCmdParamBoolean boolParam;
  2936         TPhoneCmdParamBoolean boolParam;
  3477         TRAP_IGNORE( iViewCommandHandle->ExecuteCommandL(
  2937         TRAP_IGNORE( iViewCommandHandle->ExecuteCommandL(
  3478                         EPhoneViewSetTouchPaneButtons,
  2938                         EPhoneViewSetTouchPaneButtons,
  3479                         &boolParam ) );
  2939                         &boolParam ) );
  3480         SetTouchPaneVisible( EFalse );
       
  3481         }
       
  3482     }
       
  3483 
       
  3484 // ---------------------------------------------------------
       
  3485 // CPhoneState::SetTouchPaneVisible
       
  3486 // ---------------------------------------------------------
       
  3487 //
       
  3488 EXPORT_C void CPhoneState::SetTouchPaneVisible( TBool aVisible )
       
  3489     {
       
  3490     if ( FeatureManager::FeatureSupported( KFeatureIdTouchCallHandling ) )
       
  3491         {
       
  3492         TPhoneCmdParamBoolean booleanParam;
       
  3493         booleanParam.SetBoolean( aVisible );
       
  3494         TRAP_IGNORE( iViewCommandHandle->ExecuteCommandL(
       
  3495                         EPhoneViewSetTouchPaneVisible,
       
  3496                         &booleanParam ) );
       
  3497         }
       
  3498     }
       
  3499 
       
  3500 // ----------------------------------------------------------------------------
       
  3501 // CPhoneState::SetTouchButtonEnabled
       
  3502 // ----------------------------------------------------------------------------
       
  3503 //
       
  3504 EXPORT_C void CPhoneState::SetTouchPaneButtonEnabled( TInt aCommandId )
       
  3505     {
       
  3506     if ( FeatureManager::FeatureSupported( KFeatureIdTouchCallHandling ) )
       
  3507         {
       
  3508         TPhoneCmdParamInteger commandParam;
       
  3509         commandParam.SetInteger( aCommandId );
       
  3510         iViewCommandHandle->ExecuteCommand( EPhoneViewEnableTouchButton,
       
  3511                                             &commandParam );
       
  3512         }
       
  3513     }
       
  3514 
       
  3515 // ----------------------------------------------------------------------------
       
  3516 // CPhoneState::SetTouchButtonDisabled
       
  3517 // ----------------------------------------------------------------------------
       
  3518 //
       
  3519 EXPORT_C void CPhoneState::SetTouchPaneButtonDisabled( TInt aCommandId )
       
  3520     {
       
  3521     if ( FeatureManager::FeatureSupported( KFeatureIdTouchCallHandling ) )
       
  3522         {
       
  3523         TPhoneCmdParamInteger commandParam;
       
  3524         commandParam.SetInteger( aCommandId );
       
  3525 
       
  3526         iViewCommandHandle->ExecuteCommand( EPhoneViewDisableTouchButton,
       
  3527                                             &commandParam );
       
  3528         }
  2940         }
  3529     }
  2941     }
  3530 
  2942 
  3531 // ---------------------------------------------------------
  2943 // ---------------------------------------------------------
  3532 // CPhoneState::HandleLongHashL
  2944 // CPhoneState::HandleLongHashL
  3534 //
  2946 //
  3535 EXPORT_C void CPhoneState::HandleLongHashL()
  2947 EXPORT_C void CPhoneState::HandleLongHashL()
  3536     {
  2948     {
  3537     __LOGMETHODSTARTEND( EPhoneControl, "CPhoneState::HandleLongHashL() ");
  2949     __LOGMETHODSTARTEND( EPhoneControl, "CPhoneState::HandleLongHashL() ");
  3538 
  2950 
  3539     TPhoneCmdParamInteger numberEntryCountParam;
       
  3540     iViewCommandHandle->ExecuteCommandL( EPhoneViewGetNumberEntryCount,
       
  3541             &numberEntryCountParam );
       
  3542     TInt neLength( numberEntryCountParam.Integer() );
       
  3543 
       
  3544     if( iCustomization && iCustomization->AllowAlphaNumericMode() )
       
  3545         {
       
  3546         if ( NumberEntryManagerL()->NumberEntryInNumericModeL() )
       
  3547             {
       
  3548             if ( neLength == 0 )
       
  3549                 {
       
  3550                 OnlyHashInNumberEntryL();
       
  3551                 }
       
  3552 
       
  3553             if ( neLength == 1 )
       
  3554                 {
       
  3555                 NumberEntryClearL();
       
  3556                 }
       
  3557             }
       
  3558         NumberEntryManagerL()->NumberEntryToggleAlphaNumericModeL();
       
  3559         }
       
  3560     else
       
  3561         {
       
  3562         if( neLength == 1 )
       
  3563             {
       
  3564             TPhoneCmdParamBoolean isSecurityMode;
       
  3565             iViewCommandHandle->ExecuteCommandL( EPhoneViewGetSecurityModeStatus, &isSecurityMode );
       
  3566 
       
  3567             if ( !isSecurityMode.Boolean() )
       
  3568                 {
       
  3569                 OnlyHashInNumberEntryL();
       
  3570                 }
       
  3571             }
       
  3572         }
       
  3573     }
       
  3574 
       
  3575 // -----------------------------------------------------------
       
  3576 // CPhoneState::OpenVKBL
       
  3577 // -----------------------------------------------------------
       
  3578 //
       
  3579 void CPhoneState::OpenVkbL()
       
  3580     {
       
  3581     __LOGMETHODSTARTEND( EPhoneControl, "CPhoneState::OpenVKB() ");
       
  3582     iViewCommandHandle->ExecuteCommandL( EPhoneViewOpenVirtualKeyBoard );
       
  3583     }
  2951     }
  3584 
  2952 
  3585 // -----------------------------------------------------------
  2953 // -----------------------------------------------------------
  3586 // CPhoneState::BeginUiUpdateLC
  2954 // CPhoneState::BeginUiUpdateLC
  3587 // -----------------------------------------------------------
  2955 // -----------------------------------------------------------
  3594     TCleanupItem operation( UiUpdateCleanup, this );
  2962     TCleanupItem operation( UiUpdateCleanup, this );
  3595     CleanupStack::PushL( operation );
  2963     CleanupStack::PushL( operation );
  3596     }
  2964     }
  3597 
  2965 
  3598 // -----------------------------------------------------------
  2966 // -----------------------------------------------------------
  3599 // CPhoneState::BeginTransEffectLC
       
  3600 // -----------------------------------------------------------
       
  3601 //
       
  3602 EXPORT_C void CPhoneState::BeginTransEffectLC(  TStateTransEffectType aType )
       
  3603     {
       
  3604     __LOGMETHODSTARTEND( EPhoneControl, "CPhoneState::BeginTransEffectLC( ) ");
       
  3605     TPhoneCmdParamTransEffect effectParam;
       
  3606 
       
  3607     switch ( aType )
       
  3608         {
       
  3609         case ENumberEntryOpen:
       
  3610             effectParam.SetType( EPhoneTransEffectDialerOpen );
       
  3611             break;
       
  3612         case ENumberEntryClose:
       
  3613             effectParam.SetType( EPhoneTransEffectDialerClose );
       
  3614             break;
       
  3615         case ENumberEntryCreate:
       
  3616             effectParam.SetType( EPhoneTransEffectDialerCreate );
       
  3617             break;
       
  3618         default:
       
  3619             effectParam.SetType( EPhoneTransEffectNone );
       
  3620         }
       
  3621 
       
  3622     iViewCommandHandle->ExecuteCommand( EPhoneViewBeginTransEffect,  &effectParam );
       
  3623 
       
  3624     TCleanupItem operation( EffectCleanup, this );
       
  3625     CleanupStack::PushL( operation );
       
  3626     }
       
  3627 
       
  3628 // -----------------------------------------------------------
       
  3629 // CPhoneState::EndUiUpdate
  2967 // CPhoneState::EndUiUpdate
  3630 // -----------------------------------------------------------
  2968 // -----------------------------------------------------------
  3631 //
  2969 //
  3632 EXPORT_C void CPhoneState::EndUiUpdate()
  2970 EXPORT_C void CPhoneState::EndUiUpdate()
  3633     {
  2971     {
  3634     CleanupStack::PopAndDestroy(); // Call UiUpdateCleanup
  2972     CleanupStack::PopAndDestroy(); // Call UiUpdateCleanup
  3635     }
       
  3636 
       
  3637 // -----------------------------------------------------------
       
  3638 // CPhoneState::EndTransEffect
       
  3639 // -----------------------------------------------------------
       
  3640 //
       
  3641 EXPORT_C void CPhoneState::EndTransEffect()
       
  3642     {
       
  3643     CleanupStack::PopAndDestroy(); // Call EffectCleanup
       
  3644     }
  2973     }
  3645 
  2974 
  3646 // -----------------------------------------------------------
  2975 // -----------------------------------------------------------
  3647 // CPhoneState::CheckIfShowTerminationNote
  2976 // CPhoneState::CheckIfShowTerminationNote
  3648 // This method is intended to be overridden in states
  2977 // This method is intended to be overridden in states
  3686 //
  3015 //
  3687 void CPhoneState::UiUpdateCleanup(TAny* aThis )
  3016 void CPhoneState::UiUpdateCleanup(TAny* aThis )
  3688     {
  3017     {
  3689     static_cast<CPhoneState*>( aThis )->iViewCommandHandle->ExecuteCommand(
  3018     static_cast<CPhoneState*>( aThis )->iViewCommandHandle->ExecuteCommand(
  3690         EPhoneViewEndUpdate );
  3019         EPhoneViewEndUpdate );
  3691     }
       
  3692 
       
  3693 // -----------------------------------------------------------------------------
       
  3694 // CPhoneState::EffectCleanup
       
  3695 // -----------------------------------------------------------------------------
       
  3696 //
       
  3697 void CPhoneState::EffectCleanup(TAny* aThis )
       
  3698     {
       
  3699     TPhoneCmdParamTransEffect effectParam;
       
  3700     effectParam.SetType( EPhoneTransEffectStop );
       
  3701 
       
  3702     static_cast<CPhoneState*>( aThis )->iViewCommandHandle->ExecuteCommand(
       
  3703         EPhoneViewEndTransEffect, &effectParam );
       
  3704     }
       
  3705 
       
  3706 // -----------------------------------------------------------------------------
       
  3707 // CPhoneState::IsDTMFEditorVisibleL
       
  3708 // -----------------------------------------------------------------------------
       
  3709 //
       
  3710 EXPORT_C TBool CPhoneState::IsDTMFEditorVisibleL() const
       
  3711     {
       
  3712     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::IsDTMFEditorVisibleL( ) ");
       
  3713     return iViewCommandHandle->HandleCommandL(
       
  3714         EPhoneViewIsDTMFEditorVisible ) ==
       
  3715         EPhoneViewResponseSuccess;
       
  3716     }
       
  3717 
       
  3718 // -----------------------------------------------------------------------------
       
  3719 // CPhoneState::CloseDTMFEditorL
       
  3720 // -----------------------------------------------------------------------------
       
  3721 //
       
  3722 EXPORT_C void CPhoneState::CloseDTMFEditorL()
       
  3723     {
       
  3724     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::CloseDTMFEditorL()");
       
  3725     if ( iOnScreenDialer ) // Touch
       
  3726         {
       
  3727         TPhoneCmdParamBoolean booleanParam;
       
  3728         booleanParam.SetBoolean( EFalse );
       
  3729         // Disable dialer DTMF mode
       
  3730         iViewCommandHandle->ExecuteCommandL( EPhoneViewSetDtmfDialerViewVisible,
       
  3731                                              &booleanParam );
       
  3732 
       
  3733         // Closing effect is shown when DTMF dialer exist.
       
  3734         BeginTransEffectLC( ENumberEntryClose );
       
  3735         iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNumberEntry );
       
  3736         EndTransEffect();
       
  3737         }
       
  3738     else // Non-Touch
       
  3739         {
       
  3740         // If dtmf query is visible then remove number entry
       
  3741         // because it should not be shown if user has pressed end key.
       
  3742         iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNumberEntry );
       
  3743         iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveQuery );
       
  3744         }
       
  3745 
       
  3746     // Do state-specific behaviour if number entry is cleared
       
  3747     HandleNumberEntryClearedL();
       
  3748     }
  3020     }
  3749 
  3021 
  3750 // -----------------------------------------------------------
  3022 // -----------------------------------------------------------
  3751 // CPhoneState::SetDefaultFlagsL()
  3023 // CPhoneState::SetDefaultFlagsL()
  3752 // -----------------------------------------------------------
  3024 // -----------------------------------------------------------
  3890             callText = iStateMachine->PhoneEngineInfo()->RemoteCompanyName( aCallId );
  3162             callText = iStateMachine->PhoneEngineInfo()->RemoteCompanyName( aCallId );
  3891             }
  3163             }
  3892 
  3164 
  3893         TPhoneCmdParamGlobalNote globalNoteParam;
  3165         TPhoneCmdParamGlobalNote globalNoteParam;
  3894         globalNoteParam.SetText( callText );
  3166         globalNoteParam.SetText( callText );
  3895         globalNoteParam.SetType( EAknGlobalInformationNote );
  3167         globalNoteParam.SetType( EPhoneNotificationDialog );
  3896         globalNoteParam.SetTone( EAvkonSIDInformationTone );
  3168 
  3897         globalNoteParam.SetTextResourceId(
  3169         globalNoteParam.SetTextResourceId(
  3898             CPhoneMainResourceResolver::Instance()->
  3170             CPhoneMainResourceResolver::Instance()->
  3899             ResolveResourceID( EPhoneCallWaitingWithLabel ) );
  3171             ResolveResourceID( EPhoneCallWaitingWithLabel ) );
  3900         globalNoteParam.SetNotificationDialog( ETrue );
  3172         globalNoteParam.SetNotificationDialog( ETrue );
  3901         
  3173         
  4032             ResolveResourceID(
  3304             ResolveResourceID(
  4033             EPhoneInfoCugInUse ), cugIndex );
  3305             EPhoneInfoCugInUse ), cugIndex );
  4034 
  3306 
  4035         TPhoneCmdParamGlobalNote globalNoteParam;
  3307         TPhoneCmdParamGlobalNote globalNoteParam;
  4036         globalNoteParam.SetText( *buf );
  3308         globalNoteParam.SetText( *buf );
  4037         globalNoteParam.SetType( EAknGlobalInformationNote );
  3309         globalNoteParam.SetType( EPhoneMessageBoxInformation );
  4038         globalNoteParam.SetTone( EAvkonSIDInformationTone );
  3310    
  4039 
       
  4040         iViewCommandHandle->ExecuteCommandL(
  3311         iViewCommandHandle->ExecuteCommandL(
  4041                 EPhoneViewShowGlobalNote, &globalNoteParam );
  3312                 EPhoneViewShowGlobalNote, &globalNoteParam );
  4042 
  3313 
  4043         CleanupStack::PopAndDestroy( buf );
  3314         CleanupStack::PopAndDestroy( buf );
  4044         }
  3315         }
  4059                 iCustomization );
  3330                 iCustomization );
  4060         }
  3331         }
  4061     return iCallHeaderManager;
  3332     return iCallHeaderManager;
  4062     }
  3333     }
  4063 
  3334 
  4064 // -----------------------------------------------------------------------------
       
  4065 // CPhoneState::CloseCustomizedDialerL
       
  4066 // -----------------------------------------------------------------------------
       
  4067 //
       
  4068 EXPORT_C void CPhoneState::CloseCustomizedDialerL()
       
  4069     {
       
  4070     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::CloseCustomizedDialerL( ) ");
       
  4071 
       
  4072     // Set dialer back to default mode.
       
  4073     iViewCommandHandle->HandleCommandL( EPhoneViewHideCustomizedDialer );
       
  4074 
       
  4075     // Closing effect is shown when customized dialer exist.
       
  4076     BeginTransEffectLC( ENumberEntryClose );
       
  4077 
       
  4078     iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNumberEntry );
       
  4079 
       
  4080     EndTransEffect();
       
  4081     // Do state-specific behaviour if number entry is cleared
       
  4082     HandleNumberEntryClearedL();
       
  4083     }
       
  4084 
       
  4085 // -----------------------------------------------------------------------------
       
  4086 // CPhoneState::CustomizedDialerMenuResourceId
       
  4087 // -----------------------------------------------------------------------------
       
  4088 //
       
  4089 EXPORT_C TInt CPhoneState::CustomizedDialerMenuResourceIdL()
       
  4090     {
       
  4091     __LOGMETHODSTARTEND(EPhoneControl,
       
  4092         "CPhoneState::CustomizedDialerMenuResourceId( ) ");
       
  4093     // Get and return customized dialer menu resource id
       
  4094     TPhoneCmdParamInteger integerParam;
       
  4095     iViewCommandHandle->HandleCommandL(
       
  4096         EPhoneViewGetCustomizedDialerMenuResourceId,
       
  4097         &integerParam );
       
  4098     return integerParam.Integer();
       
  4099     }
       
  4100 
       
  4101 // -----------------------------------------------------------------------------
       
  4102 // CPhoneState::CustomizedDialerCbaResourceId
       
  4103 // -----------------------------------------------------------------------------
       
  4104 //
       
  4105 EXPORT_C TInt CPhoneState::CustomizedDialerCbaResourceIdL()
       
  4106     {
       
  4107     __LOGMETHODSTARTEND(EPhoneControl,
       
  4108            "CPhoneState::CustomizedDialerCbaResourceId( ) ");
       
  4109     // Get and return customized dialer CBA resource id
       
  4110     TPhoneCmdParamInteger integerParam;
       
  4111     iViewCommandHandle->HandleCommandL(
       
  4112             EPhoneViewGetCustomizedDialerCbaResourceId,
       
  4113         &integerParam );
       
  4114     return integerParam.Integer();
       
  4115     }
       
  4116 
       
  4117 // -----------------------------------------------------------
       
  4118 // CPhoneState::ShowDtmfDialerL
       
  4119 // -----------------------------------------------------------
       
  4120 //
       
  4121 void CPhoneState::ShowDtmfDialerL()
       
  4122     {
       
  4123     __LOGMETHODSTARTEND(EPhoneControl,
       
  4124         "CPhoneState::ShowDtmfDialerL()" );
       
  4125 
       
  4126     // Set dialer to DTMF mode.
       
  4127     TPhoneCmdParamBoolean booleanParam;
       
  4128     booleanParam.SetBoolean( ETrue );
       
  4129     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetDtmfDialerViewVisible,
       
  4130                                          &booleanParam );
       
  4131 
       
  4132     BeginTransEffectLC( ENumberEntryCreate );
       
  4133 
       
  4134     if ( IsNumberEntryUsedL() )
       
  4135         {
       
  4136         // Store the number entry content to cache
       
  4137         if ( !IsNumberEntryContentStored() )
       
  4138             {
       
  4139             StoreNumberEntryContentL();
       
  4140             }
       
  4141         // Clear and display DTMF dialer
       
  4142         NumberEntryClearL();
       
  4143         SetNumberEntryVisibilityL(ETrue);
       
  4144         }
       
  4145     else
       
  4146         {
       
  4147         // Create and display DTMF dialer
       
  4148         NumberEntryManagerL()->CreateNumberEntryL();
       
  4149         }
       
  4150 
       
  4151     EndTransEffect();
       
  4152 
       
  4153     // Update CBA
       
  4154     iCbaManager->UpdateInCallCbaL();
       
  4155     }
       
  4156 
       
  4157 // -----------------------------------------------------------
  3335 // -----------------------------------------------------------
  4158 // CPhoneState::CheckIfRestoreNEContentAfterDtmfDialer
  3336 // CPhoneState::CheckIfRestoreNEContentAfterDtmfDialer
  4159 // -----------------------------------------------------------
  3337 // -----------------------------------------------------------
  4160 //
  3338 //
  4161 EXPORT_C void CPhoneState::CheckIfRestoreNEContentAfterDtmfDialer()
  3339 EXPORT_C void CPhoneState::CheckIfRestoreNEContentAfterDtmfDialer()
  4162     {
  3340     {
  4163     if ( IsOnScreenDialerSupported() )
  3341 
  4164         {
       
  4165         TBool isDialerVisible( EFalse );
       
  4166         TRAP_IGNORE( isDialerVisible = IsDTMFEditorVisibleL() );
       
  4167 
       
  4168          if ( isDialerVisible )
       
  4169              {
       
  4170              TRAP_IGNORE( CloseDTMFEditorL() );
       
  4171              }
       
  4172 
       
  4173          // if the DTMF dialer is used before the idle message, we have to
       
  4174          // restore the original content of the number entry
       
  4175          if ( IsNumberEntryContentStored() )
       
  4176              {
       
  4177              TBool isNumberEntryUsed( EFalse );
       
  4178              TRAP_IGNORE( isNumberEntryUsed = IsNumberEntryUsedL() );
       
  4179 
       
  4180              if ( !isNumberEntryUsed )
       
  4181                  {
       
  4182                  TRAP_IGNORE( NumberEntryManagerL()->CreateNumberEntryL() );
       
  4183                  }
       
  4184              // Restore the number entry content from cache
       
  4185              TRAP_IGNORE( RestoreNumberEntryContentL() );
       
  4186              }
       
  4187          }
       
  4188     }
  3342     }
  4189 
  3343 
  4190 // -----------------------------------------------------------
  3344 // -----------------------------------------------------------
  4191 // CPhoneState::IsOnScreenDialerSupported
  3345 // CPhoneState::IsOnScreenDialerSupported
  4192 // -----------------------------------------------------------
  3346 // -----------------------------------------------------------
  4274     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::IsNumberEntryVisibleL( ) ");
  3428     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::IsNumberEntryVisibleL( ) ");
  4275     return NumberEntryManagerL()->IsNumberEntryVisibleL();
  3429     return NumberEntryManagerL()->IsNumberEntryVisibleL();
  4276     }
  3430     }
  4277 
  3431 
  4278 // -----------------------------------------------------------
  3432 // -----------------------------------------------------------
  4279 // CPhoneState::KeyEventForExistingNumberEntryL
       
  4280 // -----------------------------------------------------------
       
  4281 //
       
  4282 void CPhoneState::KeyEventForExistingNumberEntryL( const TKeyEvent& aKeyEvent,
       
  4283     TEventCode aEventCode )
       
  4284     {
       
  4285     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::KeyEventForExistingNumberEntryL( ) ");
       
  4286     NumberEntryManagerL()->KeyEventForExistingNumberEntryL( aKeyEvent, aEventCode );
       
  4287     }
       
  4288 
       
  4289 // -----------------------------------------------------------
       
  4290 // CPhoneState::HandleNumberEntryClearedL
  3433 // CPhoneState::HandleNumberEntryClearedL
  4291 // -----------------------------------------------------------
  3434 // -----------------------------------------------------------
  4292 //
  3435 //
  4293 EXPORT_C void CPhoneState::HandleNumberEntryClearedL()
  3436 EXPORT_C void CPhoneState::HandleNumberEntryClearedL()
  4294     {
  3437     {
  4310         booleanParam.SetBoolean( EFalse );
  3453         booleanParam.SetBoolean( EFalse );
  4311         }
  3454         }
  4312     NumberEntryManagerL()->SetNumberEntryVisibilityL( booleanParam );
  3455     NumberEntryManagerL()->SetNumberEntryVisibilityL( booleanParam );
  4313     }
  3456     }
  4314 
  3457 
  4315 // ---------------------------------------------------------
       
  4316 // CPhoneState::HandleCreateNumberEntryL
       
  4317 // ---------------------------------------------------------
       
  4318 //
       
  4319 EXPORT_C void CPhoneState::HandleCreateNumberEntryL(
       
  4320         const TKeyEvent& /*aKeyEvent*/,
       
  4321         TEventCode /*aEventCode*/ )
       
  4322     {
       
  4323     NumberEntryManagerL()->HandleCreateNumberEntryL();
       
  4324     }
       
  4325 
       
  4326 // -----------------------------------------------------------
  3458 // -----------------------------------------------------------
  4327 // CPhoneState::IsNumberEntryContentStored
  3459 // CPhoneState::IsNumberEntryContentStored
  4328 // -----------------------------------------------------------
  3460 // -----------------------------------------------------------
  4329 //
  3461 //
  4330 EXPORT_C TBool CPhoneState::IsNumberEntryContentStored()
  3462 EXPORT_C TBool CPhoneState::IsNumberEntryContentStored()
  4342     {
  3474     {
  4343     NumberEntryManagerL()->StoreNumberEntryContentL();
  3475     NumberEntryManagerL()->StoreNumberEntryContentL();
  4344     }
  3476     }
  4345 
  3477 
  4346 // -----------------------------------------------------------
  3478 // -----------------------------------------------------------
  4347 // CPhoneState::RestoreNumberEntryContentL
       
  4348 // -----------------------------------------------------------
       
  4349 //
       
  4350 EXPORT_C void CPhoneState::RestoreNumberEntryContentL()
       
  4351     {
       
  4352     NumberEntryManagerL()->RestoreNumberEntryContentL();
       
  4353     }
       
  4354 
       
  4355 // -----------------------------------------------------------
       
  4356 // CPhoneState::ClearNumberEntryContentCache
  3479 // CPhoneState::ClearNumberEntryContentCache
  4357 // -----------------------------------------------------------
  3480 // -----------------------------------------------------------
  4358 //
  3481 //
  4359 EXPORT_C void CPhoneState::ClearNumberEntryContentCache()
  3482 EXPORT_C void CPhoneState::ClearNumberEntryContentCache()
  4360     {
  3483     {
  4361     TRAP_IGNORE( NumberEntryManagerL()->ClearNumberEntryContentCache() );
  3484     TRAP_IGNORE( NumberEntryManagerL()->ClearNumberEntryContentCache() );
  4362     }
       
  4363 
       
  4364 // -----------------------------------------------------------
       
  4365 // CPhoneState::HandleNumberEntryEdited
       
  4366 // -----------------------------------------------------------
       
  4367 //
       
  4368 EXPORT_C void CPhoneState::HandleNumberEntryEdited()
       
  4369     {
       
  4370     __LOGMETHODSTARTEND( EPhoneControl, "CPhoneState::HandleNumberEntryEdited() ");
       
  4371     TRAP_IGNORE( NumberEntryManagerL()->HandleNumberEntryEdited() );
       
  4372     }
  3485     }
  4373 
  3486 
  4374 // -----------------------------------------------------------------------------
  3487 // -----------------------------------------------------------------------------
  4375 // CPhoneState::IsAlphanumericSupportedAndCharInput
  3488 // CPhoneState::IsAlphanumericSupportedAndCharInput
  4376 // -----------------------------------------------------------------------------
  3489 // -----------------------------------------------------------------------------
  4400 // -----------------------------------------------------------
  3513 // -----------------------------------------------------------
  4401 //
  3514 //
  4402 void CPhoneState::NumberEntryClearL()
  3515 void CPhoneState::NumberEntryClearL()
  4403     {
  3516     {
  4404     NumberEntryManagerL()->NumberEntryClearL();
  3517     NumberEntryManagerL()->NumberEntryClearL();
  4405     }
       
  4406     
       
  4407 // -----------------------------------------------------------
       
  4408 // CPhoneState::UpdateSilenceButtonDimming
       
  4409 // -----------------------------------------------------------
       
  4410 //
       
  4411 EXPORT_C void CPhoneState::UpdateSilenceButtonDimming()
       
  4412     {
       
  4413     if ( FeatureManager::FeatureSupported( KFeatureIdTouchCallHandling ) )
       
  4414         {
       
  4415         const TProfileRingingType ringingType =
       
  4416             iStateMachine->PhoneEngineInfo()->RingingType();
       
  4417         
       
  4418         TBool callIsAlerting =
       
  4419                 !(( ringingType == EProfileRingingTypeSilent ) ||
       
  4420                   ( ringingType == EProfileRingingTypeBeepOnce ));
       
  4421 
       
  4422         if ( !callIsAlerting )
       
  4423             {
       
  4424             SetTouchPaneButtonDisabled( EPhoneCallComingCmdSilent );
       
  4425             }
       
  4426         }
       
  4427     }
  3518     }
  4428 
  3519 
  4429 // -----------------------------------------------------------
  3520 // -----------------------------------------------------------
  4430 // CPhoneState::GetBlockedKeyList
  3521 // CPhoneState::GetBlockedKeyList
  4431 // -----------------------------------------------------------
  3522 // -----------------------------------------------------------
  4624             // Reset blocked keys list
  3715             // Reset blocked keys list
  4625             iStateMachine->PhoneStorage()->ResetBlockedKeysList();
  3716             iStateMachine->PhoneStorage()->ResetBlockedKeysList();
  4626             }
  3717             }
  4627         }
  3718         }
  4628     }
  3719     }
  4629     
       
  4630 // ---------------------------------------------------------
       
  4631 // CPhoneState::SetToolbarDimming
       
  4632 // ---------------------------------------------------------
       
  4633 //
       
  4634 EXPORT_C void CPhoneState::SetToolbarDimming( TBool aDimmed )
       
  4635     {
       
  4636     if ( FeatureManager::FeatureSupported( KFeatureIdTouchCallHandling ) )
       
  4637         {
       
  4638         TPhoneCmdParamBoolean booleanParam;
       
  4639         booleanParam.SetBoolean( aDimmed );
       
  4640         TRAP_IGNORE( iViewCommandHandle->ExecuteCommandL(
       
  4641             EPhoneViewSetToolbarDimming, &booleanParam ));
       
  4642         }
       
  4643     }
       
  4644 
  3720 
  4645 // ---------------------------------------------------------
  3721 // ---------------------------------------------------------
  4646 // CPhoneState::SetToolbarButtonLoudspeakerEnabled
  3722 // CPhoneState::SetToolbarButtonLoudspeakerEnabled
  4647 // ---------------------------------------------------------
  3723 // ---------------------------------------------------------
  4648 //
  3724 //
  4656             EPhoneViewEnableToolbarButton, &integerParam ));
  3732             EPhoneViewEnableToolbarButton, &integerParam ));
  4657         }
  3733         }
  4658     }
  3734     }
  4659 
  3735 
  4660 // ---------------------------------------------------------
  3736 // ---------------------------------------------------------
  4661 // CPhoneState::SetToolbarDimming
  3737 // CPhoneState::SetBackButtonActive
  4662 // ---------------------------------------------------------
  3738 // ---------------------------------------------------------
  4663 //
  3739 //
  4664 EXPORT_C void CPhoneState::SetBackButtonActive( TBool aActive )
  3740 EXPORT_C void CPhoneState::SetBackButtonActive( TBool aActive )
  4665     {
  3741     {
  4666     if(IsAutoLockOn() && aActive) {
  3742     if(IsAutoLockOn() && aActive) {