398 TCoeEvent aEventType ) |
398 TCoeEvent aEventType ) |
399 { |
399 { |
400 DIALER_PRINTF("KeyPadContainer::HandleControlEventL.EventType=", |
400 DIALER_PRINTF("KeyPadContainer::HandleControlEventL.EventType=", |
401 (TInt)aEventType); |
401 (TInt)aEventType); |
402 |
402 |
403 if ( aEventType == EEventStateChanged || |
403 if ( aEventType == EEventStateChanged || |
404 aEventType == EEventRequestCancel || |
404 aEventType == EEventRequestCancel || |
405 aEventType == EEventRequestExit || |
405 aEventType == EEventRequestExit || |
406 aEventType == CDialerKeyPadButton::EEventDraggingOutsideButton ) |
406 aEventType == CDialerKeyPadButton::EEventDraggingOutsideButton ) |
407 |
407 |
408 { |
408 { |
424 return; |
424 return; |
425 } |
425 } |
426 |
426 |
427 // Send key event to phone. |
427 // Send key event to phone. |
428 TKeyEvent keyEvent; |
428 TKeyEvent keyEvent; |
|
429 keyEvent.iCode = 0; // iCode should be 0 for all but EEventKey type of events |
429 keyEvent.iScanCode = tappedButton->ScanCode(); |
430 keyEvent.iScanCode = tappedButton->ScanCode(); |
430 keyEvent.iModifiers = ( EModifierNumLock | EModifierKeypad ); // Mark that this event is dialer simulated |
431 keyEvent.iModifiers = ( EModifierNumLock | EModifierKeypad ); // Mark that this event is dialer simulated |
431 keyEvent.iRepeats = 0; |
432 keyEvent.iRepeats = 0; |
432 |
433 |
433 switch ( aEventType ) |
434 switch ( aEventType ) |
437 { |
438 { |
438 DIALER_PRINT("HandleControlEventL.EEventRequestExit"); |
439 DIALER_PRINT("HandleControlEventL.EEventRequestExit"); |
439 iButtonPressedDown = EFalse; |
440 iButtonPressedDown = EFalse; |
440 if ( !iKeyUpSimulatedDueToDragging ) |
441 if ( !iKeyUpSimulatedDueToDragging ) |
441 { |
442 { |
442 keyEvent.iCode = 0; |
|
443 ControlEnv()->SimulateKeyEventL( keyEvent, EEventKeyUp ); |
443 ControlEnv()->SimulateKeyEventL( keyEvent, EEventKeyUp ); |
444 } |
444 } |
445 iKeyUpSimulatedDueToDragging = EFalse; |
445 iKeyUpSimulatedDueToDragging = EFalse; |
446 } |
446 } |
447 break; |
447 break; |
448 |
448 |
449 case EEventStateChanged: |
449 case EEventStateChanged: |
450 { |
450 { |
451 DIALER_PRINT("HandleControlEventL.EEventStateChanged"); |
451 DIALER_PRINT("HandleControlEventL.EEventStateChanged"); |
452 iButtonPressedDown = ETrue; |
452 iButtonPressedDown = ETrue; |
453 keyEvent.iCode = tappedButton->KeyCode(); |
|
454 iParentControl.PrepareForFocusGainL(); |
453 iParentControl.PrepareForFocusGainL(); |
455 |
454 |
456 ControlEnv()->SimulateKeyEventL( keyEvent, EEventKeyDown ); |
455 ControlEnv()->SimulateKeyEventL( keyEvent, EEventKeyDown ); |
457 |
456 |
458 if( iButtonPressedDown ) |
457 if ( iButtonPressedDown ) |
459 { |
458 { |
460 // Send event key if key havent be lifted up already |
459 // Send event key if key havent be lifted up already |
|
460 keyEvent.iCode = tappedButton->KeyCode(); |
461 ControlEnv()->SimulateKeyEventL( keyEvent, EEventKey ); |
461 ControlEnv()->SimulateKeyEventL( keyEvent, EEventKey ); |
462 } |
462 } |
463 } |
463 } |
464 break; |
464 break; |
465 |
465 |
469 // User hasn't released touch yet but in order to cancel |
469 // User hasn't released touch yet but in order to cancel |
470 // long press action handled and initiated by parent control, |
470 // long press action handled and initiated by parent control, |
471 // we must send key up event now. |
471 // we must send key up event now. |
472 if ( !iKeyUpSimulatedDueToDragging ) |
472 if ( !iKeyUpSimulatedDueToDragging ) |
473 { |
473 { |
474 keyEvent.iCode = 0; |
|
475 ControlEnv()->SimulateKeyEventL( keyEvent, EEventKeyUp ); |
474 ControlEnv()->SimulateKeyEventL( keyEvent, EEventKeyUp ); |
476 iKeyUpSimulatedDueToDragging = ETrue; |
475 iKeyUpSimulatedDueToDragging = ETrue; |
477 } |
476 } |
478 } |
477 } |
479 break; |
478 break; |