uifw/AvKon/src/AknIndicatorContainer.cpp
branchRCL_3
changeset 56 d48ab3b357f1
parent 55 aecbbf00d063
equal deleted inserted replaced
55:aecbbf00d063 56:d48ab3b357f1
     1 /*
     1 /*
     2 * Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
   110     TPoint                      iPositionRelativeToScreen;
   110     TPoint                      iPositionRelativeToScreen;
   111     CAknIndicatorDataObserver*  iDataObserver;
   111     CAknIndicatorDataObserver*  iDataObserver;
   112     TInt                        iFlags;
   112     TInt                        iFlags;
   113     TBool                       iIncallBubbleDisabled;
   113     TBool                       iIncallBubbleDisabled;
   114     TBool                       iIsForeground;
   114     TBool                       iIsForeground;
   115     TBool                       iIsActiveIdle;
   115     CEikStatusPaneBase*         iStatusPane;
       
   116     MTouchFeedback*             iFeedback;
   116     };
   117     };
   117 
   118 
   118 
   119 
   119 CAknIndicatorContainerExtension* CAknIndicatorContainerExtension::NewL(
   120 CAknIndicatorContainerExtension* CAknIndicatorContainerExtension::NewL(
   120     CAknIndicatorContainer* aIndicatorContainer )
   121     CAknIndicatorContainer* aIndicatorContainer )
   138         iDataObserver =
   139         iDataObserver =
   139             new (ELeave) CAknIndicatorDataObserver( iIndicatorContainer );
   140             new (ELeave) CAknIndicatorDataObserver( iIndicatorContainer );
   140         }
   141         }
   141 
   142 
   142     TRAP_IGNORE( CCoeEnv::Static()->AddMessageMonitorObserverL( *this ) );
   143     TRAP_IGNORE( CCoeEnv::Static()->AddMessageMonitorObserverL( *this ) );
       
   144     
       
   145     iFeedback = MTouchFeedback::Instance();
       
   146     if ( iFeedback &&
       
   147          iIndicatorContainer->iIndicatorContext ==
       
   148                  CAknIndicatorContainer::EUniversalIndicators )
       
   149         {
       
   150         // Tactile feedback is only used for universal indicator pane.
       
   151         CFeedbackSpec* fbSpec = CFeedbackSpec::New();
       
   152         if ( fbSpec )
       
   153             {
       
   154             fbSpec->AddFeedback( ETouchEventStylusDown,
       
   155                                  ETouchFeedbackSensitiveButton );
       
   156             fbSpec->AddFeedback( ETouchEventStylusUp,
       
   157                                  ETouchFeedbackSensitiveButton,
       
   158                                  ETouchFeedbackVibra );
       
   159 
       
   160             iFeedback->SetFeedbackArea( iIndicatorContainer,
       
   161                                         0,
       
   162                                         iIndicatorContainer->Rect(),
       
   163                                         fbSpec );
       
   164             delete fbSpec; 
       
   165             }  
       
   166         }
   143     }
   167     }
   144 
   168 
   145 
   169 
   146 CAknIndicatorContainerExtension::CAknIndicatorContainerExtension(
   170 CAknIndicatorContainerExtension::CAknIndicatorContainerExtension(
   147     CAknIndicatorContainer* aIndicatorContainer )
   171     CAknIndicatorContainer* aIndicatorContainer )
   148     : iIndicatorContainer( aIndicatorContainer )
   172     : iIndicatorContainer( aIndicatorContainer )
   149     {
   173     {
   150     iSmallStatusPaneLayout      = AknStatuspaneUtils::SmallLayoutActive();
   174     iSmallStatusPaneLayout      = AknStatuspaneUtils::SmallLayoutActive();
   151     iIncallBubbleAllowedInUsual = ETrue;
   175     iIncallBubbleAllowedInUsual = ETrue;
   152     iIsForeground = static_cast<CAknAppUi*>( CEikonEnv::Static()->EikAppUi() )->IsForeground();
   176     iIsForeground = static_cast<CAknAppUi*>( CEikonEnv::Static()->EikAppUi() )->IsForeground();
   153     iIsActiveIdle = AknStatuspaneUtils::IsActiveIdle();
   177     iStatusPane = CEikStatusPaneBase::Current();
   154     }
   178     }
   155 
   179 
   156 
   180 
   157 CAknIndicatorContainerExtension::~CAknIndicatorContainerExtension()
   181 CAknIndicatorContainerExtension::~CAknIndicatorContainerExtension()
   158     {
   182     {
   159     delete iPictoInterface;
   183     delete iPictoInterface;
   160     delete iDataObserver;
   184     delete iDataObserver;
   161 
   185 
   162     CCoeEnv::Static()->RemoveMessageMonitorObserver( *this );
   186     CCoeEnv::Static()->RemoveMessageMonitorObserver( *this );
       
   187     
       
   188     MTouchFeedback* feedback = MTouchFeedback::Instance();
       
   189     if ( feedback )
       
   190         {
       
   191         feedback->RemoveFeedbackForControl( iIndicatorContainer );
       
   192         }
   163     }
   193     }
   164 
   194 
   165 
   195 
   166 void CAknIndicatorContainerExtension::DrawPictographArea()
   196 void CAknIndicatorContainerExtension::DrawPictographArea()
   167     {
   197     {
   275     if ( !iIndicators )
   305     if ( !iIndicators )
   276         {
   306         {
   277         iIndicators =
   307         iIndicators =
   278             new (ELeave) CAknIndicatorQueue( KAknIndicatorQueueGranularity );
   308             new (ELeave) CAknIndicatorQueue( KAknIndicatorQueueGranularity );
   279         }
   309         }
   280 
       
   281 
       
   282     iTicker = CPeriodic::NewL( CActive::EPriorityLow );
       
   283     }
   310     }
   284 
   311 
   285 
   312 
   286 // ---------------------------------------------------------------------------
   313 // ---------------------------------------------------------------------------
   287 // CAknIndicatorContainer::ConstructFromResourceL
   314 // CAknIndicatorContainer::ConstructFromResourceL
   607         {
   634         {
   608         SetContainerWindowNonFading(
   635         SetContainerWindowNonFading(
   609             AknStatuspaneUtils::ExtendedStaconPaneActive() ||
   636             AknStatuspaneUtils::ExtendedStaconPaneActive() ||
   610             ( AknStatuspaneUtils::StaconPaneActive() &&
   637             ( AknStatuspaneUtils::StaconPaneActive() &&
   611               !AknStatuspaneUtils::IdleLayoutActive() ) );
   638               !AknStatuspaneUtils::IdleLayoutActive() ) );
       
   639         
       
   640         if ( iExtension && iExtension->iFeedback )
       
   641             {
       
   642             iExtension->iFeedback->ChangeFeedbackArea( this,
       
   643                                                        0,
       
   644                                                        Rect() );
       
   645             }
   612         }
   646         }
   613 
   647 
   614     AknsUtils::RegisterControlPosition( this );
   648     AknsUtils::RegisterControlPosition( this );
   615     if ( iExtension && DrawableWindow() )
   649     if ( iExtension && DrawableWindow() )
   616         {
   650         {
   796     AknsUtils::RegisterControlPosition( this );
   830     AknsUtils::RegisterControlPosition( this );
   797     }
   831     }
   798 
   832 
   799 EXPORT_C TInt CAknIndicatorContainer::CountComponentControls() const
   833 EXPORT_C TInt CAknIndicatorContainer::CountComponentControls() const
   800     {
   834     {
   801     return (iIndicatorsShown);
   835     return  iIndicators->Count();
       
   836     }
       
   837 
       
   838 TInt CAknIndicatorContainer::CountShownIndicator() const
       
   839     {
       
   840     TInt count = iIndicators->Count();
       
   841     TInt indicatorShown = 0;
       
   842     for ( TInt i = 0; i< count; i++ )
       
   843         {
       
   844         if( iIndicators->At(i)->IndicatorState() && iIndicators->At( i )->Priority() != KIndicatorNotShown )
       
   845             {
       
   846             indicatorShown++;
       
   847             }
       
   848         }
       
   849     return indicatorShown;
   802     }
   850     }
   803 
   851 
   804 
   852 
   805 EXPORT_C CCoeControl* CAknIndicatorContainer::ComponentControl(TInt aIndex) const
   853 EXPORT_C CCoeControl* CAknIndicatorContainer::ComponentControl(TInt aIndex) const
   806     {
   854     {
   807     TInt count = iIndicators->Count();
   855     if ( aIndex >= 0 && aIndex < iIndicators->Count() )
   808 
   856         {
   809     TInt ii = 0;
   857         return iIndicators->At( aIndex );
   810     for (ii = 0; (ii < count) && (aIndex >= 0); ii++)
       
   811         {
       
   812         if ( iIndicators->At(ii)->IndicatorState() && (iIndicators->At(ii)->Priority() != KIndicatorNotShown))
       
   813             {
       
   814             aIndex--;
       
   815             }
       
   816         }
       
   817 
       
   818     if ( ii > 0 )
       
   819         {
       
   820         return iIndicators->At(--ii);
       
   821         }
   858         }
   822     else
   859     else
   823         {
   860         {
   824         return NULL;
   861         return NULL;
   825         }
   862         }
   826     }
   863     }
   827 
   864 
   828 
   865 
   829 EXPORT_C void CAknIndicatorContainer::Draw( const TRect& /*aRect*/ ) const
   866 EXPORT_C void CAknIndicatorContainer::Draw( const TRect& aRect ) const
   830     {
   867     {
   831     if ( iExtension->iIsActiveIdle )
   868     if ( iExtension->iStatusPane && 
   832         {
   869          iExtension->iStatusPane->IsTransparent() &&
       
   870          ( iIndicatorContext != EQueryEditorIndicators ) )
       
   871         {
       
   872         CWindowGc& gc = SystemGc();
       
   873         TRgb rgb(TRgb::Color16MA(0));
       
   874         gc.SetDrawMode(CGraphicsContext::EDrawModeWriteAlpha);
       
   875         gc.SetBrushStyle(CGraphicsContext::ESolidBrush);
       
   876         gc.SetBrushColor(rgb);
       
   877         gc.Clear(aRect);
   833         return;
   878         return;
   834         }
   879         }
   835 
   880 
   836     // Don't allow normal background drawing if
   881     // Don't allow normal background drawing if
   837     // background is already drawn with a background drawer.
   882     // background is already drawn with a background drawer.
  1033 EXPORT_C void CAknIndicatorContainer::HandlePointerEventL(
  1078 EXPORT_C void CAknIndicatorContainer::HandlePointerEventL(
  1034     const TPointerEvent& aPointerEvent )
  1079     const TPointerEvent& aPointerEvent )
  1035     {
  1080     {
  1036     CAknControl::HandlePointerEventL( aPointerEvent );
  1081     CAknControl::HandlePointerEventL( aPointerEvent );
  1037 
  1082 
  1038     if ( AknLayoutUtils::PenEnabled() && iExtension )
  1083     // Pointer events are only handled in the universal indicator container.
       
  1084     if ( iExtension && iIndicatorContext == EUniversalIndicators )
  1039         {
  1085         {
  1040         TRect rect( Rect() );
  1086         TRect rect( Rect() );
  1041 
  1087 
  1042         // The indicator popup is launched if both the down and up
  1088         // The indicator popup is launched if both the down and up
  1043         // pointer events happen in the indicator pane area.
  1089         // pointer events happen in the indicator pane area.
  1049                 if ( rect.Contains( aPointerEvent.iPosition ) )
  1095                 if ( rect.Contains( aPointerEvent.iPosition ) )
  1050                     {
  1096                     {
  1051                     // set flag that down was inside indicator
  1097                     // set flag that down was inside indicator
  1052                     iExtension->iFlags |=
  1098                     iExtension->iFlags |=
  1053                         EAknIndicatorsButton1DownInIndicatorPaneRect;
  1099                         EAknIndicatorsButton1DownInIndicatorPaneRect;
  1054 
       
  1055                     if ( iIndicatorContext == EUniversalIndicators &&
       
  1056                          iExtension->iFlags & EAknIndicatorsButton1DownInIndicatorPaneRect
       
  1057                           )
       
  1058                         {
       
  1059                         MTouchFeedback* feedback = MTouchFeedback::Instance();
       
  1060 
       
  1061                         if ( feedback )
       
  1062                             {
       
  1063                             feedback->InstantFeedback( this, ETouchFeedbackSensitiveButton );
       
  1064                             }
       
  1065                         }
       
  1066                     }
  1100                     }
  1067                 break;
  1101                 break;
  1068                 }
  1102                 }
  1069 
  1103 
  1070             case TPointerEvent::EButton1Up:
  1104             case TPointerEvent::EButton1Up:
  1071                 {
  1105                 {
  1072                 // Currently the small digital clock pane and universal
  1106                 // Currently the small digital clock pane, universal
  1073                 // indicator pane are regarded as one touch responsive area from
  1107                 // indicator pane and battery pane (in status pane layouts
  1074                 // which the universal indicator popup should open on tap,
  1108                 // where it's adjacent to universal indicator or digital
  1075                 // so upon pointer up event it must be checked here if
  1109                 // clock pane) are regarded as one touch responsive
  1076                 // the down event happened inside this control, but the up event
  1110                 // area from which the universal indicator popup should
  1077                 // inside digital clock pane area.
  1111                 // open on tap, so upon pointer up event it must be checked
       
  1112                 // here if the down event happened inside this control,
       
  1113                 // but the up event inside digital clock or battery pane area.
  1078                 CEikStatusPaneBase* sp = CEikStatusPaneBase::Current();
  1114                 CEikStatusPaneBase* sp = CEikStatusPaneBase::Current();
  1079                 TRect clockRect( 0, 0, 0, 0 );
  1115                 TBool pointerUpInClockArea( EFalse );
       
  1116                 TBool pointerUpInBatteryArea( EFalse );
  1080 
  1117 
  1081                 if ( sp )
  1118                 if ( sp )
  1082                     {
  1119                     {
  1083                     CCoeControl* clockPane = sp->ContainerControlL(
  1120                     CCoeControl* clockPane = sp->ContainerControlL(
  1084                         TUid::Uid( EEikStatusPaneUidDigitalClock ) );
  1121                         TUid::Uid( EEikStatusPaneUidDigitalClock ) );
  1085                     if ( clockPane )
  1122                     if ( clockPane )
  1086                         {
  1123                         {
  1087                         clockRect = TRect( clockPane->PositionRelativeToScreen(),
  1124                         TRect clockRect( clockPane->PositionRelativeToScreen(),
  1088                                            clockPane->Size() );
  1125                                          clockPane->Size() );
       
  1126                         pointerUpInClockArea =
       
  1127                             clockRect.Contains( aPointerEvent.iParentPosition );
  1089                         }
  1128                         }
       
  1129                     
       
  1130                     if ( !AknStatuspaneUtils::ExtendedFlatLayoutActive() )
       
  1131                         {
       
  1132                         CCoeControl* batteryPane = sp->ContainerControlL(
       
  1133                             TUid::Uid( EEikStatusPaneUidBattery ) );
       
  1134                         if ( batteryPane )
       
  1135                             {
       
  1136                             TRect batteryRect(
       
  1137                                 batteryPane->PositionRelativeToScreen(),
       
  1138                                 batteryPane->Size() );
       
  1139                             pointerUpInBatteryArea =
       
  1140                                 batteryRect.Contains( aPointerEvent.iParentPosition );
       
  1141                             }
       
  1142                         }
  1090                     }
  1143                     }
  1091 
  1144 
  1092                 // if indicator's rect contains pointer up position
  1145                 // if indicator's rect contains pointer up position
  1093                 if ( iIndicatorContext == EUniversalIndicators &&
  1146                 if ( ( iExtension->iFlags & EAknIndicatorsButton1DownInIndicatorPaneRect &&
  1094                      ( ( iExtension->iFlags & EAknIndicatorsButton1DownInIndicatorPaneRect &&
       
  1095                          rect.Contains( aPointerEvent.iPosition ) ) ||
  1147                          rect.Contains( aPointerEvent.iPosition ) ) ||
  1096                        clockRect.Contains( aPointerEvent.iParentPosition ) ) )
  1148                        pointerUpInClockArea ||
  1097                     {
  1149                        pointerUpInBatteryArea )
       
  1150                     {
       
  1151                     if ( iExtension->iFeedback &&
       
  1152                          ( pointerUpInClockArea || pointerUpInBatteryArea ) )
       
  1153                         {
       
  1154                         // The pointer down was received in another control,
       
  1155                         // so the tactile feedback must be given directly.
       
  1156                         iExtension->iFeedback->InstantFeedback(
       
  1157                             this,
       
  1158                             ETouchFeedbackSensitiveButton,
       
  1159                             ETouchFeedbackVibra,
       
  1160                             aPointerEvent );
       
  1161                         }
       
  1162 
       
  1163                     CAknSmallIndicator* indicatorNotifier = CAknSmallIndicator::NewLC( TUid::Uid( 0 ) );
       
  1164                     indicatorNotifier->HandleIndicatorTapL();
       
  1165                     //for indicator popup event
  1098                     MTouchFeedback* feedback = MTouchFeedback::Instance();
  1166                     MTouchFeedback* feedback = MTouchFeedback::Instance();
  1099                     if ( feedback )
  1167                     if ( feedback )
  1100                         {
  1168                         {
  1101                         feedback->InstantFeedback( this,
  1169                         feedback->InstantFeedback(
  1102                                                    ETouchFeedbackSensitiveButton,
  1170                                            this,
  1103                                                    ETouchFeedbackVibra,
  1171                                            ETouchFeedbackPopUp,
  1104                                                    aPointerEvent );
  1172                                            ETouchFeedbackVibra,
       
  1173                                            aPointerEvent );
  1105                         }
  1174                         }
  1106                     CAknSmallIndicator* indicatorNotifier = CAknSmallIndicator::NewLC( TUid::Uid( 0 ) );
       
  1107                     indicatorNotifier->HandleIndicatorTapL();
       
  1108                     CleanupStack::PopAndDestroy( indicatorNotifier );
  1175                     CleanupStack::PopAndDestroy( indicatorNotifier );
  1109                     }
  1176                     }
       
  1177 
  1110                 // Up happened, reset button down flag
  1178                 // Up happened, reset button down flag
  1111                 iExtension->iFlags &=
  1179                 iExtension->iFlags &=
  1112                     ( ~EAknIndicatorsButton1DownInIndicatorPaneRect );
  1180                     ( ~EAknIndicatorsButton1DownInIndicatorPaneRect );
  1113                 break;
  1181                 break;
  1114                 }
  1182                 }
  1138     if (count < 2)
  1206     if (count < 2)
  1139         {
  1207         {
  1140         return;
  1208         return;
  1141         }
  1209         }
  1142 
  1210 
  1143     CAknIndicator* temp;
  1211     // Bubble sorted
  1144     for(TInt ii = 1; ii < count; ii++)
  1212     for (TInt i = 0; i < ( count - 1 ); i++)
  1145         {
  1213         {
  1146         temp = iIndicators->At(ii);
  1214         TBool swaped = EFalse;
  1147         TInt tempPriority = temp->Priority();
  1215         for (TInt j = count - 1; j > i; j--)
  1148         if (tempPriority >= 0)
  1216             {
  1149             {
  1217             if ( iIndicators->At( j )->Priority()
  1150             for(TInt jj = 0; jj <= ii; jj++)
  1218                     < iIndicators->At( j - 1 )->Priority() )
  1151                 {
  1219                 {
  1152                 if (tempPriority < iIndicators->At(jj)->Priority())
  1220                 CAknIndicator* temp = iIndicators->At( j );
  1153                     {
  1221                 iIndicators->Delete( j );
  1154                     iIndicators->Delete( ii );
  1222                 CleanupStack::PushL( temp );
  1155                     CleanupStack::PushL( temp );
  1223                 iIndicators->InsertL( j - 1, temp );                
  1156                     iIndicators->InsertL( jj, temp );
  1224                 CleanupStack::Pop( temp );
  1157                     CleanupStack::Pop( temp );
  1225                 swaped = ETrue;
  1158                     break;
  1226                 }
  1159                     }
  1227             }
  1160                 else if ( jj == (ii-1) )
  1228         if( !swaped )
  1161                     {
  1229             {
  1162                     break;
  1230             break;
  1163                     }
  1231             }
  1164                 }
  1232         }
  1165             }
  1233 
  1166         }
       
  1167     }
  1234     }
  1168 
  1235 
  1169 
  1236 
  1170 TInt CAknIndicatorContainer::TickerCallback(TAny* aThis)
  1237 TInt CAknIndicatorContainer::TickerCallback(TAny* aThis)
  1171     {
  1238     {
  1907             continue;
  1974             continue;
  1908             }
  1975             }
  1909 
  1976 
  1910         TInt uid = indicator->Uid().iUid;
  1977         TInt uid = indicator->Uid().iUid;
  1911 
  1978 
  1912         if ( uid == EAknNaviPaneEditorIndicatorSecuredConnection ||
  1979         if ( uid == EAknNaviPaneEditorIndicatorGprs || 
  1913              uid == EAknNaviPaneEditorIndicatorProgressBar       ||
  1980              uid == EAknNaviPaneEditorIndicatorWlanAvailable ||
  1914              uid == EAknNaviPaneEditorIndicatorWmlWaitGlobe      ||
  1981              uid == EAknNaviPaneEditorIndicatorWlanActive || 
  1915              uid == EAknNaviPaneEditorIndicatorGprs              ||
  1982              uid == EAknNaviPaneEditorIndicatorWlanActiveSecure || 
  1916              uid == EAknNaviPaneEditorIndicatorFileSize          ||
  1983              (!isLandscape && 
  1917              uid == EAknNaviPaneEditorIndicatorWaitBar           ||
  1984                      (uid  == EAknNaviPaneEditorIndicatorProgressBar ||
  1918              uid == EAknNaviPaneEditorIndicatorWlanAvailable     ||
  1985                       uid  == EAknNaviPaneEditorIndicatorFileSize || 
  1919              uid == EAknNaviPaneEditorIndicatorWlanActive        ||
  1986                       uid  == EAknNaviPaneEditorIndicatorWaitBar || 
  1920              uid == EAknNaviPaneEditorIndicatorWlanActiveSecure )
  1987                       uid  == EAknNaviPaneEditorIndicatorSecuredConnection || 
       
  1988                       uid == EAknNaviPaneEditorIndicatorWmlWaitGlobe)))
  1921             {
  1989             {
  1922             // These indicators are not shown in this statuspane layout.
  1990             // These indicators are not shown in this statuspane layout.
  1923             indicator->SetExtent( TPoint( 0, 0 ), TSize( 0, 0 ) );
  1991             indicator->SetExtent( TPoint( 0, 0 ), TSize( 0, 0 ) );
  1924             iIndicatorsShown++;
  1992             iIndicatorsShown++;
  1925             continue;
  1993             continue;
  1926             }
  1994             }
  1927 
  1995 
  1928 
  1996 
  1929         if ( iLayoutOrientation == EVertical )
  1997         if ( iLayoutOrientation == EVertical )
  1930             {
  1998             {
       
  1999             if (uid == EAknNaviPaneEditorIndicatorProgressBar || uid
       
  2000                     == EAknNaviPaneEditorIndicatorFileSize || uid
       
  2001                     == EAknNaviPaneEditorIndicatorWaitBar || uid
       
  2002                     == EAknNaviPaneEditorIndicatorSecuredConnection || uid
       
  2003                     == EAknNaviPaneEditorIndicatorWmlWaitGlobe)
       
  2004                 {
       
  2005                 indicator->SetExtent(TPoint(0, 0), TSize(0, 0));
       
  2006                 iIndicatorsShown++;
       
  2007                 continue;
       
  2008                 }
  1931             // Highest priority indicator is put topmost.
  2009             // Highest priority indicator is put topmost.
  1932             if ( height < indicator->IconSize().iHeight )
  2010             if ( height < indicator->IconSize().iHeight )
  1933                 {
  2011                 {
  1934                 // Space for indicators is full.
  2012                 // Space for indicators is full.
  1935                 // Rest of low priority indicators are not shown.
  2013                 // Rest of low priority indicators are not shown.
  1967 
  2045 
  1968             TBool textIndicatorOffsetNeeded = ETrue;
  2046             TBool textIndicatorOffsetNeeded = ETrue;
  1969 
  2047 
  1970             TInt textIndicatorLeftOffset = KMinSpaceBetweenIconsInPixels;
  2048             TInt textIndicatorLeftOffset = KMinSpaceBetweenIconsInPixels;
  1971 
  2049 
       
  2050             ////////////////////////////////////////////////////////////////////////////
       
  2051             //small status pane
       
  2052             TRect smallStatusPaneRect;
       
  2053             AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EStatusPane,
       
  2054                     smallStatusPaneRect);
       
  2055 
       
  2056             // small statuspane, secure state indicator
       
  2057             TAknWindowLineLayout
       
  2058                     smallStatusSecureStateLayout =
       
  2059                             AknLayout::Small_status_pane_descendants_and_elements_Line_5();
       
  2060             TAknLayoutRect smallStatusSecureStateLayoutRect;
       
  2061             smallStatusSecureStateLayoutRect.LayoutRect(smallStatusPaneRect,
       
  2062                     smallStatusSecureStateLayout);
       
  2063             TRect smallStatusSecureStateRect(
       
  2064                     smallStatusSecureStateLayoutRect.Rect());
       
  2065 
       
  2066             // small statuspane, wait pane
       
  2067             TAknWindowComponentLayout smallStatusWaitPaneLayout =
       
  2068                     AknLayoutScalable_Avkon::status_small_wait_pane(3);
       
  2069             TAknLayoutRect smallStatusWaitPaneLayoutRect;
       
  2070             smallStatusWaitPaneLayoutRect.LayoutRect(smallStatusPaneRect,
       
  2071                     smallStatusWaitPaneLayout);
       
  2072             TRect smallStatusWaitPaneRect(
       
  2073                     smallStatusWaitPaneLayoutRect.Rect());
       
  2074 
       
  2075             // small statuspane, globe
       
  2076             TAknWindowComponentLayout smallStatusWmlGlobeLayout =
       
  2077                     AknLayoutScalable_Avkon::status_small_pane_g4(0);
       
  2078             TAknLayoutRect smallStatusWmlGlobeLayoutRect;
       
  2079             smallStatusWmlGlobeLayoutRect.LayoutRect(smallStatusPaneRect,
       
  2080                     smallStatusWmlGlobeLayout);
       
  2081             TRect smallStatusWmlGlobeRect(
       
  2082                     smallStatusWmlGlobeLayoutRect.Rect());
       
  2083 
       
  2084             TInt waitBarIndicatorLeftOffset = smallStatusWaitPaneRect.iTl.iX;
       
  2085             TInt progressBarIndicatorLeftOffset = 0;
       
  2086             TInt wmlWaitGlobeLeftOffset = smallStatusWmlGlobeRect.iTl.iX;
       
  2087 
       
  2088             TRect rectForMiddleIndicators(wmlWaitGlobeLeftOffset,
       
  2089                     containerRect.iTl.iY, wmlWaitGlobeLeftOffset,
       
  2090                     containerRect.iBr.iY);
       
  2091 
       
  2092             if (AknLayoutUtils::LayoutMirrored())
       
  2093                 {
       
  2094                 wmlWaitGlobeLeftOffset = smallStatusPaneRect.iBr.iX
       
  2095                         - smallStatusWmlGlobeRect.iBr.iX;
       
  2096                 waitBarIndicatorLeftOffset = smallStatusPaneRect.iBr.iX
       
  2097                         - smallStatusWaitPaneRect.iBr.iX;
       
  2098                 }
       
  2099 
       
  2100             if (uid == EAknNaviPaneEditorIndicatorProgressBar)
       
  2101                 {
       
  2102                 indicatorWidth = smallStatusWaitPaneRect.Width();
       
  2103                 indicatorHeight = smallStatusWaitPaneRect.Height();                
       
  2104                 verticalOffset = (containerRect.Height() - indicatorHeight)/ 2;
       
  2105                 leftOffset = progressBarIndicatorLeftOffset;
       
  2106 
       
  2107                 textIndicatorOffsetNeeded = ETrue;
       
  2108                 }
       
  2109             else if (uid == EAknNaviPaneEditorIndicatorFileSize)
       
  2110                 {
       
  2111                 verticalOffset = verticalOffsetForTextIndicator;
       
  2112 
       
  2113                 // need left offset in western, right offset in A&H layout.
       
  2114                 if (AknLayoutUtils::LayoutMirrored())
       
  2115                     {
       
  2116                     rightOffset = textIndicatorLeftOffset;
       
  2117                     }
       
  2118                 else
       
  2119                     {
       
  2120                     leftOffset = KMinSpaceBetweenIconsInPixels;
       
  2121                     }
       
  2122                 }
       
  2123             else if (uid == EAknNaviPaneEditorIndicatorWmlWaitGlobe)
       
  2124                 {
       
  2125                 verticalOffset = (containerRect.Height()
       
  2126                         - indicator->IconSize().iHeight) / 2;
       
  2127                 indicatorWidth = smallStatusWmlGlobeRect.Width();
       
  2128                 }
       
  2129             else if (uid == EAknNaviPaneEditorIndicatorWaitBar)
       
  2130                 {
       
  2131                 indicatorWidth = smallStatusWaitPaneRect.Width();
       
  2132                 indicatorHeight = smallStatusWaitPaneRect.Height();
       
  2133                 verticalOffset = (containerRect.Height() - indicatorHeight)/ 2;
       
  2134                 leftOffset = waitBarIndicatorLeftOffset;
       
  2135                 textIndicatorOffsetNeeded = ETrue;
       
  2136                 }
       
  2137             else if (uid == EAknNaviPaneEditorIndicatorSecuredConnection)
       
  2138                 {
       
  2139                 verticalOffset = (containerRect.Height()
       
  2140                         - smallStatusSecureStateRect.Height()) / 2;
       
  2141 
       
  2142                 // because icon bitmap does not contain enough space, increase offset as
       
  2143                 // the layout spec states.
       
  2144                 if (AknLayoutUtils::LayoutMirrored())
       
  2145                     {
       
  2146                     leftOffset = KMinSpaceBetweenIconsInPixels;
       
  2147                     }
       
  2148                 else
       
  2149                     {
       
  2150                     rightOffset = KMinSpaceBetweenIconsInPixels;
       
  2151                     }
       
  2152                 textIndicatorOffsetNeeded = EFalse;
       
  2153                 progressBarIndicatorLeftOffset = 0;
       
  2154                 }
       
  2155             ////////////////////////////////////////////////////////////////////////
  1972             if ( uid == EAknNaviPaneEditorIndicatorMessageInfo    ||
  2156             if ( uid == EAknNaviPaneEditorIndicatorMessageInfo    ||
  1973                  uid == EAknNaviPaneEditorIndicatorWmlWindowsText ||
  2157                  uid == EAknNaviPaneEditorIndicatorWmlWindowsText ||
  1974                  uid == EAknNaviPaneEditorIndicatorMessageLength )
  2158                  uid == EAknNaviPaneEditorIndicatorMessageLength )
  1975                 {
  2159                 {
  1976                 verticalOffset = verticalOffsetForTextIndicator;
  2160                 verticalOffset = verticalOffsetForTextIndicator;
  2135 
  2319 
  2136 
  2320 
  2137             // Place indicators to the middle if any.
  2321             // Place indicators to the middle if any.
  2138             if ( indicatorPosition == EMiddle )
  2322             if ( indicatorPosition == EMiddle )
  2139                 {
  2323                 {
  2140                 // Not supported for now, always set size to zero.
  2324                 TRect requiredRect( rectForMiddleIndicators.iTl.iX,
  2141                 indicator->SetExtent( TPoint( 0, 0 ), TSize( 0, 0 ) );
  2325                         rectForMiddleIndicators.iTl.iY,
  2142                 iIndicatorsShown++;
  2326                         rectForMiddleIndicators.iTl.iX + leftOffset
       
  2327                                 + indicatorWidth + rightOffset,
       
  2328                         rectForMiddleIndicators.iBr.iY );
       
  2329 
       
  2330                 // check if indicator fits
       
  2331                 if (( requiredRect.Intersects( rectForRightSideIndicators )
       
  2332                         || requiredRect.Intersects(rectForLeftSideIndicators ))
       
  2333                         || ( rectForMiddleIndicators.Width() != 0 ))
       
  2334                     {
       
  2335                     indicator->SetExtent(TPoint(0, 0), TSize(0, 0));
       
  2336                     iIndicatorsShown++;
       
  2337                     continue;
       
  2338                     }
       
  2339                 else
       
  2340                     {
       
  2341                     indicator->SetExtent( TPoint(
       
  2342                             rectForMiddleIndicators.iTl.iX + leftOffset,
       
  2343                             verticalOffset ), TSize( indicatorWidth,
       
  2344                             indicatorHeight ));
       
  2345                     rectForMiddleIndicators.iTl.iX += rightOffset;
       
  2346                     rectForMiddleIndicators.iTl.iX += indicatorWidth;
       
  2347                     }
  2143                 }
  2348                 }
  2144             }
  2349             }
  2145 
  2350 
  2146 
  2351 
  2147         iIndicatorsShown++;
  2352         iIndicatorsShown++;
  2871                 }
  3076                 }
  2872 
  3077 
  2873             iIndicatorsShown++;
  3078             iIndicatorsShown++;
  2874 
  3079 
  2875             TBool showIndicator( ETrue );
  3080             TBool showIndicator( ETrue );
       
  3081 
  2876             switch ( iIndicatorsShown )
  3082             switch ( iIndicatorsShown )
  2877                 {
  3083                 {
  2878                 case 1:
  3084                 case 1:
  2879                     {
  3085                     {
  2880                     indicatorLayout =
  3086                     if ( extendedFlatLayout )
  2881                         AknLayoutScalable_Avkon::uni_indicator_pane_g1( 1 );
  3087                         {
       
  3088                         indicatorLayout =
       
  3089                             AknLayoutScalable_Avkon::indicator_nsta_pane_cp_g1( 0 );
       
  3090                         }
       
  3091                     else
       
  3092                         {
       
  3093                         indicatorLayout =
       
  3094                             AknLayoutScalable_Avkon::uni_indicator_pane_g1( 1 );
       
  3095                         }
  2882                     break;
  3096                     break;
  2883                     }
  3097                     }
  2884                 case 2:
  3098                 case 2:
  2885                     {
  3099                     {
  2886                     indicatorLayout =
  3100                     if ( extendedFlatLayout )
  2887                         AknLayoutScalable_Avkon::uni_indicator_pane_g2( 1 );
  3101                         {
       
  3102                         indicatorLayout =
       
  3103                             AknLayoutScalable_Avkon::indicator_nsta_pane_cp_g2( 0 );
       
  3104                         }
       
  3105                     else
       
  3106                         {
       
  3107                         indicatorLayout =
       
  3108                             AknLayoutScalable_Avkon::uni_indicator_pane_g2( 1 );
       
  3109                         }
  2888                     break;
  3110                     break;
  2889                     }
  3111                     }
  2890                 case 3:
  3112                 case 3:
  2891                     {
  3113                     {
  2892                     indicatorLayout =
  3114                     if ( extendedFlatLayout )
  2893                         AknLayoutScalable_Avkon::uni_indicator_pane_g3( 1 );
  3115                         {
       
  3116                         indicatorLayout =
       
  3117                             AknLayoutScalable_Avkon::indicator_nsta_pane_cp_g3( 0 );
       
  3118                         }
       
  3119                     else
       
  3120                         {
       
  3121                         indicatorLayout =
       
  3122                             AknLayoutScalable_Avkon::uni_indicator_pane_g3( 1 );
       
  3123                         }
  2894                     break;
  3124                     break;
  2895                     }
  3125                     }
  2896                     
       
  2897                 // TODO: Add support (remove the extendedFlatLayout checks
       
  2898                 // below) for six indicators also in the extended flat layout
       
  2899                 // once the layout data is fixed.
       
  2900                     
       
  2901                 case 4:
  3126                 case 4:
  2902                     {
  3127                     {
  2903                     if ( !extendedFlatLayout )
  3128                     if ( extendedFlatLayout )
       
  3129                         {
       
  3130                         showIndicator = EFalse;
       
  3131                         }
       
  3132                     else
  2904                         {
  3133                         {
  2905                         indicatorLayout =
  3134                         indicatorLayout =
  2906                             AknLayoutScalable_Avkon::uni_indicator_pane_g4( 1 );
  3135                             AknLayoutScalable_Avkon::uni_indicator_pane_g4( 1 );
  2907                         }
  3136                         }
  2908                     else
  3137                     break;
       
  3138                     }
       
  3139                 case 5:
       
  3140                     {
       
  3141                     if ( extendedFlatLayout )
  2909                         {
  3142                         {
  2910                         showIndicator = EFalse;
  3143                         showIndicator = EFalse;
  2911                         }
  3144                         }
  2912                     break;
  3145                     else
  2913                     }
       
  2914                 case 5:
       
  2915                     {
       
  2916                     if ( !extendedFlatLayout )
       
  2917                         {
  3146                         {
  2918                         indicatorLayout =
  3147                         indicatorLayout =
  2919                             AknLayoutScalable_Avkon::uni_indicator_pane_g5( 1 );
  3148                             AknLayoutScalable_Avkon::uni_indicator_pane_g5( 1 );
  2920                         }
  3149                         }
  2921                     else
  3150                     break;
       
  3151                     }
       
  3152                 case 6:
       
  3153                     {
       
  3154                     if ( extendedFlatLayout )
  2922                         {
  3155                         {
  2923                         showIndicator = EFalse;
  3156                         showIndicator = EFalse;
  2924                         }
  3157                         }
  2925                     break;
  3158                     else
  2926                     }
       
  2927                 case 6:
       
  2928                     {
       
  2929                     if ( !extendedFlatLayout )
       
  2930                         {
  3159                         {
  2931                         indicatorLayout =
  3160                         indicatorLayout =
  2932                             AknLayoutScalable_Avkon::uni_indicator_pane_g6( 1 );
  3161                             AknLayoutScalable_Avkon::uni_indicator_pane_g6( 1 );
  2933                         }
       
  2934                     else
       
  2935                         {
       
  2936                         showIndicator = EFalse;
       
  2937                         }
  3162                         }
  2938                     break;
  3163                     break;
  2939                     }
  3164                     }
  2940                 default:
  3165                 default:
  2941                     {
  3166                     {
  3845 
  4070 
  3846             break;
  4071             break;
  3847             }
  4072             }
  3848         }
  4073         }
  3849 
  4074 
  3850     if ( indicator &&
  4075     if (indicator && (indicator->IndicatorState() || 
  3851         ( indicator->IndicatorState() || indicator->Priority() != KIndicatorNotShown ) )
  4076             indicator->Priority()!= KIndicatorNotShown))
  3852         {
  4077         {
  3853         SizeChanged();
  4078         SizeChanged();
  3854         DrawDeferred();
  4079         DrawDeferred();
  3855         }
  4080         }
  3856     }
  4081     }
  4058         }
  4283         }
  4059     // if not foreground, cancel the timer
  4284     // if not foreground, cancel the timer
  4060     if ( !iExtension->iIsForeground ||
  4285     if ( !iExtension->iIsForeground ||
  4061             R_AVKON_STATUS_PANE_LAYOUT_EMPTY == curId )
  4286             R_AVKON_STATUS_PANE_LAYOUT_EMPTY == curId )
  4062         {
  4287         {
  4063         if ( iTicker->IsActive() )
  4288         if ( iTicker )
  4064             {
  4289             {
  4065             iTicker->Cancel();
  4290             iTicker->Cancel();
  4066             }
  4291             delete iTicker;
       
  4292             iTicker = NULL;
       
  4293             }
       
  4294 
  4067         return;
  4295         return;
  4068         }
  4296         }
  4069 
  4297 
  4070     if ( !iTicker->IsActive() && iAnimatedIndicatorsShown > 0 )
  4298     if ( iAnimatedIndicatorsShown > 0 )
  4071         {
  4299         {
  4072         iTicker->Start( KAknIndicatorAnimationShortDelay,
  4300         if ( !iTicker )
  4073                         KAknIndicatorAnimationInterval,
  4301             {
  4074                         TCallBack( TickerCallback, this ) );
  4302             TRAP_IGNORE( iTicker = CPeriodic::NewL( CActive::EPriorityLow ) );
  4075         }
  4303             }
  4076     else if ( iTicker->IsActive() && iAnimatedIndicatorsShown == 0 )
  4304 
       
  4305         if ( iTicker && !iTicker->IsActive() )
       
  4306             {
       
  4307             iTicker->Start( KAknIndicatorAnimationShortDelay,
       
  4308                             KAknIndicatorAnimationInterval,
       
  4309                             TCallBack( TickerCallback, this ) );
       
  4310             }
       
  4311         }
       
  4312     else if ( iTicker && iAnimatedIndicatorsShown == 0 )
  4077         {
  4313         {
  4078         // Cancel animation timer if animated indicators
  4314         // Cancel animation timer if animated indicators
  4079         // are not visible anymore.
  4315         // are not visible anymore.
  4080         iTicker->Cancel();
  4316         iTicker->Cancel();
       
  4317         delete iTicker;
       
  4318         iTicker = NULL;
  4081         iSynchronizingValue = 0;
  4319         iSynchronizingValue = 0;
  4082         }
  4320         }
  4083     }
  4321     }
  4084 
  4322 
  4085 //  End of File
  4323 //  End of File