phonebookui/Phonebook2/CommonUI/src/CPbk2VoidNavigation.cpp
changeset 0 e686773b3f54
equal deleted inserted replaced
-1:000000000000 0:e686773b3f54
       
     1 /*
       
     2 * Copyright (c) 2005-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:  Phonebook 2 no navigation navigator.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "CPbk2VoidNavigation.h"
       
    20 
       
    21 // Phonebook 2
       
    22 #include "CPbk2IconInfo.h"
       
    23 #include <CPbk2AppUiBase.h>
       
    24 #include <CPbk2IconFactory.h>
       
    25 #include <CPbk2TabGroupContainer.h>
       
    26 #include <CPbk2IconInfoContainer.h>
       
    27 #include <Pbk2UID.h>
       
    28 
       
    29 // Virtual Phonebook
       
    30 #include <MVPbkContactLink.h>
       
    31 #include <MVPbkContactViewBase.h>
       
    32 
       
    33 // System includes
       
    34 #include <aknnavide.h>
       
    35 #include <eikspane.h>
       
    36 #include <akntabgrp.h>
       
    37 #include <AknsUtils.h>
       
    38 
       
    39 // Debugging headers
       
    40 #include <Pbk2Debug.h>
       
    41 
       
    42 // --------------------------------------------------------------------------
       
    43 // CPbk2VoidNavigation::CPbk2VoidNavigation
       
    44 // --------------------------------------------------------------------------
       
    45 //
       
    46 CPbk2VoidNavigation::CPbk2VoidNavigation
       
    47         ( TUid aViewId, MPbk2NavigationObserver& aObserver,
       
    48           MPbk2ContactNavigationLoader& aNavigationLoader,
       
    49           TArray<MVPbkContactStore*> aStoreList ) :
       
    50             CPbk2NavigationBase( aObserver, aNavigationLoader, aStoreList ),
       
    51             iViewId( aViewId )
       
    52     {
       
    53     }
       
    54 
       
    55 // --------------------------------------------------------------------------
       
    56 // CPbk2VoidNavigation::~CPbk2VoidNavigation
       
    57 // --------------------------------------------------------------------------
       
    58 //
       
    59 CPbk2VoidNavigation::~CPbk2VoidNavigation()
       
    60     {
       
    61     }
       
    62 
       
    63 // --------------------------------------------------------------------------
       
    64 // CPbk2VoidNavigation::NewL
       
    65 // --------------------------------------------------------------------------
       
    66 //
       
    67 CPbk2VoidNavigation* CPbk2VoidNavigation::NewL
       
    68         ( TUid aViewId, MPbk2NavigationObserver& aObserver,
       
    69           MPbk2ContactNavigationLoader& aNavigationLoader,
       
    70           TArray<MVPbkContactStore*> aStoreList )
       
    71     {
       
    72     CPbk2VoidNavigation* self = new ( ELeave ) CPbk2VoidNavigation
       
    73         ( aViewId, aObserver, aNavigationLoader, aStoreList );
       
    74     CleanupStack::PushL( self );
       
    75     self->ConstructL();
       
    76     CleanupStack::Pop( self );
       
    77     return self;
       
    78     }
       
    79 
       
    80 // --------------------------------------------------------------------------
       
    81 // CPbk2VoidNavigation::ConstructL
       
    82 // --------------------------------------------------------------------------
       
    83 //
       
    84 void CPbk2VoidNavigation::ConstructL()
       
    85     {
       
    86     BaseConstructL();
       
    87     }
       
    88 
       
    89 // --------------------------------------------------------------------------
       
    90 // CPbk2VoidNavigation::UpdateNaviIndicatorsL
       
    91 // --------------------------------------------------------------------------
       
    92 //
       
    93 void CPbk2VoidNavigation::UpdateNaviIndicatorsL
       
    94         ( const MVPbkContactLink& /*aContactLink*/ ) const
       
    95     {
       
    96     // Get navigation decorator
       
    97     CAknNavigationControlContainer* naviPane =
       
    98         static_cast<CAknNavigationControlContainer*>
       
    99             ( CEikonEnv::Static()->AppUiFactory()->StatusPane()->ControlL
       
   100                 ( TUid::Uid( EEikStatusPaneUidNavi ) ) );
       
   101 
       
   102     CAknNavigationDecorator* decorator = naviPane->Top();
       
   103 
       
   104     if ( decorator )
       
   105         {
       
   106         decorator->MakeScrollButtonVisible( ETrue );
       
   107         }
       
   108 
       
   109     // Update the tabgroup text
       
   110     SetTabTextToEmptyL( iViewId );
       
   111 
       
   112     naviPane->DrawNow();
       
   113     }
       
   114 
       
   115 // --------------------------------------------------------------------------
       
   116 // CPbk2VoidNavigation::HandleCommandKeyL
       
   117 // --------------------------------------------------------------------------
       
   118 //
       
   119 TBool CPbk2VoidNavigation::HandleCommandKeyL
       
   120         ( const TKeyEvent& /*aKeyEvent*/, TEventCode /*aType*/ )
       
   121     {
       
   122     return EFalse;
       
   123     }
       
   124 
       
   125 // --------------------------------------------------------------------------
       
   126 // CPbk2VoidNavigation::SetTabTextToEmptyL
       
   127 // Sets the tab text for a view.
       
   128 // --------------------------------------------------------------------------
       
   129 //
       
   130 void CPbk2VoidNavigation::SetTabTextToEmptyL
       
   131         ( const TUid aViewId ) const
       
   132     {
       
   133     MPbk2AppUi* appUi = Phonebook2::Pbk2AppUi();
       
   134 
       
   135     CPbk2TabGroupContainer* tabGroups = appUi->TabGroups();
       
   136 
       
   137     TPbk2IconId iconId( TUid::Uid( KPbk2UID3 ), aViewId.iUid );
       
   138     const CPbk2IconInfo* iconInfo = NULL;
       
   139 
       
   140     if ( tabGroups )
       
   141         {
       
   142         iconInfo = tabGroups->TabIcons().Find( iconId );
       
   143         }
       
   144 
       
   145     if ( iconInfo )
       
   146         {
       
   147         CAknNavigationDecorator* decorator =
       
   148             tabGroups->TabGroupFromViewId( aViewId.iUid );
       
   149         CAknTabGroup* aknTabGroup = static_cast<CAknTabGroup*>
       
   150             ( decorator->DecoratedControl() );
       
   151 
       
   152         CFbsBitmap* bitmap = NULL;
       
   153         CFbsBitmap* mask = NULL;
       
   154 
       
   155         CPbk2IconFactory* factory =
       
   156             CPbk2IconFactory::NewLC( tabGroups->TabIcons() );
       
   157         factory->CreateIconLC(
       
   158             iconId, *AknsUtils::SkinInstance(), bitmap, mask );
       
   159 
       
   160         aknTabGroup->ReplaceTabL( aViewId.iUid, bitmap, mask );
       
   161         CleanupStack::Pop( 2 ); // mask, bitmap
       
   162         CleanupStack::PopAndDestroy( factory );
       
   163         }
       
   164     }
       
   165 
       
   166 
       
   167 // End of File