phonebookui/Phonebook2/CommonUI/src/CPbk2AppUiBase.cpp
changeset 0 e686773b3f54
equal deleted inserted replaced
-1:000000000000 0:e686773b3f54
       
     1 /*
       
     2 * Copyright (c) 2002-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 application UI base.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <CPbk2AppUiBase.h>
       
    20 
       
    21 namespace Phonebook2 {
       
    22 
       
    23 // --------------------------------------------------------------------------
       
    24 // CPbk2AppUiBase::Pbk2AppUi
       
    25 // Selects and returns correct application UI.
       
    26 // --------------------------------------------------------------------------
       
    27 //
       
    28 EXPORT_C MPbk2AppUi* Pbk2AppUi()
       
    29     {
       
    30     MPbk2AppUi* ret = NULL;
       
    31 
       
    32     CEikAppUi* const eikAppUi = CEikonEnv::Static()->EikAppUi();
       
    33 
       
    34     // Casting has to be done in two steps since dynamic cast has problems
       
    35     // casting EikAppUi directly to the templated type. Therefore dynamic
       
    36     // cast is used to cast to the base class type and then we proceed
       
    37     // with static cast as usual.
       
    38     if ( dynamic_cast<CAknViewAppUi*>( eikAppUi ) )
       
    39         {
       
    40         ret = static_cast<CPbk2AppUiBase<CAknViewAppUi>*>
       
    41             ( eikAppUi );
       
    42         }
       
    43     else
       
    44         {
       
    45         ret = static_cast<CPbk2AppUiBase<CAknAppUi>*>
       
    46             ( eikAppUi );
       
    47         }
       
    48 
       
    49     return ret;
       
    50     }
       
    51 
       
    52 } /// namespace
       
    53 
       
    54 // End of File