uifw/AvKon/src/akndigitalclock.cpp
branchRCL_3
changeset 9 aabf2c525e0f
parent 4 8ca85d2f0db7
child 23 3d340a0166ff
--- a/uifw/AvKon/src/akndigitalclock.cpp	Fri Feb 19 23:04:46 2010 +0200
+++ b/uifw/AvKon/src/akndigitalclock.cpp	Fri Mar 12 15:43:43 2010 +0200
@@ -355,72 +355,100 @@
 
 // -----------------------------------------------------------------------------
 // CAknDigitalClock::HandlePointerEventL
-// Starts clock application in down event.
+// Opens the universal indicator popup upon tap.
 // -----------------------------------------------------------------------------
 //
 void CAknDigitalClock::HandlePointerEventL( const TPointerEvent& aPointerEvent )
     {
-    CAknControl:: HandlePointerEventL( aPointerEvent );
+    CAknControl::HandlePointerEventL( aPointerEvent );
 
-    if ( AknLayoutUtils::PenEnabled() )
+    // Do nothing if dimmed.
+    if ( IsDimmed() || Window().IsFaded() )
         {
-        // Do nothing if dimmed.
-        if ( IsDimmed() ||
-             Window().IsFaded() )
-            {
-            return;
-            }
+        return;
+        }
+
+    TRect rect( Rect() );
 
-        TRect rect( Rect() );
+    // Currently the small digital clock pane, universal
+    // indicator pane and battery pane (in status pane layouts
+    // where it's adjacent to universal indicator or digital
+    // clock pane) are regarded as one touch responsive
+    // area from which the universal indicator popup should
+    // open on tap, so upon pointer up event it must be checked
+    // here if the down event happened inside this control,
+    // but the up event inside battery or indicator pane area.
+    TBool pointerUpInIndicatorArea( EFalse );
+    TBool pointerUpInBatteryArea( EFalse );
 
-        // Currently the small digital clock pane and universal
-        // indicator pane are regarded as one touch responsive area from
-        // which the universal indicator popup should open on tap,
-        // so upon pointer up event it must be checked here if
-        // the down event happened inside this control, but the up event
-        // inside indicator pane area.
-        TRect indicatorRect( 0, 0, 0, 0 );
+    if ( iFlags & EAknDigitalClockInStatusPane &&
+         aPointerEvent.iType == TPointerEvent::EButton1Up )
+        {
+        CEikStatusPaneBase* sp = CEikStatusPaneBase::Current();
 
-        if ( iFlags & EAknDigitalClockInStatusPane &&
-             aPointerEvent.iType == TPointerEvent::EButton1Up )
+        if ( sp )
             {
-            CEikStatusPaneBase* sp = CEikStatusPaneBase::Current();
-
-            if ( sp )
+            CCoeControl* indicatorPane = sp->ContainerControlL(
+                TUid::Uid( EEikStatusPaneUidIndic ) );
+            if ( indicatorPane )
                 {
-                CCoeControl* indicatorPane = sp->ContainerControlL(
-                    TUid::Uid( EEikStatusPaneUidIndic ) );
-                if ( indicatorPane )
+                TRect indicatorRect( indicatorPane->PositionRelativeToScreen(),
+                                     indicatorPane->Size() );
+                pointerUpInIndicatorArea =
+                    indicatorRect.Contains( aPointerEvent.iParentPosition );
+                }
+            
+            if ( !AknStatuspaneUtils::ExtendedFlatLayoutActive() )
+                {
+                CCoeControl* batteryPane = sp->ContainerControlL(
+                    TUid::Uid( EEikStatusPaneUidBattery ) );
+                if ( batteryPane )
                     {
-                    indicatorRect =
-                        TRect( indicatorPane->PositionRelativeToScreen(),
-                               indicatorPane->Size() );
+                    TRect batteryRect( batteryPane->PositionRelativeToScreen(),
+                                       batteryPane->Size() );
+                    pointerUpInBatteryArea =
+                        batteryRect.Contains( aPointerEvent.iParentPosition );
                     }
                 }
             }
+        }
 
-        if ( aPointerEvent.iType == TPointerEvent::EButton1Down &&
-             rect.Contains( aPointerEvent.iPosition ) )
+    if ( aPointerEvent.iType == TPointerEvent::EButton1Down &&
+         rect.Contains( aPointerEvent.iPosition ) )
+        {
+        // Set flag that down event was inside the clock.
+        iFlags |= EAknDigitalClockButton1DownReceived;
+
+        // tactile feedback is done with SetFeedbackArea
+        }
+    else if ( aPointerEvent.iType == TPointerEvent::EButton1Up &&
+              ( ( iFlags & EAknDigitalClockButton1DownReceived &&
+                  rect.Contains( aPointerEvent.iPosition ) ) ||
+                pointerUpInIndicatorArea ||
+                pointerUpInBatteryArea ) )
+        {
+        if ( pointerUpInIndicatorArea || pointerUpInBatteryArea )
             {
-            // Set flag that down event was inside the clock.
-            iFlags |= EAknDigitalClockButton1DownReceived;
-
-            // tactile feedback is done with SetFeedbackArea
+            MTouchFeedback* feedback = MTouchFeedback::Instance();
+            if ( feedback )
+                {
+                // The pointer down was received in another control,
+                // so the tactile feedback must be given directly.
+                feedback->InstantFeedback( this,
+                                           ETouchFeedbackSensitiveButton,
+                                           ETouchFeedbackVibra,
+                                           aPointerEvent );
+                }
             }
-        else if ( aPointerEvent.iType == TPointerEvent::EButton1Up &&
-                  ( ( iFlags & EAknDigitalClockButton1DownReceived &&
-                      rect.Contains( aPointerEvent.iPosition ) ) ||
-                    ( indicatorRect.Contains( aPointerEvent.iParentPosition ) ) ) )
-            {
-            // Launch the universal indicator popup.
-            CAknSmallIndicator* indicatorNotifier =
-                CAknSmallIndicator::NewLC( TUid::Uid( 0 ) );
-            indicatorNotifier->HandleIndicatorTapL();
-            CleanupStack::PopAndDestroy( indicatorNotifier );
+    
+        // Launch the universal indicator popup.
+        CAknSmallIndicator* indicatorNotifier =
+            CAknSmallIndicator::NewLC( TUid::Uid( 0 ) );
+        indicatorNotifier->HandleIndicatorTapL();
+        CleanupStack::PopAndDestroy( indicatorNotifier );
 
-            // Up event received, reset button down flag.
-            iFlags &= ( ~EAknDigitalClockButton1DownReceived );
-            }
+        // Up event received, reset button down flag.
+        iFlags &= ( ~EAknDigitalClockButton1DownReceived );
         }
     }