phonebookui/Phonebook/App/src/CPbkAppGlobals.cpp
changeset 0 e686773b3f54
equal deleted inserted replaced
-1:000000000000 0:e686773b3f54
       
     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: 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include "CPbkAppGlobals.h"
       
    21 
       
    22 #include "CPbkCommandFactory.h"
       
    23 #include "CPbkAiwInterestItemFactory.h"
       
    24 #include <CPbkAiwInterestArray.h>
       
    25 #include <Phonebook.hrh>
       
    26 
       
    27 #include <BCardEng.h>
       
    28 #include <sendui.h>
       
    29 #include <CMessageData.h>
       
    30 
       
    31 // ================= MEMBER FUNCTIONS =======================
       
    32 
       
    33 inline CPbkAppGlobals::CPbkAppGlobals()
       
    34     {
       
    35     }
       
    36 
       
    37 inline void CPbkAppGlobals::ConstructL()
       
    38     {
       
    39     iCommandFactory = CPbkCommandFactory::NewL();
       
    40     iAiwInterestFactory = CPbkAiwInterestItemFactory::NewL();
       
    41     }
       
    42 
       
    43 CPbkAppGlobals* CPbkAppGlobals::InstanceL()
       
    44     {
       
    45     // This upcast is safe because in this classes context (Phonebook.app) the
       
    46     // app globals object is always of this class type.
       
    47     return static_cast<CPbkAppGlobals*>(CPbkAppGlobalsBase::InstanceL());
       
    48     }
       
    49 
       
    50 CPbkAppGlobals* CPbkAppGlobals::NewL()
       
    51     {
       
    52     CPbkAppGlobals* self = new (ELeave) CPbkAppGlobals;
       
    53     CleanupStack::PushL(self);
       
    54     self->ConstructL();
       
    55     CleanupStack::Pop(self);
       
    56     return self;
       
    57     }
       
    58 
       
    59 CPbkAppGlobals::~CPbkAppGlobals()
       
    60     {
       
    61     delete iAiwInterestFactory;
       
    62 	delete iCommandFactory;
       
    63     delete iSendUi;
       
    64     delete iBCardEngine;
       
    65     delete iAiwInterestArray;
       
    66     }
       
    67 
       
    68 MPbkCommandFactory& CPbkAppGlobals::CommandFactory()
       
    69     {
       
    70     return *iCommandFactory;
       
    71     }
       
    72 
       
    73 MPbkAiwInterestItemFactory& CPbkAppGlobals::AiwInterestItemFactory()
       
    74     {
       
    75     return *iAiwInterestFactory;
       
    76     }
       
    77 
       
    78 CSendUi* CPbkAppGlobals::SendUiL()
       
    79     {
       
    80     if (!iSendUi)
       
    81         {
       
    82         iSendUi = CSendUi::NewL();
       
    83         }
       
    84     return iSendUi;
       
    85     }
       
    86 
       
    87 CBCardEngine& CPbkAppGlobals::BCardEngL(CPbkContactEngine& aContactEngine)
       
    88     {
       
    89 	if (!iBCardEngine)
       
    90 		{
       
    91 	    iBCardEngine = CBCardEngine::NewL(&aContactEngine);
       
    92 		}
       
    93 	return *iBCardEngine;
       
    94     }
       
    95 
       
    96 CPbkAiwInterestArray* CPbkAppGlobals::AiwInterestArrayL
       
    97         (CPbkContactEngine& aContactEngine)
       
    98     {
       
    99     if (!iAiwInterestArray)
       
   100         {
       
   101         iAiwInterestArray = CPbkAiwInterestArray::NewL(aContactEngine);
       
   102         }
       
   103     return iAiwInterestArray;
       
   104     }
       
   105 
       
   106 void CPbkAppGlobals::DoRelease()
       
   107     {
       
   108     }
       
   109 
       
   110 // End of File