phonebookui/Phonebook2/ServerApplication/src/TPbk2TitlePaneOperator.cpp
changeset 0 e686773b3f54
child 68 9da50d567e3c
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 server application title pane manager.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "TPbk2TitlePaneOperator.h"
       
    20 
       
    21 // Phonebook 2
       
    22 #include <Pbk2UID.h>
       
    23 #include <Pbk2CommonUi.rsg>
       
    24 
       
    25 // Virtual Phonebook
       
    26 
       
    27 // System includes
       
    28 #include <akntitle.h>
       
    29 #include <akncontext.h>
       
    30 #include <StringLoader.h>
       
    31 #include <eikspane.h>
       
    32 #include <avkon.hrh> // EEikStatusPaneUidTitle
       
    33 #include <AknsUtils.h>
       
    34 
       
    35 // --------------------------------------------------------------------------
       
    36 // TPbk2TitlePaneOperator::TPbk2TitlePaneOperator
       
    37 // --------------------------------------------------------------------------
       
    38 //
       
    39 TPbk2TitlePaneOperator::TPbk2TitlePaneOperator()
       
    40     {
       
    41     }
       
    42 
       
    43 // --------------------------------------------------------------------------
       
    44 // TPbk2TitlePaneOperator::SetTitlePaneL
       
    45 // --------------------------------------------------------------------------
       
    46 //
       
    47 void TPbk2TitlePaneOperator::SetTitlePaneL( HBufC* aTitlePaneText )
       
    48     {
       
    49     if ( !aTitlePaneText )
       
    50         {
       
    51         HBufC* title = StringLoader::LoadL( R_QTN_PHOB_TITLE );
       
    52         ChangeTitlePaneL( title );
       
    53         ChangeContextIconL();
       
    54         }
       
    55     else
       
    56         {
       
    57         ChangeTitlePaneL( aTitlePaneText );
       
    58         }
       
    59     }
       
    60 
       
    61 // --------------------------------------------------------------------------
       
    62 // TPbk2TitlePaneOperator::ChangeTitlePaneL
       
    63 // --------------------------------------------------------------------------
       
    64 //
       
    65 void TPbk2TitlePaneOperator::ChangeTitlePaneL( HBufC* aTitle  )
       
    66     {
       
    67     CleanupStack::PushL( aTitle );
       
    68 
       
    69     CEikStatusPane* statusPane =
       
    70         CEikonEnv::Static()->AppUiFactory()->StatusPane();
       
    71     if ( statusPane && statusPane->PaneCapabilities
       
    72             ( TUid::Uid( EEikStatusPaneUidTitle ) ).IsPresent() )
       
    73         {
       
    74         CAknTitlePane* titlePane = static_cast<CAknTitlePane*>(
       
    75             statusPane->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) );
       
    76         CleanupStack::Pop( aTitle );
       
    77 
       
    78         titlePane->SetText( aTitle ); // takes ownership of title
       
    79         }
       
    80     else
       
    81         {
       
    82         CleanupStack::PopAndDestroy( aTitle );
       
    83         }
       
    84     }
       
    85 
       
    86 // --------------------------------------------------------------------------
       
    87 // TPbk2TitlePaneOperator::ChangeContextIconL
       
    88 // --------------------------------------------------------------------------
       
    89 //
       
    90 inline void TPbk2TitlePaneOperator::ChangeContextIconL()
       
    91     {
       
    92     CEikStatusPane* statusPane =
       
    93         CEikonEnv::Static()->AppUiFactory()->StatusPane();
       
    94     if ( statusPane && statusPane->PaneCapabilities
       
    95             ( TUid::Uid( EEikStatusPaneUidContext ) ).IsInCurrentLayout() )
       
    96         {
       
    97         CAknContextPane* contextPane = static_cast<CAknContextPane*>(
       
    98             statusPane->ControlL( TUid::Uid( EEikStatusPaneUidContext ) ) );
       
    99 
       
   100         CFbsBitmap* bitmap = NULL;
       
   101         CFbsBitmap* mask = NULL;
       
   102 
       
   103         AknsUtils::CreateAppIconLC
       
   104             ( AknsUtils::SkinInstance(), TUid::Uid( KPbk2UID3 ),
       
   105               EAknsAppIconTypeContext, bitmap, mask );
       
   106 
       
   107         CleanupStack::Pop( 2 ); // bitmap, mask
       
   108         contextPane->SetPicture(bitmap, mask);
       
   109         }
       
   110     }
       
   111 
       
   112 // End of File