messagingappbase/msgeditor/appuisrc/MsgNaviPaneControl.cpp
branchRCL_3
changeset 60 7fdbb852d323
equal deleted inserted replaced
57:ebe688cedc25 60:7fdbb852d323
       
     1 /*
       
     2 * Copyright (c) 2007 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:  MsgNaviPaneControl implementation
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // ========== INCLUDE FILES ================================
       
    21 
       
    22 #include <coecontrolarray.h>
       
    23 #include <eiklabel.h>
       
    24 #include <eikimage.h>
       
    25 
       
    26 #include <data_caging_path_literals.hrh>
       
    27 #include <barsread.h>               // TResourceReader
       
    28 #include <gulicon.h>                // CGulIcon
       
    29 #include <AknsUtils.h>
       
    30 #include <AknsConstants.h>
       
    31 #include <AknUtils.h>
       
    32 #include <avkon.rsg>
       
    33 #include <layoutmetadata.cdl.h>     // Layout
       
    34 #include <applayout.cdl.h>          // LAF
       
    35 #include <AknStatuspaneUtils.h>     // AknStatuspaneUtils
       
    36 #include <aknlayoutscalable_apps.cdl.h>
       
    37 #include <StringLoader.h>
       
    38 #include <MuiuMessageIterator.h>    // for CMessageIterator
       
    39 #include <muiumsvuiserviceutilitiesinternal.h>
       
    40 #include <MsgEditorAppUi.rsg>       // resouce identifiers
       
    41 
       
    42 #ifdef RD_TACTILE_FEEDBACK
       
    43 #include <touchfeedback.h>
       
    44 #endif 
       
    45 
       
    46 #include <msgeditor.mbg>
       
    47 
       
    48 #include "MsgNaviPaneControl.h"
       
    49 #include "MsgNaviPaneControlObserver.h"
       
    50 
       
    51 // ========== EXTERNAL DATA STRUCTURES =====================
       
    52 
       
    53 // ========== EXTERNAL FUNCTION PROTOTYPES =================
       
    54 
       
    55 // ========== CONSTANTS ====================================
       
    56 
       
    57 _LIT( KIconMbmFile, "msgeditor.mbm" );
       
    58 const TInt KTimeStringMaxLength = 32;
       
    59 
       
    60 // ========== MACROS =======================================
       
    61 
       
    62 // ========== LOCAL CONSTANTS AND MACROS ===================
       
    63 
       
    64 // ========== MODULE DATA STRUCTURES =======================
       
    65 
       
    66 // ========== LOCAL FUNCTION PROTOTYPES ====================
       
    67 
       
    68 // ========== LOCAL FUNCTIONS ==============================
       
    69 
       
    70 // ========== MEMBER FUNCTIONS =============================
       
    71 
       
    72 // ----------------------------------------------------------------------------
       
    73 // CMsgNaviPaneControl::CMsgNaviPaneControl
       
    74 // C++ default constructor.
       
    75 // ----------------------------------------------------------------------------
       
    76 //
       
    77 CMsgNaviPaneControl::CMsgNaviPaneControl()
       
    78     {
       
    79     }
       
    80 
       
    81 // ----------------------------------------------------------------------------
       
    82 // CMsgNaviPaneControl::ConstructL
       
    83 // Symbian 2nd phase constructor.
       
    84 // ----------------------------------------------------------------------------
       
    85 //
       
    86 #ifdef RD_MSG_NAVIPANE_IMPROVEMENT
       
    87 void CMsgNaviPaneControl::ConstructL( const CCoeControl* aParent )
       
    88     {
       
    89     SetContainerWindowL( *aParent );
       
    90     
       
    91     iControlArray = CCoeControlArray::NewL( *this );
       
    92     iControlArray->SetControlsOwnedExternally( EFalse );
       
    93     iPriorityIndicator = EFalse;
       
    94     iMessageIterator = NULL;
       
    95     UpdateVarientId();
       
    96     SetComponentsToInheritVisibility( ETrue );
       
    97     ActivateL();
       
    98     }
       
    99 #else
       
   100 void CMsgNaviPaneControl::ConstructL( const CCoeControl* /*aParent*/ )
       
   101     {
       
   102     User::Leave( KErrNotSupported );
       
   103     }
       
   104 #endif
       
   105 
       
   106 
       
   107 // ---------------------------------------------------------
       
   108 // CMsgNaviPaneControl::NewL
       
   109 //
       
   110 // Symbian two phased constructor
       
   111 // ---------------------------------------------------------
       
   112 //
       
   113 EXPORT_C CMsgNaviPaneControl* CMsgNaviPaneControl::NewL( const CCoeControl* aParent )
       
   114     {
       
   115     CMsgNaviPaneControl* self = new(ELeave) CMsgNaviPaneControl();
       
   116     
       
   117     CleanupStack::PushL( self );
       
   118     self->ConstructL( aParent );
       
   119     CleanupStack::Pop( self );
       
   120 
       
   121     return self;
       
   122     }
       
   123 
       
   124 // ----------------------------------------------------------------------------
       
   125 // CMsgNaviPaneControl::~CMsgNaviPaneControl
       
   126 // Destructor.
       
   127 // ----------------------------------------------------------------------------
       
   128 //
       
   129 CMsgNaviPaneControl::~CMsgNaviPaneControl()
       
   130     {
       
   131     delete iControlArray;
       
   132     delete iMessageIterator;
       
   133     }
       
   134 
       
   135 // ----------------------------------------------------------------------------
       
   136 // CMsgNaviPaneControl::SetTimeIndicatorL
       
   137 // ----------------------------------------------------------------------------
       
   138 //
       
   139 EXPORT_C void CMsgNaviPaneControl::SetTimeIndicatorL( TTime aTime, TBool aUtcTime )
       
   140     {
       
   141     if ( aUtcTime )
       
   142         {
       
   143         MsvUiServiceUtilitiesInternal::ConvertUtcToLocalTime( aTime );
       
   144         }    
       
   145     
       
   146     iTime = aTime;
       
   147     
       
   148     UpdateTimeIndicatorL();
       
   149     }
       
   150         
       
   151 // ----------------------------------------------------------------------------
       
   152 // CMsgNaviPaneControl::SetPriorityIndicatorL
       
   153 // ----------------------------------------------------------------------------
       
   154 //
       
   155 EXPORT_C void CMsgNaviPaneControl::SetPriorityIndicatorL( TMsgEditorMsgPriority aPriority )
       
   156     {
       
   157     iPriority = aPriority;
       
   158     
       
   159     UpdatePriorityIndicatorL();
       
   160     }
       
   161         
       
   162 // ----------------------------------------------------------------------------
       
   163 // CMsgNaviPaneControl::SetNavigationIndicatorL
       
   164 // ----------------------------------------------------------------------------
       
   165 //
       
   166 EXPORT_C void CMsgNaviPaneControl::SetNavigationIndicatorL( CMsvSession& aSession,
       
   167                                                    const TMsvEntry& aCurrentMessage )
       
   168     {
       
   169     if(!iMessageIterator)
       
   170         {
       
   171         // Iterator will be deleted once in the destructer only.
       
   172         //deleting and creating it again is degrading the performance
       
   173  
       
   174         iMessageIterator = CMessageIterator::NewL( aSession, aCurrentMessage );
       
   175         iMessageIterator->SetMessageIteratorObserver( this );
       
   176         }
       
   177     UpdateNavigationIndicatorsL();
       
   178     }
       
   179 
       
   180 // ----------------------------------------------------------------------------
       
   181 // CMsgNaviPaneControl::SetNavigationControlObserver
       
   182 // ----------------------------------------------------------------------------
       
   183 //
       
   184 EXPORT_C void CMsgNaviPaneControl::SetNavigationControlObserver( MMsgNaviPaneControlObserver* aObserver)
       
   185     {
       
   186     iObserver = aObserver;
       
   187     }
       
   188 
       
   189 // ----------------------------------------------------------------------------
       
   190 // CMsgNaviPaneControl::CountComponentControls
       
   191 // Returns number of child controls.
       
   192 // ----------------------------------------------------------------------------
       
   193 //
       
   194 TInt CMsgNaviPaneControl::CountComponentControls() const
       
   195     {
       
   196     return iControlArray->Count();
       
   197     }
       
   198 
       
   199 // ----------------------------------------------------------------------------
       
   200 // CMsgNaviPaneControl::ComponentControl
       
   201 // Returns specified child controls.
       
   202 // ----------------------------------------------------------------------------
       
   203 //
       
   204 CCoeControl* CMsgNaviPaneControl::ComponentControl( TInt aIndex ) const
       
   205     {
       
   206     return iControlArray->At( aIndex ).iControl;
       
   207     }
       
   208 
       
   209 // ----------------------------------------------------------------------------
       
   210 // CMsgNaviPaneControl::SizeChanged
       
   211 // ----------------------------------------------------------------------------
       
   212 //
       
   213 void CMsgNaviPaneControl::SizeChanged()
       
   214     {
       
   215     LayoutIndicators();
       
   216     }
       
   217         
       
   218 // ----------------------------------------------------------------------------
       
   219 // CMsgNaviPaneControl::PositionChanged
       
   220 // ----------------------------------------------------------------------------
       
   221 //      
       
   222 void CMsgNaviPaneControl::PositionChanged()
       
   223     {
       
   224     LayoutIndicators();
       
   225     }
       
   226 
       
   227 // ----------------------------------------------------------------------------
       
   228 // CMsgNaviPaneControl::HandlePointerEventL
       
   229 // ----------------------------------------------------------------------------
       
   230 //      
       
   231 void CMsgNaviPaneControl::HandlePointerEventL( const TPointerEvent& aPointerEvent )
       
   232     {
       
   233     TBool tactilefeedback = EFalse;
       
   234     if ( iObserver &&
       
   235          aPointerEvent.iType == TPointerEvent::EButton1Down ||
       
   236          aPointerEvent.iType == TPointerEvent::EButton1Up )
       
   237         {
       
   238         CEikImage* leftArrowIndicator = iControlArray->ControlById<CEikImage>( EMsgNaviLeftArrowControlId );
       
   239         CEikImage* rightArrowIndicator = iControlArray->ControlById<CEikImage>( EMsgNaviRightArrowControlId );
       
   240         
       
   241         if ( aPointerEvent.iType == TPointerEvent::EButton1Down )
       
   242             {
       
   243             iPreviouslyFocusedControl = NULL;
       
   244             }
       
   245         
       
   246         if ( leftArrowIndicator &&
       
   247              iLeftArrowTouchRect.Contains( aPointerEvent.iPosition ) )
       
   248             {
       
   249             tactilefeedback = ETrue;
       
   250             if ( aPointerEvent.iType == TPointerEvent::EButton1Down )
       
   251                 {
       
   252                 iPreviouslyFocusedControl = leftArrowIndicator;
       
   253                 }
       
   254             else if ( iPreviouslyFocusedControl == leftArrowIndicator )
       
   255                 {
       
   256                 iObserver->HandleNavigationControlEventL( 
       
   257                             MMsgNaviPaneControlObserver::EMsgNaviLeftArrowPressed );
       
   258                 }
       
   259             }
       
   260         else if ( rightArrowIndicator &&
       
   261                   iRightArrowTouchRect.Contains( aPointerEvent.iPosition ) )
       
   262             {
       
   263             tactilefeedback = ETrue;
       
   264             if ( aPointerEvent.iType == TPointerEvent::EButton1Down )
       
   265                 {
       
   266                 iPreviouslyFocusedControl = rightArrowIndicator;
       
   267                 }
       
   268             else if ( iPreviouslyFocusedControl == rightArrowIndicator )
       
   269                 {
       
   270                 iObserver->HandleNavigationControlEventL( 
       
   271                             MMsgNaviPaneControlObserver::EMsgNaviRightArrowPressed );
       
   272                 }
       
   273             }
       
   274         }
       
   275 #ifdef RD_TACTILE_FEEDBACK 
       
   276      if ( aPointerEvent.iType == TPointerEvent::EButton1Down && tactilefeedback )
       
   277         {
       
   278         MTouchFeedback* feedback = MTouchFeedback::Instance();
       
   279         if ( feedback )
       
   280             {
       
   281             feedback->InstantFeedback( this, ETouchFeedbackBasic );                        
       
   282             }                                     
       
   283         }
       
   284 #endif
       
   285     }
       
   286 
       
   287 // ----------------------------------------------------------------------------
       
   288 // CMsgNaviPaneControl::HandleResourceChange
       
   289 // ----------------------------------------------------------------------------
       
   290 //      
       
   291 void CMsgNaviPaneControl::HandleResourceChange( TInt aType )
       
   292     {
       
   293     if ( aType == KAknsMessageSkinChange )
       
   294         {
       
   295         UpdateVarientId();
       
   296         TRAP_IGNORE( HandleSkinChangeL() );
       
   297         }
       
   298     }
       
   299 
       
   300 // ----------------------------------------------------------------------------
       
   301 // CMsgNaviPaneControl::HandleIteratorEventL
       
   302 // ----------------------------------------------------------------------------
       
   303 //      
       
   304 void CMsgNaviPaneControl::HandleIteratorEventL( TMessageIteratorEvent aEvent )
       
   305     {
       
   306     if ( aEvent == EFolderCountChanged )
       
   307         {
       
   308         UpdateVarientId();
       
   309         UpdateNavigationIndicatorsL();
       
   310         LayoutNavigationIndicators();
       
   311         }
       
   312     }
       
   313     
       
   314 // ----------------------------------------------------------------------------
       
   315 // CMsgNaviPaneControl::LayoutIndicators
       
   316 // Sets correct layout for volume control according current LAF. Determines also
       
   317 // if either of the arrow icons are overlapping with the pause indicator.
       
   318 // ----------------------------------------------------------------------------
       
   319 //
       
   320 void CMsgNaviPaneControl::LayoutIndicators()
       
   321     {
       
   322     UpdateVarientId();
       
   323     LayoutTimeIndicator();
       
   324     LayoutNavigationIndicators();
       
   325     LayoutPriorityIndicator();
       
   326     }
       
   327     
       
   328 // ----------------------------------------------------------------------------
       
   329 // CMsgNaviPaneControl::LayoutNavigationIndicators
       
   330 // ----------------------------------------------------------------------------
       
   331 //
       
   332 void CMsgNaviPaneControl::LayoutNavigationIndicators()
       
   333     {
       
   334     if ( Rect().IsEmpty() )
       
   335         {
       
   336         return;
       
   337         }
       
   338         
       
   339     CEikImage* leftArrowIndicator = iControlArray->ControlById<CEikImage>( EMsgNaviLeftArrowControlId );
       
   340     if ( leftArrowIndicator )
       
   341         {
       
   342         TAknLayoutRect leftArrowPane;
       
   343         if ( AknLayoutUtils::LayoutMirrored() )
       
   344             {
       
   345             leftArrowPane.LayoutRect( Rect(), AknLayoutScalable_Apps::navi_pane_g3(iVarientId) );
       
   346             }
       
   347         else
       
   348             {
       
   349             leftArrowPane.LayoutRect( Rect(), AknLayoutScalable_Apps::navi_pane_g2(iVarientId));
       
   350             }
       
   351         
       
   352         SetIconIndicatorExtent( leftArrowIndicator, leftArrowPane );    
       
   353         }
       
   354     
       
   355     CEikImage* rightArrowIndicator = iControlArray->ControlById<CEikImage>( EMsgNaviRightArrowControlId );
       
   356     if ( rightArrowIndicator )
       
   357         {
       
   358         TAknLayoutRect rightArrowPane;
       
   359         if ( AknLayoutUtils::LayoutMirrored() )
       
   360             {
       
   361             rightArrowPane.LayoutRect( Rect(), AknLayoutScalable_Apps::navi_pane_g2(iVarientId) );
       
   362             }
       
   363         else
       
   364             {
       
   365             rightArrowPane.LayoutRect( Rect(), AknLayoutScalable_Apps::navi_pane_g3(iVarientId));
       
   366             }
       
   367         
       
   368         
       
   369         SetIconIndicatorExtent( rightArrowIndicator, rightArrowPane );    
       
   370         }
       
   371 
       
   372     if ( AknLayoutUtils::PenEnabled() )
       
   373         {
       
   374         TAknLayoutRect leftArrowTouchRect;
       
   375         leftArrowTouchRect.LayoutRect( Rect(), AknLayoutScalable_Apps::aid_size_touch_mv_arrow_left(iVarientId) );
       
   376     
       
   377         TAknLayoutRect rightArrowTouchRect;
       
   378         rightArrowTouchRect.LayoutRect( Rect(), AknLayoutScalable_Apps::aid_size_touch_mv_arrow_right(iVarientId) );
       
   379         if ( AknLayoutUtils::LayoutMirrored() )
       
   380         	{
       
   381         		iLeftArrowTouchRect=rightArrowTouchRect.Rect();
       
   382         		iRightArrowTouchRect= leftArrowTouchRect.Rect();
       
   383         	}
       
   384         else
       
   385         	{
       
   386         		iLeftArrowTouchRect=leftArrowTouchRect.Rect();
       
   387         		iRightArrowTouchRect= rightArrowTouchRect.Rect();
       
   388         	}
       
   389  
       
   390         }
       
   391     }
       
   392         
       
   393 // ----------------------------------------------------------------------------
       
   394 // CMsgNaviPaneControl::LayoutPriorityIndicator
       
   395 // ----------------------------------------------------------------------------
       
   396 //
       
   397 void CMsgNaviPaneControl::LayoutPriorityIndicator()
       
   398     {
       
   399     if ( Rect().IsEmpty() )
       
   400         {
       
   401         return;
       
   402         }
       
   403     
       
   404     CEikImage* priorityIndicator = iControlArray->ControlById<CEikImage>( EMsgNaviPriorityControlId );
       
   405     if ( priorityIndicator )
       
   406         {
       
   407         TAknLayoutRect priorityPane;
       
   408         if(Layout_Meta_Data::IsLandscapeOrientation()) // in landscape mode
       
   409             {
       
   410             priorityPane.LayoutRect( Rect(), AknLayoutScalable_Apps::navi_pane_mv_g2(2) );      
       
   411             }        
       
   412         else // portrait mode
       
   413             {
       
   414             priorityPane.LayoutRect( Rect(), AknLayoutScalable_Apps::navi_pane_mv_g2(1) );      
       
   415             }            
       
   416         SetIconIndicatorExtent( priorityIndicator, priorityPane );
       
   417         }
       
   418     }
       
   419     
       
   420 // ----------------------------------------------------------------------------
       
   421 // CMsgNaviPaneControl::LayoutTimeIndicatorL
       
   422 // ----------------------------------------------------------------------------
       
   423 //
       
   424 void CMsgNaviPaneControl::LayoutTimeIndicator()
       
   425     {
       
   426     if ( Rect().IsEmpty() )
       
   427         {
       
   428         return;
       
   429         }
       
   430     
       
   431     CEikLabel* timeIndicator = iControlArray->ControlById<CEikLabel>( EMsgNaviTimeControlId );
       
   432     if ( timeIndicator )
       
   433         {
       
   434         TAknLayoutText timePane;
       
   435         timePane.LayoutText( Rect(), AknLayoutScalable_Apps::navi_pane_mv_t1(iVarientId) );
       
   436         
       
   437         timeIndicator->SetRect( timePane.TextRect() );
       
   438         timeIndicator->SetFont( timePane.Font() );
       
   439         
       
   440         TRgb timeColor( AKN_LAF_COLOR( KRgbBlack.Value() ) );
       
   441         
       
   442         AknsUtils::GetCachedColor( AknsUtils::SkinInstance(), 
       
   443                                    timeColor, 
       
   444                                    KAknsIIDQsnIconColors,
       
   445                                    EAknsCIQsnIconColorsCG7 );
       
   446         
       
   447         TRAP_IGNORE( timeIndicator->OverrideColorL( EColorLabelText, timeColor ) );   
       
   448         
       
   449         TInt align( ELayoutAlignNone );
       
   450         switch( timePane.Align() )
       
   451             {
       
   452             case CGraphicsContext::ELeft:
       
   453                 {
       
   454                 align = ELayoutAlignLeft;
       
   455                 break;
       
   456                 }
       
   457             case CGraphicsContext::ECenter:
       
   458                 {
       
   459                 align = ELayoutAlignCenter;
       
   460                 break;
       
   461                 }
       
   462             case CGraphicsContext::ERight:
       
   463                 {
       
   464                 align = ELayoutAlignRight;
       
   465                 break;
       
   466                 }
       
   467             default:
       
   468                 {
       
   469                 break;
       
   470                 }
       
   471             }
       
   472             
       
   473         timeIndicator->SetLabelAlignment( align );
       
   474         }
       
   475     }
       
   476         
       
   477 // ----------------------------------------------------------------------------
       
   478 // CMsgNaviPaneControl::SetIconIndicatorExtent
       
   479 // Sets given icon extent to specified one.
       
   480 // ----------------------------------------------------------------------------
       
   481 //
       
   482 void CMsgNaviPaneControl::SetIconIndicatorExtent( CEikImage* aIconIndicator,
       
   483                                                    const TAknLayoutRect& aExtent) const
       
   484     {
       
   485     TInt result = AknIconUtils::SetSize( const_cast<CFbsBitmap*>( aIconIndicator->Bitmap() ), 
       
   486                                          aExtent.Rect().Size() );
       
   487     
       
   488     if ( result == KErrNone )
       
   489         {
       
   490         aIconIndicator->SetRect( aExtent.Rect() );
       
   491         }
       
   492     else
       
   493         {
       
   494         aIconIndicator->SetRect( TRect() );
       
   495         }
       
   496     }
       
   497 
       
   498 // ----------------------------------------------------------------------------
       
   499 // CMsgNaviPaneControl::InitializeIconIndicatorL
       
   500 // Creates and initializes given member variable icon control with specified bitmap and mask.
       
   501 // ----------------------------------------------------------------------------
       
   502 //
       
   503 void CMsgNaviPaneControl::InitializeIconIndicatorL( CEikImage*& aIndicator, 
       
   504                                                     const TAknsItemID& aItem, 
       
   505                                                     const TInt aBitmapIndex,
       
   506                                                     const TInt aMaskIndex ) const
       
   507     {
       
   508     // Initializes member variable
       
   509     aIndicator = new( ELeave ) CEikImage;
       
   510     aIndicator->SetContainerWindowL( *this );
       
   511     
       
   512     TParse fileParse;
       
   513     User::LeaveIfError( fileParse.Set( KIconMbmFile, &KDC_APP_BITMAP_DIR, NULL ) );
       
   514     
       
   515     CFbsBitmap* bitmap = NULL;
       
   516     CFbsBitmap* mask = NULL;
       
   517     
       
   518     AknsUtils::CreateColorIconL( AknsUtils::SkinInstance(), 
       
   519                                  aItem,
       
   520                                  KAknsIIDQsnIconColors,
       
   521                                  EAknsCIQsnIconColorsCG7,
       
   522                                  bitmap, 
       
   523                                  mask,
       
   524                                  fileParse.FullName(), 
       
   525                                  aBitmapIndex,
       
   526                                  aMaskIndex,
       
   527                                  AKN_LAF_COLOR( KRgbBlack.Value() ) ); 
       
   528                                      
       
   529     
       
   530     aIndicator->SetNewBitmaps( bitmap, mask );
       
   531     }
       
   532 
       
   533 // ----------------------------------------------------------------------------
       
   534 // CSmilPlayerVolumeIndicatorController::UpdateNavigationIndicatorsL
       
   535 // ----------------------------------------------------------------------------
       
   536 //
       
   537 void CMsgNaviPaneControl::UpdateNavigationIndicatorsL()
       
   538     {
       
   539     if ( iEikonEnv->StartedAsServerApp() )
       
   540         {
       
   541         TBool nextMessage = iMessageIterator->NextMessageExists();
       
   542         TBool previousMessage = iMessageIterator->PreviousMessageExists();
       
   543         
       
   544         CEikImage* rightArrowIndicator = iControlArray->ControlById<CEikImage>( EMsgNaviRightArrowControlId );
       
   545         CEikImage* leftArrowIndicator = iControlArray->ControlById<CEikImage>( EMsgNaviLeftArrowControlId );
       
   546         CEikImage* navigationIndicator = iControlArray->ControlById<CEikImage>( EMsgNaviNavigationControlId );
       
   547 
       
   548         if ( AknLayoutUtils::LayoutMirrored() )
       
   549             {
       
   550             TBool temp = nextMessage;
       
   551             nextMessage = previousMessage;
       
   552             previousMessage = temp;
       
   553             }
       
   554 
       
   555         if ( nextMessage )
       
   556             {
       
   557             if ( !rightArrowIndicator )
       
   558                 {
       
   559                 InitializeIconIndicatorL( rightArrowIndicator, 
       
   560                                           KAknsIIDQgnIndiNaviArrowRight,
       
   561                                           EMbmMsgeditorQgn_indi_navi_arrow_right, 
       
   562                                           EMbmMsgeditorQgn_indi_navi_arrow_right_mask );
       
   563                                           
       
   564                 AddToControlArrayL( rightArrowIndicator, EMsgNaviRightArrowControlId );
       
   565                 }
       
   566             }
       
   567         else
       
   568             {
       
   569             RemoveFromControlArray( EMsgNaviRightArrowControlId );
       
   570             rightArrowIndicator = NULL;
       
   571             }
       
   572         
       
   573         if ( previousMessage )
       
   574             {
       
   575             if ( !leftArrowIndicator )
       
   576                 {
       
   577                 InitializeIconIndicatorL( leftArrowIndicator, 
       
   578                                           KAknsIIDQgnIndiNaviArrowLeft,
       
   579                                           EMbmMsgeditorQgn_indi_navi_arrow_left, 
       
   580                                           EMbmMsgeditorQgn_indi_navi_arrow_left_mask );
       
   581                                           
       
   582                 AddToControlArrayL( leftArrowIndicator, EMsgNaviLeftArrowControlId );
       
   583                 }
       
   584             }
       
   585         else
       
   586             {
       
   587             RemoveFromControlArray( EMsgNaviLeftArrowControlId );
       
   588             leftArrowIndicator = NULL;
       
   589             }
       
   590         
       
   591         if ( rightArrowIndicator || leftArrowIndicator )
       
   592             {
       
   593             LayoutNavigationIndicators();
       
   594             }
       
   595         else
       
   596             {
       
   597             RemoveFromControlArray( EMsgNaviNavigationControlId );
       
   598             }
       
   599         
       
   600         DrawDeferred();
       
   601         }
       
   602     }
       
   603 
       
   604 // ----------------------------------------------------------------------------
       
   605 // CMsgNaviPaneControl::UpdatePriorityIndicatorL
       
   606 // ----------------------------------------------------------------------------
       
   607 //
       
   608 void CMsgNaviPaneControl::UpdatePriorityIndicatorL()
       
   609     {
       
   610     RemoveFromControlArray( EMsgNaviPriorityControlId );
       
   611     
       
   612     CEikImage* priorityIndicator = NULL;
       
   613     
       
   614     if ( iPriority == EMsgEditorMsgPriorityLow )
       
   615         {
       
   616         InitializeIconIndicatorL( priorityIndicator, 
       
   617                                   KAknsIIDQgnIndiMcePriorityLow,
       
   618                                   EMbmMsgeditorQgn_indi_mce_priority_low, 
       
   619                                   EMbmMsgeditorQgn_indi_mce_priority_low_mask );
       
   620         }
       
   621     else if ( iPriority == EMsgEditorMsgPriorityHigh )
       
   622         {
       
   623         InitializeIconIndicatorL( priorityIndicator, 
       
   624                                   KAknsIIDQgnIndiMcePriorityHigh,
       
   625                                   EMbmMsgeditorQgn_indi_mce_priority_high, 
       
   626                                   EMbmMsgeditorQgn_indi_mce_priority_high_mask );
       
   627         }
       
   628     
       
   629     if ( priorityIndicator )
       
   630         {
       
   631         iPriorityIndicator = ETrue;
       
   632         AddToControlArrayL( priorityIndicator, EMsgNaviPriorityControlId );
       
   633         LayoutPriorityIndicator();
       
   634         }
       
   635     else
       
   636         {
       
   637         iPriorityIndicator = EFalse;
       
   638         }
       
   639     
       
   640     DrawDeferred();
       
   641     }
       
   642 
       
   643 // ----------------------------------------------------------------------------
       
   644 // CMsgNaviPaneControl::UpdateTimeIndicatorL
       
   645 // ----------------------------------------------------------------------------
       
   646 //
       
   647 void CMsgNaviPaneControl::UpdateTimeIndicatorL()
       
   648     {
       
   649     TTime homeTime;
       
   650     homeTime.HomeTime();
       
   651     
       
   652     TDateTime nowDateTime = homeTime.DateTime();    
       
   653     TDateTime messageDateTime = iTime.DateTime();
       
   654     
       
   655     
       
   656     HBufC* dateFormat = StringLoader::LoadLC( R_QTN_DATE_SHORT_WITH_ZERO, iCoeEnv );
       
   657     TBuf<KTimeStringMaxLength> datestring;
       
   658     iTime.FormatL( datestring, dateFormat->Des() );
       
   659    
       
   660 
       
   661     HBufC* timeFormat = StringLoader::LoadLC( R_QTN_TIME_USUAL,iCoeEnv );
       
   662     TBuf<KTimeStringMaxLength> timestring;
       
   663     iTime.FormatL( timestring, timeFormat->Des() );
       
   664 
       
   665 
       
   666      CDesCArray* array = new( ELeave )CDesCArrayFlat( 2 ); // two items
       
   667      CleanupStack::PushL( array );
       
   668      array->AppendL( timestring );
       
   669      array->AppendL( datestring );
       
   670      HBufC* buff = StringLoader::LoadLC( R_QTN_MSG_TIMESTAMP,*array,iCoeEnv );                   
       
   671                                          
       
   672 
       
   673  
       
   674     CEikLabel* timeIndicator = iControlArray->ControlById<CEikLabel>( EMsgNaviTimeControlId );
       
   675     if ( !timeIndicator )
       
   676         {
       
   677         timeIndicator = new( ELeave ) CEikLabel;
       
   678         AddToControlArrayL( timeIndicator, EMsgNaviTimeControlId );
       
   679         
       
   680         timeIndicator->SetContainerWindowL( *this );
       
   681         }
       
   682     
       
   683    	TPtr datetimePtr = buff->Des();
       
   684    	AknTextUtils::DisplayTextLanguageSpecificNumberConversion(datetimePtr);
       
   685     
       
   686     timeIndicator->SetTextL(buff->Des());
       
   687   	CleanupStack::PopAndDestroy(4); // buff,array,timeformat,dateformat
       
   688   	    
       
   689     LayoutTimeIndicator();
       
   690     DrawDeferred();
       
   691     }
       
   692 
       
   693 // ----------------------------------------------------------------------------
       
   694 // CMsgNaviPaneControl::AddToControlArrayL
       
   695 // ----------------------------------------------------------------------------
       
   696 //
       
   697 void CMsgNaviPaneControl::AddToControlArrayL( CCoeControl* aControl, TMsgNaviControlId aControlId )
       
   698     {
       
   699     iControlArray->AppendLC( aControl, aControlId );
       
   700     CleanupStack::Pop( aControl );
       
   701     }
       
   702 
       
   703 // ----------------------------------------------------------------------------
       
   704 // CMsgNaviPaneControl::RemoveFromControlArray
       
   705 // ----------------------------------------------------------------------------
       
   706 //
       
   707 void CMsgNaviPaneControl::RemoveFromControlArray( TMsgNaviControlId aControlId )
       
   708     {
       
   709     CCoeControl* control = iControlArray->RemoveById( aControlId );
       
   710     delete control;
       
   711     }
       
   712 
       
   713 // ----------------------------------------------------------------------------
       
   714 // CMsgNaviPaneControl::HandleSkinChangeL
       
   715 //
       
   716 // Sets the currently used skin color for shown indicators.
       
   717 // ----------------------------------------------------------------------------
       
   718 //
       
   719 void CMsgNaviPaneControl::HandleSkinChangeL()
       
   720     {
       
   721     TRgb indicatorColor( AKN_LAF_COLOR( KRgbBlack.Value() ) );
       
   722     AknsUtils::GetCachedColor( AknsUtils::SkinInstance(), 
       
   723             indicatorColor, 
       
   724             KAknsIIDQsnIconColors,
       
   725             EAknsCIQsnIconColorsCG7 );
       
   726     
       
   727     CEikLabel* timeIndicator = iControlArray->ControlById<CEikLabel>( EMsgNaviTimeControlId );
       
   728     if ( timeIndicator )
       
   729         {        
       
   730         timeIndicator->OverrideColorL( EColorLabelText, indicatorColor );
       
   731         }
       
   732     
       
   733     RemoveFromControlArray( EMsgNaviPriorityControlId );
       
   734     UpdatePriorityIndicatorL();
       
   735     
       
   736     RemoveFromControlArray( EMsgNaviRightArrowControlId );
       
   737     RemoveFromControlArray( EMsgNaviLeftArrowControlId );
       
   738     RemoveFromControlArray( EMsgNaviNavigationControlId );
       
   739     UpdateNavigationIndicatorsL();
       
   740     }
       
   741 
       
   742 // ----------------------------------------------------------------------------
       
   743 // CMsgNaviPaneControl::UpdateVarientId
       
   744 //
       
   745 // Depending upon the orientation and Priority of the Message. varientid is set.
       
   746 // ----------------------------------------------------------------------------
       
   747 //
       
   748 void CMsgNaviPaneControl::UpdateVarientId()
       
   749     {
       
   750         if(Layout_Meta_Data::IsLandscapeOrientation()) 
       
   751             {
       
   752             if(iPriorityIndicator)
       
   753                 {
       
   754                 iVarientId = 4;    
       
   755                 }
       
   756             else
       
   757                 {
       
   758                 iVarientId = 3;    
       
   759                 }                            
       
   760             }
       
   761         else // portrait mode 
       
   762             {
       
   763             if(iPriorityIndicator)
       
   764                 {
       
   765                 iVarientId = 2;    
       
   766                 }
       
   767             else
       
   768                 {
       
   769                 iVarientId = 1;    
       
   770                 }                  
       
   771             }    
       
   772     }
       
   773 
       
   774 // ----------------------------------------------------------------------------
       
   775 // CMsgNaviPaneControl::GetNavigationIndicator
       
   776 // ----------------------------------------------------------------------------
       
   777 //
       
   778 EXPORT_C CMessageIterator* CMsgNaviPaneControl::GetMessageIterator()
       
   779     {
       
   780      return iMessageIterator;
       
   781     }
       
   782 //  End of File