phoneuis/dialer/src/cdialertoolbarcontainer.cpp
branchRCL_3
changeset 25 91c2fb4b78df
parent 19 544e34b3255a
child 57 94dc1107e8b2
equal deleted inserted replaced
19:544e34b3255a 25:91c2fb4b78df
   217 //
   217 //
   218 void CDialerToolbarContainer::HandleControlEventL( CCoeControl* aControl, TCoeEvent aEventType )
   218 void CDialerToolbarContainer::HandleControlEventL( CCoeControl* aControl, TCoeEvent aEventType )
   219     {
   219     {
   220     if ( aEventType == MCoeControlObserver::EEventStateChanged )
   220     if ( aEventType == MCoeControlObserver::EEventStateChanged )
   221         {
   221         {
       
   222         // Give dialer a chance to update editor state before handling the button press.
       
   223         // Used to reconfigure editor after user has closed virtual keyboard.
       
   224         iParentControl.PrepareForFocusGainL();
       
   225 
   222         // Handle button press. 
   226         // Handle button press. 
   223 
   227 
   224         // Multistate buttons change state automatically when pressed. 
   228         // Multistate buttons change state automatically when pressed. 
   225         // Revert this change as we do not want to use states
   229         // Revert this change as we do not want to use states
   226         // for "toggle button" type of functionality but to give one button
   230         // for "toggle button" type of functionality but to give one button
   236         CAknButton* button = static_cast<CAknButton*>( aControl );
   240         CAknButton* button = static_cast<CAknButton*>( aControl );
   237         TInt commandId = ButtonCommand( *button );
   241         TInt commandId = ButtonCommand( *button );
   238         
   242         
   239         if ( commandId == EPhoneDialerCmdClear )
   243         if ( commandId == EPhoneDialerCmdClear )
   240             {
   244             {
   241             // simulate backspace
   245             SimulateBackspace();
   242             TKeyEvent keyEvent;
       
   243             keyEvent.iModifiers = 0;
       
   244             keyEvent.iRepeats = 0;
       
   245             keyEvent.iCode = EKeyBackspace;
       
   246             keyEvent.iScanCode = EStdKeyBackspace;
       
   247             iCoeEnv->SimulateKeyEventL( keyEvent, EEventKey );
       
   248             }
   246             }
   249         else
   247         else
   250             {
   248             {
   251             // Forward pressed toolbar button to the framework 
   249             // Forward pressed toolbar button to the framework 
   252             // so that we can handle it in active state
   250             // so that we can handle it in active state
   457         }
   455         }
   458     
   456     
   459     return nextPos;
   457     return nextPos;
   460     }
   458     }
   461 
   459 
       
   460 // ---------------------------------------------------------------------------
       
   461 // SimulateBackspace
       
   462 // Simulate backspace press including key down event, key event, and key up 
       
   463 // event
       
   464 // ---------------------------------------------------------------------------
       
   465 //
       
   466 void CDialerToolbarContainer::SimulateBackspace()
       
   467     {
       
   468     TKeyEvent keyEvent;
       
   469     keyEvent.iModifiers = 0;
       
   470     keyEvent.iRepeats = 0;
       
   471     keyEvent.iCode = 0; // key code is always 0 for key up and down events
       
   472     keyEvent.iScanCode = EStdKeyBackspace;
       
   473 
       
   474     iCoeEnv->SimulateKeyEventL( keyEvent, EEventKeyDown );
       
   475 
       
   476     keyEvent.iCode = EKeyBackspace;
       
   477     iCoeEnv->SimulateKeyEventL( keyEvent, EEventKey );
       
   478     
       
   479     keyEvent.iCode = 0;
       
   480     iCoeEnv->SimulateKeyEventL( keyEvent, EEventKeyUp );
       
   481     }
       
   482 
   462 // end of file
   483 // end of file