31 #include <aknlayoutscalable_apps.cdl.h> |
31 #include <aknlayoutscalable_apps.cdl.h> |
32 #include <layoutmetadata.cdl.h> |
32 #include <layoutmetadata.cdl.h> |
33 #include <data_caging_path_literals.hrh> // for KDC_APP_RESOURCE_DIR |
33 #include <data_caging_path_literals.hrh> // for KDC_APP_RESOURCE_DIR |
34 #include <touchfeedback.h> |
34 #include <touchfeedback.h> |
35 #include <aknlayoutscalable_avkon.cdl.h> |
35 #include <aknlayoutscalable_avkon.cdl.h> |
36 #include <aknsframebackgroundcontrolcontext.h> |
36 #include <AknsFrameBackgroundControlContext.h> |
37 |
37 |
38 #include "cdialerkeypadcontainer.h" |
38 #include "cdialerkeypadcontainer.h" |
39 #include "dialercommon.h" |
39 #include "dialercommon.h" |
40 #include "dialertrace.h" |
40 #include "dialertrace.h" |
41 |
41 |
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 |
407 |
407 { |
408 { |
408 // Find tapped control |
409 // Find tapped control |
409 |
410 |
410 CDialerKeyPadButton* tappedButton = NULL; |
411 CDialerKeyPadButton* tappedButton = NULL; |
415 tappedButton = iButtons[i]; |
416 tappedButton = iButtons[i]; |
416 break; |
417 break; |
417 } |
418 } |
418 } |
419 } |
419 |
420 |
420 __ASSERT_ALWAYS( tappedButton, |
421 if ( !tappedButton ) |
421 _L("CDialerKeyPadContainer::HandleControlEventL, invalid button handle")); // TODO: This is meaningless statement, use either Panic or make this only comment. |
422 { |
|
423 __ASSERT_DEBUG( EFalse, DialerPanic( EDialerPanicEventFromUnknownControl ) ); |
|
424 return; |
|
425 } |
422 |
426 |
423 // Send key event to phone. |
427 // Send key event to phone. |
424 TKeyEvent keyEvent; |
428 TKeyEvent keyEvent; |
425 keyEvent.iScanCode = tappedButton->ScanCode(); |
429 keyEvent.iScanCode = tappedButton->ScanCode(); |
426 keyEvent.iModifiers = ( EModifierNumLock | EModifierKeypad ); // Mark that this event is dialer simulated |
430 keyEvent.iModifiers = ( EModifierNumLock | EModifierKeypad ); // Mark that this event is dialer simulated |
427 keyEvent.iRepeats = 0; |
431 keyEvent.iRepeats = 0; |
428 |
432 |
429 switch ( aEventType ) |
433 switch ( aEventType ) |
430 { |
434 { |
431 case EEventRequestExit: |
435 case EEventRequestExit: |
432 case EEventRequestCancel: |
436 case EEventRequestCancel: |
433 { |
437 { |
434 DIALER_PRINT("HandleControlEventL.EEventRequestExit"); |
438 DIALER_PRINT("HandleControlEventL.EEventRequestExit"); |
435 iButtonPressedDown = EFalse; |
439 iButtonPressedDown = EFalse; |
436 keyEvent.iCode = 0; |
440 if ( !iKeyUpSimulatedDueToDragging ) |
437 ControlEnv()->SimulateKeyEventL( keyEvent, EEventKeyUp ); |
441 { |
|
442 keyEvent.iCode = 0; |
|
443 ControlEnv()->SimulateKeyEventL( keyEvent, EEventKeyUp ); |
|
444 } |
|
445 iKeyUpSimulatedDueToDragging = EFalse; |
438 } |
446 } |
439 break; |
447 break; |
|
448 |
440 case EEventStateChanged: |
449 case EEventStateChanged: |
441 { |
450 { |
442 DIALER_PRINT("HandleControlEventL.EEventStateChanged"); |
451 DIALER_PRINT("HandleControlEventL.EEventStateChanged"); |
443 iButtonPressedDown = ETrue; |
452 iButtonPressedDown = ETrue; |
444 keyEvent.iCode = tappedButton->KeyCode(); |
453 keyEvent.iCode = tappedButton->KeyCode(); |
445 iParentControl.PrepareForFocusGainL(); |
454 iParentControl.PrepareForFocusGainL(); |
446 |
455 |
447 ControlEnv()->SimulateKeyEventL( keyEvent, EEventKeyDown ); |
456 ControlEnv()->SimulateKeyEventL( keyEvent, EEventKeyDown ); |
448 |
457 |
449 if( iButtonPressedDown ) |
458 if( iButtonPressedDown ) |
450 { |
459 { |
451 // Send event key if key havent be lifted up already |
460 // Send event key if key havent be lifted up already |
452 ControlEnv()->SimulateKeyEventL( keyEvent, EEventKey ); |
461 ControlEnv()->SimulateKeyEventL( keyEvent, EEventKey ); |
453 } |
462 } |
454 } |
463 } |
455 break; |
464 break; |
|
465 |
|
466 case CDialerKeyPadButton::EEventDraggingOutsideButton: |
|
467 { |
|
468 DIALER_PRINT("HandleControlEventL.EEventDraggingOutsideButton"); |
|
469 // User hasn't released touch yet but in order to cancel |
|
470 // long press action handled and initiated by parent control, |
|
471 // we must send key up event now. |
|
472 if ( !iKeyUpSimulatedDueToDragging ) |
|
473 { |
|
474 keyEvent.iCode = 0; |
|
475 ControlEnv()->SimulateKeyEventL( keyEvent, EEventKeyUp ); |
|
476 iKeyUpSimulatedDueToDragging = ETrue; |
|
477 } |
|
478 } |
|
479 break; |
|
480 |
456 default: |
481 default: |
457 break; |
482 break; |
458 } |
483 } |
459 } |
484 } |
460 DIALER_PRINT("KeyPadContainer::HandleControlEventL>"); |
485 DIALER_PRINT("KeyPadContainer::HandleControlEventL>"); |
461 } |
486 } |
462 |
487 |
463 // --------------------------------------------------------------------------- |
488 // --------------------------------------------------------------------------- |
464 // CDialerKeyPadContainer::HandleResourceChange |
489 // CDialerKeyPadContainer::HandleResourceChange |
465 // |
490 // |
466 // Forwards skin change event to buttons |
491 // Forwards skin change event to buttons |
467 // |
492 // |