phoneuis/dialer/src/cdialertoolbarcontainer.cpp
branchRCL_3
changeset 7 544e34b3255a
parent 5 2a26698d78ba
child 9 91c2fb4b78df
--- a/phoneuis/dialer/src/cdialertoolbarcontainer.cpp	Wed Mar 31 21:30:06 2010 +0300
+++ b/phoneuis/dialer/src/cdialertoolbarcontainer.cpp	Wed Apr 14 15:56:42 2010 +0300
@@ -276,7 +276,7 @@
     {
     // no implementation needed
     }
-    
+
 // ---------------------------------------------------------------------------
 // HandleLosingForeground
 //
@@ -286,12 +286,16 @@
     {
     // This is needed when dialer control disappeares during keypress. 
     // Last pressed pointer event must be forwarted to framework 
-    // as pointer up event. Thus button is set to unpressed state etc. 
+    // as pointer up event. Thus button is set to unpressed state etc.
+    // This code calls HandlePointerEventL of the parent class instead of this.
+    // If we call this classes HandlePointerEventL, this classes 
+    // grab status is not cleared, and later coming EButton1Up events may end
+    // up erroneously to this class, although intended elsewhere.
     // 
-    if ( iLatestPointerEvent.iType != TPointerEvent::EButton1Up )
+    if ( iLatestPointerEvent.iType != TPointerEvent::EButton1Up && Parent() )
         {    
         iLatestPointerEvent.iType = TPointerEvent::EButton1Up;
-        TRAP_IGNORE( HandlePointerEventL( iLatestPointerEvent ) );
+        TRAP_IGNORE( Parent()->HandlePointerEventL( iLatestPointerEvent ) );
         }    
     }
 
@@ -402,15 +406,7 @@
     TInt commandId = KErrNotFound;
     
     // Find out index of the button in iButtons array
-    TInt btnIndex = KErrNotFound;
-    for ( TInt i = 0 ; i < iButtons.Count() ; ++i )
-        {
-        if ( iButtons[i] == &aButton )
-            {
-            btnIndex = i;
-            i = iButtons.Count(); // to break out of the loop
-            }
-        }
+    TInt btnIndex = iButtons.Find( &aButton );
     __ASSERT_DEBUG( btnIndex >= 0, DialerPanic( EDialerPanicToolbarButtonNotFound ) );
     
     // Find the corresponding command from command array