139 { |
139 { |
140 __LOGMETHODSTARTEND( EPhoneControl, |
140 __LOGMETHODSTARTEND( EPhoneControl, |
141 "CPhoneKeyEventForwarder::OfferKeyEventL"); |
141 "CPhoneKeyEventForwarder::OfferKeyEventL"); |
142 |
142 |
143 TKeyResponse ret( EKeyWasNotConsumed ); |
143 TKeyResponse ret( EKeyWasNotConsumed ); |
|
144 |
|
145 // After event key, expect to have key up event. |
|
146 iExpectKeyUpEvent = ( aType == EEventKey ); |
144 |
147 |
145 ret = OfferKeyEventBeforeControlStackL( aKeyEvent, aType ); |
148 ret = OfferKeyEventBeforeControlStackL( aKeyEvent, aType ); |
146 |
149 |
147 if ( !aKeyEvent.iRepeats ) |
150 if ( !aKeyEvent.iRepeats ) |
148 { |
151 { |
149 // Convert event. Use already converted iKeyPressedDown. |
152 // Convert event. Use already converted iKeyPressedDown. |
150 TKeyEvent keyEvent = aKeyEvent; |
153 TKeyEvent keyEvent = aKeyEvent; |
151 keyEvent.iCode = iKeyPressedDown; |
154 keyEvent.iCode = iKeyPressedDown; |
152 |
155 |
153 // Start and stop dtmf |
156 // Do not handle dtmf tone if the type is EEventKey but we are not |
154 iStateMachine->State()->HandleDtmfKeyToneL( keyEvent, aType ); |
157 // expecting key up event. This happens if the key up event has been |
|
158 // handled by some CActiveSchedulerWait object somewhere in the execution |
|
159 // of function OfferKeyEventBeforeControlStackL. |
|
160 if ( iExpectKeyUpEvent || aType != EEventKey ) |
|
161 { |
|
162 // Start and stop dtmf |
|
163 iStateMachine->State()->HandleDtmfKeyToneL( keyEvent, aType ); |
|
164 } |
|
165 |
155 // Open number entry view if any allowed character key |
166 // Open number entry view if any allowed character key |
156 // is pressed on homescreen or in-call ui |
167 // is pressed on homescreen or in-call ui |
157 if ( aType != EEventKeyUp && IsKeyAllowed( keyEvent ) ) |
168 if ( aType != EEventKeyUp && IsKeyAllowed( keyEvent ) ) |
158 { |
169 { |
159 // Do not open number entry with up key |
170 // Do not open number entry with up key |
432 // Cancel the long press key event timer, if it is active |
443 // Cancel the long press key event timer, if it is active |
433 if ( iLongPressKeyEventTimer->IsActive() ) |
444 if ( iLongPressKeyEventTimer->IsActive() ) |
434 { |
445 { |
435 iLongPressKeyEventTimer->CancelTimer(); |
446 iLongPressKeyEventTimer->CancelTimer(); |
436 } |
447 } |
437 |
448 |
438 // Re-start the timer |
449 // Don't initiate long tap timer if all these are true |
439 iLongPressKeyEventTimer->After( |
450 // a) key event is not from virtual dialer |
440 KPhoneLongPressKeyEventDuration, |
451 // b) device is in qwerty mode |
441 TCallBack( DoHandleLongPressKeyEventCallbackL, |
452 // c) phone number editor is alpha mode, i.e. not in numeric mode |
442 this ) ); |
453 // This is to prevent phone app's long tap functionality with qwerty |
|
454 // long presses, and to have the normal editor long press behaviour |
|
455 // instead. |
|
456 TBool preventLongTap = |
|
457 !IsKeySimulatedByTouchDialer( aKeyEvent ) && |
|
458 iQwertyHandler->IsQwertyInput() && |
|
459 iViewCommandHandle->HandleCommandL( EPhoneViewIsNumberEntryNumericMode ) != EPhoneViewResponseSuccess; |
|
460 |
|
461 if ( !preventLongTap ) |
|
462 { |
|
463 // Start long press timer |
|
464 iLongPressKeyEventTimer->After( |
|
465 KPhoneLongPressKeyEventDuration, |
|
466 TCallBack( DoHandleLongPressKeyEventCallbackL, |
|
467 this ) ); |
|
468 } |
443 |
469 |
444 return ( EKeyWasNotConsumed ); |
470 return ( EKeyWasNotConsumed ); |
445 } |
471 } |
446 |
472 |
447 // ----------------------------------------------------------- |
473 // ----------------------------------------------------------- |
497 } |
523 } |
498 response = EKeyWasConsumed; |
524 response = EKeyWasConsumed; |
499 } |
525 } |
500 } |
526 } |
501 |
527 |
502 // Prevent repeats of DTMF keys anyway |
|
503 if ( response == EKeyWasNotConsumed ) |
|
504 { |
|
505 // Convert event. |
|
506 keyEvent.iCode = iKeyPressedDown; |
|
507 if ( aKeyEvent.iRepeats > 0 && |
|
508 aKeyEvent.iCode != EKeyF18 && // EKeyF18 is used for AknCCPU support |
|
509 CPhoneKeys::IsDtmfTone( keyEvent, EEventKey ) ) |
|
510 { |
|
511 // Do not repeat dtmf characters |
|
512 response = EKeyWasConsumed; |
|
513 } |
|
514 } |
|
515 |
|
516 return response; |
528 return response; |
517 } |
529 } |
518 |
530 |
519 // ----------------------------------------------------------- |
531 // ----------------------------------------------------------- |
520 // CPhoneKeyEventForwarder::HandleEventKeyUpBeforeControlStackL |
532 // CPhoneKeyEventForwarder::HandleEventKeyUpBeforeControlStackL |