172 iStateMachine->State()->HandleDtmfKeyToneL( keyEvent, aType ); |
172 iStateMachine->State()->HandleDtmfKeyToneL( keyEvent, aType ); |
173 } |
173 } |
174 |
174 |
175 // Open number entry view if any allowed character key |
175 // Open number entry view if any allowed character key |
176 // is pressed on homescreen or in-call ui |
176 // is pressed on homescreen or in-call ui |
177 if ( aType != EEventKeyUp && IsKeyAllowed( keyEvent ) ) |
177 if ( aType != EEventKeyUp && IsKeyAllowedL( keyEvent ) ) |
178 { |
178 { |
179 // Do not open number entry with up key |
179 // Do not open number entry with up key |
180 iStateMachine->State()->HandleCreateNumberEntryL( keyEvent, aType ); |
180 iStateMachine->State()->HandleCreateNumberEntryL( keyEvent, aType ); |
181 } |
181 } |
182 } |
182 } |
250 iMenu = env->AppUiFactory()->MenuBar(); |
250 iMenu = env->AppUiFactory()->MenuBar(); |
251 } |
251 } |
252 } |
252 } |
253 |
253 |
254 // ----------------------------------------------------------------------------- |
254 // ----------------------------------------------------------------------------- |
255 // CPhoneKeyEventForwarder::IsAlphaNumericKey |
255 // CPhoneKeyEventForwarder::IsKeyAllowedL |
256 // ----------------------------------------------------------------------------- |
256 // ----------------------------------------------------------------------------- |
257 // |
257 // |
258 TBool CPhoneKeyEventForwarder::IsKeyAllowed( const TKeyEvent& aKeyEvent ) |
258 TBool CPhoneKeyEventForwarder::IsKeyAllowedL( const TKeyEvent& aKeyEvent ) |
259 { |
259 { |
260 __LOGMETHODSTARTEND( EPhoneControl, |
260 __LOGMETHODSTARTEND( EPhoneControl, |
261 "CPhoneKeyEventForwarder::IsAlphaNumericKey"); |
261 "CPhoneKeyEventForwarder::IsKeyAllowedL"); |
262 |
262 |
263 TKeyEvent keyEvent( aKeyEvent ); |
263 TKeyEvent keyEvent( aKeyEvent ); |
264 |
264 |
265 // Check keyboard mode |
265 // Check keyboard mode |
266 TBool isModeNumeric = iViewCommandHandle->HandleCommandL( |
266 TBool isModeNumeric = iViewCommandHandle->HandleCommandL( |
426 // Send key to editor |
426 // Send key to editor |
427 iStateMachine->State()->HandleKeyEventL( aKeyEvent, aType ); |
427 iStateMachine->State()->HandleKeyEventL( aKeyEvent, aType ); |
428 |
428 |
429 if ( EEventKeyUp == aType && EKeyNull != iKeyPressedDown ) |
429 if ( EEventKeyUp == aType && EKeyNull != iKeyPressedDown ) |
430 { |
430 { |
431 // Handle short key press |
431 // EKeyEnter is always offered to Telephony so donīt offer it |
432 iStateMachine->State()->HandleKeyMessageL( |
432 // to state if there is menu or a dialog open. |
433 MPhoneKeyEvents::EPhoneKeyShortPress, |
433 if ( !( EKeyEnter == iKeyPressedDown |
434 TKeyCode( iKeyPressedDown ) ); |
434 && iDisplayingMenuOrDialogOnEventKeyDown ) ) |
435 |
435 { |
|
436 // Handle short key press |
|
437 iStateMachine->State()->HandleKeyMessageL( |
|
438 MPhoneKeyEvents::EPhoneKeyShortPress, |
|
439 TKeyCode( iKeyPressedDown ) ); |
|
440 } |
436 // Reset key code |
441 // Reset key code |
437 iScanCode = EStdKeyNull; |
442 iScanCode = EStdKeyNull; |
438 iKeyPressedDown = EKeyNull; |
443 iKeyPressedDown = EKeyNull; |
|
444 iDisplayingMenuOrDialogOnEventKeyDown = EFalse; |
439 } |
445 } |
440 |
446 |
441 return EKeyWasNotConsumed; |
447 return EKeyWasNotConsumed; |
442 } |
448 } |
443 |
449 |
476 { |
482 { |
477 __LOGMETHODSTARTEND( EPhoneControl, |
483 __LOGMETHODSTARTEND( EPhoneControl, |
478 "CPhoneKeyEventForwarder::HandleEventKeyDownBeforeControlStackL"); |
484 "CPhoneKeyEventForwarder::HandleEventKeyDownBeforeControlStackL"); |
479 |
485 |
480 // Convert key code |
486 // Convert key code |
481 ConvertKeyCode( iKeyPressedDown, aKeyEvent ); |
487 ConvertKeyCodeL( iKeyPressedDown, aKeyEvent ); |
482 // Save key scan code |
488 // Save key scan code |
483 iScanCode = aKeyEvent.iScanCode; |
489 iScanCode = aKeyEvent.iScanCode; |
484 |
490 |
485 // Store the previous keypress time. |
491 // Store the previous keypress time. |
486 iPreviousKeyPressTime = iKeyPressTime; |
492 iPreviousKeyPressTime = iKeyPressTime; |
518 KPhoneLongPressKeyEventDuration, |
524 KPhoneLongPressKeyEventDuration, |
519 TCallBack( DoHandleLongPressKeyEventCallbackL, |
525 TCallBack( DoHandleLongPressKeyEventCallbackL, |
520 this ) ); |
526 this ) ); |
521 } |
527 } |
522 |
528 |
523 return ( EKeyWasNotConsumed ); |
529 // Check if dialog or menu is open |
|
530 // EikAppUi()->IsDisplayingMenuOrDialog doesnīt always return correct |
|
531 // value for menubar, so ask visibility also from CEikMenuBar |
|
532 iDisplayingMenuOrDialogOnEventKeyDown = ( iViewCommandHandle->HandleCommandL( |
|
533 EPhoneViewIsDisplayingMenuOrDialog ) == |
|
534 EPhoneViewResponseSuccess ) || ( iMenu && iMenu->IsDisplayed() ); |
|
535 |
|
536 // Consume dialer simulated key events, pass others on |
|
537 return ( IsKeySimulatedByTouchDialer( aKeyEvent ) ? EKeyWasConsumed : EKeyWasNotConsumed ); |
524 } |
538 } |
525 |
539 |
526 // ----------------------------------------------------------- |
540 // ----------------------------------------------------------- |
527 // CPhoneKeyEventForwarder::HandleEventKeyBeforeControlStackL |
541 // CPhoneKeyEventForwarder::HandleEventKeyBeforeControlStackL |
528 // Both short key press event (iRepeats == 0) and |
542 // Both short key press event (iRepeats == 0) and |
629 } |
643 } |
630 |
644 |
631 // Store the previous scan code |
645 // Store the previous scan code |
632 iPreviousScanCode = iScanCode; |
646 iPreviousScanCode = iScanCode; |
633 |
647 |
634 return EKeyWasNotConsumed; |
648 // Consume dialer simulated key events, pass others on |
|
649 return ( IsKeySimulatedByTouchDialer( aKeyEvent ) ? EKeyWasConsumed : EKeyWasNotConsumed ); |
635 } |
650 } |
636 |
651 |
637 // --------------------------------------------------------- |
652 // --------------------------------------------------------- |
638 // CPhoneKeyEventForwarder::DoHandleLongPressKeyEventCallback |
653 // CPhoneKeyEventForwarder::DoHandleLongPressKeyEventCallback |
639 // |
654 // |
697 iScanCode = EStdKeyNull; |
712 iScanCode = EStdKeyNull; |
698 iKeyPressedDown = EKeyNull; |
713 iKeyPressedDown = EKeyNull; |
699 } |
714 } |
700 |
715 |
701 // ----------------------------------------------------------- |
716 // ----------------------------------------------------------- |
702 // CPhoneKeyEventForwarder::ConvertKeyCode |
717 // CPhoneKeyEventForwarder::ConvertKeyCodeL |
703 // ----------------------------------------------------------- |
718 // ----------------------------------------------------------- |
704 // |
719 // |
705 void CPhoneKeyEventForwarder::ConvertKeyCode( TUint& aCode, |
720 void CPhoneKeyEventForwarder::ConvertKeyCodeL( TUint& aCode, |
706 const TKeyEvent& aKeyEvent ) |
721 const TKeyEvent& aKeyEvent ) |
707 { |
722 { |
708 __LOGMETHODSTARTEND( EPhoneControl, |
723 __LOGMETHODSTARTEND( EPhoneControl, |
709 "CPhoneKeyEventForwarder::ConvertKeyCode"); |
724 "CPhoneKeyEventForwarder::ConvertKeyCodeL"); |
710 |
725 |
711 // Handler for special device key mapping in case iScanCode |
726 // Handler for special device key mapping in case iScanCode |
712 // to iCode conversion hasn't been handled by CAknAppUi::GetAliasKeyCodeL |
727 // to iCode conversion hasn't been handled by CAknAppUi::GetAliasKeyCodeL |
713 __PHONELOG1( EBasic, EPhoneControl, |
728 __PHONELOG1( EBasic, EPhoneControl, |
714 "CPhoneKeyEventHandler::ConvertKeyCode scan code (%d)", |
729 "CPhoneKeyEventHandler::ConvertKeyCodeL scan code (%d)", |
715 aKeyEvent.iScanCode ); |
730 aKeyEvent.iScanCode ); |
716 |
731 |
717 if ( !ConvertHalfQwertySpecialChar( aCode, aKeyEvent ) ) |
732 if ( !ConvertHalfQwertySpecialChar( aCode, aKeyEvent ) ) |
718 { |
733 { |
719 TBool numMode = iViewCommandHandle->HandleCommandL( |
734 TBool numMode = iViewCommandHandle->HandleCommandL( |