profilesapplication/Profiles/ProfileApp/SettingsViewSrc/CProfileNaviPaneContainer.cpp
changeset 0 ca436256272f
child 2 627793106ff9
equal deleted inserted replaced
-1:000000000000 0:ca436256272f
       
     1 /*
       
     2 * Copyright (c) 2002 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:  Container for navi pane decorator.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include    "CProfileNaviPaneContainer.h"
       
    22 
       
    23 #include    <aknnavide.h>
       
    24 #include    <aknnavilabel.h>
       
    25 #include    <eikspane.h>
       
    26 #include    <avkon.hrh> // EEikStatusPaneUidNavi
       
    27 #include    <AknUtils.h> // AknTextUtils
       
    28 #include    <mprofilesnamesarray.h>
       
    29 #include    <mprofileengineextended.h>
       
    30 #include    <mprofilename.h>
       
    31 
       
    32 #include    "CProfileEngineHandler.h"
       
    33 
       
    34 // ============================ MEMBER FUNCTIONS ===============================
       
    35 
       
    36 // -----------------------------------------------------------------------------
       
    37 // CProfileNaviPaneContainer::CProfileNaviPaneContainer
       
    38 // C++ constructor can NOT contain any code, that might leave.
       
    39 // -----------------------------------------------------------------------------
       
    40 //
       
    41 CProfileNaviPaneContainer::CProfileNaviPaneContainer(
       
    42     CProfileEngineHandler& aEngineHandler )
       
    43     :   iEngineHandler( aEngineHandler )
       
    44     {
       
    45     }
       
    46 
       
    47 // -----------------------------------------------------------------------------
       
    48 // CProfileNaviPaneContainer::ConstructL
       
    49 // Symbian 2nd phase constructor can leave.
       
    50 // -----------------------------------------------------------------------------
       
    51 //
       
    52 void CProfileNaviPaneContainer::ConstructL( CEikStatusPane& aStatusPane )
       
    53     {
       
    54     iNaviPane = static_cast< CAknNavigationControlContainer* >(
       
    55         aStatusPane.ControlL( TUid::Uid( EEikStatusPaneUidNavi ) ) );
       
    56     iNaviDecorator = iNaviPane->CreateNavigationLabelL();
       
    57     iNaviPane->PushL( *iNaviDecorator );
       
    58     }
       
    59 
       
    60 // -----------------------------------------------------------------------------
       
    61 // CProfileNaviPaneContainer::NewLC
       
    62 // Two-phased constructor.
       
    63 // -----------------------------------------------------------------------------
       
    64 //
       
    65 EXPORT_C CProfileNaviPaneContainer* CProfileNaviPaneContainer::NewL(
       
    66     CEikStatusPane& aStatusPane, CProfileEngineHandler& aEngineHandler )
       
    67     {
       
    68     CProfileNaviPaneContainer* self =
       
    69         new( ELeave ) CProfileNaviPaneContainer( aEngineHandler );
       
    70     CleanupStack::PushL( self );
       
    71     self->ConstructL( aStatusPane );
       
    72     CleanupStack::Pop( self );
       
    73     return self;
       
    74     }
       
    75 
       
    76 // Destructor
       
    77 CProfileNaviPaneContainer::~CProfileNaviPaneContainer()
       
    78     {
       
    79    	Release();
       
    80     }
       
    81 
       
    82 // -----------------------------------------------------------------------------
       
    83 // CProfileNaviPaneContainer::SetNaviPaneTextL
       
    84 // -----------------------------------------------------------------------------
       
    85 //
       
    86 EXPORT_C void CProfileNaviPaneContainer::SetNaviPaneTextL( const TDesC& aText )
       
    87     {
       
    88     CAknNaviLabel* label = static_cast< CAknNaviLabel* >(
       
    89         iNaviDecorator->DecoratedControl() );
       
    90     RBuf title;
       
    91     title.CreateL( aText );
       
    92     CleanupClosePushL( title );
       
    93     AknTextUtils::DisplayTextLanguageSpecificNumberConversion( title );
       
    94     label->SetTextL( title );
       
    95     CleanupStack::PopAndDestroy( &title );
       
    96     label->DrawDeferred();
       
    97     }
       
    98 
       
    99 // -----------------------------------------------------------------------------
       
   100 // CProfileNaviPaneContainer::SetNaviPaneTextL
       
   101 // -----------------------------------------------------------------------------
       
   102 //
       
   103 EXPORT_C void CProfileNaviPaneContainer::SetNaviPaneTextL()
       
   104     {
       
   105     iEngineHandler.ReadIdArrayL();
       
   106     MProfilesNamesArray* nameArray = iEngineHandler.IdArray();
       
   107     TInt index( nameArray->FindById( iEngineHandler.Engine()->ActiveProfileId() ) );
       
   108     SetNaviPaneTextL( nameArray->ProfileName( index )->NaviName() );
       
   109     }
       
   110 
       
   111 // -----------------------------------------------------------------------------
       
   112 // CProfileNaviPaneContainer::SetNaviPaneTextL
       
   113 // -----------------------------------------------------------------------------
       
   114 //
       
   115 void CProfileNaviPaneContainer::Release()
       
   116     {
       
   117   	if( iNaviDecorator )
       
   118         {
       
   119         iNaviPane->Pop( iNaviDecorator );
       
   120         delete iNaviDecorator;
       
   121         iNaviDecorator = NULL;
       
   122         }
       
   123     }
       
   124 
       
   125 // End of File