uifw/AvKon/src/AknIndicatorContainer.cpp
changeset 0 2f259fa3e83a
child 9 aabf2c525e0f
child 14 3320e4e6e8bb
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     1 /*
       
     2 * Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Implementation for default status indicator control.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include <AknsDrawUtils.h>
       
    21 #include <AknPictographInterface.h>
       
    22 #include <AknPictographDrawerInterface.h>
       
    23 #include <aknlayoutscalable_avkon.cdl.h>
       
    24 #include <aknlayoutscalable_apps.cdl.h>
       
    25 #include <AknSmallIndicator.h>
       
    26 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
       
    27 #include <uikon/eikenvinterface.h>
       
    28 #endif
       
    29 
       
    30 #include <AknTasHook.h>
       
    31 #include <touchfeedback.h>
       
    32 
       
    33 
       
    34 #include "AknIndicatorObserver.h"
       
    35 #include "aknindicatordataobserver.h"
       
    36 #include "AknSgcc.h"
       
    37 #include "AknIncallStatusBubble.h"
       
    38 #include "AknUtils.h"
       
    39 #include "aknconsts.h"
       
    40 #include "AknIndicator.h"
       
    41 #include "AknIndicatorContainer.h"
       
    42 #include "aknenv.h"
       
    43 #include "AknStatuspaneUtils.h"
       
    44 #include "AknIndicatorFader.h"
       
    45 #include "aknappui.h"
       
    46 #include "AknDef.h"
       
    47 #include "layoutmetadata.cdl.h"
       
    48 
       
    49 // CONSTANTS
       
    50 const TInt KAknIndicatorQueueGranularity       = 4;
       
    51 const TInt KAknIndicatorAnimationInterval      = 500000; // micro seconds
       
    52 const TInt KAknIndicatorAnimationShortDelay    = 400000; // micro seconds
       
    53 
       
    54 // Indicator pane control flags.
       
    55 enum TIndicatorPaneControlFlags
       
    56     {
       
    57     EAknIndicatorsButton1DownInIndicatorPaneRect = 0x00000001
       
    58     };
       
    59 
       
    60 // ================= PRIVATE CLASS =======================
       
    61 
       
    62 NONSHARABLE_CLASS( CAknIndicatorContainerExtension ) :
       
    63     public CBase,
       
    64     public MAknPictographAnimatorCallBack,
       
    65     public MCoeMessageMonitorObserver
       
    66     {
       
    67 public:
       
    68     /**
       
    69     * Constructor.
       
    70     */
       
    71     static CAknIndicatorContainerExtension* NewL(
       
    72         CAknIndicatorContainer* aIndicatorContainer );
       
    73 
       
    74     /**
       
    75     * Destructor.
       
    76     */
       
    77     ~CAknIndicatorContainerExtension();
       
    78 
       
    79     TBool SmallStatusPaneLayout();
       
    80     void SetSmallStatusPaneLayout( TBool aIsActive );
       
    81 
       
    82     // From base class @c MCoeMessageMonitorObserver.
       
    83 
       
    84     /**
       
    85     * Used to receive event from window server
       
    86     * when the visibility of the window changes.
       
    87     *
       
    88     * @param  aEvent  The window server event.
       
    89     */
       
    90     void MonitorWsMessage( const TWsEvent &aEvent );
       
    91 
       
    92 private:
       
    93 
       
    94     CAknIndicatorContainerExtension(
       
    95         CAknIndicatorContainer* aIndicatorContainer );
       
    96 
       
    97     void ConstructL();
       
    98 
       
    99     // From MAknPictographAnimatorCallBack
       
   100     void DrawPictographArea();
       
   101 
       
   102 public:
       
   103 
       
   104     CAknIndicatorContainer*     iIndicatorContainer;
       
   105     CAknPictographInterface*    iPictoInterface;
       
   106     TBool                       iSmallStatusPaneLayout;
       
   107     TBool                       iSwitchLayoutInProgress;
       
   108     TBool                       iIncallBubbleAllowedInIdle;
       
   109     TBool                       iIncallBubbleAllowedInUsual;
       
   110     TPoint                      iPositionRelativeToScreen;
       
   111     CAknIndicatorDataObserver*  iDataObserver;
       
   112     TInt                        iFlags;
       
   113     TBool                       iIncallBubbleDisabled;
       
   114     TBool                       iIsForeground;
       
   115     TBool                       iIsActiveIdle;
       
   116     };
       
   117 
       
   118 
       
   119 CAknIndicatorContainerExtension* CAknIndicatorContainerExtension::NewL(
       
   120     CAknIndicatorContainer* aIndicatorContainer )
       
   121     {
       
   122     CAknIndicatorContainerExtension* self = new( ELeave )
       
   123         CAknIndicatorContainerExtension( aIndicatorContainer );
       
   124 
       
   125     CleanupStack::PushL( self );
       
   126     self->ConstructL();
       
   127     CleanupStack::Pop( self );
       
   128     return self;
       
   129     }
       
   130 
       
   131 
       
   132 void CAknIndicatorContainerExtension::ConstructL()
       
   133     {
       
   134     iPictoInterface = CAknPictographInterface::NewL( *iIndicatorContainer, *this );
       
   135     if ( iIndicatorContainer->IndicatorContext() ==
       
   136             CAknIndicatorContainer::EUniversalIndicators )
       
   137         {
       
   138         iDataObserver =
       
   139             new (ELeave) CAknIndicatorDataObserver( iIndicatorContainer );
       
   140         }
       
   141 
       
   142     TRAP_IGNORE( CCoeEnv::Static()->AddMessageMonitorObserverL( *this ) );
       
   143     }
       
   144 
       
   145 
       
   146 CAknIndicatorContainerExtension::CAknIndicatorContainerExtension(
       
   147     CAknIndicatorContainer* aIndicatorContainer )
       
   148     : iIndicatorContainer( aIndicatorContainer )
       
   149     {
       
   150     iSmallStatusPaneLayout      = AknStatuspaneUtils::SmallLayoutActive();
       
   151     iIncallBubbleAllowedInUsual = ETrue;
       
   152     iIsForeground = static_cast<CAknAppUi*>( CEikonEnv::Static()->EikAppUi() )->IsForeground();
       
   153     iIsActiveIdle = AknStatuspaneUtils::IsActiveIdle();
       
   154     }
       
   155 
       
   156 
       
   157 CAknIndicatorContainerExtension::~CAknIndicatorContainerExtension()
       
   158     {
       
   159     delete iPictoInterface;
       
   160     delete iDataObserver;
       
   161 
       
   162     CCoeEnv::Static()->RemoveMessageMonitorObserver( *this );
       
   163     }
       
   164 
       
   165 
       
   166 void CAknIndicatorContainerExtension::DrawPictographArea()
       
   167     {
       
   168     iIndicatorContainer->DrawPictographArea();
       
   169     }
       
   170 
       
   171 
       
   172 TBool CAknIndicatorContainerExtension::SmallStatusPaneLayout()
       
   173     {
       
   174     return iSmallStatusPaneLayout;
       
   175     }
       
   176 
       
   177 
       
   178 void CAknIndicatorContainerExtension::SetSmallStatusPaneLayout(
       
   179     TBool aIsActive )
       
   180     {
       
   181     iSmallStatusPaneLayout = aIsActive;
       
   182     }
       
   183 
       
   184 void CAknIndicatorContainerExtension::MonitorWsMessage( const TWsEvent& aEvent )
       
   185     {
       
   186     switch ( aEvent.Type() )
       
   187         {
       
   188         case KAknFullOrPartialForegroundGained:
       
   189             iIndicatorContainer->ResetAnimTicker( ETrue );
       
   190             break;
       
   191 
       
   192         case KAknFullOrPartialForegroundLost:
       
   193             iIndicatorContainer->ResetAnimTicker( EFalse );
       
   194             break;
       
   195 
       
   196         default:
       
   197             break;
       
   198         }
       
   199     }
       
   200 
       
   201 // ================= MEMBER FUNCTIONS =======================
       
   202 
       
   203 // ---------------------------------------------------------------------------
       
   204 // CAknIndicatorContainer::CAknIndicatorContainer
       
   205 // Default constructor.
       
   206 // ---------------------------------------------------------------------------
       
   207 //
       
   208 EXPORT_C CAknIndicatorContainer::CAknIndicatorContainer() :
       
   209     iLayoutOrientation( EVertical ),
       
   210     iPreviousLayoutOrientation( EVertical ),
       
   211     iAlignment( ERight ),
       
   212     iIndicatorContext( EUniversalIndicators ),
       
   213     iSynchronizingValue( 0 )
       
   214     {
       
   215     AKNTASHOOK_ADD( this, "CAknIndicatorContainer" );
       
   216     }
       
   217 
       
   218 
       
   219 // ---------------------------------------------------------------------------
       
   220 // CAknIndicatorContainer::CAknIndicatorContainer
       
   221 // Constructor with context type parameter.
       
   222 // ---------------------------------------------------------------------------
       
   223 //
       
   224 EXPORT_C CAknIndicatorContainer::CAknIndicatorContainer(
       
   225     TBool aIndicatorContext )
       
   226     : iLayoutOrientation( EVertical ),
       
   227       iPreviousLayoutOrientation( EVertical ),
       
   228       iAlignment( ERight ),
       
   229       iIndicatorContext( aIndicatorContext ),
       
   230       iSynchronizingValue( 0 )
       
   231     {
       
   232     AKNTASHOOK_ADD( this, "CAknIndicatorContainer" );
       
   233     }
       
   234 
       
   235 // ---------------------------------------------------------------------------
       
   236 // CAknIndicatorContainer::~CAknIndicatorContainer
       
   237 // Destructor.
       
   238 // ---------------------------------------------------------------------------
       
   239 //
       
   240 EXPORT_C CAknIndicatorContainer::~CAknIndicatorContainer()
       
   241     {
       
   242     AKNTASHOOK_REMOVE();
       
   243     AknsUtils::DeregisterControlPosition( this );
       
   244 
       
   245     if ( iIndicators )
       
   246         {
       
   247         TInt count = iIndicators->Count();
       
   248         for ( TInt ii = 0; ii < count; ii++)
       
   249             {
       
   250             delete iIndicators->At( ii );
       
   251             }
       
   252         delete iIndicators;
       
   253         }
       
   254 
       
   255     if ( iTicker )
       
   256         {
       
   257         iTicker->Cancel();
       
   258         delete iTicker;
       
   259         }
       
   260 
       
   261     delete iIncallBubble;
       
   262     delete iExtension;
       
   263     }
       
   264 
       
   265 
       
   266 // ---------------------------------------------------------------------------
       
   267 // CAknIndicatorContainer::ConstructL
       
   268 // Second-phase constructor.
       
   269 // ---------------------------------------------------------------------------
       
   270 //
       
   271 EXPORT_C void CAknIndicatorContainer::ConstructL()
       
   272     {
       
   273     iExtension = CAknIndicatorContainerExtension::NewL( this );
       
   274 
       
   275     if ( !iIndicators )
       
   276         {
       
   277         iIndicators =
       
   278             new (ELeave) CAknIndicatorQueue( KAknIndicatorQueueGranularity );
       
   279         }
       
   280 
       
   281 
       
   282     iTicker = CPeriodic::NewL( CActive::EPriorityLow );
       
   283     }
       
   284 
       
   285 
       
   286 // ---------------------------------------------------------------------------
       
   287 // CAknIndicatorContainer::ConstructFromResourceL
       
   288 // Resource constructor.
       
   289 // ---------------------------------------------------------------------------
       
   290 //
       
   291 EXPORT_C void CAknIndicatorContainer::ConstructFromResourceL(
       
   292     TResourceReader& aReader )
       
   293     {
       
   294     ConstructL();
       
   295 
       
   296     if ( iIndicatorContext != EUniversalIndicators &&
       
   297          iIndicatorContext != ENaviPaneEditorIndicators &&
       
   298          iIndicatorContext != EQueryEditorIndicators )
       
   299         {
       
   300         TInt count = aReader.ReadInt16();
       
   301         for ( TInt ii = 0; ii < count; ii++ )
       
   302             {
       
   303             CAknIndicator* indicator =
       
   304                 new (ELeave) CAknIndicator ( iIndicatorContext );
       
   305             CleanupStack::PushL( indicator );
       
   306             indicator->SetContainerWindowL( *this );
       
   307             indicator->ConstructFromResourceL( aReader, this );
       
   308             iIndicators->AppendL( indicator );
       
   309             CleanupStack::Pop( indicator );
       
   310             indicator = NULL;
       
   311             }
       
   312 
       
   313         PrioritizeIndicatorsL();
       
   314         }
       
   315     }
       
   316 
       
   317 
       
   318 // ---------------------------------------------------------------------------
       
   319 // CAknIndicatorContainer::IndicatorContext
       
   320 // Returns the indicator context of this container.
       
   321 // ---------------------------------------------------------------------------
       
   322 //
       
   323 EXPORT_C TInt CAknIndicatorContainer::IndicatorContext() const
       
   324     {
       
   325     return iIndicatorContext;
       
   326     }
       
   327 
       
   328 
       
   329 // ---------------------------------------------------------------------------
       
   330 // CAknIndicatorContainer::SetIndicatorState
       
   331 // Sets the state of an indicator in this container.
       
   332 // ---------------------------------------------------------------------------
       
   333 //
       
   334 EXPORT_C void CAknIndicatorContainer::SetIndicatorState( TUid aIndicatorId,
       
   335                                                          TInt aState,
       
   336                                                          TBool aDrawNow )
       
   337     {
       
   338     if ( !IndicatorExists( aIndicatorId ) )
       
   339         {
       
   340         if ( iIndicatorContext == EUniversalIndicators )
       
   341             {
       
   342             TRAP_IGNORE( CreateIndicatorFromPaneResourceL(
       
   343                 aIndicatorId, R_AVKON_STATUS_PANE_INDICATOR_DEFAULT, 0 ) );
       
   344             }
       
   345         else if ( iIndicatorContext == ENaviPaneEditorIndicators ||
       
   346                   iIndicatorContext == EQueryEditorIndicators )
       
   347             {
       
   348             TRAP_IGNORE( CreateIndicatorFromPaneResourceL(
       
   349                 aIndicatorId, R_AVKON_NAVI_PANE_EDITOR_INDICATORS, 0 ) );
       
   350             }
       
   351         }
       
   352 
       
   353     TBool changed = EFalse;
       
   354     TInt  count   = iIndicators->Count();
       
   355 
       
   356     CAknIndicator* indicator = NULL;
       
   357     for ( TInt ii = 0; ii < count; ii++ )
       
   358         {
       
   359         indicator = iIndicators->At( ii );
       
   360 
       
   361         if ( indicator->Uid() == aIndicatorId )
       
   362             {
       
   363             if ( indicator->IndicatorState() != aState )
       
   364                 {
       
   365                 changed = ETrue;
       
   366                 }
       
   367 
       
   368             indicator->SetIndicatorState( aState );
       
   369             if ( aState == MAknIndicator::EIndicatorAnimate )
       
   370                 {
       
   371                 // Synchronizes new animated indicator with previous ones
       
   372                 indicator->SetAnimateState( iSynchronizingValue );
       
   373                 }
       
   374 
       
   375             // In case of GPRS indicator in small status pane it is necessary
       
   376             // to check whether a correct status pane layout is used.
       
   377             if ( aIndicatorId == TUid::Uid( EAknNaviPaneEditorIndicatorGprs ) )
       
   378                 {
       
   379                 TBool layoutUpdated( EFalse );
       
   380                 TRAPD( err, layoutUpdated = UpdateSmallLayoutL() );
       
   381                 if ( layoutUpdated && err == KErrNone )
       
   382                     {
       
   383                     // Needed because this method is not called again.
       
   384                     iExtension->iSwitchLayoutInProgress = EFalse;
       
   385                     }
       
   386                 }
       
   387 
       
   388             break;
       
   389             }
       
   390         }
       
   391 
       
   392     if ( changed )
       
   393         {
       
   394         TRAP_IGNORE( PrioritizeIndicatorsL() );
       
   395         SizeChanged(); // starts/stops also animation timers if needed
       
   396         }
       
   397 
       
   398     // Do not draw in case the indicator state has not changed and
       
   399     // the indicator is not visible, even if aDrawNow is defined,
       
   400     // otherwise flicker will occur.
       
   401     if ( aDrawNow && ( changed || aState ) )
       
   402         {
       
   403         DrawNow();
       
   404         }
       
   405     }
       
   406 
       
   407 
       
   408 // ---------------------------------------------------------------------------
       
   409 // CAknIndicatorContainer::IndicatorState
       
   410 // Returns current state of a status indicator in this container.
       
   411 // ---------------------------------------------------------------------------
       
   412 //
       
   413 EXPORT_C TInt CAknIndicatorContainer::IndicatorState( TUid aIndicatorId )
       
   414     {
       
   415     TInt indicatorState( MAknIndicator::EIndicatorOff );
       
   416 
       
   417     TInt count = iIndicators->Count();
       
   418     CAknIndicator* indicator = NULL;
       
   419     for ( TInt ii = 0; ii < count; ii++ )
       
   420         {
       
   421         indicator = iIndicators->At( ii );
       
   422 
       
   423         if ( indicator->Uid() == aIndicatorId )
       
   424             {
       
   425             indicatorState = indicator->IndicatorState();
       
   426             break;
       
   427             }
       
   428         }
       
   429 
       
   430     return indicatorState;
       
   431     }
       
   432 
       
   433 
       
   434 EXPORT_C void CAknIndicatorContainer::SetIndicatorValueL( TUid aIndicatorId,
       
   435                                                           const TDesC& aString )
       
   436     {
       
   437     if ( ( iIndicatorContext == ENaviPaneEditorIndicators ||
       
   438            iIndicatorContext == EQueryEditorIndicators )  &&
       
   439          !IndicatorExists( aIndicatorId ) )
       
   440         {
       
   441         CreateIndicatorFromPaneResourceL( aIndicatorId, R_AVKON_NAVI_PANE_EDITOR_INDICATORS, 0);
       
   442         }
       
   443 
       
   444     TInt count = iIndicators->Count();
       
   445     for(TInt ii = 0; ii < count; ii++)
       
   446         {
       
   447         CAknIndicator* indicator = iIndicators->At(ii);
       
   448         if ( indicator->Uid() == aIndicatorId )
       
   449             {
       
   450             TInt indicatorWidthBefore = indicator->IconSize().iWidth;
       
   451             indicator->SetIndicatorValueL(aString);
       
   452             TInt indicatorWidthAfter = indicator->IconSize().iWidth;
       
   453 
       
   454             // Draw the message length indicator if it is visible.
       
   455             if (  indicator->IndicatorState() != EAknIndicatorStateOff )
       
   456                 {
       
   457                 if ( indicatorWidthBefore != indicatorWidthAfter )
       
   458                     {
       
   459                     // If indicator width was changed, reposition all indicators.
       
   460                     PrioritizeIndicatorsL();
       
   461                     SizeChanged();
       
   462                     }
       
   463                 DrawNow();
       
   464                 }
       
   465             break;
       
   466             }
       
   467         }
       
   468     }
       
   469 
       
   470 void CAknIndicatorContainer::DrawPictographArea()
       
   471     {
       
   472     TInt count = iIndicators->Count();
       
   473 
       
   474     for ( TInt i = 0; i < count; i++ )
       
   475         {
       
   476         CAknIndicator* indicator = iIndicators->At( i );
       
   477         // Draw the indicator if it is visible and contains pictographs.
       
   478         if ( indicator->TextIndicator() &&
       
   479              indicator->IndicatorState() != EAknIndicatorStateOff &&
       
   480              indicator->IsVisible() &&
       
   481              iExtension->iPictoInterface->Interface()->ContainsPictographs(
       
   482                 *( indicator->iIndicatorText ) ) )
       
   483             {
       
   484             indicator->DrawDeferred();
       
   485             }
       
   486         }
       
   487     }
       
   488 
       
   489 
       
   490 CAknPictographInterface* CAknIndicatorContainer::PictographInterface() const
       
   491     {
       
   492     return iExtension->iPictoInterface;
       
   493     }
       
   494 
       
   495 
       
   496 EXPORT_C void  CAknIndicatorContainer::SetIncallBubbleFlags( const TInt& aFlags )
       
   497     {
       
   498     if ( aFlags & CIncallStatusBubble::ESBVisible )
       
   499         {
       
   500         if ( !iIncallBubble )
       
   501             {
       
   502             TRAP_IGNORE( CreateIncallBubbleL() );
       
   503             }
       
   504 
       
   505         if ( iIncallBubble )
       
   506             {
       
   507             iIncallBubble->SetFlags( aFlags );
       
   508             }
       
   509         }
       
   510     else
       
   511         {
       
   512         // RAM optimization, delete if not shown.
       
   513         delete iIncallBubble;
       
   514         iIncallBubble = NULL;
       
   515         }
       
   516     HandleStatusPaneSizeChange();
       
   517     }
       
   518 
       
   519 
       
   520 EXPORT_C void CAknIndicatorContainer::HandleStatusPaneSizeChange()
       
   521     {
       
   522     CEikStatusPaneBase* statusPane = CEikStatusPaneBase::Current();
       
   523     if ( statusPane && iIncallBubble )
       
   524         {
       
   525         // In CDMA, the Phone app is on foreground during incall lock state
       
   526         // In GSM/WCDMA the Autolock application is on foreground
       
   527 
       
   528         // Nowdays Autolock itself takes care of the visibility
       
   529         const TBool showIncallIndicatorInLockState = EFalse;
       
   530 
       
   531         TBool showIncallIndicatorInIdle =
       
   532             iExtension->iIncallBubbleAllowedInIdle &&
       
   533             !iExtension->iIncallBubbleDisabled;
       
   534 
       
   535         TBool showIncallIndicatorInUsual =
       
   536             iExtension->iIncallBubbleAllowedInUsual &&
       
   537             !iExtension->iIncallBubbleDisabled;
       
   538 
       
   539         TBool visible = EFalse;
       
   540 
       
   541         TBool usualStatuspane = AknStatuspaneUtils::UsualLayoutActive();
       
   542         TBool idleStatuspane  = AknStatuspaneUtils::IdleLayoutActive();
       
   543 
       
   544         // Call bubble is never displayed if video telephony is
       
   545         // on the foreground.
       
   546         TInt currentLayoutResId = statusPane->CurrentLayoutResId();
       
   547         TBool vtStatuspane =
       
   548             ( currentLayoutResId == R_AVKON_STATUS_PANE_LAYOUT_VT ||
       
   549               currentLayoutResId == R_AVKON_STATUS_PANE_LAYOUT_VT_MIRRORED );
       
   550 
       
   551        if ( statusPane->IsVisible() && iExtension->iIsForeground &&
       
   552             ( ( usualStatuspane && showIncallIndicatorInUsual ) ||
       
   553               ( idleStatuspane && showIncallIndicatorInIdle && !vtStatuspane ) ) )
       
   554             {
       
   555             // Incall bubble window is shown only in the usual layout when status
       
   556             // pane is shown. Exception for this rule: The bubble is shown also
       
   557             // when autolock application is in the front even if the idle
       
   558             // layout is visible.
       
   559             visible = ( iIncallBubble->Flags() & CIncallStatusBubble::ESBVisible );
       
   560             }
       
   561 
       
   562         IncallBubbleSizeChanged( showIncallIndicatorInLockState );
       
   563         iIncallBubble->MakeVisible( visible );
       
   564         }
       
   565     }
       
   566 
       
   567 
       
   568 //-----------------------------------------------------------------------------
       
   569 // CAknIndicatorContainer::HandleResourceChange
       
   570 //-----------------------------------------------------------------------------
       
   571 //
       
   572 EXPORT_C void CAknIndicatorContainer::HandleResourceChange( TInt aType )
       
   573     {
       
   574     CCoeControl::HandleResourceChange( aType );
       
   575 
       
   576     if ( aType == KEikMessageFadeAllWindows && iIncallBubble )
       
   577         {
       
   578         CEikStatusPaneBase* statusPane = CEikStatusPaneBase::Current();
       
   579         iIncallBubble->SetFaded( statusPane->IsFaded() );
       
   580         }
       
   581 
       
   582     if ( aType == KEikColorResourceChange || aType == KAknsMessageSkinChange )
       
   583         {
       
   584         DrawDeferred();
       
   585         }
       
   586     else if ( aType == KEikDynamicLayoutVariantSwitch )
       
   587         {
       
   588         SizeChanged();
       
   589         DrawDeferred();
       
   590         }
       
   591 
       
   592     if ( iIncallBubble )
       
   593         {
       
   594         iIncallBubble->HandleResourceChange( aType );
       
   595         }
       
   596     }
       
   597 
       
   598 
       
   599 //-----------------------------------------------------------------------------
       
   600 // CAknIndicatorContainer::SizeChanged
       
   601 //-----------------------------------------------------------------------------
       
   602 //
       
   603 EXPORT_C void CAknIndicatorContainer::SizeChanged()
       
   604     {
       
   605     // No fading if staconpane is active and in few other cases too...
       
   606     if ( iIndicatorContext == EUniversalIndicators )
       
   607         {
       
   608         SetContainerWindowNonFading(
       
   609             AknStatuspaneUtils::ExtendedStaconPaneActive() ||
       
   610             ( AknStatuspaneUtils::StaconPaneActive() &&
       
   611               !AknStatuspaneUtils::IdleLayoutActive() ) );
       
   612         }
       
   613 
       
   614     AknsUtils::RegisterControlPosition( this );
       
   615     if ( iExtension && DrawableWindow() )
       
   616         {
       
   617         iExtension->iPositionRelativeToScreen = PositionRelativeToScreen();
       
   618         }
       
   619 
       
   620     // Select right layout modes for indicators.
       
   621     // This is now done always to ensure right layout mode.
       
   622     SetupIndicatorLayoutModes();
       
   623 
       
   624     // HandleStatusPaneSizeChange() is called here always to check
       
   625     // incall bubble visibility because status pane size change is
       
   626     // not only case when it changes.
       
   627     HandleStatusPaneSizeChange();
       
   628 
       
   629     // Check if layout is mirrored and the context
       
   630     // of the indicators is mirrorable.
       
   631     if ( AknLayoutUtils::LayoutMirrored() &&
       
   632          ( iIndicatorContext == EUniversalIndicators ||
       
   633            iIndicatorContext == ENaviPaneEditorIndicators ||
       
   634            iIndicatorContext == EQueryEditorIndicators ) )
       
   635         {
       
   636         iAlignment = TIndicatorAlignment( ELeft );
       
   637         }
       
   638     else
       
   639         {
       
   640         iAlignment = TIndicatorAlignment( ERight );
       
   641         }
       
   642 
       
   643     TRect containerRect( Rect() );
       
   644 
       
   645     if ( containerRect.IsEmpty() )
       
   646         {
       
   647         return;
       
   648         }
       
   649 
       
   650     // Set faders off by default (only used in stacon)
       
   651     if ( iIndicatorContext == EUniversalIndicators )
       
   652         {
       
   653         TInt count = iIndicators->Count();
       
   654         for ( TInt ii = 0; ii < count; ii++ )
       
   655             {
       
   656             CAknIndicator* indicator = iIndicators->At( ii );
       
   657             if ( indicator )
       
   658                 {
       
   659                 indicator->SetIndicatorFader( NULL );
       
   660                 }
       
   661             }
       
   662         }
       
   663 
       
   664     TBool idleLayout           = AknStatuspaneUtils::IdleLayoutActive();
       
   665     TBool smallLayout          = EFalse;
       
   666     TBool flatLayout           = EFalse;
       
   667     TBool extendedFlatLayout   = EFalse;
       
   668     TBool staconLayout         = EFalse;
       
   669     TBool extendedStaconLayout = EFalse;
       
   670     TBool hdLayout             = EFalse;
       
   671     TBool extendedLayout       = EFalse;
       
   672 
       
   673     if ( AknStatuspaneUtils::SmallLayoutActive() )
       
   674         {
       
   675         smallLayout = ETrue;
       
   676         }
       
   677     else if ( AknStatuspaneUtils::FlatLayoutActive() )
       
   678         {
       
   679         flatLayout         = ETrue;
       
   680         extendedFlatLayout = !AknLayoutUtils::PenEnabled() &&
       
   681                              AknStatuspaneUtils::ExtendedFlatLayoutActive();
       
   682         hdLayout           = AknStatuspaneUtils::HDLayoutActive();
       
   683         }
       
   684     else if ( AknStatuspaneUtils::StaconPaneActive() )
       
   685         {
       
   686         staconLayout         = ETrue;
       
   687         extendedStaconLayout = AknStatuspaneUtils::ExtendedStaconPaneActive();
       
   688         }
       
   689     else
       
   690         {
       
   691         hdLayout       = AknStatuspaneUtils::HDLayoutActive();
       
   692         extendedLayout = AknStatuspaneUtils::ExtendedLayoutActive();
       
   693         }
       
   694 
       
   695     switch ( iIndicatorContext )
       
   696         {
       
   697         case ENaviPaneEditorIndicators:
       
   698             {
       
   699             if ( smallLayout )
       
   700                 {
       
   701                 SizeChangedInSmallStatusPane();
       
   702                 }
       
   703             else if ( staconLayout &&
       
   704                       !idleLayout )
       
   705                 {
       
   706                 SizeChangedInStaconPane();
       
   707                 }
       
   708             else if ( hdLayout )
       
   709                 {
       
   710                 SizeChangedInExtendedStatusPane();
       
   711                 }
       
   712             else
       
   713                 {
       
   714                 SizeChangedInNormalStatusPane();
       
   715                 }
       
   716             break;
       
   717             }
       
   718 
       
   719         case EUniversalIndicators:
       
   720             {
       
   721             if ( extendedLayout )
       
   722                 {
       
   723                 if ( idleLayout && !hdLayout )
       
   724                     {
       
   725                     SizeChangedInIdleExtendedStatusPane();
       
   726                     }
       
   727                 else
       
   728                     {
       
   729                     SizeChangedInExtendedStatusPane();
       
   730                     }
       
   731                 }
       
   732             else if ( flatLayout )
       
   733                 {
       
   734                 if ( extendedFlatLayout )
       
   735                     {
       
   736                     // Extended flat status pane layout.
       
   737                     SizeChangedInExtendedStatusPane();
       
   738                     }
       
   739                 else
       
   740                     {
       
   741                     // Old flat status pane layout.
       
   742                     SizeChangedInFlatStatusPane();
       
   743                     }
       
   744                 }
       
   745             else if ( staconLayout )
       
   746                 {
       
   747                 if ( extendedStaconLayout )
       
   748                     {
       
   749                     // Extended stacon layout.
       
   750                     SizeChangedInExtendedStatusPane();
       
   751                     }
       
   752                 else if ( !idleLayout )
       
   753                     {
       
   754                     // Old stacon layout.
       
   755                     SizeChangedInStaconPane();
       
   756                     }
       
   757                 else
       
   758                     {
       
   759                     SizeChangedInNormalStatusPane();
       
   760                     }
       
   761                 }
       
   762             else if ( idleLayout &&
       
   763                       Layout_Meta_Data::IsLandscapeOrientation() &&
       
   764                       Size().iWidth < Size().iHeight )
       
   765                 {
       
   766                 // Universal indicator container in idle landscape
       
   767                 // using vertical indicators.
       
   768                 SizeChangedInIdleVertical();
       
   769                 }
       
   770             else
       
   771                 {
       
   772                 // Normal status pane by default.
       
   773                 SizeChangedInNormalStatusPane();
       
   774                 }
       
   775             break;
       
   776             }
       
   777 
       
   778         default:
       
   779             {
       
   780             if ( hdLayout )
       
   781                 {
       
   782                 SizeChangedInExtendedStatusPane();
       
   783                 }
       
   784             else
       
   785                 {
       
   786                 // Normal status pane by default.
       
   787                 SizeChangedInNormalStatusPane();
       
   788                 }
       
   789             break;
       
   790             }
       
   791         }
       
   792     }
       
   793 
       
   794 EXPORT_C void CAknIndicatorContainer::PositionChanged()
       
   795     {
       
   796     AknsUtils::RegisterControlPosition( this );
       
   797     }
       
   798 
       
   799 EXPORT_C TInt CAknIndicatorContainer::CountComponentControls() const
       
   800     {
       
   801     return (iIndicatorsShown);
       
   802     }
       
   803 
       
   804 
       
   805 EXPORT_C CCoeControl* CAknIndicatorContainer::ComponentControl(TInt aIndex) const
       
   806     {
       
   807     TInt count = iIndicators->Count();
       
   808 
       
   809     TInt ii = 0;
       
   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         }
       
   822     else
       
   823         {
       
   824         return NULL;
       
   825         }
       
   826     }
       
   827 
       
   828 
       
   829 EXPORT_C void CAknIndicatorContainer::Draw( const TRect& /*aRect*/ ) const
       
   830     {
       
   831     if ( iExtension->iIsActiveIdle )
       
   832         {
       
   833         return;
       
   834         }
       
   835 
       
   836     // Don't allow normal background drawing if
       
   837     // background is already drawn with a background drawer.
       
   838     const MCoeControlBackground* backgroundDrawer = FindBackground();
       
   839     if ( backgroundDrawer )
       
   840         {
       
   841         return;
       
   842         }
       
   843         
       
   844     CWindowGc& gc = SystemGc();
       
   845 
       
   846     MAknsSkinInstance* skin = AknsUtils::SkinInstance();
       
   847 
       
   848     MAknsControlContext* cc = AknsDrawUtils::ControlContext( this );
       
   849 
       
   850     TRect rect( Rect() );
       
   851     gc.SetPenStyle( CGraphicsContext::ENullPen );
       
   852     gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
       
   853 
       
   854     //
       
   855     // S60 flat statuspane
       
   856     //
       
   857     if ( AknStatuspaneUtils::FlatLayoutActive() )
       
   858         {
       
   859         if ( iIndicatorContext == EUniversalIndicators )
       
   860             {
       
   861             if( !AknsDrawUtils::Background( skin, cc, this, gc, rect ) )
       
   862                 {
       
   863                 gc.SetPenStyle( CGraphicsContext::ENullPen );
       
   864                 gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
       
   865                 gc.SetBrushColor(
       
   866                     AKN_LAF_COLOR( KStatusPaneBackgroundGraphicsColorUsual ) );
       
   867                 gc.DrawRect( rect );
       
   868                 }
       
   869 
       
   870             if( iIndicatorsShown &&
       
   871                 iExtension &&
       
   872                 AknStatuspaneUtils::IdleLayoutActive() &&
       
   873                 !AknStatuspaneUtils::ExtendedFlatLayoutActive() &&
       
   874                 !AknStatuspaneUtils::HDLayoutActive() )
       
   875                 {
       
   876                 TRect fadeRect( rect );
       
   877                 // Draw fade if there are indicators
       
   878                 if ( iLayoutOrientation == EVertical &&
       
   879                      Layout_Meta_Data::IsLandscapeOrientation() )
       
   880                     {
       
   881                     AknsDrawUtils::DrawCachedImage(
       
   882                         skin,
       
   883                         gc,
       
   884                         fadeRect,
       
   885                         KAknsIIDQgnGrafIdleFadeLsc );
       
   886                     }
       
   887                 else if ( iLayoutOrientation == EHorizontal )
       
   888                     {
       
   889                     AknsDrawUtils::DrawCachedImage(
       
   890                         skin,
       
   891                         gc,
       
   892                         fadeRect,
       
   893                         KAknsIIDQgnGrafIdleFade );
       
   894                     }
       
   895                 }
       
   896             }
       
   897         else if ( iIndicatorContext == ENaviPaneEditorIndicators )
       
   898             {
       
   899             if( !AknsDrawUtils::Background( skin, cc, this, gc, rect ) )
       
   900                 {
       
   901                 gc.SetPenStyle( CGraphicsContext::ENullPen );
       
   902                 gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
       
   903                 gc.SetBrushColor(
       
   904                     AKN_LAF_COLOR( KStatusPaneBackgroundGraphicsColorUsual ) );
       
   905                 gc.DrawRect( rect );
       
   906                 }
       
   907             }
       
   908         else
       
   909             {
       
   910             gc.SetBrushColor( AKN_LAF_COLOR( 0 ) );
       
   911             AknsDrawUtils::Background( skin, cc, this, gc, rect );
       
   912             }
       
   913 
       
   914         return;
       
   915         }
       
   916 
       
   917 
       
   918     //
       
   919     // S60 staconpane
       
   920     //
       
   921     if (AknStatuspaneUtils::StaconPaneActive() &&
       
   922        (iIndicatorContext == EUniversalIndicators || iIndicatorContext == ENaviPaneEditorIndicators))
       
   923         {
       
   924         if (iIndicatorContext == ENaviPaneEditorIndicators)
       
   925             {
       
   926             if( !AknsDrawUtils::Background( skin, cc, this, gc, rect ) )
       
   927                 {
       
   928                 gc.SetPenStyle(CGraphicsContext::ENullPen);
       
   929                 gc.SetBrushStyle(CGraphicsContext::ESolidBrush);
       
   930                 gc.SetBrushColor(AKN_LAF_COLOR(KStatusPaneBackgroundGraphicsColorUsual) );
       
   931                 gc.DrawRect(rect);
       
   932                 }
       
   933             }
       
   934 
       
   935         else if ( iIndicatorContext == EUniversalIndicators )
       
   936             {
       
   937             if( !AknsDrawUtils::Background( skin, cc, this, gc, rect ) )
       
   938                 {
       
   939                 gc.SetPenStyle(CGraphicsContext::ENullPen);
       
   940                 gc.SetBrushStyle(CGraphicsContext::ESolidBrush);
       
   941                 gc.SetBrushColor(AKN_LAF_COLOR(KStatusPaneBackgroundGraphicsColorUsual) );
       
   942                 gc.DrawRect(rect);
       
   943                 }
       
   944 
       
   945 
       
   946             if( iIndicatorsShown &&
       
   947                 iExtension &&
       
   948                 AknStatuspaneUtils::IdleLayoutActive() &&
       
   949                 !AknStatuspaneUtils::ExtendedStaconPaneActive())
       
   950                 {
       
   951                 TRect fadeRect( rect );
       
   952                 if (iLayoutOrientation == EHorizontal)
       
   953                     {
       
   954                     // Always this fade
       
   955                     AknsDrawUtils::DrawCachedImage( skin, gc, fadeRect,
       
   956                         KAknsIIDQgnGrafIdleFade );
       
   957                     }
       
   958                else
       
   959                     {
       
   960                     AknsDrawUtils::DrawCachedImage( skin, gc, fadeRect,
       
   961                         KAknsIIDQgnGrafIdleFadeLsc );
       
   962 
       
   963                     }
       
   964                 }
       
   965             }
       
   966         else
       
   967             {
       
   968             // Draw background for query editor indicators
       
   969             gc.SetBrushColor(AKN_LAF_COLOR(0));
       
   970             AknsDrawUtils::Background( skin, cc, this, gc, rect );
       
   971             }
       
   972         return;
       
   973         }
       
   974 
       
   975     //
       
   976     // Extended S60 statuspane
       
   977     //
       
   978     if (AknStatuspaneUtils::ExtendedLayoutActive())
       
   979         {
       
   980         if( CAknEnv::Static()->TransparencyEnabled() )
       
   981             {
       
   982             AknsDrawUtils::Background( skin, cc, this, gc, rect, KAknsDrawParamNoClearUnderImage );
       
   983             }
       
   984         else
       
   985             {
       
   986             AknsDrawUtils::Background( skin, cc, this, gc, rect );
       
   987             }
       
   988         return;
       
   989         }
       
   990 
       
   991     //
       
   992     // Default S60 statuspane
       
   993     //
       
   994     if ( iIndicatorContext == EUniversalIndicators )
       
   995         {
       
   996         // Draw background for universal indicator pane
       
   997         gc.SetBrushColor(AKN_LAF_COLOR(0)); // Universal indicator background color
       
   998         AknsDrawUtils::Background( skin, cc, this, gc, rect );
       
   999 
       
  1000         if( (iLayoutOrientation == EHorizontal) && iIndicatorsShown && iExtension && !AknStatuspaneUtils::StaconPaneActive())
       
  1001             {
       
  1002             if (AknStatuspaneUtils::IdleLayoutActive())
       
  1003                 {
       
  1004                 TRect fadeRect( rect );
       
  1005                 // Draw fade if there are indicators
       
  1006                 AknsDrawUtils::DrawCachedImage( skin, gc, fadeRect,
       
  1007                     KAknsIIDQgnGrafIdleFade );
       
  1008                 }
       
  1009             }
       
  1010         }
       
  1011     if ( iIndicatorContext != EUniversalIndicators )
       
  1012         {
       
  1013         if ( iIndicatorContext == ENaviPaneEditorIndicators )
       
  1014             {
       
  1015             AknsDrawUtils::Background( skin, cc, this, gc, rect );
       
  1016             }
       
  1017         else
       
  1018             {
       
  1019             // Draw background for query editor indicators
       
  1020             gc.SetBrushColor(AKN_LAF_COLOR(0));
       
  1021             if( CAknEnv::Static()->TransparencyEnabled() )
       
  1022                 {
       
  1023                 AknsDrawUtils::Background( skin, cc, this, gc, rect, KAknsDrawParamNoClearUnderImage );
       
  1024                 }
       
  1025             else
       
  1026                 {
       
  1027                 AknsDrawUtils::Background( skin, cc, this, gc, rect );
       
  1028                 }
       
  1029             }
       
  1030         }
       
  1031     }
       
  1032 
       
  1033 EXPORT_C void CAknIndicatorContainer::HandlePointerEventL(
       
  1034     const TPointerEvent& aPointerEvent )
       
  1035     {
       
  1036     CAknControl::HandlePointerEventL( aPointerEvent );
       
  1037 
       
  1038     if ( AknLayoutUtils::PenEnabled() && iExtension )
       
  1039         {
       
  1040         TRect rect( Rect() );
       
  1041 
       
  1042         // The indicator popup is launched if both the down and up
       
  1043         // pointer events happen in the indicator pane area.
       
  1044         switch ( aPointerEvent.iType )
       
  1045             {
       
  1046             case TPointerEvent::EButton1Down:
       
  1047                 {
       
  1048                 // if indicator's rect contains pointer down position
       
  1049                 if ( rect.Contains( aPointerEvent.iPosition ) )
       
  1050                     {
       
  1051                     // set flag that down was inside indicator
       
  1052                     iExtension->iFlags |=
       
  1053                         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                     }
       
  1067                 break;
       
  1068                 }
       
  1069 
       
  1070             case TPointerEvent::EButton1Up:
       
  1071                 {
       
  1072                 // Currently the small digital clock pane and universal
       
  1073                 // indicator pane are regarded as one touch responsive area from
       
  1074                 // which the universal indicator popup should open on tap,
       
  1075                 // so upon pointer up event it must be checked here if
       
  1076                 // the down event happened inside this control, but the up event
       
  1077                 // inside digital clock pane area.
       
  1078                 CEikStatusPaneBase* sp = CEikStatusPaneBase::Current();
       
  1079                 TRect clockRect( 0, 0, 0, 0 );
       
  1080 
       
  1081                 if ( sp )
       
  1082                     {
       
  1083                     CCoeControl* clockPane = sp->ContainerControlL(
       
  1084                         TUid::Uid( EEikStatusPaneUidDigitalClock ) );
       
  1085                     if ( clockPane )
       
  1086                         {
       
  1087                         clockRect = TRect( clockPane->PositionRelativeToScreen(),
       
  1088                                            clockPane->Size() );
       
  1089                         }
       
  1090                     }
       
  1091 
       
  1092                 // if indicator's rect contains pointer up position
       
  1093                 if ( iIndicatorContext == EUniversalIndicators &&
       
  1094                      ( ( iExtension->iFlags & EAknIndicatorsButton1DownInIndicatorPaneRect &&
       
  1095                          rect.Contains( aPointerEvent.iPosition ) ) ||
       
  1096                        clockRect.Contains( aPointerEvent.iParentPosition ) ) )
       
  1097                     {
       
  1098                     MTouchFeedback* feedback = MTouchFeedback::Instance();
       
  1099                     if ( feedback )
       
  1100                         {
       
  1101                         feedback->InstantFeedback( this,
       
  1102                                                    ETouchFeedbackSensitiveButton,
       
  1103                                                    ETouchFeedbackVibra,
       
  1104                                                    aPointerEvent );
       
  1105                         }
       
  1106                     CAknSmallIndicator* indicatorNotifier = CAknSmallIndicator::NewLC( TUid::Uid( 0 ) );
       
  1107                     indicatorNotifier->HandleIndicatorTapL();
       
  1108                     CleanupStack::PopAndDestroy( indicatorNotifier );
       
  1109                     }
       
  1110                 // Up happened, reset button down flag
       
  1111                 iExtension->iFlags &=
       
  1112                     ( ~EAknIndicatorsButton1DownInIndicatorPaneRect );
       
  1113                 break;
       
  1114                 }
       
  1115 
       
  1116             default:
       
  1117                 {
       
  1118                 break;
       
  1119                 }
       
  1120             }
       
  1121         }
       
  1122     }
       
  1123 
       
  1124 EXPORT_C void* CAknIndicatorContainer::ExtensionInterface( TUid /*aInterface*/ )
       
  1125     {
       
  1126     return NULL;
       
  1127     }
       
  1128 
       
  1129 void CAknIndicatorContainer::Reserved_1()
       
  1130     {}
       
  1131 
       
  1132 
       
  1133 void CAknIndicatorContainer::PrioritizeIndicatorsL()
       
  1134     {
       
  1135     iPreviousLayoutOrientation = iLayoutOrientation;
       
  1136 
       
  1137     TInt count = iIndicators->Count();
       
  1138     if (count < 2)
       
  1139         {
       
  1140         return;
       
  1141         }
       
  1142 
       
  1143     CAknIndicator* temp;
       
  1144     for(TInt ii = 1; ii < count; ii++)
       
  1145         {
       
  1146         temp = iIndicators->At(ii);
       
  1147         TInt tempPriority = temp->Priority();
       
  1148         if (tempPriority >= 0)
       
  1149             {
       
  1150             for(TInt jj = 0; jj <= ii; jj++)
       
  1151                 {
       
  1152                 if (tempPriority < iIndicators->At(jj)->Priority())
       
  1153                     {
       
  1154                     iIndicators->Delete( ii );
       
  1155                     CleanupStack::PushL( temp );
       
  1156                     iIndicators->InsertL( jj, temp );
       
  1157                     CleanupStack::Pop( temp );
       
  1158                     break;
       
  1159                     }
       
  1160                 else if ( jj == (ii-1) )
       
  1161                     {
       
  1162                     break;
       
  1163                     }
       
  1164                 }
       
  1165             }
       
  1166         }
       
  1167     }
       
  1168 
       
  1169 
       
  1170 TInt CAknIndicatorContainer::TickerCallback(TAny* aThis)
       
  1171     {
       
  1172     return static_cast<CAknIndicatorContainer*>(aThis)->DoTick();
       
  1173     }
       
  1174 
       
  1175 TInt CAknIndicatorContainer::DoTick()
       
  1176     {
       
  1177     if (iAnimatedIndicatorsShown > 0)
       
  1178         {
       
  1179         TInt count = iIndicators->Count();
       
  1180 
       
  1181         TInt ii = 0;
       
  1182         for (ii = 0; ii < count; ii++)
       
  1183             {
       
  1184             if ( iIndicators->At(ii)->IndicatorState() == MAknIndicator::EIndicatorAnimate && (iIndicators->At(ii)->Priority() != KIndicatorNotShown))
       
  1185                 {
       
  1186                 iIndicators->At(ii)->Animate();
       
  1187                 }
       
  1188             }
       
  1189         iSynchronizingValue += 1;
       
  1190         if (iSynchronizingValue >= 185794560) // This number can be divided with 2,4,6,8,10,12,14,16 and 18
       
  1191             {
       
  1192             iSynchronizingValue = 0;
       
  1193             }
       
  1194 
       
  1195         DrawDeferred(); // Must be DrawDeferred (not DrawNow) so that we don't block application thread in high load situations
       
  1196         }
       
  1197     return ETrue;
       
  1198     }
       
  1199 
       
  1200 
       
  1201 void CAknIndicatorContainer::IncallBubbleSizeChanged(
       
  1202     TBool /*aAllowIdleStateBubble*/ )
       
  1203     {
       
  1204     if ( iIncallBubble &&
       
  1205          iIncallBubble->Flags() & CIncallStatusBubble::ESBVisible )
       
  1206         {
       
  1207         TAknWindowLineLayout layout;
       
  1208         if ( iIndicatorsShown > 0 )
       
  1209             {
       
  1210             // Position of incall bubble if universal small indicator(s) present.
       
  1211             // This position is also used when the bubble is shown with idle layout
       
  1212             // when autolock application is activated and it is front application.
       
  1213             layout = AknLayoutScalable_Apps::popup_call_status_window( 0 ).LayoutLine();
       
  1214             }
       
  1215         else
       
  1216             {
       
  1217             // Position of incall bubble if universal small indicator pane is empty.
       
  1218             layout = AknLayoutScalable_Apps::popup_call_status_window( 1 ).LayoutLine();
       
  1219             }
       
  1220 
       
  1221         // screen
       
  1222         TRect screenRect( iAvkonAppUi->ApplicationRect() );
       
  1223         TAknLayoutRect layoutRect;
       
  1224 
       
  1225         if ( Layout_Meta_Data::IsLandscapeOrientation() )
       
  1226             {
       
  1227             TInt topVariety = 8; // default to flat landscape statuspane variety
       
  1228             if ( AknStatuspaneUtils::StaconPaneActive() )
       
  1229                 {
       
  1230                 topVariety = 2;
       
  1231                 }
       
  1232 
       
  1233             TInt skvariety = 6;
       
  1234             if ( AknStatuspaneUtils::StaconPaneActive() )
       
  1235                 {
       
  1236                 if ( AknStatuspaneUtils::StaconSoftKeysRight() )
       
  1237                     {
       
  1238                     skvariety = 6;
       
  1239                     }
       
  1240                 else
       
  1241                     {
       
  1242                     skvariety = 8;
       
  1243                     }
       
  1244                 }
       
  1245             else if ( AknStatuspaneUtils::FlatLayoutActive() ||
       
  1246                       AknStatuspaneUtils::HDLayoutActive() )
       
  1247                 {
       
  1248                 skvariety = 10;
       
  1249                 }
       
  1250 
       
  1251             if ( iIndicatorsShown > 0 )
       
  1252                 {
       
  1253                 // If indicators are shown we use one bigger variety index. But for "10" there is not such.
       
  1254                 if ( skvariety != 10 )
       
  1255                     {
       
  1256                     skvariety++;
       
  1257                     }
       
  1258                 }
       
  1259 
       
  1260             layout = AknLayoutScalable_Apps::popup_call_status_window( skvariety ).LayoutLine();
       
  1261 
       
  1262             // To keep the call bubble in indicator pane area,
       
  1263             // otherwise it'll get on top of the title pane in A&H layouts.
       
  1264             if ( AknLayoutUtils::LayoutMirrored() )
       
  1265                 {
       
  1266                 TInt tmp = layout.il;
       
  1267                 layout.il = layout.ir;
       
  1268                 layout.ir = tmp;
       
  1269                 }
       
  1270 
       
  1271             TAknWindowComponentLayout topLayout = AknLayoutScalable_Avkon::area_top_pane( topVariety );
       
  1272             layoutRect.LayoutRect( screenRect, topLayout );
       
  1273             TRect topLayoutRect( layoutRect.Rect() );
       
  1274             layoutRect.LayoutRect( topLayoutRect, layout );
       
  1275             }
       
  1276         else
       
  1277             {
       
  1278             // Incall bubble
       
  1279             layoutRect.LayoutRect( screenRect, layout );
       
  1280             }
       
  1281 
       
  1282         TRect rect( layoutRect.Rect() );
       
  1283 
       
  1284         // SizeChanged of incall indicator is heavyweight, so set size only if 
       
  1285 		// necessary.
       
  1286         if ( rect != TRect( iIncallBubble->Position(), iIncallBubble->Size() ) )
       
  1287             {
       
  1288             iIncallBubble->SetRect( rect );
       
  1289             }
       
  1290         }
       
  1291     }
       
  1292 
       
  1293 EXPORT_C void CAknIndicatorContainer::SetIndicatorValue(TUid aIndicatorId, TInt aValue, TInt aMaxValue)
       
  1294     {
       
  1295     TInt count = iIndicators->Count();
       
  1296     for(TInt ii = 0; ii < count; ii++)
       
  1297         {
       
  1298         CAknIndicator* indicator = iIndicators->At(ii);
       
  1299         if ( indicator->Uid() == aIndicatorId )
       
  1300             {
       
  1301             indicator->SetIndicatorValue(aValue, aMaxValue);
       
  1302             // Draw the indicator if it is visible.
       
  1303             if (  indicator->IndicatorState() != EAknIndicatorStateOff )
       
  1304                 {
       
  1305                 DrawNow();
       
  1306                 }
       
  1307             break;
       
  1308             }
       
  1309         }
       
  1310     }
       
  1311 
       
  1312 void CAknIndicatorContainer::SizeChangedInSmallStatusPane()
       
  1313     {
       
  1314     iLayoutOrientation = EHorizontal; // always horizontal
       
  1315 
       
  1316     // only editor indicators are supported in small statuspane
       
  1317     if (iIndicatorContext != ENaviPaneEditorIndicators)
       
  1318         {
       
  1319         return;
       
  1320         }
       
  1321 
       
  1322     // Gprs indicator is a special case. It is drawn
       
  1323     // to other spane by the system. Check here that correct
       
  1324     // statuspane layout is enabled and switch if needed
       
  1325     //
       
  1326     CEikStatusPaneBase* statusPane = CEikStatusPaneBase::Current();
       
  1327     TInt statusPaneCurrentLayoutResourceId = 0;
       
  1328     if ( statusPane )
       
  1329         {
       
  1330         statusPaneCurrentLayoutResourceId = statusPane->CurrentLayoutResId();
       
  1331         }
       
  1332     TInt last = iIndicators->Count() - 1;
       
  1333 
       
  1334     // Update the status pane layout if needed to correspond the
       
  1335     // visibility of the GPRS indicator. If status pane layout is changed
       
  1336     // this function will be called again.
       
  1337     TBool layoutChanged = EFalse;
       
  1338     TRAP_IGNORE( layoutChanged = UpdateSmallLayoutL() );
       
  1339     if ( layoutChanged )
       
  1340         {
       
  1341         return; // this method will be called again
       
  1342         }
       
  1343 
       
  1344     TBool layoutMirrored( AknLayoutUtils::LayoutMirrored() );
       
  1345 
       
  1346     TRect containerRect( Rect() );
       
  1347 
       
  1348     // screen
       
  1349     TRect screenRect = iAvkonAppUi->ApplicationRect();
       
  1350 
       
  1351     // small statuspane
       
  1352     TRect smallStatusPaneRect;
       
  1353     AknLayoutUtils::LayoutMetricsRect(
       
  1354         AknLayoutUtils::EStatusPane, smallStatusPaneRect );
       
  1355 
       
  1356     // small statuspane, wait pane
       
  1357     TAknLayoutRect smallStatusWaitPaneLayoutRect;
       
  1358     smallStatusWaitPaneLayoutRect.LayoutRect(
       
  1359         smallStatusPaneRect, AknLayoutScalable_Avkon::status_small_wait_pane( 0 ) );
       
  1360     TRect smallStatusWaitPaneRect( smallStatusWaitPaneLayoutRect.Rect() );
       
  1361 
       
  1362     // small statuspane, globe
       
  1363     TAknLayoutRect smallStatusWmlGlobeLayoutRect;
       
  1364     smallStatusWmlGlobeLayoutRect.LayoutRect(
       
  1365         smallStatusPaneRect, AknLayoutScalable_Avkon::status_small_pane_g4( 0 ) );
       
  1366     TRect smallStatusWmlGlobeRect( smallStatusWmlGlobeLayoutRect.Rect() );
       
  1367 
       
  1368     // small statuspane, gprs indicator
       
  1369     TAknLayoutRect smallStatusGprsLayoutRect;
       
  1370     smallStatusGprsLayoutRect.LayoutRect(
       
  1371         smallStatusPaneRect, AknLayoutScalable_Avkon::status_small_pane_g2( 0 ) );
       
  1372     TRect smallStatusGprsRect( smallStatusGprsLayoutRect.Rect() );
       
  1373 
       
  1374     // small statuspane, secure state indicator
       
  1375     TAknLayoutRect smallStatusSecureStateLayoutRect;
       
  1376     smallStatusSecureStateLayoutRect.LayoutRect(
       
  1377         smallStatusPaneRect, AknLayoutScalable_Avkon::status_small_pane_g3( 0 ) );
       
  1378     TRect smallStatusSecureStateRect( smallStatusSecureStateLayoutRect.Rect() );
       
  1379 
       
  1380 
       
  1381     // small statuspane, texts
       
  1382     TAknTextComponentLayout smallStatusTextLayout;
       
  1383     if ( statusPaneCurrentLayoutResourceId ==
       
  1384             AVKONENV->StatusPaneResIdForCurrentLayout( R_AVKON_STATUS_PANE_LAYOUT_SMALL ) )
       
  1385         {
       
  1386         smallStatusTextLayout = AknLayoutScalable_Avkon::status_small_pane_t1( 0 );
       
  1387         }
       
  1388     else // gprs indicator visible
       
  1389         {
       
  1390         smallStatusTextLayout = AknLayoutScalable_Avkon::status_small_pane_t1( 1 );
       
  1391         }
       
  1392 
       
  1393     TAknLayoutText textLayout;
       
  1394     textLayout.LayoutText( smallStatusPaneRect, smallStatusTextLayout );
       
  1395     TRect smallStatusTextRect( textLayout.TextRect() );
       
  1396 
       
  1397     TInt textIndicatorLeftOffset = smallStatusTextRect.iTl.iX;
       
  1398 
       
  1399     // Take possible touch pane into account.
       
  1400     TInt textIndicatorVerticalOffset =
       
  1401         ( containerRect.Height() - smallStatusTextRect.Height() ) / 2;
       
  1402 
       
  1403     TInt waitBarIndicatorLeftOffset     = smallStatusWaitPaneRect.iTl.iX;
       
  1404     TInt progressBarIndicatorLeftOffset = smallStatusWaitPaneRect.iTl.iX;
       
  1405     TInt wmlWaitGlobeLeftOffset         = smallStatusWmlGlobeRect.iTl.iX;
       
  1406 
       
  1407     if ( layoutMirrored )
       
  1408         {
       
  1409         waitBarIndicatorLeftOffset =
       
  1410             smallStatusPaneRect.iBr.iX - smallStatusWaitPaneRect.iBr.iX;
       
  1411 
       
  1412         progressBarIndicatorLeftOffset =
       
  1413             smallStatusPaneRect.iBr.iX - smallStatusWaitPaneRect.iBr.iX;
       
  1414 
       
  1415         wmlWaitGlobeLeftOffset =
       
  1416             smallStatusPaneRect.iBr.iX - smallStatusWmlGlobeRect.iBr.iX;
       
  1417         }
       
  1418 
       
  1419 
       
  1420     if ( statusPaneCurrentLayoutResourceId ==
       
  1421             AVKONENV->StatusPaneResIdForCurrentLayout(
       
  1422                 R_AVKON_STATUS_PANE_LAYOUT_SMALL_WITH_SIGNAL_PANE ) )
       
  1423         {
       
  1424         // If GPRS indicator is visible then a larger offset is needed
       
  1425         // for text indicator because there are no pixels empty in
       
  1426         // the right side of the GPRS status icon as the layout spec
       
  1427         // requires in this case.
       
  1428         if ( textIndicatorLeftOffset < KMinSpaceBetweenIconsInPixels )
       
  1429             {
       
  1430             textIndicatorLeftOffset = KMinSpaceBetweenIconsInPixels;
       
  1431             }
       
  1432 
       
  1433         // This makes the globe indicator position adjusted to
       
  1434         // middle if GPRS indicator is in either side
       
  1435         if( !layoutMirrored )
       
  1436             {
       
  1437             wmlWaitGlobeLeftOffset -= smallStatusGprsRect.Width();
       
  1438             }
       
  1439         }
       
  1440 
       
  1441     // Modify containerRect if alignment is Right.
       
  1442     // For Left aligned no need to modify containerRect.
       
  1443     if ( iAlignment == TIndicatorAlignment( ERight ) )
       
  1444         {
       
  1445         containerRect.iBr.iX -= 3; // Right margin of editor indicators
       
  1446         containerRect.iTl.iX += 0; // Left margin of editor indicators
       
  1447         }
       
  1448 
       
  1449     iIndicatorsShown                = 0;
       
  1450     iAnimatedIndicatorsShown        = 0;
       
  1451     TBool textIndicatorOffsetNeeded = ETrue;
       
  1452 
       
  1453     TRect rectForRightSideIndicators( containerRect.iBr.iX,
       
  1454                                       containerRect.iTl.iY,
       
  1455                                       containerRect.iBr.iX,
       
  1456                                       containerRect.iBr.iY );
       
  1457 
       
  1458     TRect rectForLeftSideIndicators( containerRect.iTl.iX,
       
  1459                                      containerRect.iTl.iY,
       
  1460                                      containerRect.iTl.iX,
       
  1461                                      containerRect.iBr.iY );
       
  1462 
       
  1463     TRect rectForMiddleIndicators( wmlWaitGlobeLeftOffset,
       
  1464                                    containerRect.iTl.iY,
       
  1465                                    wmlWaitGlobeLeftOffset,
       
  1466                                    containerRect.iBr.iY );
       
  1467 
       
  1468     for ( TInt ii = 0; ii <= last; ii++ )
       
  1469         {
       
  1470         CAknIndicator* indicator = iIndicators->At( ii );
       
  1471         TInt uid                 = indicator->Uid().iUid;
       
  1472         TInt indicatorPosition   = 0;
       
  1473 
       
  1474         // Decide here how indicators are positioned.
       
  1475         // Default is right side.
       
  1476         indicatorPosition = indicator->IndicatorPosition();
       
  1477 
       
  1478         // Check if indicator is not shown on current layout even it is set ON.
       
  1479         if ( !indicator->IndicatorState() ||
       
  1480              indicator->Priority() == KIndicatorNotShown )
       
  1481             {
       
  1482             continue;
       
  1483             }
       
  1484 
       
  1485         // Check if this is GPRS indicator, it is never shown here
       
  1486         // but is drawn to the signal pane by the system
       
  1487         if ( uid == EAknNaviPaneEditorIndicatorGprs )
       
  1488             {
       
  1489             indicator->SetExtent( TPoint( 0, 0 ), TSize( 0, 0 ) );
       
  1490             iIndicatorsShown++;
       
  1491             continue;
       
  1492             }
       
  1493 
       
  1494         // Handle offsets.
       
  1495         TAknLayoutRect statusPaneIconSmallRect;
       
  1496         statusPaneIconSmallRect.LayoutRect(
       
  1497             smallStatusPaneRect, AknLayoutScalable_Avkon::status_small_icon_pane() );
       
  1498 
       
  1499         // Take possible touch pane into account
       
  1500         TInt verticalOffset =
       
  1501             ( containerRect.Height() - statusPaneIconSmallRect.Rect().Height() ) / 2;
       
  1502 
       
  1503         TInt leftOffset  = 0;  // default offset
       
  1504         TInt rightOffset = 0;  // default offset
       
  1505 
       
  1506         TInt indicatorWidth  = indicator->IconSize().iWidth;  // default width
       
  1507         TInt indicatorHeight = indicator->IconSize().iHeight; // default height
       
  1508 
       
  1509         if ( uid == EAknNaviPaneEditorIndicatorMessageInfo    ||
       
  1510              uid == EAknNaviPaneEditorIndicatorWmlWindowsText ||
       
  1511              uid == EAknNaviPaneEditorIndicatorMessageLength )
       
  1512             {
       
  1513             indicatorHeight = smallStatusTextRect.Height();
       
  1514             verticalOffset  = textIndicatorVerticalOffset;
       
  1515             // First text indicator needs horizontal offset.
       
  1516             if ( textIndicatorOffsetNeeded )
       
  1517                 {
       
  1518                 leftOffset += textIndicatorLeftOffset;
       
  1519                 }
       
  1520 
       
  1521             textIndicatorOffsetNeeded = EFalse;
       
  1522             }
       
  1523         else if ( uid == EAknNaviPaneEditorIndicatorFileSize )
       
  1524             {
       
  1525             verticalOffset = textIndicatorVerticalOffset;
       
  1526 
       
  1527             // Need left offset in western, right offset in A&H layout.
       
  1528             if ( layoutMirrored )
       
  1529                 {
       
  1530                 rightOffset = textIndicatorLeftOffset;
       
  1531                 }
       
  1532             else
       
  1533                 {
       
  1534                 leftOffset  = KMinSpaceBetweenIconsInPixels;
       
  1535                 }
       
  1536             }
       
  1537         else if ( uid == EAknNaviPaneEditorIndicatorSecuredConnection )
       
  1538             {
       
  1539             verticalOffset =
       
  1540                 ( containerRect.Height() - smallStatusSecureStateRect.Height() ) / 2;
       
  1541 
       
  1542             // Because icon bitmap does not contain enough space,
       
  1543             // increase offset as the layout spec states.
       
  1544             if ( layoutMirrored )
       
  1545                 {
       
  1546                 leftOffset = KMinSpaceBetweenIconsInPixels;
       
  1547                 }
       
  1548             else
       
  1549                 {
       
  1550                 rightOffset = KMinSpaceBetweenIconsInPixels;
       
  1551                 }
       
  1552 
       
  1553             textIndicatorOffsetNeeded      = EFalse;
       
  1554             waitBarIndicatorLeftOffset     = 0;
       
  1555             progressBarIndicatorLeftOffset = 0;
       
  1556             }
       
  1557         else if ( uid == EAknNaviPaneEditorIndicatorWmlWaitGlobe )
       
  1558             {
       
  1559             verticalOffset =
       
  1560                 ( containerRect.Height() - indicator->IconSize().iHeight ) / 2;
       
  1561             indicatorWidth = smallStatusWmlGlobeRect.Width();
       
  1562             }
       
  1563         else if ( uid == EAknNaviPaneEditorIndicatorProgressBar )
       
  1564             {
       
  1565             indicatorWidth  = smallStatusWaitPaneRect.Width();
       
  1566             indicatorHeight = smallStatusWaitPaneRect.Height();
       
  1567             verticalOffset  = ( containerRect.Height() - indicatorHeight ) / 2;
       
  1568             leftOffset      = progressBarIndicatorLeftOffset;
       
  1569             textIndicatorOffsetNeeded = ETrue;
       
  1570             }
       
  1571         else if ( uid == EAknNaviPaneEditorIndicatorWaitBar )
       
  1572             {
       
  1573             indicatorWidth  = smallStatusWaitPaneRect.Width();
       
  1574             indicatorHeight = smallStatusWaitPaneRect.Height();
       
  1575             verticalOffset  = ( containerRect.Height() - indicatorHeight ) / 2;
       
  1576             leftOffset      = waitBarIndicatorLeftOffset;
       
  1577             textIndicatorOffsetNeeded = ETrue;
       
  1578             }
       
  1579 
       
  1580         if ( layoutMirrored )
       
  1581             {
       
  1582             TInt temp   = leftOffset;
       
  1583             leftOffset  = rightOffset;
       
  1584             rightOffset = temp;
       
  1585             }
       
  1586 
       
  1587         // Place indicators to the left side.
       
  1588         if ( ( indicatorPosition == ELeftSide &&
       
  1589                iAlignment == TIndicatorAlignment( ERight ) ) ||
       
  1590              ( indicatorPosition == ERightSide &&
       
  1591                iAlignment == TIndicatorAlignment( ELeft ) ) )
       
  1592             {
       
  1593             TRect requiredRect(
       
  1594                 rectForLeftSideIndicators.iBr.iX,
       
  1595                 rectForLeftSideIndicators.iTl.iY,
       
  1596                 rectForLeftSideIndicators.iBr.iX + leftOffset + indicatorWidth + rightOffset,
       
  1597                 rectForLeftSideIndicators.iBr.iY );
       
  1598 
       
  1599             // check if indicator fits
       
  1600             TBool indicatorDoesNotFit =
       
  1601                 ( requiredRect.Intersects( rectForRightSideIndicators ) ||
       
  1602                   requiredRect.Intersects( rectForMiddleIndicators )    ||
       
  1603                   containerRect.iTl.iX > requiredRect.iTl.iX            ||
       
  1604                   containerRect.iBr.iX < requiredRect.iBr.iX );
       
  1605 
       
  1606             if ( indicatorDoesNotFit &&
       
  1607                  !indicator->DynamicTextIndicator() )
       
  1608                 {
       
  1609                 indicator->SetExtent( TPoint( 0, 0 ), TSize( 0, 0 ) );
       
  1610                 iIndicatorsShown++;
       
  1611                 continue;
       
  1612                 }
       
  1613             else
       
  1614                 {
       
  1615                 if ( indicator->DynamicTextIndicator() && indicatorDoesNotFit )
       
  1616                     {
       
  1617                     // Dynamic text indicators (not normal text indicators)
       
  1618                     // can adjust to any size.
       
  1619                     TInt maxWidthForDynamicTextIndicator =
       
  1620                         containerRect.iBr.iX - requiredRect.iTl.iX;
       
  1621 
       
  1622                     if ( requiredRect.Intersects( rectForRightSideIndicators ) )
       
  1623                         {
       
  1624                         maxWidthForDynamicTextIndicator =
       
  1625                             rectForRightSideIndicators.iTl.iX - requiredRect.iTl.iX;
       
  1626                         }
       
  1627 
       
  1628                     if ( requiredRect.Intersects( rectForMiddleIndicators ) )
       
  1629                         {
       
  1630                         maxWidthForDynamicTextIndicator =
       
  1631                             rectForMiddleIndicators.iTl.iX - requiredRect.iTl.iX;
       
  1632                         }
       
  1633 
       
  1634                     indicator->SetExtent( TPoint( requiredRect.iTl.iX + leftOffset,
       
  1635                                                   verticalOffset ),
       
  1636                                           TSize( maxWidthForDynamicTextIndicator,
       
  1637                                                  indicatorHeight ) );
       
  1638 
       
  1639                     rectForLeftSideIndicators.iBr.iX =
       
  1640                         indicator->Position().iX + indicator->Size().iWidth;
       
  1641                     }
       
  1642                 else
       
  1643                     {
       
  1644                     indicator->SetExtent( TPoint( requiredRect.iTl.iX + leftOffset,
       
  1645                                                   verticalOffset ),
       
  1646                                           TSize( indicatorWidth, indicatorHeight ) );
       
  1647 
       
  1648                     rectForLeftSideIndicators.iBr.iX = requiredRect.iBr.iX;
       
  1649                     }
       
  1650                 }
       
  1651             }
       
  1652 
       
  1653 
       
  1654         // Place indicators to the right side.
       
  1655         if ( ( indicatorPosition == ERightSide &&
       
  1656                iAlignment == TIndicatorAlignment( ERight ) ) ||
       
  1657              ( indicatorPosition == ELeftSide &&
       
  1658                iAlignment == TIndicatorAlignment( ELeft ) ) )
       
  1659             {
       
  1660             TRect requiredRect(
       
  1661                 rectForRightSideIndicators.iTl.iX - leftOffset - indicatorWidth - rightOffset,
       
  1662                 rectForRightSideIndicators.iTl.iY,
       
  1663                 rectForRightSideIndicators.iTl.iX,
       
  1664                 rectForRightSideIndicators.iBr.iY );
       
  1665 
       
  1666              // Check if indicator fits.
       
  1667              TBool indicatorDoesNotFit =
       
  1668                  ( requiredRect.Intersects( rectForLeftSideIndicators ) ||
       
  1669                    requiredRect.Intersects( rectForMiddleIndicators )   ||
       
  1670                    containerRect.iTl.iX > requiredRect.iTl.iX           ||
       
  1671                    containerRect.iBr.iX < requiredRect.iBr.iX );
       
  1672 
       
  1673             if ( indicatorDoesNotFit &&
       
  1674                  !indicator->DynamicTextIndicator() )
       
  1675                 {
       
  1676                 indicator->SetExtent( TPoint( 0, 0 ), TSize( 0, 0 ) );
       
  1677                 iIndicatorsShown++;
       
  1678                 continue;
       
  1679                 }
       
  1680             else
       
  1681                 {
       
  1682                 if ( indicator->DynamicTextIndicator() && indicatorDoesNotFit )
       
  1683                     {
       
  1684                     // Dynamic text indicators (not normal text indicators)
       
  1685                     // can adjust to any size.
       
  1686                     TInt maxWidthForDynamicTextIndicator =
       
  1687                         requiredRect.iBr.iX - containerRect.iTl.iX - leftOffset;
       
  1688 
       
  1689                     if ( requiredRect.Intersects( rectForLeftSideIndicators ) )
       
  1690                         {
       
  1691                         maxWidthForDynamicTextIndicator =
       
  1692                             requiredRect.iBr.iX - rectForLeftSideIndicators.iBr.iX;
       
  1693                         }
       
  1694 
       
  1695                     if ( requiredRect.Intersects( rectForMiddleIndicators ) )
       
  1696                         {
       
  1697                         maxWidthForDynamicTextIndicator =
       
  1698                             requiredRect.iBr.iX - rectForMiddleIndicators.iBr.iX;
       
  1699                         }
       
  1700 
       
  1701                     indicator->SetExtent(
       
  1702                         TPoint( requiredRect.iBr.iX - maxWidthForDynamicTextIndicator - leftOffset,
       
  1703                                 verticalOffset ),
       
  1704                         TSize( maxWidthForDynamicTextIndicator,
       
  1705                                indicatorHeight ) );
       
  1706 
       
  1707                     rectForRightSideIndicators.iTl.iX = indicator->Position().iX;
       
  1708                     }
       
  1709                 else
       
  1710                     {
       
  1711                     indicator->SetExtent( TPoint( requiredRect.iTl.iX + leftOffset,
       
  1712                                                   verticalOffset),
       
  1713                                           TSize( indicatorWidth, indicatorHeight ) );
       
  1714 
       
  1715                     rectForRightSideIndicators.iTl.iX = requiredRect.iTl.iX;
       
  1716                     }
       
  1717                 }
       
  1718             }
       
  1719 
       
  1720 
       
  1721         // Place indicators to the middle, only indicator is wml wait globe.
       
  1722         if ( indicatorPosition == EMiddle )
       
  1723             {
       
  1724             TRect requiredRect(
       
  1725                 rectForMiddleIndicators.iTl.iX,
       
  1726                 rectForMiddleIndicators.iTl.iY,
       
  1727                 rectForMiddleIndicators.iTl.iX + leftOffset + indicatorWidth + rightOffset,
       
  1728                 rectForMiddleIndicators.iBr.iY);
       
  1729 
       
  1730             // Check if indicator fits.
       
  1731             if ( ( requiredRect.Intersects( rectForRightSideIndicators ) ||
       
  1732                    requiredRect.Intersects( rectForLeftSideIndicators ) ) ||
       
  1733                  ( rectForMiddleIndicators.Width() != 0 ) )
       
  1734                 {
       
  1735                 indicator->SetExtent( TPoint( 0, 0 ), TSize( 0, 0 ) );
       
  1736                 iIndicatorsShown++;
       
  1737                 continue;
       
  1738                 }
       
  1739             else
       
  1740                 {
       
  1741                 indicator->SetExtent( TPoint( rectForMiddleIndicators.iTl.iX + leftOffset,
       
  1742                                               verticalOffset),
       
  1743                                       TSize( indicatorWidth, indicatorHeight) );
       
  1744                 rectForMiddleIndicators.iTl.iX += rightOffset;
       
  1745                 rectForMiddleIndicators.iTl.iX += indicatorWidth;
       
  1746                 }
       
  1747             }
       
  1748 
       
  1749         iIndicatorsShown++;
       
  1750 
       
  1751         if ( indicator->IndicatorState() == MAknIndicator::EIndicatorAnimate )
       
  1752             {
       
  1753             iAnimatedIndicatorsShown++;
       
  1754             }
       
  1755         } // for
       
  1756 
       
  1757     ResetAnimTicker( iExtension->iIsForeground );
       
  1758     }
       
  1759 
       
  1760 
       
  1761 // ---------------------------------------------------------------------------
       
  1762 // CAknIndicatorContainer::SizeChangedInNormalStatusPane
       
  1763 // Handles size change events in normal status pane layouts.
       
  1764 // ---------------------------------------------------------------------------
       
  1765 //
       
  1766 void CAknIndicatorContainer::SizeChangedInNormalStatusPane()
       
  1767     {
       
  1768     TRect containerRect( Rect() );
       
  1769 
       
  1770     TInt height = containerRect.Height();
       
  1771     TInt width  = containerRect.Width();
       
  1772 
       
  1773     // Find out if pane layout is horizontal or vertical
       
  1774     // Following pane uses vertical layout:
       
  1775     //   - System owned universal small indicator pane
       
  1776     //     when status pane is in usual layout
       
  1777     // Following panes use horizontal layout:
       
  1778     //   - System owned universal small indicator pane
       
  1779     //     when status pane is in idle layout
       
  1780     //   - Navigation pane editor indicator pane
       
  1781     //   - Query editor indicators
       
  1782     iLayoutOrientation = ( height > width ) ? EVertical : EHorizontal;
       
  1783 
       
  1784     TBool isLandscape( Layout_Meta_Data::IsLandscapeOrientation() );
       
  1785 
       
  1786     TAknWindowComponentLayout indicatorIconLayout(
       
  1787         AknLayoutScalable_Avkon::indicator_pane_g1( isLandscape ) );
       
  1788 
       
  1789     if ( iIndicatorContext != EUniversalIndicators )
       
  1790         {
       
  1791         // Editor indicators
       
  1792         if ( iAlignment == TIndicatorAlignment( ERight ) )
       
  1793             {
       
  1794             containerRect.iBr.iX -= 4; // Right margin of editor indicators
       
  1795             containerRect.iTl.iX += 6; // Left margin of editor indicators
       
  1796             }
       
  1797         else
       
  1798             {
       
  1799             containerRect.iBr.iX -= 6; // Right margin of editor indicators
       
  1800             containerRect.iTl.iX += 1; // Left margin of editor indicators
       
  1801             }
       
  1802         }
       
  1803     else if ( iLayoutOrientation == EHorizontal )
       
  1804         {
       
  1805         TAknWindowLineLayout indicatorLayout = AknLayout::Indicator_pane_elements_Line_1();
       
  1806         TAknLayoutRect indicatorLayoutRect;
       
  1807         indicatorLayoutRect.LayoutRect(containerRect, indicatorLayout);
       
  1808         TRect indicatorRect( indicatorLayoutRect.Rect() );
       
  1809 
       
  1810         // Layout adaptation layer does not work correctly. Access the layout data directly in
       
  1811         // scalable UI...and calculate...
       
  1812         TAknWindowLineLayout layout1( AknLayoutScalable_Avkon::indicator_pane_g1(0).LayoutLine() );
       
  1813 
       
  1814         indicatorLayoutRect.LayoutRect(containerRect, layout1);
       
  1815         indicatorRect = indicatorLayoutRect.Rect();
       
  1816 
       
  1817         // variety 1 is only valid in landscape layouts
       
  1818         if(Layout_Meta_Data::IsLandscapeOrientation())
       
  1819             {
       
  1820             TAknWindowLineLayout layout2 = AknLayoutScalable_Avkon::indicator_pane_g1(1).LayoutLine();
       
  1821             indicatorLayoutRect.LayoutRect(containerRect, layout2);
       
  1822             TRect rect2( indicatorLayoutRect.Rect() );
       
  1823             indicatorRect.BoundingRect(rect2);
       
  1824             }
       
  1825 
       
  1826         containerRect.iBr.iX = indicatorRect.iBr.iX;
       
  1827         containerRect.iTl.iX = indicatorRect.iTl.iX;
       
  1828         }
       
  1829 
       
  1830     // Available space for indicators
       
  1831     TRect rect( containerRect );
       
  1832 
       
  1833     height = rect.Height();
       
  1834     width  = rect.Width();
       
  1835 
       
  1836     TInt verticalIndicatorOffset        = rect.iTl.iY;
       
  1837     TInt verticalOffsetForTextIndicator = verticalIndicatorOffset;
       
  1838 
       
  1839     TAknLayoutText layoutText;
       
  1840     layoutText.LayoutText(
       
  1841         Rect(),
       
  1842         TAknWindowComponentLayout::ComposeText(
       
  1843             AknLayoutScalable_Avkon::navi_text_pane( 0 ),
       
  1844             AknLayoutScalable_Avkon::navi_text_pane_t1() ) );
       
  1845 
       
  1846     TAknLayoutRect editingIconLayoutRect;
       
  1847     editingIconLayoutRect.LayoutRect(
       
  1848         Rect(),
       
  1849         TAknWindowComponentLayout::Compose(
       
  1850             AknLayoutScalable_Avkon::navi_icon_pane( 0 ),
       
  1851             AknLayoutScalable_Avkon::navi_icon_pane_g1() ) );
       
  1852 
       
  1853     if ( iIndicatorContext != EUniversalIndicators )
       
  1854         {
       
  1855         if ( iIndicatorContext == ENaviPaneEditorIndicators )
       
  1856             {
       
  1857             verticalIndicatorOffset += editingIconLayoutRect.Rect().iTl.iY;
       
  1858             verticalOffsetForTextIndicator = layoutText.TextRect().iTl.iY;
       
  1859             }
       
  1860         // In query editor indicators have offset 0
       
  1861         }
       
  1862     else if ( iLayoutOrientation == EHorizontal )
       
  1863         {
       
  1864         TAknLayoutRect indicatorLayoutRect;
       
  1865         indicatorLayoutRect.LayoutRect( containerRect, indicatorIconLayout );
       
  1866         TRect indicatorRect( indicatorLayoutRect.Rect() );
       
  1867 
       
  1868         verticalIndicatorOffset += indicatorRect.iTl.iY;
       
  1869         }
       
  1870 
       
  1871     TInt verticalOffset = verticalIndicatorOffset;
       
  1872 
       
  1873     // If layout orientation has been changed since last call,
       
  1874     // prioritize indicators again.
       
  1875     if ( iLayoutOrientation != iPreviousLayoutOrientation )
       
  1876         {
       
  1877         // Following leave is ignored.
       
  1878         // In case of leave indicators are not maybe shown correctly.
       
  1879         TRAP_IGNORE ( PrioritizeIndicatorsL() );
       
  1880         }
       
  1881 
       
  1882     iIndicatorsShown         = 0;
       
  1883     iAnimatedIndicatorsShown = 0;
       
  1884     TInt last                = iIndicators->Count() - 1;
       
  1885 
       
  1886     TRect rectForRightSideIndicators( containerRect.iBr.iX,
       
  1887                                       containerRect.iTl.iY,
       
  1888                                       containerRect.iBr.iX,
       
  1889                                       containerRect.iBr.iY );
       
  1890 
       
  1891     TRect rectForLeftSideIndicators( containerRect.iTl.iX,
       
  1892                                      containerRect.iTl.iY,
       
  1893                                      containerRect.iTl.iX,
       
  1894                                      containerRect.iBr.iY );
       
  1895 
       
  1896     // Not really supported in this layout.
       
  1897     TRect rectForMiddleIndicators( TRect( 0, 0, 0, 0 ) );
       
  1898 
       
  1899 
       
  1900     for ( TInt ii = 0; ii <= last; ii++ )
       
  1901         {
       
  1902         CAknIndicator* indicator = iIndicators->At( ii );
       
  1903         if ( !indicator->IndicatorState() ||
       
  1904              indicator->Priority() == KIndicatorNotShown )
       
  1905             {
       
  1906             // Indicator is not shown on current layout even it is set ON.
       
  1907             continue;
       
  1908             }
       
  1909 
       
  1910         TInt uid = indicator->Uid().iUid;
       
  1911 
       
  1912         if ( uid == EAknNaviPaneEditorIndicatorSecuredConnection ||
       
  1913              uid == EAknNaviPaneEditorIndicatorProgressBar       ||
       
  1914              uid == EAknNaviPaneEditorIndicatorWmlWaitGlobe      ||
       
  1915              uid == EAknNaviPaneEditorIndicatorGprs              ||
       
  1916              uid == EAknNaviPaneEditorIndicatorFileSize          ||
       
  1917              uid == EAknNaviPaneEditorIndicatorWaitBar           ||
       
  1918              uid == EAknNaviPaneEditorIndicatorWlanAvailable     ||
       
  1919              uid == EAknNaviPaneEditorIndicatorWlanActive        ||
       
  1920              uid == EAknNaviPaneEditorIndicatorWlanActiveSecure )
       
  1921             {
       
  1922             // These indicators are not shown in this statuspane layout.
       
  1923             indicator->SetExtent( TPoint( 0, 0 ), TSize( 0, 0 ) );
       
  1924             iIndicatorsShown++;
       
  1925             continue;
       
  1926             }
       
  1927 
       
  1928 
       
  1929         if ( iLayoutOrientation == EVertical )
       
  1930             {
       
  1931             // Highest priority indicator is put topmost.
       
  1932             if ( height < indicator->IconSize().iHeight )
       
  1933                 {
       
  1934                 // Space for indicators is full.
       
  1935                 // Rest of low priority indicators are not shown.
       
  1936                 break;
       
  1937                 }
       
  1938             // Position indicators side by side.
       
  1939             if ( iAlignment == TIndicatorAlignment( ERight ) )
       
  1940                 {
       
  1941                 indicator->SetExtent( rect.iTl, indicator->IconSize() );
       
  1942                 }
       
  1943             // If layout is left aligned, must leave one pixel to the left empty.
       
  1944             else
       
  1945                 {
       
  1946                 indicator->SetExtent( TPoint( rect.iTl.iX + 1, rect.iTl.iY ),
       
  1947                                       indicator->IconSize() );
       
  1948                 }
       
  1949             rect.iTl.iY += indicator->IconSize().iHeight;
       
  1950             height       = rect.Height();
       
  1951             }
       
  1952         else
       
  1953             {
       
  1954             // Code to set indicator positions starts,
       
  1955             // supports dynamic text indicators.
       
  1956             verticalOffset = verticalIndicatorOffset;
       
  1957 
       
  1958             // Decide here how indicators are positioned.
       
  1959             // Default is right side.
       
  1960             TInt indicatorPosition = indicator->IndicatorPosition();
       
  1961 
       
  1962             TInt leftOffset  = 0;  // default offset
       
  1963             TInt rightOffset = 0;  // default offset
       
  1964 
       
  1965             TInt indicatorWidth  = indicator->IconSize().iWidth;  // default width
       
  1966             TInt indicatorHeight = indicator->IconSize().iHeight; // default height
       
  1967 
       
  1968             TBool textIndicatorOffsetNeeded = ETrue;
       
  1969 
       
  1970             TInt textIndicatorLeftOffset = KMinSpaceBetweenIconsInPixels;
       
  1971 
       
  1972             if ( uid == EAknNaviPaneEditorIndicatorMessageInfo    ||
       
  1973                  uid == EAknNaviPaneEditorIndicatorWmlWindowsText ||
       
  1974                  uid == EAknNaviPaneEditorIndicatorMessageLength )
       
  1975                 {
       
  1976                 verticalOffset = verticalOffsetForTextIndicator;
       
  1977                 // First text indicator need horizontal offset.
       
  1978                 if ( textIndicatorOffsetNeeded )
       
  1979                     {
       
  1980                     leftOffset += textIndicatorLeftOffset;
       
  1981                     }
       
  1982 
       
  1983                 textIndicatorOffsetNeeded = EFalse;
       
  1984                 }
       
  1985 
       
  1986             if ( uid == EAknNaviPaneEditorIndicatorFileSize )
       
  1987                 {
       
  1988                 verticalOffset = verticalOffsetForTextIndicator;
       
  1989 
       
  1990                 // Need left offset in western, right offset in A&H layout.
       
  1991                 if( AknLayoutUtils::LayoutMirrored() )
       
  1992                     {
       
  1993                     rightOffset = textIndicatorLeftOffset;
       
  1994                     }
       
  1995                 else
       
  1996                     {
       
  1997                     leftOffset  = KMinSpaceBetweenIconsInPixels;
       
  1998                     }
       
  1999                 }
       
  2000 
       
  2001             if( AknLayoutUtils::LayoutMirrored() )
       
  2002                 {
       
  2003                 TInt temp   = leftOffset;
       
  2004                 leftOffset  = rightOffset;
       
  2005                 rightOffset = temp;
       
  2006                 }
       
  2007 
       
  2008             // Place indicators to the leftside.
       
  2009             if ( ( indicatorPosition == ELeftSide &&
       
  2010                    iAlignment == TIndicatorAlignment( ERight ) ) ||
       
  2011                  ( indicatorPosition == ERightSide &&
       
  2012                    iAlignment == TIndicatorAlignment( ELeft ) ) )
       
  2013                 {
       
  2014                 TRect requiredRect(
       
  2015                     rectForLeftSideIndicators.iBr.iX,
       
  2016                     rectForLeftSideIndicators.iTl.iY,
       
  2017                     rectForLeftSideIndicators.iBr.iX + leftOffset + indicatorWidth + rightOffset,
       
  2018                     rectForLeftSideIndicators.iBr.iY );
       
  2019 
       
  2020                 // Check if indicator fits.
       
  2021                 TBool indicatorDoesNotFit =
       
  2022                     ( requiredRect.Intersects( rectForRightSideIndicators ) ||
       
  2023                       requiredRect.Intersects( rectForMiddleIndicators )    ||
       
  2024                       containerRect.iTl.iX > requiredRect.iTl.iX            ||
       
  2025                       containerRect.iBr.iX < requiredRect.iBr.iX );
       
  2026 
       
  2027                 if ( indicatorDoesNotFit &&
       
  2028                      !indicator->DynamicTextIndicator() )
       
  2029                     {
       
  2030                     indicator->SetExtent( TPoint( 0, 0 ), TSize( 0, 0 ) );
       
  2031                     iIndicatorsShown++;
       
  2032                     continue;
       
  2033                     }
       
  2034                 else
       
  2035                     {
       
  2036                     if ( indicator->DynamicTextIndicator() && indicatorDoesNotFit )
       
  2037                         {
       
  2038                         // Dynamic text indicators (not normal text indicators)
       
  2039                         // can adjust to any size.
       
  2040                         TInt maxWidthForDynamicTextIndicator =
       
  2041                             containerRect.iBr.iX - requiredRect.iTl.iX;
       
  2042 
       
  2043                         if ( requiredRect.Intersects( rectForRightSideIndicators ) )
       
  2044                             {
       
  2045                             maxWidthForDynamicTextIndicator =
       
  2046                                 rectForRightSideIndicators.iTl.iX - requiredRect.iTl.iX;
       
  2047                             }
       
  2048 
       
  2049                         if ( requiredRect.Intersects( rectForMiddleIndicators ) )
       
  2050                             {
       
  2051                             maxWidthForDynamicTextIndicator =
       
  2052                                 rectForMiddleIndicators.iTl.iX - requiredRect.iTl.iX;
       
  2053                             }
       
  2054 
       
  2055                         indicator->SetExtent(
       
  2056                             TPoint( requiredRect.iTl.iX + leftOffset, verticalOffset ),
       
  2057                             TSize( maxWidthForDynamicTextIndicator, indicatorHeight ) );
       
  2058 
       
  2059                         rectForLeftSideIndicators.iBr.iX =
       
  2060                             indicator->Position().iX + indicator->Size().iWidth;
       
  2061                         }
       
  2062                     else
       
  2063                         {
       
  2064                         indicator->SetExtent(
       
  2065                             TPoint( requiredRect.iTl.iX + leftOffset, verticalOffset ),
       
  2066                             TSize( indicatorWidth, indicatorHeight ) );
       
  2067                         rectForLeftSideIndicators.iBr.iX = requiredRect.iBr.iX;
       
  2068                         }
       
  2069                     }
       
  2070                 }
       
  2071 
       
  2072 
       
  2073             // Place indicators on the right side.
       
  2074             if ( ( indicatorPosition == ERightSide &&
       
  2075                    iAlignment == TIndicatorAlignment( ERight ) ) ||
       
  2076                  ( indicatorPosition == ELeftSide &&
       
  2077                    iAlignment == TIndicatorAlignment( ELeft ) ) )
       
  2078                 {
       
  2079                 TRect requiredRect(
       
  2080                     rectForRightSideIndicators.iTl.iX - leftOffset - indicatorWidth - rightOffset,
       
  2081                     rectForRightSideIndicators.iTl.iY,
       
  2082                     rectForRightSideIndicators.iTl.iX,
       
  2083                     rectForRightSideIndicators.iBr.iY );
       
  2084 
       
  2085                 // Check if indicator fits.
       
  2086                  TBool indicatorDoesNotFit =
       
  2087                      ( requiredRect.Intersects( rectForLeftSideIndicators ) ||
       
  2088                        requiredRect.Intersects( rectForMiddleIndicators )   ||
       
  2089                        containerRect.iTl.iX > requiredRect.iTl.iX           ||
       
  2090                        containerRect.iBr.iX < requiredRect.iBr.iX );
       
  2091 
       
  2092                 if ( indicatorDoesNotFit &&
       
  2093                      !indicator->DynamicTextIndicator() )
       
  2094                     {
       
  2095                     indicator->SetExtent( TPoint( 0, 0 ), TSize( 0, 0 ) );
       
  2096                     iIndicatorsShown++;
       
  2097                     continue;
       
  2098                     }
       
  2099                 else
       
  2100                     {
       
  2101                     if ( indicator->DynamicTextIndicator() && indicatorDoesNotFit )
       
  2102                         {
       
  2103                         // Dynamic text indicators (not normal text indicators)
       
  2104                         // can adjust to any size.
       
  2105                         TInt maxWidthForDynamicTextIndicator =
       
  2106                             requiredRect.iBr.iX - containerRect.iTl.iX - leftOffset;
       
  2107 
       
  2108                         if ( requiredRect.Intersects( rectForLeftSideIndicators ) )
       
  2109                             {
       
  2110                             maxWidthForDynamicTextIndicator =
       
  2111                                 requiredRect.iBr.iX - rectForLeftSideIndicators.iBr.iX;
       
  2112                             }
       
  2113 
       
  2114                         if ( requiredRect.Intersects( rectForMiddleIndicators ) )
       
  2115                             {
       
  2116                             maxWidthForDynamicTextIndicator =
       
  2117                                 requiredRect.iBr.iX - rectForMiddleIndicators.iBr.iX;
       
  2118                             }
       
  2119 
       
  2120                         indicator->SetExtent(
       
  2121                             TPoint( requiredRect.iBr.iX - maxWidthForDynamicTextIndicator + leftOffset,
       
  2122                                     verticalOffset ),
       
  2123                             TSize( maxWidthForDynamicTextIndicator, indicatorHeight ) );
       
  2124                         rectForRightSideIndicators.iTl.iX = indicator->Position().iX;
       
  2125                         }
       
  2126                     else
       
  2127                         {
       
  2128                         indicator->SetExtent(
       
  2129                             TPoint( requiredRect.iTl.iX + leftOffset, verticalOffset ),
       
  2130                             TSize( indicatorWidth, indicatorHeight ) );
       
  2131                         rectForRightSideIndicators.iTl.iX = requiredRect.iTl.iX;
       
  2132                         }
       
  2133                     }
       
  2134                 }
       
  2135 
       
  2136 
       
  2137             // Place indicators to the middle if any.
       
  2138             if ( indicatorPosition == EMiddle )
       
  2139                 {
       
  2140                 // Not supported for now, always set size to zero.
       
  2141                 indicator->SetExtent( TPoint( 0, 0 ), TSize( 0, 0 ) );
       
  2142                 iIndicatorsShown++;
       
  2143                 }
       
  2144             }
       
  2145 
       
  2146 
       
  2147         iIndicatorsShown++;
       
  2148         if ( indicator->IndicatorState() == MAknIndicator::EIndicatorAnimate )
       
  2149             {
       
  2150             iAnimatedIndicatorsShown++;
       
  2151             }
       
  2152         }
       
  2153 
       
  2154     // Code for setting indicator positions ends.
       
  2155 
       
  2156     ResetAnimTicker( iExtension->iIsForeground );
       
  2157     }
       
  2158 
       
  2159 
       
  2160 // ---------------------------------------------------------------------------
       
  2161 // CAknIndicatorContainer::SizeChangedInExtendedStatusPane
       
  2162 // Handles size change events in extended status pane layouts.
       
  2163 // ---------------------------------------------------------------------------
       
  2164 //
       
  2165 void CAknIndicatorContainer::SizeChangedInExtendedStatusPane()
       
  2166     {
       
  2167     TRect containerRect( Rect() );
       
  2168 
       
  2169     TBool hdLayout( AknStatuspaneUtils::HDLayoutActive() );
       
  2170 
       
  2171     // In landscape layoutdata there is not yet data
       
  2172     // so we approximate a bit here...
       
  2173     if ( AknStatuspaneUtils::ExtendedStaconPaneActive() )
       
  2174         {
       
  2175         containerRect.iTl.iY += Rect().Size().iHeight / 9;
       
  2176         containerRect.iBr.iY -= Rect().Size().iHeight / 9;
       
  2177         }
       
  2178 
       
  2179     if ( iIndicatorContext == EUniversalIndicators )
       
  2180         {
       
  2181         iLayoutOrientation = EHorizontal;
       
  2182 
       
  2183         if ( hdLayout )
       
  2184             {
       
  2185             if ( !AknLayoutUtils::LayoutMirrored() )
       
  2186                 {
       
  2187                 iAlignment = TIndicatorAlignment( ELeft );
       
  2188                 }
       
  2189             else
       
  2190                 {
       
  2191                 iAlignment = TIndicatorAlignment( ERight );
       
  2192                 }
       
  2193             }
       
  2194         }
       
  2195 
       
  2196     // Available space for indicators
       
  2197     TRect rect( containerRect );
       
  2198 
       
  2199     // If layout orientation has been changed since last call, prioritize indicators again.
       
  2200     if ( iLayoutOrientation != iPreviousLayoutOrientation )
       
  2201         {
       
  2202         TRAP_IGNORE ( PrioritizeIndicatorsL() );
       
  2203         }
       
  2204 
       
  2205     iIndicatorsShown         = 0;
       
  2206     iAnimatedIndicatorsShown = 0;
       
  2207     TInt last = iIndicators->Count() - 1;
       
  2208 
       
  2209     if ( iIndicatorContext == EUniversalIndicators )
       
  2210         {
       
  2211         TRect parent( rect );
       
  2212 
       
  2213         // Read the maximum amount of indicators in one row
       
  2214         // from the layout data.
       
  2215         TAknLayoutScalableParameterLimits limit(
       
  2216             AknLayoutScalable_Avkon::cell_indicator_nsta_pane_ParamLimits() );
       
  2217         TInt maxIndicatorsShown = limit.LastColumn() + 1;
       
  2218 
       
  2219         TInt indicatorNumberVariety = 0;
       
  2220         if ( maxIndicatorsShown == 4 )
       
  2221             {
       
  2222             indicatorNumberVariety = 1;
       
  2223             }
       
  2224 
       
  2225         TAknLayoutRect layoutRect;
       
  2226         TAknWindowLineLayout cellLayout;
       
  2227         TAknWindowComponentLayout indicatorLayout(
       
  2228             AknLayoutScalable_Avkon::cell_indicator_nsta_pane_g2( hdLayout ) );
       
  2229 
       
  2230 
       
  2231         TInt totalIndicatorsOn( 0 );
       
  2232 
       
  2233         // Need to go through the indicator array two times
       
  2234         // to be able to place the indicators in correct order.
       
  2235         for ( TInt i = 0; i <= last; i++ )
       
  2236             {
       
  2237             CAknIndicator* indicator = iIndicators->At( i );
       
  2238             if ( indicator->IndicatorState() &&
       
  2239                  indicator->Priority() != KIndicatorNotShown )
       
  2240                 {
       
  2241                 totalIndicatorsOn++;
       
  2242                 }
       
  2243             }
       
  2244 
       
  2245         for ( TInt ii = 0; ii <= last; ii++ )
       
  2246             {
       
  2247             CAknIndicator* indicator = iIndicators->At( ii );
       
  2248             if ( !indicator->IndicatorState() ||
       
  2249                  indicator->Priority() == KIndicatorNotShown )
       
  2250                 {
       
  2251                 // Indicator is not shown on current layout even it is set ON.
       
  2252                 continue;
       
  2253                 }
       
  2254 
       
  2255             iIndicatorsShown++;
       
  2256 
       
  2257             if ( iIndicatorsShown > maxIndicatorsShown )
       
  2258                 {
       
  2259                 // Maximum number of indicators is already shown.
       
  2260                 indicator->SetExtent( TPoint( 0, 0 ), TSize( 0, 0 ) );
       
  2261                 break;
       
  2262                 }
       
  2263             else
       
  2264                 {
       
  2265                 TInt columnVariety( iIndicatorsShown - 1 );
       
  2266 
       
  2267                 if ( !hdLayout && totalIndicatorsOn < maxIndicatorsShown )
       
  2268                     {
       
  2269                     if ( totalIndicatorsOn == 1 )
       
  2270                         {
       
  2271                         columnVariety = maxIndicatorsShown - 1;
       
  2272                         }
       
  2273                     else
       
  2274                         {
       
  2275                         columnVariety = iIndicatorsShown;
       
  2276                         }
       
  2277                     }
       
  2278 
       
  2279                 // set indicator sizes here, leftmost cell first if we are in
       
  2280                 // HD status pane layout, otherwise rightmost cell first.
       
  2281                 cellLayout = AknLayoutScalable_Avkon::cell_indicator_nsta_pane(
       
  2282                     columnVariety,
       
  2283                     indicatorNumberVariety ).LayoutLine();
       
  2284                 layoutRect.LayoutRect( parent, cellLayout );
       
  2285                 TRect cell( layoutRect.Rect() );
       
  2286 
       
  2287                 layoutRect.LayoutRect( cell, indicatorLayout );
       
  2288                 TRect indicatorRect( layoutRect.Rect() );
       
  2289 
       
  2290                 // FIXME: Layout is broken, we fix it here.
       
  2291                 // Remove this when layout is fixed.
       
  2292                 if ( indicatorRect.iBr.iX > cell.iBr.iX )
       
  2293                     {
       
  2294                     indicatorRect.iBr.iX = cell.iBr.iX;
       
  2295                     }
       
  2296                 if ( indicatorRect.iTl.iX < cell.iTl.iX )
       
  2297                     {
       
  2298                     indicatorRect.iTl.iX = cell.iTl.iX;
       
  2299                     }
       
  2300                 // End of FIXME
       
  2301 
       
  2302                 // TBD: When touch is supported, the size may have
       
  2303                 // to be reconsidered.
       
  2304                 indicator->SetRect( indicatorRect );
       
  2305                 }
       
  2306 
       
  2307             if ( indicator->IndicatorState() == MAknIndicator::EIndicatorAnimate )
       
  2308                 {
       
  2309                 iAnimatedIndicatorsShown++;
       
  2310                 }
       
  2311             } // for
       
  2312 
       
  2313         ResetAnimTicker( iExtension->iIsForeground );
       
  2314         } // if universal indicators.
       
  2315     else  // Editor indicators.
       
  2316         {
       
  2317         // Navi and query editor indicators are always horizontally
       
  2318         // arranged in extended status pane layouts.
       
  2319         iLayoutOrientation = EHorizontal;
       
  2320 
       
  2321         TInt verticalIndicatorOffset        = rect.iTl.iY;
       
  2322         TInt verticalOffsetForTextIndicator = verticalIndicatorOffset;
       
  2323 
       
  2324         // Text layout.
       
  2325         TAknLayoutText layoutText;
       
  2326         layoutText.LayoutText(
       
  2327             rect, AknLayoutScalable_Avkon::navi_text_pane_t1() );
       
  2328 
       
  2329         // Offsets calculated from layout data.
       
  2330         TAknLayoutRect editingIconLayoutRect;
       
  2331         editingIconLayoutRect.LayoutRect(
       
  2332             rect, AknLayoutScalable_Avkon::navi_icon_pane_g1( 1 ) );
       
  2333 
       
  2334         if ( iIndicatorContext == ENaviPaneEditorIndicators )
       
  2335             {
       
  2336             verticalIndicatorOffset        += editingIconLayoutRect.Rect().iTl.iY;
       
  2337             verticalOffsetForTextIndicator = layoutText.TextRect().iTl.iY;
       
  2338             }
       
  2339         // In query editor indicators have offset 0
       
  2340 
       
  2341         TInt verticalOffset = verticalIndicatorOffset;
       
  2342 
       
  2343         // If layout orientation has been changed since last call, prioritize indicators again.
       
  2344         if ( iLayoutOrientation != iPreviousLayoutOrientation )
       
  2345             {
       
  2346             // Following leave is ignored.
       
  2347             // In case of leave indicators are not maybe shown correctly.
       
  2348             TRAP_IGNORE ( PrioritizeIndicatorsL() );
       
  2349             }
       
  2350 
       
  2351         iIndicatorsShown         = 0;
       
  2352         iAnimatedIndicatorsShown = 0;
       
  2353         TInt last                = iIndicators->Count() - 1;
       
  2354 
       
  2355         // Check if the secured connection indicator is on before
       
  2356         // reading the layouts because of different positioning
       
  2357         // of wait and progress bars with that indicator on.
       
  2358         TBool secureConnectionIndicOn( EFalse );
       
  2359         for ( TInt i = 0; i <= last; i++ )
       
  2360             {
       
  2361             CAknIndicator* indicator = iIndicators->At( i );
       
  2362 
       
  2363             if ( indicator->Uid().iUid == EAknNaviPaneEditorIndicatorSecuredConnection &&
       
  2364                  indicator->IndicatorState() &&
       
  2365                  indicator->Priority() != KIndicatorNotShown )
       
  2366                 {
       
  2367                 secureConnectionIndicOn = ETrue;
       
  2368                 }
       
  2369             }
       
  2370 
       
  2371         // Wait bar layout.
       
  2372         TAknWindowComponentLayout smallStatusWaitPaneLayout(
       
  2373             AknLayoutScalable_Avkon::status_small_wait_pane(
       
  2374                 secureConnectionIndicOn ? 2 : 1 ) );
       
  2375         TAknLayoutRect smallStatusWaitPaneLayoutRect;
       
  2376         smallStatusWaitPaneLayoutRect.LayoutRect(
       
  2377             rect, smallStatusWaitPaneLayout );
       
  2378         TRect smallStatusWaitPaneRect( smallStatusWaitPaneLayoutRect.Rect() );
       
  2379 
       
  2380         // Globe layout.
       
  2381         TAknLayoutRect smallStatusWmlGlobeLayoutRect;
       
  2382         smallStatusWmlGlobeLayoutRect.LayoutRect(
       
  2383             rect, AknLayoutScalable_Avkon::status_small_pane_g4( 0 ) );
       
  2384         TRect smallStatusWmlGlobeRect( smallStatusWmlGlobeLayoutRect.Rect() );
       
  2385 
       
  2386         TInt wmlWaitGlobeLeftOffset =
       
  2387             rect.Width() / 2 - smallStatusWmlGlobeRect.Width() / 2;
       
  2388 
       
  2389         TRect rectForRightSideIndicators( rect.iBr.iX,
       
  2390                                           rect.iTl.iY,
       
  2391                                           rect.iBr.iX,
       
  2392                                           rect.iBr.iY );
       
  2393 
       
  2394         TRect rectForLeftSideIndicators( rect.iTl.iX,
       
  2395                                          rect.iTl.iY,
       
  2396                                          rect.iTl.iX,
       
  2397                                          rect.iBr.iY );
       
  2398 
       
  2399         TRect rectForMiddleIndicators( 0, 0, 0, 0 ); // Not used in portrait.
       
  2400         if ( hdLayout )
       
  2401             {
       
  2402             rectForMiddleIndicators = TRect( wmlWaitGlobeLeftOffset,
       
  2403                                              rect.iTl.iY,
       
  2404                                              wmlWaitGlobeLeftOffset,
       
  2405                                              rect.iBr.iY );
       
  2406             }
       
  2407 
       
  2408         for ( TInt ii = 0; ii <= last; ii++ )
       
  2409             {
       
  2410             CAknIndicator* indicator = iIndicators->At( ii );
       
  2411 
       
  2412             // Check if indicator is not shown on current layout even it is set ON.
       
  2413             if ( !indicator->IndicatorState() ||
       
  2414                  indicator->Priority() == KIndicatorNotShown )
       
  2415                 {
       
  2416                 continue;
       
  2417                 }
       
  2418 
       
  2419             TInt uid                 = indicator->Uid().iUid;
       
  2420             TInt indicatorPosition   = indicator->IndicatorPosition();
       
  2421 
       
  2422             // Handle indicators that are not shown in this layout here.
       
  2423 
       
  2424             // Check if this is gprs indicator, it is never shown here but is drawn
       
  2425             // to the signal pane by the system
       
  2426             if ( uid == EAknNaviPaneEditorIndicatorGprs )
       
  2427                 {
       
  2428                 indicator->SetExtent( TPoint( 0, 0 ), TSize( 0, 0 ) );
       
  2429                 iIndicatorsShown++;
       
  2430                 continue;
       
  2431                 }
       
  2432             else if ( ( !hdLayout &&
       
  2433                         ( uid == EAknNaviPaneEditorIndicatorSecuredConnection ||
       
  2434                           uid == EAknNaviPaneEditorIndicatorProgressBar       ||
       
  2435                           uid == EAknNaviPaneEditorIndicatorWmlWaitGlobe      ||
       
  2436                           uid == EAknNaviPaneEditorIndicatorGprs              ||
       
  2437                           uid == EAknNaviPaneEditorIndicatorFileSize          ||
       
  2438                           uid == EAknNaviPaneEditorIndicatorWaitBar ) ) ||
       
  2439                       ( hdLayout &&
       
  2440                         ( uid == EAknNaviPaneEditorIndicatorWlanAvailable     ||
       
  2441                           uid == EAknNaviPaneEditorIndicatorWlanActive        ||
       
  2442                           uid == EAknNaviPaneEditorIndicatorWlanActiveSecure ) ) )
       
  2443                 {
       
  2444                 // These indicators are not shown in this statuspane layout
       
  2445                 indicator->SetExtent( TPoint( 0, 0 ), TSize( 0, 0 ) );
       
  2446                 iIndicatorsShown++;
       
  2447                 continue;
       
  2448                 }
       
  2449 
       
  2450             // End of layout exceptions
       
  2451 
       
  2452             // Calculate offsets.
       
  2453             TInt leftOffset     = 0;  // default offset
       
  2454             TInt rightOffset    = 0;  // default offset
       
  2455 
       
  2456             TSize indicatorSize  = indicator->IconSize();
       
  2457             TInt indicatorWidth  = indicatorSize.iWidth;  // default width
       
  2458             TInt indicatorHeight = indicatorSize.iHeight; // default height
       
  2459 
       
  2460 
       
  2461             switch ( uid )
       
  2462                 {
       
  2463                 case EAknNaviPaneEditorIndicatorMessageInfo:
       
  2464                 case EAknNaviPaneEditorIndicatorWmlWindowsText:
       
  2465                 case EAknNaviPaneEditorIndicatorMessageLength:
       
  2466                     {
       
  2467                     verticalOffset = verticalOffsetForTextIndicator;
       
  2468                     break;
       
  2469                     }
       
  2470 
       
  2471                 case EAknNaviPaneEditorIndicatorFileSize:
       
  2472                     {
       
  2473                     verticalOffset = verticalOffsetForTextIndicator;
       
  2474                     leftOffset     = KMinSpaceBetweenIconsInPixels;
       
  2475                     break;
       
  2476                     }
       
  2477 
       
  2478                 case EAknNaviPaneEditorIndicatorSecuredConnection:
       
  2479                 case EAknNaviPaneEditorIndicatorWlanAvailable:
       
  2480                 case EAknNaviPaneEditorIndicatorWlanActive:
       
  2481                 case EAknNaviPaneEditorIndicatorWlanActiveSecure:
       
  2482                     {
       
  2483                     // Because icon bitmap does not contain enough space,
       
  2484                     // increase offset as the layout spec states.
       
  2485                     if ( AknLayoutUtils::LayoutMirrored() )
       
  2486                         {
       
  2487                         leftOffset = KMinSpaceBetweenIconsInPixels;
       
  2488                         }
       
  2489                     else
       
  2490                         {
       
  2491                         rightOffset = KMinSpaceBetweenIconsInPixels;
       
  2492                         }
       
  2493                     break;
       
  2494                     }
       
  2495 
       
  2496                 case EAknNaviPaneEditorIndicatorWmlWaitGlobe:
       
  2497                     {
       
  2498                     verticalOffset = ( rect.Height() - indicator->IconSize().iHeight ) / 2;
       
  2499                     indicatorWidth = smallStatusWmlGlobeRect.Width();
       
  2500                     break;
       
  2501                     }
       
  2502 
       
  2503                 case EAknNaviPaneEditorIndicatorProgressBar:
       
  2504                     {
       
  2505                     indicatorWidth  = smallStatusWaitPaneRect.Width();
       
  2506                     indicatorHeight = smallStatusWaitPaneRect.Height();
       
  2507                     leftOffset      = KMinSpaceBetweenIconsInPixels;
       
  2508                     break;
       
  2509                     }
       
  2510 
       
  2511                 case EAknNaviPaneEditorIndicatorWaitBar:
       
  2512                     {
       
  2513                     indicatorWidth  = smallStatusWaitPaneRect.Width();
       
  2514                     indicatorHeight = smallStatusWaitPaneRect.Height();
       
  2515                     leftOffset      = KMinSpaceBetweenIconsInPixels;
       
  2516                     break;
       
  2517                     }
       
  2518 
       
  2519                 default:
       
  2520                     {
       
  2521                     // Default offsets.
       
  2522                     break;
       
  2523                     }
       
  2524                 }
       
  2525 
       
  2526             // End of offset calculations.
       
  2527 
       
  2528             // Place indicators to the left side.
       
  2529             if ( ( indicatorPosition == ELeftSide  &&
       
  2530                    iAlignment == TIndicatorAlignment( ERight ) ) ||
       
  2531                  ( indicatorPosition == ERightSide &&
       
  2532                    iAlignment == TIndicatorAlignment( ELeft ) ) )
       
  2533                 {
       
  2534                 TRect requiredRect(
       
  2535                     rectForLeftSideIndicators.iBr.iX,
       
  2536                     rectForLeftSideIndicators.iTl.iY,
       
  2537                     rectForLeftSideIndicators.iBr.iX + leftOffset + indicatorWidth + rightOffset,
       
  2538                     rectForLeftSideIndicators.iBr.iY );
       
  2539 
       
  2540                 // Check if indicator fits
       
  2541                 TBool indicatorDoesNotFit =
       
  2542                     requiredRect.Intersects( rectForRightSideIndicators ) ||
       
  2543                     requiredRect.Intersects( rectForMiddleIndicators )    ||
       
  2544                     rect.iTl.iX > requiredRect.iTl.iX                     ||
       
  2545                     rect.iBr.iX < requiredRect.iBr.iX;
       
  2546 
       
  2547                 if ( indicatorDoesNotFit &&
       
  2548                      !indicator->DynamicTextIndicator() )
       
  2549                     {
       
  2550                     indicator->SetExtent( TPoint( 0, 0 ), TSize( 0, 0 ) );
       
  2551                     iIndicatorsShown++;
       
  2552                     continue;
       
  2553                     }
       
  2554                 else
       
  2555                     {
       
  2556                     if ( indicator->DynamicTextIndicator() && indicatorDoesNotFit )
       
  2557                         {
       
  2558                         // Dynamic text indicators (not normal text indicators) can adjust to any size.
       
  2559                         TInt maxWidthForDynamicTextIndicator =
       
  2560                             rect.iBr.iX - requiredRect.iTl.iX;
       
  2561                         if ( requiredRect.Intersects( rectForRightSideIndicators ) )
       
  2562                             {
       
  2563                             maxWidthForDynamicTextIndicator =
       
  2564                                 rectForRightSideIndicators.iTl.iX - requiredRect.iTl.iX;
       
  2565                             }
       
  2566                         if ( requiredRect.Intersects( rectForMiddleIndicators ) )
       
  2567                             {
       
  2568                             maxWidthForDynamicTextIndicator =
       
  2569                                 rectForMiddleIndicators.iTl.iX - requiredRect.iTl.iX;
       
  2570                             }
       
  2571 
       
  2572                         indicator->SetExtent(
       
  2573                             TPoint( requiredRect.iTl.iX + leftOffset,
       
  2574                                     verticalOffset ),
       
  2575                             TSize( maxWidthForDynamicTextIndicator,
       
  2576                                    indicatorHeight ) );
       
  2577 
       
  2578                         // Adjust remaining space.
       
  2579                         rectForLeftSideIndicators.iBr.iX =
       
  2580                             indicator->Position().iX + indicator->Size().iWidth;
       
  2581                         }
       
  2582                     else
       
  2583                         {
       
  2584                         indicator->SetExtent(
       
  2585                             TPoint( requiredRect.iTl.iX + leftOffset,
       
  2586                                     verticalOffset ),
       
  2587                             TSize( indicatorWidth,
       
  2588                                    indicatorHeight ) );
       
  2589 
       
  2590                         // Adjust remaining space.
       
  2591                         rectForLeftSideIndicators.iBr.iX = requiredRect.iBr.iX;
       
  2592                         }
       
  2593                     }
       
  2594                 }
       
  2595 
       
  2596 
       
  2597             // Place indicators on the right side.
       
  2598             if ( ( indicatorPosition == ERightSide &&
       
  2599                    iAlignment == TIndicatorAlignment( ERight ) ) ||
       
  2600                  ( indicatorPosition == ELeftSide  &&
       
  2601                    iAlignment == TIndicatorAlignment( ELeft ) ) )
       
  2602                 {
       
  2603                 TRect requiredRect(
       
  2604                     rectForRightSideIndicators.iTl.iX - leftOffset - indicatorWidth - rightOffset,
       
  2605                     rectForRightSideIndicators.iTl.iY,
       
  2606                     rectForRightSideIndicators.iTl.iX,
       
  2607                     rectForRightSideIndicators.iBr.iY );
       
  2608 
       
  2609                 // Check if indicator fits.
       
  2610                  TBool indicatorDoesNotFit =
       
  2611                      ( requiredRect.Intersects( rectForLeftSideIndicators ) ||
       
  2612                        requiredRect.Intersects( rectForMiddleIndicators )   ||
       
  2613                        rect.iTl.iX > requiredRect.iTl.iX                    ||
       
  2614                        rect.iBr.iX < requiredRect.iBr.iX );
       
  2615 
       
  2616                 if ( indicatorDoesNotFit &&
       
  2617                      !indicator->DynamicTextIndicator() )
       
  2618                     {
       
  2619                     indicator->SetExtent( TPoint( 0, 0 ), TSize( 0, 0 ) );
       
  2620                     iIndicatorsShown++;
       
  2621                     continue;
       
  2622                     }
       
  2623                 else
       
  2624                     {
       
  2625                     if ( indicator->DynamicTextIndicator() && indicatorDoesNotFit )
       
  2626                         {
       
  2627                         // Dynamic text indicators (not normal text indicators)
       
  2628                         // can adjust to any size.
       
  2629                         TInt maxWidthForDynamicTextIndicator =
       
  2630                             requiredRect.iBr.iX - rect.iTl.iX  - leftOffset;
       
  2631                         if ( requiredRect.Intersects( rectForLeftSideIndicators ) )
       
  2632                             {
       
  2633                             maxWidthForDynamicTextIndicator =
       
  2634                                 requiredRect.iBr.iX - rectForLeftSideIndicators.iBr.iX;
       
  2635                             }
       
  2636                         if ( requiredRect.Intersects( rectForMiddleIndicators ) )
       
  2637                             {
       
  2638                             maxWidthForDynamicTextIndicator =
       
  2639                                 requiredRect.iBr.iX - rectForMiddleIndicators.iBr.iX;
       
  2640                             }
       
  2641 
       
  2642                         indicator->SetExtent(
       
  2643                             TPoint( requiredRect.iBr.iX - maxWidthForDynamicTextIndicator - leftOffset,
       
  2644                                     verticalOffset),
       
  2645                             TSize( maxWidthForDynamicTextIndicator, indicatorHeight ) );
       
  2646 
       
  2647                         // Adjust remaining space.
       
  2648                         rectForRightSideIndicators.iTl.iX = indicator->Position().iX;
       
  2649                         }
       
  2650                     else
       
  2651                         {
       
  2652                         indicator->SetExtent(
       
  2653                             TPoint( requiredRect.iTl.iX + leftOffset,
       
  2654                                     verticalOffset),
       
  2655                             indicatorSize );
       
  2656 
       
  2657                         // Adjust remaining space.
       
  2658                         rectForRightSideIndicators.iTl.iX = requiredRect.iTl.iX;
       
  2659                         }
       
  2660                     }
       
  2661                 }
       
  2662 
       
  2663             // Place indicators to the middle, only indicator
       
  2664             // at the moment is the wml wait globe.
       
  2665             if ( indicatorPosition == EMiddle )
       
  2666                 {
       
  2667                 TRect requiredRect(
       
  2668                     rectForMiddleIndicators.iTl.iX,
       
  2669                     rectForMiddleIndicators.iTl.iY,
       
  2670                     rectForMiddleIndicators.iTl.iX + leftOffset + indicatorWidth + rightOffset,
       
  2671                     rectForMiddleIndicators.iBr.iY );
       
  2672 
       
  2673                 // Check if indicator fits.
       
  2674                 if ( ( requiredRect.Intersects( rectForRightSideIndicators ) ||
       
  2675                        requiredRect.Intersects( rectForLeftSideIndicators ) )  ||
       
  2676                      rectForMiddleIndicators.Width() != 0 )
       
  2677                     {
       
  2678                     // No space available in the middle.
       
  2679                     indicator->SetExtent( TPoint( 0, 0 ), TSize( 0, 0 ) );
       
  2680                     iIndicatorsShown++;
       
  2681                     continue;
       
  2682                     }
       
  2683                 else
       
  2684                     {
       
  2685                     indicator->SetExtent(
       
  2686                         TPoint( rectForMiddleIndicators.iTl.iX + leftOffset,
       
  2687                                 verticalOffset ),
       
  2688                         indicatorSize );
       
  2689 
       
  2690                     // Adjust remaining space.
       
  2691                     rectForMiddleIndicators.iTl.iX += rightOffset + indicatorWidth;
       
  2692                     }
       
  2693                 }
       
  2694 
       
  2695             iIndicatorsShown++;
       
  2696 
       
  2697             if ( indicator->IndicatorState() == MAknIndicator::EIndicatorAnimate )
       
  2698                 {
       
  2699                 iAnimatedIndicatorsShown++;
       
  2700                 }
       
  2701             } // for
       
  2702 
       
  2703         // Code for setting indicator positions ends.
       
  2704 
       
  2705         ResetAnimTicker( iExtension->iIsForeground );
       
  2706         }
       
  2707     }
       
  2708 
       
  2709 
       
  2710 void CAknIndicatorContainer::SizeChangedInIdleExtendedStatusPane()
       
  2711     {
       
  2712     TRect containerRect( Rect() );
       
  2713 
       
  2714     if (iIndicatorContext == EUniversalIndicators)
       
  2715         {
       
  2716         iLayoutOrientation = EHorizontal;
       
  2717         }
       
  2718 
       
  2719     // Available space for indicators
       
  2720     TRect rect(containerRect);
       
  2721 
       
  2722     // If layout orientation has been changed since last call, prioritize indicators again.
       
  2723     if ( iLayoutOrientation != iPreviousLayoutOrientation )
       
  2724         {
       
  2725         TRAP_IGNORE ( PrioritizeIndicatorsL() );
       
  2726         }
       
  2727 
       
  2728     iIndicatorsShown = 0;
       
  2729     iAnimatedIndicatorsShown = 0;
       
  2730     TInt last = iIndicators->Count() - 1;
       
  2731 
       
  2732     if (iIndicatorContext == EUniversalIndicators)
       
  2733         {
       
  2734         TRect parent( rect );
       
  2735 
       
  2736         TAknLayoutScalableParameterLimits limit =
       
  2737             AknLayoutScalable_Avkon::cell_indicator_nsta_pane_ParamLimits();
       
  2738         TInt maxIndicatorsShownInOneLine = 3; // magic
       
  2739 
       
  2740         TAknLayoutRect layoutRect;
       
  2741         TAknWindowLineLayout cellLayout;
       
  2742         TAknWindowLineLayout indicatorLayout;
       
  2743 
       
  2744         TInt totalIndicatorsOn = 0;
       
  2745 
       
  2746         // Need to go through the indicator array two times
       
  2747         // to be able to place the indicators in correct order.
       
  2748         for ( TInt i = 0; i <= last; i++ )
       
  2749             {
       
  2750             CAknIndicator* indicator = iIndicators->At( i );
       
  2751 
       
  2752             if ( indicator->IndicatorState() &&
       
  2753                  indicator->Priority() != KIndicatorNotShown )
       
  2754                 {
       
  2755                 totalIndicatorsOn++;
       
  2756                 }
       
  2757             }
       
  2758 
       
  2759         for ( TInt ii = 0; ii <= last; ii++ )
       
  2760             {
       
  2761             CAknIndicator* indicator = iIndicators->At(ii);
       
  2762             if ( !indicator->IndicatorState() || (indicator->Priority() == KIndicatorNotShown))
       
  2763                 {
       
  2764                 // Indicator is not shown on current layout even it is set ON.
       
  2765                 continue;
       
  2766                 }
       
  2767 
       
  2768             iIndicatorsShown++;
       
  2769 
       
  2770             if (iIndicatorsShown > maxIndicatorsShownInOneLine * 2)
       
  2771                 {
       
  2772                 indicator->SetExtent(TPoint(0,0), TSize(0,0));
       
  2773                 break;
       
  2774                 }
       
  2775             else
       
  2776                 {
       
  2777                 TInt indicatorRow = ( iIndicatorsShown - 1 ) / maxIndicatorsShownInOneLine;
       
  2778 
       
  2779                 TInt columnVariety =
       
  2780                     iIndicatorsShown - maxIndicatorsShownInOneLine * indicatorRow - 1;
       
  2781 
       
  2782                 if ( ( totalIndicatorsOn < maxIndicatorsShownInOneLine &&
       
  2783                        indicatorRow == 0 ) ||
       
  2784                      ( totalIndicatorsOn > maxIndicatorsShownInOneLine &&
       
  2785                        totalIndicatorsOn < maxIndicatorsShownInOneLine * 2 &&
       
  2786                        indicatorRow == 1 ) )
       
  2787                     {
       
  2788                     if ( totalIndicatorsOn == 1 ||
       
  2789                          totalIndicatorsOn == maxIndicatorsShownInOneLine + 1 )
       
  2790                         {
       
  2791                         columnVariety = maxIndicatorsShownInOneLine - 1;
       
  2792                         }
       
  2793                     else
       
  2794                         {
       
  2795                         columnVariety =
       
  2796                             iIndicatorsShown - maxIndicatorsShownInOneLine * indicatorRow;
       
  2797                         }
       
  2798                     }
       
  2799 
       
  2800                 // set indicator sizes here...rightmost cell first
       
  2801                 cellLayout = AknLayoutScalable_Avkon::cell_indicator_nsta_pane(
       
  2802                     columnVariety,
       
  2803                     2,
       
  2804                     indicatorRow ).LayoutLine();
       
  2805                 layoutRect.LayoutRect( parent, cellLayout );
       
  2806                 TRect cell( layoutRect.Rect() );
       
  2807 
       
  2808                 indicatorLayout =
       
  2809                     AknLayoutScalable_Avkon::cell_indicator_nsta_pane_g2().LayoutLine();
       
  2810                 layoutRect.LayoutRect(cell,indicatorLayout);
       
  2811                 TRect indicatorRect( layoutRect.Rect() );
       
  2812 
       
  2813                 // FIXME: Layout is broken, we fix it here. Remove this when layout is fixed.
       
  2814                 if (indicatorRect.iBr.iX > cell.iBr.iX)
       
  2815                     indicatorRect.iBr.iX = cell.iBr.iX;
       
  2816                 if (indicatorRect.iTl.iX < cell.iTl.iX)
       
  2817                     indicatorRect.iTl.iX = cell.iTl.iX;
       
  2818                 // End of FIXME
       
  2819 
       
  2820                 // TBD: When touch is supported, the size may have to be reconsidered.
       
  2821                 indicator->SetRect(indicatorRect);
       
  2822                 }
       
  2823 
       
  2824             if (indicator->IndicatorState() == MAknIndicator::EIndicatorAnimate)
       
  2825                 {
       
  2826                 iAnimatedIndicatorsShown++;
       
  2827                 }
       
  2828             } // for
       
  2829 
       
  2830         ResetAnimTicker( iExtension->iIsForeground );
       
  2831         } // if universal indicators
       
  2832     }
       
  2833 
       
  2834 
       
  2835 void CAknIndicatorContainer::SizeChangedInFlatStatusPane()
       
  2836     {
       
  2837     TRect containerRect(Rect());
       
  2838 
       
  2839     if (iIndicatorContext == EUniversalIndicators)
       
  2840         {
       
  2841         iLayoutOrientation = EVertical;
       
  2842         }
       
  2843 
       
  2844     // Available space for indicators
       
  2845     TRect rect(containerRect);
       
  2846 
       
  2847     // If layout orientation has been changed since last call, prioritize indicators again.
       
  2848     if ( iLayoutOrientation != iPreviousLayoutOrientation )
       
  2849         {
       
  2850         TRAP_IGNORE ( PrioritizeIndicatorsL() );
       
  2851         }
       
  2852 
       
  2853     iIndicatorsShown = 0;
       
  2854     iAnimatedIndicatorsShown = 0;
       
  2855     TInt last = iIndicators->Count() - 1;
       
  2856 
       
  2857     if (iIndicatorContext == EUniversalIndicators)
       
  2858         {
       
  2859         TAknLayoutRect layoutRect;
       
  2860         TAknWindowComponentLayout indicatorLayout;
       
  2861         TBool extendedFlatLayout(
       
  2862             AknStatuspaneUtils::ExtendedFlatLayoutActive() );
       
  2863         
       
  2864         for (TInt ii = 0; ii <= last; ii++)
       
  2865             {
       
  2866             CAknIndicator* indicator = iIndicators->At(ii);
       
  2867             if ( !indicator->IndicatorState() || (indicator->Priority() == KIndicatorNotShown))
       
  2868                 {
       
  2869                 // Indicator is not shown on current layout even it is set ON.
       
  2870                 continue;
       
  2871                 }
       
  2872 
       
  2873             iIndicatorsShown++;
       
  2874 
       
  2875             TBool showIndicator( ETrue );
       
  2876 
       
  2877             switch ( iIndicatorsShown )
       
  2878                 {
       
  2879                 case 1:
       
  2880                     {
       
  2881                     if ( extendedFlatLayout )
       
  2882                         {
       
  2883                         indicatorLayout =
       
  2884                             AknLayoutScalable_Avkon::indicator_nsta_pane_cp_g1( 0 );
       
  2885                         }
       
  2886                     else
       
  2887                         {
       
  2888                         indicatorLayout =
       
  2889                             AknLayoutScalable_Avkon::uni_indicator_pane_g1( 1 );
       
  2890                         }
       
  2891                     break;
       
  2892                     }
       
  2893                 case 2:
       
  2894                     {
       
  2895                     if ( extendedFlatLayout )
       
  2896                         {
       
  2897                         indicatorLayout =
       
  2898                             AknLayoutScalable_Avkon::indicator_nsta_pane_cp_g2( 0 );
       
  2899                         }
       
  2900                     else
       
  2901                         {
       
  2902                         indicatorLayout =
       
  2903                             AknLayoutScalable_Avkon::uni_indicator_pane_g2( 1 );
       
  2904                         }
       
  2905                     break;
       
  2906                     }
       
  2907                 case 3:
       
  2908                     {
       
  2909                     if ( extendedFlatLayout )
       
  2910                         {
       
  2911                         indicatorLayout =
       
  2912                             AknLayoutScalable_Avkon::indicator_nsta_pane_cp_g3( 0 );
       
  2913                         }
       
  2914                     else
       
  2915                         {
       
  2916                         indicatorLayout =
       
  2917                             AknLayoutScalable_Avkon::uni_indicator_pane_g3( 1 );
       
  2918                         }
       
  2919                     break;
       
  2920                     }
       
  2921                 case 4:
       
  2922                     {
       
  2923                     if ( extendedFlatLayout )
       
  2924                         {
       
  2925                         indicatorLayout =
       
  2926                             AknLayoutScalable_Avkon::indicator_nsta_pane_cp_g4( 0 );
       
  2927                         }
       
  2928                     else
       
  2929                         {
       
  2930                         indicatorLayout =
       
  2931                             AknLayoutScalable_Avkon::uni_indicator_pane_g4( 1 );
       
  2932                         }
       
  2933                     break;
       
  2934                     }
       
  2935                 case 5:
       
  2936                     {
       
  2937                     if ( extendedFlatLayout )
       
  2938                         {
       
  2939                         indicatorLayout =
       
  2940                             AknLayoutScalable_Avkon::indicator_nsta_pane_cp_g5( 0 );
       
  2941                         }
       
  2942                     else
       
  2943                         {
       
  2944                         indicatorLayout =
       
  2945                             AknLayoutScalable_Avkon::uni_indicator_pane_g5( 1 );
       
  2946                         }
       
  2947                     break;
       
  2948                     }
       
  2949                 case 6:
       
  2950                     {
       
  2951                     if ( extendedFlatLayout )
       
  2952                         {
       
  2953                         indicatorLayout =
       
  2954                             AknLayoutScalable_Avkon::indicator_nsta_pane_cp_g6( 0 );
       
  2955                         }
       
  2956                     else
       
  2957                         {
       
  2958                         indicatorLayout =
       
  2959                             AknLayoutScalable_Avkon::uni_indicator_pane_g6( 1 );
       
  2960                         }
       
  2961                     break;
       
  2962                     }
       
  2963                 default:
       
  2964                     {
       
  2965                     showIndicator = EFalse;
       
  2966                     break;
       
  2967                     }
       
  2968                 }
       
  2969 
       
  2970             if ( showIndicator )
       
  2971                 {
       
  2972                 layoutRect.LayoutRect( containerRect, indicatorLayout );
       
  2973                 indicator->SetRect( layoutRect.Rect() );
       
  2974                 }
       
  2975             else // Maximum indicator are shown, others are invisible.
       
  2976                 {
       
  2977                 indicator->SetExtent( TPoint( 0, 0 ), TSize( 0, 0 ) );
       
  2978                 }
       
  2979             
       
  2980             if (indicator->IndicatorState() == MAknIndicator::EIndicatorAnimate)
       
  2981                 {
       
  2982                 iAnimatedIndicatorsShown++;
       
  2983                 }
       
  2984             } // for
       
  2985 
       
  2986         ResetAnimTicker( iExtension->iIsForeground );
       
  2987         } // if universal indicators
       
  2988     }
       
  2989 
       
  2990 
       
  2991 // ---------------------------------------------------------------------------
       
  2992 // CAknIndicatorContainer::SizeChangedInStaconPane
       
  2993 // Handles size change events in stacon pane layouts.
       
  2994 // ---------------------------------------------------------------------------
       
  2995 //
       
  2996 void CAknIndicatorContainer::SizeChangedInStaconPane()
       
  2997     {
       
  2998     TRect containerRect( Rect() );
       
  2999 
       
  3000     if ( iIndicatorContext == EUniversalIndicators )
       
  3001         {
       
  3002         if ( AknStatuspaneUtils::IdleLayoutActive() )
       
  3003             {
       
  3004             iLayoutOrientation = EHorizontal;
       
  3005             }
       
  3006         else
       
  3007             {
       
  3008             iLayoutOrientation = EVertical;
       
  3009             }
       
  3010         }
       
  3011 
       
  3012     // Available space for indicators.
       
  3013     TRect rect( containerRect );
       
  3014 
       
  3015     // If layout orientation has been changed since last call,
       
  3016     // prioritize indicators again.
       
  3017     if ( iLayoutOrientation != iPreviousLayoutOrientation )
       
  3018         {
       
  3019         // Following leave is ignored.
       
  3020         // In case of leave indicators are not maybe shown correctly.
       
  3021         TRAP_IGNORE ( PrioritizeIndicatorsL() );
       
  3022         }
       
  3023 
       
  3024     iIndicatorsShown         = 0;
       
  3025     iAnimatedIndicatorsShown = 0;
       
  3026     TInt last                = iIndicators->Count() - 1;
       
  3027 
       
  3028     if ( iIndicatorContext == EUniversalIndicators )
       
  3029         {
       
  3030         TRect parent( rect );
       
  3031 
       
  3032         // Layout data for four indicators in stacon pane layout exists,
       
  3033         // but for only two indicators are shown.
       
  3034         for ( TInt ii = 0; ii <= last; ii++ )
       
  3035             {
       
  3036             CAknIndicator* indicator = iIndicators->At( ii );
       
  3037             if ( !indicator->IndicatorState() ||
       
  3038                  indicator->Priority() == KIndicatorNotShown )
       
  3039                 {
       
  3040                 // Indicator is not shown on current layout even it is set ON.
       
  3041                 continue;
       
  3042                 }
       
  3043 
       
  3044             iIndicatorsShown++;
       
  3045 
       
  3046             // No fading is done to indicators until transparent
       
  3047             // windows are available, faders always set to NULL for now.
       
  3048             CAknIndicatorFader* topFader    = NULL;
       
  3049             CAknIndicatorFader* bottomFader = NULL;
       
  3050 
       
  3051             if ( AknStatuspaneUtils::StaconSoftKeysRight() )
       
  3052                 {
       
  3053                 if ( iIndicatorsShown == 1 )
       
  3054                     {
       
  3055                     indicator->SetIndicatorFader( topFader );
       
  3056                     AknLayoutUtils::LayoutControl(
       
  3057                         indicator,
       
  3058                         parent,
       
  3059                         AknLayoutScalable_Avkon::uni_indicator_pane_stacon_g1() );
       
  3060                     }
       
  3061                 else if ( iIndicatorsShown == 2 )
       
  3062                     {
       
  3063                     indicator->SetIndicatorFader( bottomFader );
       
  3064                     AknLayoutUtils::LayoutControl(
       
  3065                         indicator,
       
  3066                         parent,
       
  3067                         AknLayoutScalable_Avkon::uni_indicator_pane_stacon_g2() );
       
  3068                     }
       
  3069                 }
       
  3070             else if ( AknStatuspaneUtils::StaconSoftKeysLeft() )
       
  3071                 {
       
  3072                 // LAF does not contain mirrored lines. We mirror positions here.
       
  3073                 if ( iIndicatorsShown == 1 )
       
  3074                     {
       
  3075                     indicator->SetIndicatorFader( topFader );
       
  3076                     AknLayoutUtils::LayoutControl(
       
  3077                         indicator,
       
  3078                         parent,
       
  3079                         AknLayoutScalable_Avkon::uni_indicator_pane_stacon_g3() );
       
  3080                     }
       
  3081                 else if ( iIndicatorsShown == 2 )
       
  3082                     {
       
  3083                     indicator->SetIndicatorFader( bottomFader );
       
  3084                     AknLayoutUtils::LayoutControl(
       
  3085                         indicator,
       
  3086                         parent,
       
  3087                         AknLayoutScalable_Avkon::uni_indicator_pane_stacon_g4() );
       
  3088                     }
       
  3089                 }
       
  3090 
       
  3091             if ( iIndicatorsShown > 2 )
       
  3092                 {
       
  3093                 indicator->SetIndicatorFader( NULL );
       
  3094                 indicator->SetExtent( TPoint( 0, 0 ), TSize( 0, 0 ) );
       
  3095                 break;
       
  3096                 }
       
  3097 
       
  3098             if ( indicator->IndicatorState() == MAknIndicator::EIndicatorAnimate )
       
  3099                 {
       
  3100                 iAnimatedIndicatorsShown++;
       
  3101                 }
       
  3102             } // for
       
  3103 
       
  3104         ResetAnimTicker( iExtension->iIsForeground );
       
  3105         } // if universal indicators
       
  3106     // Currently uses small statuspane layouts in navipane indicators because not all exist for stacon yet.
       
  3107     else if ( iIndicatorContext == ENaviPaneEditorIndicators )
       
  3108         {
       
  3109         TBool isMirrored( AknLayoutUtils::LayoutMirrored() );
       
  3110 
       
  3111         iLayoutOrientation = EHorizontal; // always horizontal
       
  3112 
       
  3113         TRect containerRect( Rect() );
       
  3114 
       
  3115         // Check if the secured connection indicator is on before
       
  3116         // reading the layouts because of different positioning
       
  3117         // of wait and progress bars with that indicator on.
       
  3118         TBool secureConnectionIndicOn( EFalse );
       
  3119         for ( TInt i = 0; i <= last; i++ )
       
  3120             {
       
  3121             CAknIndicator* indicator = iIndicators->At( i );
       
  3122 
       
  3123             if ( indicator->Uid().iUid == EAknNaviPaneEditorIndicatorSecuredConnection &&
       
  3124                  indicator->IndicatorState() &&
       
  3125                  indicator->Priority() != KIndicatorNotShown )
       
  3126                 {
       
  3127                 secureConnectionIndicOn = ETrue;
       
  3128                 }
       
  3129             }
       
  3130 
       
  3131         // screen
       
  3132         TRect screenRect;
       
  3133         AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, screenRect );
       
  3134 
       
  3135         // app window
       
  3136         TRect applicationWindowRect;
       
  3137         AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EApplicationWindow,
       
  3138                                            applicationWindowRect );
       
  3139 
       
  3140         // small statuspane
       
  3141         TAknLayoutRect smallStatusPaneLayoutRect;
       
  3142         smallStatusPaneLayoutRect.LayoutRect(
       
  3143             applicationWindowRect,
       
  3144             TAknWindowComponentLayout::Compose(
       
  3145                 AknLayoutScalable_Avkon::area_top_pane( 1 ),
       
  3146                 AknLayoutScalable_Avkon::status_small_pane() ) );
       
  3147         TRect smallStatusPaneRect( smallStatusPaneLayoutRect.Rect() );
       
  3148 
       
  3149         // small statuspane, wait pane
       
  3150         TAknLayoutRect smallStatusWaitPaneLayoutRect;
       
  3151         smallStatusWaitPaneLayoutRect.LayoutRect(
       
  3152             smallStatusPaneRect,
       
  3153             AknLayoutScalable_Avkon::status_small_wait_pane(
       
  3154                 secureConnectionIndicOn ? 2 : 1 ) );
       
  3155         TRect smallStatusWaitPaneRect( smallStatusWaitPaneLayoutRect.Rect() );
       
  3156 
       
  3157         // small statuspane, globe
       
  3158         TAknLayoutRect smallStatusWmlGlobeLayoutRect;
       
  3159         smallStatusWmlGlobeLayoutRect.LayoutRect(
       
  3160             smallStatusPaneRect,
       
  3161             AknLayoutScalable_Avkon::status_small_pane_g4( 0 ) );
       
  3162         TRect smallStatusWmlGlobeRect( smallStatusWmlGlobeLayoutRect.Rect() );
       
  3163 
       
  3164         // small statuspane, GPRS indicator
       
  3165         TAknLayoutRect smallStatusGprsLayoutRect;
       
  3166         smallStatusGprsLayoutRect.LayoutRect(
       
  3167             smallStatusPaneRect,
       
  3168             AknLayoutScalable_Avkon::status_small_pane_g2( 0 ) );
       
  3169         TRect smallStatusGprsRect( smallStatusGprsLayoutRect.Rect() );
       
  3170 
       
  3171         // small statuspane, secure state indicator
       
  3172         TAknLayoutRect smallStatusSecureStateLayoutRect;
       
  3173         smallStatusSecureStateLayoutRect.LayoutRect(
       
  3174             smallStatusPaneRect,
       
  3175             AknLayoutScalable_Avkon::status_small_pane_g3( 0 ) );
       
  3176         TRect smallStatusSecureStateRect( smallStatusSecureStateLayoutRect.Rect() );
       
  3177 
       
  3178 
       
  3179         // small statuspane, texts
       
  3180         TAknLayoutText textLayout;
       
  3181         textLayout.LayoutText(
       
  3182             containerRect,
       
  3183             AknLayoutScalable_Avkon::status_small_pane_t1( 0 ) );
       
  3184         TRect smallStatusTextRect( textLayout.TextRect() );
       
  3185 
       
  3186         TInt textIndicatorLeftOffset     = smallStatusTextRect.iTl.iX;
       
  3187         TInt textIndicatorVerticalOffset = smallStatusTextRect.iTl.iY;
       
  3188 
       
  3189         TInt wmlWaitGlobeLeftOffset =
       
  3190             containerRect.Width() / 2 - smallStatusWmlGlobeRect.Width() / 2;
       
  3191 
       
  3192         // Modify containerRect if alignment is Right.
       
  3193         // For Left aligned no need to modify containerRect.
       
  3194         if ( iAlignment == TIndicatorAlignment( ERight ) )
       
  3195             {
       
  3196             containerRect.iBr.iX -= 3; // Right margin of editor indicators
       
  3197             containerRect.iTl.iX += 0; // Left margin of editor indicators
       
  3198             }
       
  3199 
       
  3200         iIndicatorsShown                = 0;
       
  3201         iAnimatedIndicatorsShown        = 0;
       
  3202         TBool textIndicatorOffsetNeeded = ETrue;
       
  3203 
       
  3204         TRect rectForRightSideIndicators( containerRect.iBr.iX,
       
  3205                                           containerRect.iTl.iY,
       
  3206                                           containerRect.iBr.iX,
       
  3207                                           containerRect.iBr.iY );
       
  3208 
       
  3209         TRect rectForLeftSideIndicators( containerRect.iTl.iX,
       
  3210                                          containerRect.iTl.iY,
       
  3211                                          containerRect.iTl.iX,
       
  3212                                          containerRect.iBr.iY );
       
  3213 
       
  3214         TRect rectForMiddleIndicators( wmlWaitGlobeLeftOffset,
       
  3215                                        containerRect.iTl.iY,
       
  3216                                        wmlWaitGlobeLeftOffset,
       
  3217                                        containerRect.iBr.iY );
       
  3218 
       
  3219         for ( TInt ii = 0; ii <= last; ii++ )
       
  3220             {
       
  3221             CAknIndicator* indicator = iIndicators->At( ii );
       
  3222             TInt uid = indicator->Uid().iUid;
       
  3223             TInt indicatorPosition = 0;
       
  3224 
       
  3225             // decide here how indicators are positioned. Default is rigth side.
       
  3226             indicatorPosition = indicator->IndicatorPosition();
       
  3227 
       
  3228             // Check if indicator is not shown on current layout even it is set ON.
       
  3229             if ( !indicator->IndicatorState() ||
       
  3230                  indicator->Priority() == KIndicatorNotShown )
       
  3231                 {
       
  3232                 continue;
       
  3233                 }
       
  3234 
       
  3235             // Check if this is gprs indicator, it is never shown here but is drawn
       
  3236             // to the signal pane by the system
       
  3237             if ( uid == EAknNaviPaneEditorIndicatorGprs )
       
  3238                 {
       
  3239                 indicator->SetExtent( TPoint( 0, 0 ), TSize( 0, 0 ) );
       
  3240                 iIndicatorsShown++;
       
  3241                 continue;
       
  3242                 }
       
  3243             else if ( uid == EAknNaviPaneEditorIndicatorWlanAvailable ||
       
  3244                       uid == EAknNaviPaneEditorIndicatorWlanActive ||
       
  3245                       uid == EAknNaviPaneEditorIndicatorWlanActiveSecure )
       
  3246                 {
       
  3247                 // These are not shown in stacon layout navi pane, as
       
  3248                 // the same indicators are shown on the universal
       
  3249                 // indicator pane.
       
  3250                 indicator->SetExtent( TPoint( 0, 0 ), TSize( 0, 0 ) );
       
  3251                 iIndicatorsShown++;
       
  3252                 continue;
       
  3253                 }
       
  3254 
       
  3255             // handle offsets
       
  3256             TAknWindowLineLayout areaTopPaneLayout = AknLayoutScalable_Avkon::area_top_pane( 0 );
       
  3257             TAknLayoutRect areaTopPaneLayoutRect;
       
  3258             areaTopPaneLayoutRect.LayoutRect( screenRect, areaTopPaneLayout );
       
  3259 
       
  3260             TAknWindowLineLayout statusPaneIconSmallLayout(
       
  3261                 TAknWindowComponentLayout::Compose(
       
  3262                     AknLayoutScalable_Avkon::area_top_pane( 1 ),
       
  3263                     TAknWindowComponentLayout::Compose(
       
  3264                         AknLayoutScalable_Avkon::status_small_pane(),
       
  3265                         AknLayoutScalable_Avkon::status_small_icon_pane() ) ).LayoutLine() );
       
  3266 
       
  3267             // If top pane area's vertical position doesn't start at 0,
       
  3268             // the statusPaneIconSmallRect's values will be incorrect and
       
  3269             // must be adjusted.
       
  3270             TInt offsetFromTop = areaTopPaneLayoutRect.Rect().iTl.iY;
       
  3271             TRect normSmallStatusPaneRect( smallStatusPaneRect );
       
  3272             normSmallStatusPaneRect.iTl.iY -= offsetFromTop;
       
  3273             statusPaneIconSmallLayout.it -= offsetFromTop;
       
  3274 
       
  3275             TAknLayoutRect statusPaneIconSmallLayoutRect;
       
  3276             statusPaneIconSmallLayoutRect.LayoutRect(
       
  3277                 normSmallStatusPaneRect, statusPaneIconSmallLayout );
       
  3278 
       
  3279             TInt verticalOffset = statusPaneIconSmallLayoutRect.Rect().iTl.iY;
       
  3280 
       
  3281             TInt leftOffset  = 0;  // default offset
       
  3282             TInt rightOffset = 0;  // default offset
       
  3283 
       
  3284             TInt indicatorWidth = indicator->IconSize().iWidth;   // default width
       
  3285             TInt indicatorHeight = indicator->IconSize().iHeight; // default height
       
  3286 
       
  3287             if ( uid == EAknNaviPaneEditorIndicatorMessageInfo    ||
       
  3288                  uid == EAknNaviPaneEditorIndicatorWmlWindowsText ||
       
  3289                  uid == EAknNaviPaneEditorIndicatorMessageLength )
       
  3290                 {
       
  3291                 verticalOffset = textIndicatorVerticalOffset;
       
  3292                 // first text idicator need horizontal offset
       
  3293                 if ( textIndicatorOffsetNeeded )
       
  3294                     {
       
  3295                     leftOffset += textIndicatorLeftOffset;
       
  3296                     }
       
  3297                 textIndicatorOffsetNeeded = EFalse;
       
  3298                 }
       
  3299             else if ( uid == EAknNaviPaneEditorIndicatorFileSize )
       
  3300                 {
       
  3301                 verticalOffset = textIndicatorVerticalOffset;
       
  3302 
       
  3303                 // Need left offset in western, right offset in A&H layout.
       
  3304                 if ( isMirrored )
       
  3305                     {
       
  3306                     rightOffset = textIndicatorLeftOffset;
       
  3307                     }
       
  3308                 else
       
  3309                     {
       
  3310                     leftOffset  = KMinSpaceBetweenIconsInPixels;
       
  3311                     }
       
  3312                 }
       
  3313             else if ( uid == EAknNaviPaneEditorIndicatorSecuredConnection )
       
  3314                 {
       
  3315                 verticalOffset = smallStatusSecureStateRect.iTl.iY;
       
  3316                 // Because icon bitmap does not contain enough space,
       
  3317                 // increase offset as the layout spec states.
       
  3318                 if ( isMirrored )
       
  3319                     {
       
  3320                     leftOffset = KMinSpaceBetweenIconsInPixels;
       
  3321                     }
       
  3322                 else
       
  3323                     {
       
  3324                     rightOffset = KMinSpaceBetweenIconsInPixels;
       
  3325                     }
       
  3326                 textIndicatorOffsetNeeded = EFalse;
       
  3327                 }
       
  3328             else if ( uid == EAknNaviPaneEditorIndicatorWmlWaitGlobe )
       
  3329                 {
       
  3330                 verticalOffset = (containerRect.Height() - indicator->IconSize().iHeight)/2;
       
  3331                 indicatorWidth = smallStatusWmlGlobeRect.Width();
       
  3332                 }
       
  3333             else if ( uid == EAknNaviPaneEditorIndicatorProgressBar )
       
  3334                 {
       
  3335                 verticalOffset  = smallStatusWaitPaneRect.iTl.iY;
       
  3336                 indicatorWidth  = smallStatusWaitPaneRect.Width();
       
  3337                 indicatorHeight = smallStatusWaitPaneRect.Height();
       
  3338                 leftOffset      = 0;
       
  3339                 textIndicatorOffsetNeeded = ETrue;
       
  3340                 }
       
  3341             else if ( uid == EAknNaviPaneEditorIndicatorWaitBar )
       
  3342                 {
       
  3343                 verticalOffset  = smallStatusWaitPaneRect.iTl.iY;
       
  3344                 indicatorWidth  = smallStatusWaitPaneRect.Width();
       
  3345                 indicatorHeight = smallStatusWaitPaneRect.Height();
       
  3346                 leftOffset      = 0;
       
  3347                 textIndicatorOffsetNeeded = ETrue;
       
  3348                 }
       
  3349 
       
  3350             if ( isMirrored )
       
  3351                 {
       
  3352                 TInt temp   = leftOffset;
       
  3353                 leftOffset  = rightOffset;
       
  3354                 rightOffset = temp;
       
  3355                 }
       
  3356 
       
  3357             // Place indicators to the left side.
       
  3358             if ( ( indicatorPosition == ELeftSide &&
       
  3359                    iAlignment == TIndicatorAlignment( ERight ) ) ||
       
  3360                  ( indicatorPosition == ERightSide &&
       
  3361                    iAlignment == TIndicatorAlignment( ELeft ) ) )
       
  3362                 {
       
  3363                 TRect requiredRect(
       
  3364                     rectForLeftSideIndicators.iBr.iX,
       
  3365                     rectForLeftSideIndicators.iTl.iY,
       
  3366                     rectForLeftSideIndicators.iBr.iX + leftOffset + indicatorWidth + rightOffset,
       
  3367                     rectForLeftSideIndicators.iBr.iY );
       
  3368 
       
  3369                 // Check if indicator fits.
       
  3370                 TBool indicatorDoesNotFit =
       
  3371                     ( requiredRect.Intersects( rectForRightSideIndicators ) ||
       
  3372                       requiredRect.Intersects( rectForMiddleIndicators )    ||
       
  3373                       containerRect.iTl.iX > requiredRect.iTl.iX            ||
       
  3374                       containerRect.iBr.iX < requiredRect.iBr.iX );
       
  3375 
       
  3376                     if ( indicatorDoesNotFit &&
       
  3377                          !indicator->DynamicTextIndicator() )
       
  3378                         {
       
  3379                         indicator->SetExtent( TPoint( 0, 0 ), TSize( 0, 0 ) );
       
  3380                         iIndicatorsShown++;
       
  3381                         continue;
       
  3382                         }
       
  3383                     else
       
  3384                         {
       
  3385                         if ( indicator->DynamicTextIndicator() && indicatorDoesNotFit )
       
  3386                             {
       
  3387                             // Dynamic text indicators (not normal text indicators)
       
  3388                             // can adjust to any size.
       
  3389                             TInt maxWidthForDynamicTextIndicator =
       
  3390                                 containerRect.iBr.iX - requiredRect.iTl.iX;
       
  3391 
       
  3392                             if ( requiredRect.Intersects( rectForRightSideIndicators ) )
       
  3393                                 {
       
  3394                                 maxWidthForDynamicTextIndicator =
       
  3395                                     rectForRightSideIndicators.iTl.iX - requiredRect.iTl.iX;
       
  3396                                 }
       
  3397 
       
  3398                             if ( requiredRect.Intersects( rectForMiddleIndicators ) )
       
  3399                                 {
       
  3400                                 maxWidthForDynamicTextIndicator =
       
  3401                                     rectForMiddleIndicators.iTl.iX - requiredRect.iTl.iX;
       
  3402                                 }
       
  3403 
       
  3404                             indicator->SetExtent(
       
  3405                                 TPoint( requiredRect.iTl.iX + leftOffset, verticalOffset ),
       
  3406                                 TSize( maxWidthForDynamicTextIndicator, indicatorHeight ) );
       
  3407 
       
  3408                             rectForLeftSideIndicators.iBr.iX =
       
  3409                                 indicator->Position().iX + indicator->Size().iWidth;
       
  3410                             }
       
  3411                         else
       
  3412                             {
       
  3413                             indicator->SetExtent(
       
  3414                                 TPoint( requiredRect.iTl.iX + leftOffset, verticalOffset ),
       
  3415                                 TSize( indicatorWidth, indicatorHeight ) );
       
  3416 
       
  3417                             rectForLeftSideIndicators.iBr.iX = requiredRect.iBr.iX;
       
  3418                             }
       
  3419                         }
       
  3420                     }
       
  3421 
       
  3422 
       
  3423                 // Place indicators to the right side.
       
  3424                 if ( ( indicatorPosition == ERightSide &&
       
  3425                        iAlignment == TIndicatorAlignment( ERight ) ) ||
       
  3426                      ( indicatorPosition == ELeftSide &&
       
  3427                        iAlignment == TIndicatorAlignment( ELeft ) ) )
       
  3428                     {
       
  3429                     TRect requiredRect(
       
  3430                         rectForRightSideIndicators.iTl.iX - leftOffset - indicatorWidth - rightOffset,
       
  3431                         rectForRightSideIndicators.iTl.iY,
       
  3432                         rectForRightSideIndicators.iTl.iX,
       
  3433                         rectForRightSideIndicators.iBr.iY );
       
  3434 
       
  3435                     // Check if indicator fits.
       
  3436                     TBool indicatorDoesNotFit =
       
  3437                          ( requiredRect.Intersects( rectForLeftSideIndicators ) ||
       
  3438                            requiredRect.Intersects( rectForMiddleIndicators )   ||
       
  3439                            containerRect.iTl.iX > requiredRect.iTl.iX           ||
       
  3440                            containerRect.iBr.iX < requiredRect.iBr.iX );
       
  3441 
       
  3442                     if ( indicatorDoesNotFit &&
       
  3443                          !indicator->DynamicTextIndicator() )
       
  3444                         {
       
  3445                         indicator->SetExtent( TPoint( 0, 0 ), TSize( 0, 0 ) );
       
  3446                         iIndicatorsShown++;
       
  3447                         continue;
       
  3448                         }
       
  3449                     else
       
  3450                         {
       
  3451                         if ( indicator->DynamicTextIndicator() &&
       
  3452                              indicatorDoesNotFit )
       
  3453                             {
       
  3454                             // Dynamic text indicators (not normal text indicators)
       
  3455                             // can adjust to any size.
       
  3456                             TInt maxWidthForDynamicTextIndicator =
       
  3457                                 requiredRect.iBr.iX - containerRect.iTl.iX  - leftOffset;
       
  3458 
       
  3459                             if ( requiredRect.Intersects( rectForLeftSideIndicators ) )
       
  3460                                 {
       
  3461                                 maxWidthForDynamicTextIndicator =
       
  3462                                     requiredRect.iBr.iX - rectForLeftSideIndicators.iBr.iX;
       
  3463                                 }
       
  3464                             if ( requiredRect.Intersects( rectForMiddleIndicators ) )
       
  3465                                 {
       
  3466                                 maxWidthForDynamicTextIndicator =
       
  3467                                     requiredRect.iBr.iX - rectForMiddleIndicators.iBr.iX;
       
  3468                                 }
       
  3469 
       
  3470                             indicator->SetExtent(
       
  3471                                 TPoint( requiredRect.iBr.iX - maxWidthForDynamicTextIndicator + leftOffset,
       
  3472                                         verticalOffset),
       
  3473                                 TSize( maxWidthForDynamicTextIndicator, indicatorHeight ) );
       
  3474                             rectForRightSideIndicators.iTl.iX = indicator->Position().iX;
       
  3475                             }
       
  3476                         else
       
  3477                             {
       
  3478                             indicator->SetExtent(
       
  3479                                 TPoint( requiredRect.iTl.iX + leftOffset, verticalOffset ),
       
  3480                                 TSize( indicatorWidth, indicatorHeight ) );
       
  3481 
       
  3482                             rectForRightSideIndicators.iTl.iX = requiredRect.iTl.iX;
       
  3483                             }
       
  3484                         }
       
  3485                     }
       
  3486 
       
  3487 
       
  3488             // place indicators to the middle, only indicator is wml wait globe
       
  3489             if ( indicatorPosition == EMiddle )
       
  3490                 {
       
  3491                 TRect requiredRect(
       
  3492                     rectForMiddleIndicators.iTl.iX,
       
  3493                     rectForMiddleIndicators.iTl.iY,
       
  3494                     rectForMiddleIndicators.iTl.iX + leftOffset + indicatorWidth + rightOffset,
       
  3495                     rectForMiddleIndicators.iBr.iY );
       
  3496 
       
  3497                 // check if indicator fits
       
  3498                 if ( requiredRect.Intersects( rectForRightSideIndicators ) ||
       
  3499                      requiredRect.Intersects( rectForLeftSideIndicators )  ||
       
  3500                      rectForMiddleIndicators.Width() != 0 )
       
  3501                     {
       
  3502                     indicator->SetExtent( TPoint( 0, 0 ), TSize( 0, 0 ) );
       
  3503                     iIndicatorsShown++;
       
  3504                     continue;
       
  3505                     }
       
  3506                 else
       
  3507                     {
       
  3508                     indicator->SetExtent( TPoint( rectForMiddleIndicators.iTl.iX + leftOffset,
       
  3509                                                   verticalOffset ),
       
  3510                                           TSize( indicatorWidth, indicatorHeight ) );
       
  3511 
       
  3512                     rectForMiddleIndicators.iTl.iX += ( rightOffset + indicatorWidth );
       
  3513                     }
       
  3514                 }
       
  3515 
       
  3516             iIndicatorsShown++;
       
  3517 
       
  3518             if ( indicator->IndicatorState() == MAknIndicator::EIndicatorAnimate )
       
  3519                 {
       
  3520                 iAnimatedIndicatorsShown++;
       
  3521                 }
       
  3522             } // for
       
  3523         }
       
  3524 
       
  3525     ResetAnimTicker( iExtension->iIsForeground );
       
  3526     }
       
  3527 
       
  3528 
       
  3529 // ---------------------------------------------------------------------------
       
  3530 // CAknIndicatorContainer::SetIncallBubbleAllowedInIdle
       
  3531 // Allows/disallows showing the small incall status bubble of this container
       
  3532 // in idle status pane layouts.
       
  3533 // ---------------------------------------------------------------------------
       
  3534 //
       
  3535 EXPORT_C void CAknIndicatorContainer::SetIncallBubbleAllowedInIdle(
       
  3536     TBool aAllowed )
       
  3537     {
       
  3538     if ( iExtension )
       
  3539         {
       
  3540         iExtension->iIncallBubbleAllowedInIdle = aAllowed;
       
  3541         }
       
  3542     }
       
  3543 
       
  3544 
       
  3545 // ---------------------------------------------------------------------------
       
  3546 // CAknIndicatorContainer::SetIncallBubbleAllowedInUsual
       
  3547 // Allows/disallows showing the small incall status bubble of this container
       
  3548 // in usual status pane layouts.
       
  3549 // ---------------------------------------------------------------------------
       
  3550 //
       
  3551 EXPORT_C void CAknIndicatorContainer::SetIncallBubbleAllowedInUsual(
       
  3552     TBool aAllowed )
       
  3553     {
       
  3554     if ( iExtension )
       
  3555         {
       
  3556         iExtension->iIncallBubbleAllowedInUsual = aAllowed;
       
  3557         }
       
  3558     }
       
  3559 
       
  3560 
       
  3561 // ---------------------------------------------------------------------------
       
  3562 // CAknIndicatorContainer::SetIndicatorObserver
       
  3563 // Sets aIndicatorObserver to observe indicator with aIndicatorUid
       
  3564 // by looping through indicators to find indicator with aIndicaotrUid
       
  3565 // and calling SetIndicatorObserver to it with given pointer to observer
       
  3566 // ---------------------------------------------------------------------------
       
  3567 //
       
  3568 EXPORT_C void CAknIndicatorContainer::SetIndicatorObserver(
       
  3569     MAknIndicatorObserver* aIndicatorObserver,
       
  3570     TUid aIndicatorUid )
       
  3571     {
       
  3572     if ( AknLayoutUtils::PenEnabled() )
       
  3573         {
       
  3574         TInt count = iIndicators->Count();
       
  3575 
       
  3576         // Loop through indicators and find indicator with given UID.
       
  3577         for ( TInt ii = 0; ii < count; ii++ )
       
  3578             {
       
  3579             CAknIndicator* indicator = iIndicators->At( ii );
       
  3580 
       
  3581             // If indicator found, set aIndicatorObserver to observe it.
       
  3582             if ( indicator->Uid() == aIndicatorUid )
       
  3583                 {
       
  3584                 indicator->SetIndicatorObserver( aIndicatorObserver );
       
  3585                 break;
       
  3586                 }
       
  3587             }
       
  3588         }
       
  3589     }
       
  3590 
       
  3591 
       
  3592 // ---------------------------------------------------------------------------
       
  3593 // CAknIndicatorContainer::SetContainerWindowNonFading
       
  3594 // Allows/disallows fading of this pane.
       
  3595 // ---------------------------------------------------------------------------
       
  3596 //
       
  3597 void CAknIndicatorContainer::SetContainerWindowNonFading( TBool aNonFading )
       
  3598     {
       
  3599     CEikStatusPaneBase* statusPane = CEikStatusPaneBase::Current();
       
  3600     if ( statusPane )
       
  3601         {
       
  3602         CCoeControl* control = NULL;
       
  3603         TRAP_IGNORE(
       
  3604             control = statusPane->ContainerControlL(
       
  3605                 TUid::Uid( EEikStatusPaneUidIndic ) ) );
       
  3606 
       
  3607         if ( control )
       
  3608             {
       
  3609             control->DrawableWindow()->SetNonFading( aNonFading );
       
  3610             }
       
  3611         }
       
  3612     }
       
  3613 
       
  3614 
       
  3615 // ---------------------------------------------------------------------------
       
  3616 // CAknIndicatorContainer::SetupIndicatorLayoutModes
       
  3617 // Sets the appropriate layout mode to all the indicators inside
       
  3618 // this container.
       
  3619 // ---------------------------------------------------------------------------
       
  3620 //
       
  3621 void CAknIndicatorContainer::SetupIndicatorLayoutModes()
       
  3622     {
       
  3623     TInt mode  = SelectIndicatorLayoutMode();
       
  3624     TInt count = iIndicators->Count();
       
  3625     for ( TInt ii = 0; ii < count; ii++ )
       
  3626         {
       
  3627         iIndicators->At( ii )->SetLayoutMode(
       
  3628             (CAknIndicator::TLayoutMode) mode );
       
  3629         }
       
  3630     }
       
  3631 
       
  3632 
       
  3633 // ---------------------------------------------------------------------------
       
  3634 // CAknIndicatorContainer::SelectIndicatorLayoutMode
       
  3635 // Decides the layout mode to be used for indicators inside this container.
       
  3636 // ---------------------------------------------------------------------------
       
  3637 //
       
  3638 TInt CAknIndicatorContainer::SelectIndicatorLayoutMode()
       
  3639     {
       
  3640     // Usually this can be used to decide mode...
       
  3641     TInt mode = ( Rect().Height() > Rect().Width() ) ?
       
  3642         CAknIndicator::ELayoutModeUsual :
       
  3643         CAknIndicator::ELayoutModeWide;
       
  3644 
       
  3645     // But one exception is idle where we can have vertical indicators using "wide" mode.
       
  3646     if ( iIndicatorContext == EUniversalIndicators &&
       
  3647          AknStatuspaneUtils::IdleLayoutActive() )
       
  3648         {
       
  3649         mode = CAknIndicator::ELayoutModeWide;
       
  3650 
       
  3651         // But exception to exception is portraitmode video telephony layout
       
  3652         CEikStatusPaneBase* statusPane = CEikStatusPaneBase::Current();
       
  3653         if ( statusPane )
       
  3654             {
       
  3655             TInt currentStatusPaneLayoutResId = statusPane->CurrentLayoutResId();
       
  3656             if ( currentStatusPaneLayoutResId == R_AVKON_STATUS_PANE_LAYOUT_VT ||
       
  3657                  currentStatusPaneLayoutResId == R_AVKON_STATUS_PANE_LAYOUT_VT_MIRRORED )
       
  3658                 {
       
  3659                 mode = CAknIndicator::ELayoutModeUsual;
       
  3660                 }
       
  3661             }
       
  3662         }
       
  3663     // Another thing is if universal indicators but not idle
       
  3664     else if ( iIndicatorContext == EUniversalIndicators &&
       
  3665               !AknStatuspaneUtils::IdleLayoutActive() )
       
  3666         {
       
  3667         mode = CAknIndicator::ELayoutModeUsual;
       
  3668         }
       
  3669     else if ( iIndicatorContext == EQueryEditorIndicators )
       
  3670         {
       
  3671         mode = CAknIndicator::ELayoutModeUsual;
       
  3672         }
       
  3673 
       
  3674     return mode;
       
  3675     }
       
  3676 
       
  3677 
       
  3678 // ---------------------------------------------------------------------------
       
  3679 // CAknIndicatorContainer::SizeChangedInIdleVertical
       
  3680 // Handles size change events of vertically arranged universal indicator
       
  3681 // pane in idle status pane layout.
       
  3682 // ---------------------------------------------------------------------------
       
  3683 //
       
  3684 void CAknIndicatorContainer::SizeChangedInIdleVertical()
       
  3685     {
       
  3686     TRect containerRect( Rect() );
       
  3687 
       
  3688     if ( iIndicatorContext == EUniversalIndicators )
       
  3689         {
       
  3690         iLayoutOrientation = EVertical;
       
  3691         }
       
  3692 
       
  3693     // Available space for indicators
       
  3694     TRect rect( containerRect );
       
  3695 
       
  3696     // If layout orientation has been changed since last call,
       
  3697     // prioritize indicators again.
       
  3698     if ( iLayoutOrientation != iPreviousLayoutOrientation )
       
  3699         {
       
  3700         TRAP_IGNORE ( PrioritizeIndicatorsL() );
       
  3701         }
       
  3702 
       
  3703     iIndicatorsShown         = 0;
       
  3704     iAnimatedIndicatorsShown = 0;
       
  3705     TInt last                = iIndicators->Count() - 1;
       
  3706 
       
  3707     if ( iIndicatorContext == EUniversalIndicators )
       
  3708         {
       
  3709         TRect parent( rect );
       
  3710         TAknLayoutRect layoutRect;
       
  3711 
       
  3712         layoutRect.LayoutRect(
       
  3713             parent, AknLayoutScalable_Avkon::grid_indicator_pane() );
       
  3714         parent = layoutRect.Rect();
       
  3715 
       
  3716         TRect indicatorRect( 0,0,0,0 );
       
  3717 
       
  3718         TInt maxNumberOfIndicatorsShown =
       
  3719             AknLayoutScalable_Avkon::cell_indicator_pane_ParamLimits().LastRow();
       
  3720 
       
  3721         for ( TInt ii = 0; ii <= last; ii++ )
       
  3722             {
       
  3723             CAknIndicator* indicator = iIndicators->At( ii );
       
  3724             if ( !indicator->IndicatorState() ||
       
  3725                  indicator->Priority() == KIndicatorNotShown )
       
  3726                 {
       
  3727                 // Indicator is not shown on current layout even it is set ON.
       
  3728                 continue;
       
  3729                 }
       
  3730 
       
  3731             layoutRect.LayoutRect(
       
  3732                 parent,
       
  3733                 AknLayoutScalable_Avkon::cell_indicator_pane( iIndicatorsShown ) );
       
  3734             indicatorRect = layoutRect.Rect();
       
  3735             indicator->SetRect( indicatorRect );
       
  3736 
       
  3737             iIndicatorsShown++;
       
  3738 
       
  3739             if ( iIndicatorsShown > maxNumberOfIndicatorsShown )
       
  3740                 {
       
  3741                 indicator->SetExtent( TPoint( 0, 0 ), TSize( 0, 0 ) );
       
  3742                 break;
       
  3743                 }
       
  3744 
       
  3745             if ( indicator->IndicatorState() == MAknIndicator::EIndicatorAnimate )
       
  3746                 {
       
  3747                 iAnimatedIndicatorsShown++;
       
  3748                 }
       
  3749             } // for
       
  3750 
       
  3751         ResetAnimTicker( iExtension->iIsForeground );
       
  3752 
       
  3753         } // if universal indicators
       
  3754     }
       
  3755 
       
  3756 
       
  3757 // ---------------------------------------------------------------------------
       
  3758 // CAknIndicatorContainer::CreateIndicatorFromResourceL
       
  3759 // Constructs a status indicator from an indicator resource.
       
  3760 // ---------------------------------------------------------------------------
       
  3761 //
       
  3762 EXPORT_C TUid CAknIndicatorContainer::CreateIndicatorFromResourceL(
       
  3763     TInt aIndicatorResourceId,
       
  3764     TInt aCustomIndicatorFlags )
       
  3765     {
       
  3766     CAknIndicator* newIndicator =
       
  3767         new (ELeave) CAknIndicator ( iIndicatorContext );
       
  3768     CleanupStack::PushL( newIndicator );
       
  3769     newIndicator->SetContainerWindowL( *this );
       
  3770 
       
  3771     TResourceReader reader;
       
  3772     iCoeEnv->CreateResourceReaderLC( reader, aIndicatorResourceId );
       
  3773     newIndicator->ConstructFromResourceL( reader, this );
       
  3774     CleanupStack::PopAndDestroy();  // resource reader
       
  3775 
       
  3776     // Always assign a dynamic UID to avoid clash with pre-defined indicators
       
  3777     TInt dynamicUid = EAknNaviPaneEditorIndicatorDynamicUidRangeFirst;
       
  3778     TInt count      = iIndicators->Count();
       
  3779 
       
  3780     // Loop through indicators and try to find a free dynamic UID.
       
  3781     while ( dynamicUid <= EAknNaviPaneEditorIndicatorDynamicUidRangeLast )
       
  3782         {
       
  3783         for ( TInt ii = 0; ii < count; ii++ )
       
  3784             {
       
  3785             CAknIndicator* indicator = iIndicators->At( ii );
       
  3786             if ( indicator->iUid == dynamicUid )
       
  3787                 {
       
  3788                 dynamicUid++;
       
  3789                 break;
       
  3790                 }
       
  3791             }
       
  3792         break;
       
  3793         }
       
  3794 
       
  3795     if ( dynamicUid <= EAknNaviPaneEditorIndicatorDynamicUidRangeLast )
       
  3796         {
       
  3797         newIndicator->iUid = dynamicUid;
       
  3798         }
       
  3799     else
       
  3800         {
       
  3801         User::Leave( KErrGeneral ); // All dynamic UIDs already in use.
       
  3802         }
       
  3803 
       
  3804 
       
  3805     // Handle flags here
       
  3806     if ( aCustomIndicatorFlags & EMultiColorIndicator )
       
  3807         {
       
  3808         newIndicator->SetMultiColorMode( ETrue );
       
  3809         }
       
  3810 
       
  3811     if ( aCustomIndicatorFlags & EIndicatorPositionInverted )
       
  3812         {
       
  3813         newIndicator->SetIndicatorPosition( ELeftSide );
       
  3814         }
       
  3815     else
       
  3816         {
       
  3817         newIndicator->SetIndicatorPosition( ERightSide );
       
  3818         }
       
  3819 
       
  3820     // Finally add the new indicator and prioritize all.
       
  3821     TUid uid = TUid::Uid( newIndicator->iUid );
       
  3822     iIndicators->AppendL( newIndicator );
       
  3823     CleanupStack::Pop( newIndicator );
       
  3824     newIndicator = NULL;
       
  3825 
       
  3826     PrioritizeIndicatorsL();
       
  3827 
       
  3828     return uid;
       
  3829     }
       
  3830 
       
  3831 
       
  3832 // ---------------------------------------------------------------------------
       
  3833 // CAknIndicatorContainer::ReplaceIndicatorIconL
       
  3834 // Replaces the icon of an existing indicator.
       
  3835 // ---------------------------------------------------------------------------
       
  3836 //
       
  3837 EXPORT_C void CAknIndicatorContainer::ReplaceIndicatorIconL(
       
  3838     TUid aIndicator,
       
  3839     TInt /*aState*/,
       
  3840     TInt aLayoutMode,
       
  3841     CFbsBitmap* aIconBitmap,
       
  3842     CFbsBitmap* aIconMask,
       
  3843     TInt aIconIndex )
       
  3844     {
       
  3845     TInt count = iIndicators->Count();
       
  3846     CAknIndicator* indicator = NULL;
       
  3847     for ( TInt ii = 0; ii < count; ii++ )
       
  3848         {
       
  3849         indicator = iIndicators->At( ii );
       
  3850         if ( indicator && indicator->iUid == aIndicator.iUid )
       
  3851             {
       
  3852             // This ensures all default bitmaps are created.
       
  3853             indicator->CreateLoadedIndicatorBitmapsL();
       
  3854 
       
  3855             if ( aIconBitmap &&
       
  3856                  indicator->iIndicatorBitmaps[aLayoutMode]->At( aIconIndex ) )
       
  3857                 {
       
  3858                 delete indicator->iIndicatorBitmaps[aLayoutMode]->At( aIconIndex );
       
  3859                 indicator->iIndicatorBitmaps[aLayoutMode]->At( aIconIndex ) = aIconBitmap;
       
  3860                 }
       
  3861 
       
  3862             if ( aIconMask &&
       
  3863                  indicator->iIndicatorBitmaps[aLayoutMode]->At( aIconIndex + 1 ) )
       
  3864                 {
       
  3865                 delete indicator->iIndicatorBitmaps[aLayoutMode]->At( aIconIndex + 1 );
       
  3866                 indicator->iIndicatorBitmaps[aLayoutMode]->At( aIconIndex + 1 ) = aIconMask;
       
  3867                 }
       
  3868 
       
  3869             break;
       
  3870             }
       
  3871         }
       
  3872 
       
  3873     if ( indicator &&
       
  3874          indicator->IndicatorState() ||
       
  3875          indicator->Priority() != KIndicatorNotShown )
       
  3876         {
       
  3877         SizeChanged();
       
  3878         DrawDeferred();
       
  3879         }
       
  3880     }
       
  3881 
       
  3882 // ---------------------------------------------------------------------------
       
  3883 // CAknIndicatorContainer::CreateIndicatorFromPaneResourceL
       
  3884 // Creates a status indicator from an indicator pane resource.
       
  3885 // ---------------------------------------------------------------------------
       
  3886 //
       
  3887 void CAknIndicatorContainer::CreateIndicatorFromPaneResourceL(
       
  3888     TUid aUid,
       
  3889     TInt aIndicatorPaneResourceId,
       
  3890     TInt aCustomIndicatorFlags )
       
  3891     {
       
  3892     TResourceReader res;
       
  3893     iEikonEnv->CreateResourceReaderLC( res, aIndicatorPaneResourceId );
       
  3894 
       
  3895     TInt indicatorCount = res.ReadInt16();
       
  3896     for ( TInt ii = 0; ii < indicatorCount; ii++ )
       
  3897         {
       
  3898         TInt foundUid = res.ReadInt16();
       
  3899         if ( foundUid == aUid.iUid )
       
  3900             {
       
  3901             res.Rewind( sizeof( TInt16 ) );
       
  3902             CAknIndicator* indicator =
       
  3903                 new (ELeave) CAknIndicator ( iIndicatorContext );
       
  3904             CleanupStack::PushL( indicator );
       
  3905             indicator->SetContainerWindowL( *this );
       
  3906             indicator->ConstructFromResourceL( res, this );
       
  3907             iIndicators->AppendL( indicator );
       
  3908 
       
  3909             if ( aCustomIndicatorFlags & EMultiColorIndicator )
       
  3910                 {
       
  3911                 indicator->SetMultiColorMode( ETrue );
       
  3912                 }
       
  3913 
       
  3914             // Editor indicator positions are set separately.
       
  3915             if ( iIndicatorContext == EUniversalIndicators )
       
  3916                 {
       
  3917                 if ( aCustomIndicatorFlags & EIndicatorPositionInverted )
       
  3918                     {
       
  3919                     indicator->SetIndicatorPosition( ELeftSide );
       
  3920                     }
       
  3921                 else
       
  3922                     {
       
  3923                     indicator->SetIndicatorPosition( ERightSide );
       
  3924                     }
       
  3925                 }
       
  3926 
       
  3927             indicator->SetLayoutMode(
       
  3928                 (CAknIndicator::TLayoutMode) SelectIndicatorLayoutMode() );
       
  3929 
       
  3930             CleanupStack::Pop( indicator );
       
  3931             indicator = NULL;
       
  3932             break;
       
  3933             }
       
  3934         else
       
  3935             {
       
  3936             res.ReadInt16();
       
  3937             res.ReadInt16();
       
  3938             HBufC* bitmapFile = res.ReadHBufCL(); // bmp filename
       
  3939             delete bitmapFile;
       
  3940             bitmapFile = NULL;
       
  3941             TInt numberOfStates = res.ReadInt16();  // Number of states
       
  3942             for ( TInt i = 0; i < numberOfStates; i++ )
       
  3943                 {
       
  3944                 res.ReadInt16(); // State id
       
  3945                 TInt numberOfIcons = res.ReadInt16();
       
  3946                 for ( TInt j = 0; j < numberOfIcons; j++ )
       
  3947                     {
       
  3948                     for ( TInt jj = ELayoutModeUsual; jj <= ELayoutModeWide; jj++ )
       
  3949                         {
       
  3950                         res.ReadInt16(); // bitmaps
       
  3951                         res.ReadInt16(); // mask
       
  3952                         }
       
  3953                     }
       
  3954                 }
       
  3955             }
       
  3956         }
       
  3957 
       
  3958     CleanupStack::PopAndDestroy();  // res
       
  3959     }
       
  3960 
       
  3961 
       
  3962 // ---------------------------------------------------------------------------
       
  3963 // CAknIndicatorContainer::IndicatorExists
       
  3964 // Checks if an indicator already exists in the indicator array.
       
  3965 // ---------------------------------------------------------------------------
       
  3966 //
       
  3967 TBool CAknIndicatorContainer::IndicatorExists( TUid aUid ) const
       
  3968     {
       
  3969     TBool exists( EFalse );
       
  3970 
       
  3971     TInt count = iIndicators->Count();
       
  3972     for ( TInt ii = 0; ii < count; ii++ )
       
  3973         {
       
  3974         if ( iIndicators->At( ii )->Uid() == aUid )
       
  3975             {
       
  3976             exists = ETrue;
       
  3977             break;
       
  3978             }
       
  3979         }
       
  3980 
       
  3981     return exists;
       
  3982     }
       
  3983 
       
  3984 // ---------------------------------------------------------------------------
       
  3985 // CAknIndicatorContainer::CreateIncallBubbleL
       
  3986 // Creates the small incall status bubble.
       
  3987 // ---------------------------------------------------------------------------
       
  3988 //
       
  3989 void CAknIndicatorContainer::CreateIncallBubbleL()
       
  3990     {
       
  3991 	// Create incall indicator, use empty rect.
       
  3992 	// Correct size is set in IncallBubbleSizeChanged.
       
  3993     iIncallBubble = CIncallStatusBubble::NewL( TRect() );
       
  3994     iIncallBubble->SetFlags( 0 );
       
  3995     iIncallBubble->MakeVisible( EFalse );
       
  3996     iIncallBubble->SetFaded( CAknSgcClient::IsSystemFaded() );
       
  3997     }
       
  3998 
       
  3999 
       
  4000 TBool CAknIndicatorContainer::UpdateSmallLayoutL()
       
  4001     {
       
  4002     // Needed only if small status pane is in use.
       
  4003     if ( AknStatuspaneUtils::SmallLayoutActive() )
       
  4004         {
       
  4005         CEikStatusPaneBase* statusPane = CEikStatusPaneBase::Current();
       
  4006 
       
  4007         if ( statusPane )
       
  4008             {
       
  4009             TInt statusPaneCurrentLayoutResourceId = statusPane->CurrentLayoutResId();
       
  4010             TInt statusPaneRequiredLayoutResourceId =
       
  4011                 AVKONENV->StatusPaneResIdForCurrentLayout(R_AVKON_STATUS_PANE_LAYOUT_SMALL);
       
  4012 
       
  4013             TInt last = iIndicators->Count() - 1;
       
  4014             for (TInt j = 0; j <= last; j++)
       
  4015                 {
       
  4016                 CAknIndicator* indicator = iIndicators->At(j);
       
  4017                 TUid uid = indicator->Uid();
       
  4018 
       
  4019                 if ( uid == TUid::Uid(EAknNaviPaneEditorIndicatorGprs) )
       
  4020                     {
       
  4021                     if ( indicator->IndicatorState() )
       
  4022                         {
       
  4023                         if ( AknLayoutUtils::LayoutMirrored() )
       
  4024                             {
       
  4025                             statusPaneRequiredLayoutResourceId =
       
  4026                             AVKONENV->StatusPaneResIdForCurrentLayout(
       
  4027                                 R_AVKON_STATUS_PANE_LAYOUT_SMALL_WITH_SIGNAL_PANE_MIRRORED);
       
  4028                             }
       
  4029                         else
       
  4030                             {
       
  4031                             statusPaneRequiredLayoutResourceId =
       
  4032                                 AVKONENV->StatusPaneResIdForCurrentLayout(
       
  4033                                     R_AVKON_STATUS_PANE_LAYOUT_SMALL_WITH_SIGNAL_PANE);
       
  4034                             }
       
  4035                         break;
       
  4036                         }
       
  4037                     }
       
  4038                 }
       
  4039 
       
  4040             // switch layout if needed
       
  4041             if ( statusPaneCurrentLayoutResourceId != statusPaneRequiredLayoutResourceId )
       
  4042                 {
       
  4043                 if (iExtension && !iExtension->iSwitchLayoutInProgress)
       
  4044                     {
       
  4045                     iExtension->iSwitchLayoutInProgress = ETrue;
       
  4046                     statusPane->SwitchLayoutL( statusPaneRequiredLayoutResourceId );
       
  4047                     return ETrue;
       
  4048                     }
       
  4049                 }
       
  4050             else
       
  4051                 {
       
  4052                 if (iExtension)
       
  4053                     {
       
  4054                     iExtension->iSwitchLayoutInProgress = EFalse;
       
  4055                     }
       
  4056                 }
       
  4057             }
       
  4058         }
       
  4059 
       
  4060     // layout not changed
       
  4061     return EFalse;
       
  4062     }
       
  4063 
       
  4064 
       
  4065 void CAknIndicatorContainer::SetIncallBubbleDisabled( TBool aDisabled )
       
  4066     {
       
  4067     if ( iExtension )
       
  4068         {
       
  4069         iExtension->iIncallBubbleDisabled = aDisabled;
       
  4070         }
       
  4071     }
       
  4072 
       
  4073 void CAknIndicatorContainer::ResetAnimTicker( TBool bForeground )
       
  4074     {
       
  4075     iExtension->iIsForeground = bForeground;
       
  4076 
       
  4077     CEikStatusPaneBase* statusPane = CEikStatusPaneBase::Current();
       
  4078     TInt curId = R_AVKON_STATUS_PANE_LAYOUT_USUAL;
       
  4079     if ( statusPane )
       
  4080         {
       
  4081         curId = statusPane->CurrentLayoutResId();
       
  4082         }
       
  4083     // if not foreground, cancel the timer
       
  4084     if ( !iExtension->iIsForeground ||
       
  4085             R_AVKON_STATUS_PANE_LAYOUT_EMPTY == curId )
       
  4086         {
       
  4087         if ( iTicker->IsActive() )
       
  4088             {
       
  4089             iTicker->Cancel();
       
  4090             }
       
  4091         return;
       
  4092         }
       
  4093 
       
  4094     if ( !iTicker->IsActive() && iAnimatedIndicatorsShown > 0 )
       
  4095         {
       
  4096         iTicker->Start( KAknIndicatorAnimationShortDelay,
       
  4097                         KAknIndicatorAnimationInterval,
       
  4098                         TCallBack( TickerCallback, this ) );
       
  4099         }
       
  4100     else if ( iTicker->IsActive() && iAnimatedIndicatorsShown == 0 )
       
  4101         {
       
  4102         // Cancel animation timer if animated indicators
       
  4103         // are not visible anymore.
       
  4104         iTicker->Cancel();
       
  4105         iSynchronizingValue = 0;
       
  4106         }
       
  4107     }
       
  4108 
       
  4109 //  End of File