uifw/AvKon/src/aknindicator.cpp
branchRCL_3
changeset 38 c52421ed5f07
parent 23 3d340a0166ff
child 55 aecbbf00d063
--- a/uifw/AvKon/src/aknindicator.cpp	Wed Jun 09 09:58:37 2010 +0300
+++ b/uifw/AvKon/src/aknindicator.cpp	Mon Jun 21 15:57:43 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2002-2010 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"
@@ -859,8 +859,6 @@
 
 void CAknIndicator::SetSvgIconSize( CFbsBitmap*& aBitmap, TInt aLayoutMode )
     {
-    TRect rect( Rect() );
-
     TInt indicatorUid = iUid;
     if (indicatorUid >= EAknNaviPaneEditorIndicatorDynamicUidRangeFirst &&
         indicatorUid <= EAknNaviPaneEditorIndicatorDynamicUidRangeLast)
@@ -871,51 +869,7 @@
     TSize size(10,10); // default size (every SVG icon needs to be initialized)
     TScaleMode aspectRatio = EAspectRatioPreservedAndUnusedSpaceRemoved;
 
-    TRect navipaneRect(0,0,0,0);
-    CEikStatusPaneBase* statusPane = CEikStatusPaneBase::Current();
-    if (statusPane)
-        {
-        CCoeControl* control = NULL;
-        TRAP_IGNORE(control = statusPane->ControlL(TUid::Uid( EEikStatusPaneUidNavi )));
-        if (control)
-            {
-            navipaneRect.SetSize( control->Size() );
-            }
-        }
-
-    // If navipane is not found, we get portrait normal navipanerect frop laf data which is usually right enough.
-    if (navipaneRect.Size() == TSize(0,0))
-        {
-        TInt battery = 0;
-        TRect statusPaneRect;
-        AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EStatusPane, statusPaneRect );
-
-        if ( AknStatuspaneUtils::IdleLayoutActive() )
-            {
-            if ( ( iIndicatorContext == CAknIndicatorContainer::EQueryEditorIndicators )
-                && ( statusPaneRect.Size() == TSize(0,0) ) )
-                {
-                battery = 0;
-                }
-            else
-                {
-                battery = 1;
-                }
-            }
-
-
-        // Navi pane
-        TAknWindowComponentLayout naviPaneLayout( AknLayoutScalable_Avkon::navi_pane(battery) );
-        TAknLayoutRect naviPaneLayoutRect;
-        naviPaneLayoutRect.LayoutRect(statusPaneRect, naviPaneLayout);
-        navipaneRect.SetSize( naviPaneLayoutRect.Rect().Size() );
-        }
-
-    // Screen
-    TRect screenRect;
-    AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, screenRect );
-
-    switch (indicatorUid)
+    switch ( indicatorUid )
         {
         // Status pane's indicators
         case EAknIndicatorIrActive:
@@ -984,85 +938,16 @@
         case EAknIndicatorMecoServiceTab:
         case EAknIndicatorIntegratedIM:
             {
-            // Main pane
-            TRect mainPaneRect;
-            AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane,
-                                               mainPaneRect );
 
-            // statuspane, usual
-            TRect usualStatusPaneRect;
-            AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EStatusPane,
-                                               usualStatusPaneRect );
-
-            // status indicator pane elements
-            TRect statusIndicatorPaneElementsRect;
-            AknLayoutUtils::LayoutMetricsRect(
-                AknLayoutUtils::EIndicatorPane,
-                statusIndicatorPaneElementsRect );
-
-            // universal indicator pane (note statuspane as parent)
-            TAknLayoutRect universalIndicatorPaneLayoutRect;
-            universalIndicatorPaneLayoutRect.LayoutRect(
-                usualStatusPaneRect,
-                AknLayoutScalable_Avkon::uni_indicator_pane( 0 ) );
-            TRect universalIndicatorPaneRect(
-                universalIndicatorPaneLayoutRect.Rect() );
-
-            // universal indicator pane elements
-            TAknLayoutRect universalIndicatorPaneElementsLayoutRect;
-            universalIndicatorPaneElementsLayoutRect.LayoutRect(
-                universalIndicatorPaneRect,
-                AknLayoutScalable_Avkon::uni_indicator_pane_g1() );
-            TRect universalIndicatorPaneElementsRect(
-                universalIndicatorPaneElementsLayoutRect.Rect() );
-
-            if ( aLayoutMode == ELayoutModeUsual )
+            // Portrait extended cases
+            if ( AknStatuspaneUtils::ExtendedLayoutActive() &&
+                 AknStatuspaneUtils::IdleLayoutActive() &&
+                 !AknStatuspaneUtils::HDLayoutActive() )
                 {
-                size = universalIndicatorPaneElementsRect.Size();
+                aspectRatio = EAspectRatioPreserved;
                 }
 
-            if ( aLayoutMode == ELayoutModeWide )
-                {
-                size = statusIndicatorPaneElementsRect.Size();
-                }
-
-            // Stacon special cases
-            if ( AknStatuspaneUtils::StaconPaneActive() &&
-                 !AknStatuspaneUtils::IdleLayoutActive() &&
-                 !AknStatuspaneUtils::ExtendedStaconPaneActive())
-                {
-                size = Size();
-                }
-            else if ( AknStatuspaneUtils::ExtendedStaconPaneActive() )
-                {
-                size = Size();
-                }
-
-            // Flat special cases
-            if ( AknStatuspaneUtils::FlatLayoutActive() )
-                {
-                size = Size();
-                }
-
-            // Portrait extended cases
-            if ( AknStatuspaneUtils::ExtendedLayoutActive() )
-                {
-                size = Size();
-                if ( AknStatuspaneUtils::IdleLayoutActive() &&
-                     !AknStatuspaneUtils::HDLayoutActive() )
-                    {
-                    aspectRatio = EAspectRatioPreserved;
-                    }
-                }
-
-            // In landscape idle we use vertical indicators if parent
-            // is in vertical mode, otherwise horizontal.
-            if ( AknStatuspaneUtils::IdleLayoutActive() &&
-                 Layout_Meta_Data::IsLandscapeOrientation() &&
-                 iParent->Size().iWidth < iParent->Size().iHeight )
-                {
-                size = Size();
-                }
+            size = Size();
 
             break;
             }
@@ -1162,9 +1047,41 @@
         case EAknNaviPaneEditorIndicatorFnKeyLocked:
 #endif
             {
-            TAknWindowComponentLayout l1 = AknLayoutScalable_Avkon::navi_icon_pane(0);
-            TAknWindowComponentLayout l2 = AknLayoutScalable_Avkon::navi_icon_pane_g1();
-            TAknWindowComponentLayout layout = TAknWindowComponentLayout::Compose( l1, l2 );
+            TRect navipaneRect( 0, 0, 0, 0 );
+            CEikStatusPaneBase* statusPane = CEikStatusPaneBase::Current();
+            if ( statusPane )
+                {
+                CCoeControl* control = NULL;
+                TRAP_IGNORE(
+                    control = statusPane->ControlL(
+                        TUid::Uid( EEikStatusPaneUidNavi ) ) );
+                if ( control )
+                    {
+                    navipaneRect.SetSize( control->Size() );
+                    }
+                }
+        
+            // If navi pane is not found, we get portrait normal navi pane
+            // rect from LAF data which is usually right enough.
+            if ( navipaneRect.IsEmpty() )
+                {
+                TRect statusPaneRect;
+                AknLayoutUtils::LayoutMetricsRect(
+                    AknLayoutUtils::EStatusPane, statusPaneRect );
+
+                // Navi pane
+                TAknLayoutRect naviPaneLayoutRect;
+                naviPaneLayoutRect.LayoutRect(
+                    statusPaneRect, AknLayoutScalable_Avkon::navi_pane( 6 ) );
+                navipaneRect.SetSize( naviPaneLayoutRect.Rect().Size() );
+                }
+            
+            TAknWindowComponentLayout l1(
+                AknLayoutScalable_Avkon::navi_icon_pane( 0 ) );
+            TAknWindowComponentLayout l2(
+                AknLayoutScalable_Avkon::navi_icon_pane_g1() );
+            TAknWindowComponentLayout layout(
+                TAknWindowComponentLayout::Compose( l1, l2 ) );
 
             TAknLayoutRect layoutRect;
             layoutRect.LayoutRect( navipaneRect, layout );
@@ -1178,6 +1095,8 @@
         case EAknNaviPaneEditorIndicatorWaitBar:
         case EAknNaviPaneEditorIndicatorProgressBar:
             {
+            TRect rect( Rect() );
+
             TAknLayoutRect waitPaneComponentLayoutRect;
             waitPaneComponentLayoutRect.LayoutRect(
                 rect,
@@ -1198,28 +1117,30 @@
         case EAknNaviPaneEditorIndicatorWlanActive:
         case EAknNaviPaneEditorIndicatorWlanActiveSecure:
             {
-            // app window
-            TAknWindowComponentLayout applicationWindowLayout( AknLayoutScalable_Avkon::application_window(0) );
-            TAknLayoutRect applicationWindowLayoutRect;
-            applicationWindowLayoutRect.LayoutRect( screenRect, applicationWindowLayout );
-            TRect applicationWindowRect( applicationWindowLayoutRect.Rect() );
+            // Screen
+            TRect screenRect;
+            AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen,
+                                               screenRect );
 
-            // top area
-            TAknWindowComponentLayout topAreaLayout( AknLayoutScalable_Avkon::area_top_pane(1) );
+            // top area, skip the application window as it's the same
+            // size as the screen.
             TAknLayoutRect topAreaLayoutRect;
-            topAreaLayoutRect.LayoutRect( applicationWindowRect, topAreaLayout );
+            topAreaLayoutRect.LayoutRect(
+                screenRect, AknLayoutScalable_Avkon::area_top_pane( 1 ) );
             TRect topAreaRect( topAreaLayoutRect.Rect() );
 
             // small statuspane
-            TAknWindowComponentLayout smallStatusPaneLayout( AknLayoutScalable_Avkon::status_small_pane() );
             TAknLayoutRect smallStatusPaneLayoutRect;
-            smallStatusPaneLayoutRect.LayoutRect( topAreaRect, smallStatusPaneLayout );
+            smallStatusPaneLayoutRect.LayoutRect(
+                topAreaRect, AknLayoutScalable_Avkon::status_small_pane() );
             TRect smallStatusPaneRect( smallStatusPaneLayoutRect.Rect() );
 
             // icon pane
-            TAknWindowComponentLayout iconPaneLayout( AknLayoutScalable_Avkon::status_small_icon_pane() );
             TAknLayoutRect iconPaneLayoutRect;
-            iconPaneLayoutRect.LayoutRect( smallStatusPaneRect, iconPaneLayout );
+            iconPaneLayoutRect.LayoutRect(
+                smallStatusPaneRect,
+                AknLayoutScalable_Avkon::status_small_icon_pane() );
+
             TRect iconPaneRect( iconPaneLayoutRect.Rect() );
 
             size = iconPaneRect.Size();