uifw/AvKon/src/aknbattery.cpp
branchRCL_3
changeset 19 aecbbf00d063
parent 10 3d340a0166ff
child 20 d48ab3b357f1
--- a/uifw/AvKon/src/aknbattery.cpp	Thu Aug 19 10:11:06 2010 +0300
+++ b/uifw/AvKon/src/aknbattery.cpp	Tue Aug 31 15:28:30 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -25,9 +25,6 @@
 #include <aknlayoutscalable_avkon.cdl.h>
 #include <layoutmetadata.cdl.h>
 
-#include <AknSmallIndicator.h>
-#include <touchfeedback.h>
-
 #include <AknTasHook.h>
 #include "AknUtils.h"
 #include "aknconsts.h"
@@ -69,7 +66,6 @@
 EXPORT_C CAknBatteryPane::~CAknBatteryPane()
     {
     AKNTASHOOK_REMOVE();
-    
     AknsUtils::DeregisterControlPosition( this );
 
     delete iBatteryIconControl;
@@ -98,7 +94,7 @@
     iBatteryStrengthControl->SetContainerWindowL( *this );
     iPrivateFlags = 0; // reset flags
     iDataObserver = new (ELeave) CAknBatteryDataObserver( this );
-    iStatusPane = CEikStatusPaneBase::Current();
+    iIsActiveIdle = AknStatuspaneUtils::IsActiveIdle();
     }
 
 
@@ -330,22 +326,6 @@
         iBatteryStrengthControl, parent, batteryStrenghtLayout );
 
     AknsUtils::RegisterControlPosition( this );
-    
-    MTouchFeedback* feedback = MTouchFeedback::Instance();
-    if ( feedback )
-        {
-        if ( AknStatuspaneUtils::ExtendedFlatLayoutActive() )
-            {
-            // Disable tactile feedback in extended flat layout because
-            // the battery pane isn't adjacent to the universal indicator
-            // and small digital clock pane.
-            feedback->EnableFeedbackForControl( this, EFalse );
-            }
-        else
-            {
-            feedback->EnableFeedbackForControl( this, ETrue );
-            }
-        }
     }
 
 
@@ -365,38 +345,24 @@
 // Draws the battery pane.
 // ---------------------------------------------------------------------------
 //
-EXPORT_C void CAknBatteryPane::Draw( const TRect& aRect ) const
+EXPORT_C void CAknBatteryPane::Draw( const TRect& /*aRect*/ ) const
     {
-    if ( iStatusPane && 
-         iStatusPane->IsTransparent() )
+    if ( iIsActiveIdle )
         {
-        CWindowGc& gc = SystemGc();
-        TRgb rgb(TRgb::Color16MA(0));
-        gc.SetDrawMode(CGraphicsContext::EDrawModeWriteAlpha);
-        gc.SetBrushStyle(CGraphicsContext::ESolidBrush);
-        gc.SetBrushColor(rgb);
-        gc.Clear(aRect);
         return;
         }
-        
 
-    // Don't allow normal background drawing if
-    // background is already drawn with a background drawer.
-    const MCoeControlBackground* backgroundDrawer = FindBackground();
-    if ( !backgroundDrawer )
+    if ( AknStatuspaneUtils::StaconPaneActive() )
         {
-        if ( AknStatuspaneUtils::StaconPaneActive() )
-            {
-            DrawInStaconPane( Rect() );
-            }
-        else if ( AknStatuspaneUtils::FlatLayoutActive() )
-            {
-            DrawInFlatStatusPane( Rect() );
-            }
-        else
-            {
-            DrawInNormalStatusPane( Rect() );
-            }
+        DrawInStaconPane( Rect() );
+        }
+    else if ( AknStatuspaneUtils::FlatLayoutActive() )
+        {
+        DrawInFlatStatusPane( Rect() );
+        }
+    else
+        {
+        DrawInNormalStatusPane( Rect() );
         }
     }
 
@@ -541,135 +507,55 @@
 
 // ---------------------------------------------------------------------------
 // CAknBatteryPane::HandlePointerEventL
-// Processes battery pane's pointer events.
+// Processes battery pane's pointer events. Actually this does nothing yet.
 // ---------------------------------------------------------------------------
 //
 void CAknBatteryPane::HandlePointerEventL( const TPointerEvent& aPointerEvent )
     {
-    if ( IsDimmed() )
+    if ( AknLayoutUtils::PenEnabled() )
         {
-        iPrivateFlags &= (~EAknBatteryPaneButton1DownInBatteryRect);
-        return;
-        }
-
-    CEikStatusPaneBase* sp = CEikStatusPaneBase::Current();
-	if ( sp )
-	    {
-        TInt statusPaneCurrentLayoutResourceId = sp->CurrentLayoutResId();
-        if ( statusPaneCurrentLayoutResourceId ==
-                 R_AVKON_STATUS_PANE_LAYOUT_POWER_OFF_RECHARGE ||
-             statusPaneCurrentLayoutResourceId ==
-                 R_AVKON_STATUS_PANE_LAYOUT_POWER_OFF_RECHARGE_MIRRORED )
+        if ( IsDimmed() )
             {
-            AknsUtils::DeregisterControlPosition( this );
+            iPrivateFlags &= (~EAknBatteryPaneButton1DownInBatteryRect);
             return;
             }
-        }
-    // Get the rect of battery pane.
-    TRect rect( Rect() );
 
-    // Switch by type
-    switch ( aPointerEvent.iType )
-        {
-        case TPointerEvent::EButton1Down:
+        // Get the rect of battery pane.
+        TRect rect( Rect() );
+
+        // Switch by type
+        switch ( aPointerEvent.iType )
             {
-            // if battery pane's rect contains pointer down position
-            if ( rect.Contains( aPointerEvent.iPosition ) )
+            case TPointerEvent::EButton1Down:
                 {
-                // set flag that pointerdown was inside battery pane
-                iPrivateFlags |= EAknBatteryPaneButton1DownInBatteryRect;
-                if ( !AknStatuspaneUtils::ExtendedFlatLayoutActive() )
+                // if battery pane's rect contains pointer down position
+                if ( rect.Contains( aPointerEvent.iPosition ) )
                     {
-                    MTouchFeedback* feedback = MTouchFeedback::Instance();
-                    if ( feedback )
-                        {
-                        feedback->InstantFeedback( ETouchFeedbackSensitiveButton );
-                        }
+                    // set flag that pointerdown was inside battery pane
+                    iPrivateFlags |= EAknBatteryPaneButton1DownInBatteryRect;
                     }
                 }
-            }
-            break;
+                break;
 
-        case TPointerEvent::EButton1Up:
-            {
-            if ( !AknStatuspaneUtils::ExtendedFlatLayoutActive() )
+            case TPointerEvent::EButton1Up:
                 {
-                // 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 digital clock or indicator
-                // pane area.
-                
-                TBool pointerUpInIndicatorArea( EFalse );
-                TBool pointerUpInClockArea( EFalse );
-                    
-                if ( sp )
+                // if battery pane's rect contains pointer down position and
+                // Button1Down was clicked inside battery rect
+                if ( iPrivateFlags&EAknBatteryPaneButton1DownInBatteryRect &&
+                    rect.Contains( aPointerEvent.iPosition ) )
                     {
-                    CCoeControl* clockPane = sp->ContainerControlL(
-                        TUid::Uid( EEikStatusPaneUidDigitalClock ) );
-                    if ( clockPane )
-                        {
-                        TRect clockRect(
-                            clockPane->PositionRelativeToScreen(),
-                            clockPane->Size() );
-                        pointerUpInClockArea =
-                            clockRect.Contains( aPointerEvent.iParentPosition );
-                        }
-                        
-                    CCoeControl* indicatorPane = sp->ContainerControlL(
-                        TUid::Uid( EEikStatusPaneUidIndic ) );
-                    if ( indicatorPane )
-                        {
-                        TRect indicatorRect(
-                            indicatorPane->PositionRelativeToScreen(),
-                            indicatorPane->Size() );
-                        pointerUpInIndicatorArea =
-                            indicatorRect.Contains( aPointerEvent.iParentPosition );
-                        }
+                    // Up happened inside battery pane's rect
+                    // activate something
                     }
-    
-                if ( ( iPrivateFlags & EAknBatteryPaneButton1DownInBatteryRect &&
-                       rect.Contains( aPointerEvent.iPosition ) ) ||
-                     pointerUpInClockArea ||
-                     pointerUpInIndicatorArea )
-                    {
-                    MTouchFeedback* feedback = MTouchFeedback::Instance();
-                    if ( feedback )
-                        {
-                        feedback->InstantFeedback(
-                            this,
-                            ETouchFeedbackSensitiveButton,
-                            ETouchFeedbackVibra,
-                            aPointerEvent );
-                        }
 
-                    CAknSmallIndicator* indicatorNotifier =
-                        CAknSmallIndicator::NewLC( TUid::Uid( 0 ) );
-                    indicatorNotifier->HandleIndicatorTapL();
-                    //for indicator popup event
-                    if ( feedback )
-                        {
-                        feedback->InstantFeedback(
-                                           this,
-                                           ETouchFeedbackPopUp,
-                                           ETouchFeedbackVibra,
-                                           aPointerEvent );
-                        }
-                    CleanupStack::PopAndDestroy( indicatorNotifier );
-                    }
+                // Up happened, reset button down flag
+                iPrivateFlags &= (~EAknBatteryPaneButton1DownInBatteryRect);
                 }
+                break;
 
-            // Up happened, reset button down flag
-            iPrivateFlags &= (~EAknBatteryPaneButton1DownInBatteryRect);
+            default:
+                break;
             }
-            break;
-
-        default:
-            break;
         }
     }