274 // |
274 // |
275 void CDialerToolbarContainer::HandleGainingForeground() |
275 void CDialerToolbarContainer::HandleGainingForeground() |
276 { |
276 { |
277 // no implementation needed |
277 // no implementation needed |
278 } |
278 } |
279 |
279 |
280 // --------------------------------------------------------------------------- |
280 // --------------------------------------------------------------------------- |
281 // HandleLosingForeground |
281 // HandleLosingForeground |
282 // |
282 // |
283 // --------------------------------------------------------------------------- |
283 // --------------------------------------------------------------------------- |
284 // |
284 // |
285 void CDialerToolbarContainer::HandleLosingForeground() |
285 void CDialerToolbarContainer::HandleLosingForeground() |
286 { |
286 { |
287 // This is needed when dialer control disappeares during keypress. |
287 // This is needed when dialer control disappeares during keypress. |
288 // Last pressed pointer event must be forwarted to framework |
288 // Last pressed pointer event must be forwarted to framework |
289 // as pointer up event. Thus button is set to unpressed state etc. |
289 // as pointer up event. Thus button is set to unpressed state etc. |
|
290 // This code calls HandlePointerEventL of the parent class instead of this. |
|
291 // If we call this classes HandlePointerEventL, this classes |
|
292 // grab status is not cleared, and later coming EButton1Up events may end |
|
293 // up erroneously to this class, although intended elsewhere. |
290 // |
294 // |
291 if ( iLatestPointerEvent.iType != TPointerEvent::EButton1Up ) |
295 if ( iLatestPointerEvent.iType != TPointerEvent::EButton1Up && Parent() ) |
292 { |
296 { |
293 iLatestPointerEvent.iType = TPointerEvent::EButton1Up; |
297 iLatestPointerEvent.iType = TPointerEvent::EButton1Up; |
294 TRAP_IGNORE( HandlePointerEventL( iLatestPointerEvent ) ); |
298 TRAP_IGNORE( Parent()->HandlePointerEventL( iLatestPointerEvent ) ); |
295 } |
299 } |
296 } |
300 } |
297 |
301 |
298 // --------------------------------------------------------------------------- |
302 // --------------------------------------------------------------------------- |
299 // CreateButtonsL |
303 // CreateButtonsL |
400 TInt CDialerToolbarContainer::ButtonCommand( const CAknButton& aButton ) const |
404 TInt CDialerToolbarContainer::ButtonCommand( const CAknButton& aButton ) const |
401 { |
405 { |
402 TInt commandId = KErrNotFound; |
406 TInt commandId = KErrNotFound; |
403 |
407 |
404 // Find out index of the button in iButtons array |
408 // Find out index of the button in iButtons array |
405 TInt btnIndex = KErrNotFound; |
409 TInt btnIndex = iButtons.Find( &aButton ); |
406 for ( TInt i = 0 ; i < iButtons.Count() ; ++i ) |
|
407 { |
|
408 if ( iButtons[i] == &aButton ) |
|
409 { |
|
410 btnIndex = i; |
|
411 i = iButtons.Count(); // to break out of the loop |
|
412 } |
|
413 } |
|
414 __ASSERT_DEBUG( btnIndex >= 0, DialerPanic( EDialerPanicToolbarButtonNotFound ) ); |
410 __ASSERT_DEBUG( btnIndex >= 0, DialerPanic( EDialerPanicToolbarButtonNotFound ) ); |
415 |
411 |
416 // Find the corresponding command from command array |
412 // Find the corresponding command from command array |
417 TInt btnStateIdx = aButton.StateIndex(); |
413 TInt btnStateIdx = aButton.StateIndex(); |
418 if ( btnIndex < iButtonCommands.Count() && |
414 if ( btnIndex < iButtonCommands.Count() && |