phonebookui/Phonebook2/Application/src/CPbk2Document.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 document.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include "CPbk2Document.h"
       
    21 
       
    22 // Phonebook 2
       
    23 #include "CPbk2Application.h"
       
    24 #include "CPbk2AppUi.h"
       
    25 #include "CPbk2UIExtensionManager.h"
       
    26 #include "CPbk2UIApplicationServices.h"
       
    27 
       
    28 // Debugging headers
       
    29 #include <Pbk2Debug.h>
       
    30 #include <Pbk2Profile.h>
       
    31 
       
    32 // --------------------------------------------------------------------------
       
    33 // CPbk2Document::CPbk2Document
       
    34 // --------------------------------------------------------------------------
       
    35 //
       
    36 inline CPbk2Document::CPbk2Document( CEikApplication& aApp ) :
       
    37         CPbk2DocumentBase( aApp )
       
    38     {
       
    39     }
       
    40 
       
    41 // --------------------------------------------------------------------------
       
    42 // CPbk2Document::~CPbk2Document
       
    43 // --------------------------------------------------------------------------
       
    44 //
       
    45 CPbk2Document::~CPbk2Document()
       
    46     {
       
    47     Release( iExtensionManager );
       
    48     delete iAppServices;
       
    49     }
       
    50 
       
    51 // --------------------------------------------------------------------------
       
    52 // CPbk2Document::NewL
       
    53 // --------------------------------------------------------------------------
       
    54 //
       
    55 CPbk2Document* CPbk2Document::NewL( CEikApplication& aApp )
       
    56     {
       
    57     CPbk2Document* self = new ( ELeave ) CPbk2Document( aApp );
       
    58     CleanupStack::PushL( self );
       
    59     self->ConstructL();
       
    60     CleanupStack::Pop( self );
       
    61     return self;
       
    62     }
       
    63 
       
    64 // --------------------------------------------------------------------------
       
    65 // CPbk2Document::ConstructL
       
    66 // --------------------------------------------------------------------------
       
    67 //
       
    68 inline void CPbk2Document::ConstructL()
       
    69     {
       
    70     PBK2_DEBUG_PRINT( PBK2_DEBUG_STRING
       
    71         ( "CPbk2Document::ConstructL(0x%x)" ), this );
       
    72     }
       
    73 
       
    74 // --------------------------------------------------------------------------
       
    75 // CPbk2Document::Pbk2Application
       
    76 // --------------------------------------------------------------------------
       
    77 //
       
    78 CPbk2Application* CPbk2Document::Pbk2Application() const
       
    79     {
       
    80     // Explicit cast: application must always be of type CPbk2Application
       
    81     return static_cast<CPbk2Application*>(Application());
       
    82     }
       
    83 
       
    84 // --------------------------------------------------------------------------
       
    85 // CPbk2Document::CreateGlobalsL
       
    86 // --------------------------------------------------------------------------
       
    87 //
       
    88 void CPbk2Document::CreateGlobalsL()
       
    89     {
       
    90     PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING
       
    91         ("CPbk2Document::CreateGlobalsL(0x%x)"), this);
       
    92 
       
    93     PBK2_PROFILE_START(Pbk2Profile::EDocumentCreateExtensionManager);
       
    94     iExtensionManager = CPbk2UIExtensionManager::InstanceL();
       
    95     PBK2_PROFILE_END(Pbk2Profile::EDocumentCreateExtensionManager);
       
    96 
       
    97     PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING
       
    98         ("CPbk2Document::CreateGlobalsL(0x%x) end"), this);
       
    99     }
       
   100 
       
   101 // --------------------------------------------------------------------------
       
   102 // CPbk2Document::ApplicationServicesL
       
   103 // --------------------------------------------------------------------------
       
   104 //
       
   105 MPbk2ApplicationServices* CPbk2Document::ApplicationServicesL()
       
   106     {
       
   107     if (!iAppServices)
       
   108         {
       
   109         iAppServices = CPbk2UIApplicationServices::NewL();
       
   110         }
       
   111 
       
   112     return iAppServices;
       
   113     }
       
   114 
       
   115 // --------------------------------------------------------------------------
       
   116 // CPbk2Document::ExtensionManager
       
   117 // --------------------------------------------------------------------------
       
   118 //
       
   119 CPbk2UIExtensionManager& CPbk2Document::ExtensionManager() const
       
   120     {
       
   121     return *iExtensionManager;
       
   122     }
       
   123 
       
   124 // --------------------------------------------------------------------------
       
   125 // CPbk2Document::CreateAppUiL
       
   126 // --------------------------------------------------------------------------
       
   127 //
       
   128 CEikAppUi* CPbk2Document::CreateAppUiL()
       
   129     {
       
   130     PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING
       
   131         ( "CPbk2Document::CreateAppUiL(0x%x)" ), this );
       
   132 
       
   133     return ( new ( ELeave ) CPbk2AppUi );
       
   134     }
       
   135 
       
   136 //  End of File