phoneengine/phonecntfinder2/src/cphcntfactoryimpl2.cpp
changeset 37 ba76fc04e6c2
child 51 f39ed5e045e0
child 78 baacf668fe89
equal deleted inserted replaced
36:2eacb6118286 37:ba76fc04e6c2
       
     1 /*
       
     2 * Copyright (c) 2009 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    <qglobal.h>
       
    21 #include    <e32cmn.h>  
       
    22 #include    <qcontactmanager.h>
       
    23 #include    <CProfileChangeNotifyHandler.h>
       
    24 #include    <MProfileChangeObserver.h>
       
    25 #include    <featmgr.h>     // Feature Manager
       
    26 #include    <QString>
       
    27 #include    "cphcntfactoryimpl2.h"
       
    28 #include    "cphcntmatcherimpl2.h"
       
    29 #include    "qtphonelog.h"
       
    30 
       
    31 
       
    32 static const QString SYMBIAN_CONTACTS_BACKEND  = "symbian";
       
    33 
       
    34 
       
    35 // -----------------------------------------------------------------------------
       
    36 // CPhCntFactoryImpl::NewL
       
    37 // Two-phased constructor.
       
    38 // -----------------------------------------------------------------------------
       
    39 //
       
    40 CPhCntFactoryImpl2* CPhCntFactoryImpl2::NewL()
       
    41     {
       
    42     PHONE_DEBUG("CPhCntFactoryImpl2::NewL - enter");
       
    43     CPhCntFactoryImpl2* self = new (ELeave) CPhCntFactoryImpl2;
       
    44 
       
    45     CleanupStack::PushL( self );
       
    46     self->ConstructL();
       
    47     CleanupStack::Pop();
       
    48     PHONE_DEBUG("CPhCntFactoryImpl2::cntfinder2 is ready. lets rock.");
       
    49     return self;
       
    50     }
       
    51 
       
    52 // ---------------------------------------------------------------------------
       
    53 // CPhCntFactoryImpl2::~CPhCntFactoryImpl2
       
    54 // ---------------------------------------------------------------------------
       
    55 //
       
    56 CPhCntFactoryImpl2::~CPhCntFactoryImpl2()
       
    57     {
       
    58 
       
    59     FeatureManager::UnInitializeLib();
       
    60     }
       
    61 
       
    62 
       
    63 
       
    64 // ---------------------------------------------------------------------------
       
    65 // CPhCntFactoryImpl2::CreateContactMatcherL
       
    66 // 
       
    67 //  Create contact matcher
       
    68 // ---------------------------------------------------------------------------
       
    69 //
       
    70 CPhCntMatcher* CPhCntFactoryImpl2::CreateContactMatcherL()
       
    71     {
       
    72     QContactManager* contactMgr = NULL;
       
    73     QT_TRYCATCH_LEAVING(contactMgr = new QContactManager(SYMBIAN_CONTACTS_BACKEND));
       
    74     CPhCntMatcher*matcher = CPhCntMatcherImpl2::NewL(contactMgr);
       
    75     return matcher;
       
    76     }
       
    77 
       
    78 
       
    79 // ---------------------------------------------------------------------------
       
    80 // CPhCntFactoryImpl2::CreateProfileEngineNotifyHandlerL
       
    81 // ---------------------------------------------------------------------------
       
    82 //
       
    83 CBase* CPhCntFactoryImpl2::CreateProfileEngineNotifyHandlerL( 
       
    84         MProfileChangeObserver* aObserver )
       
    85     {
       
    86     return CProfileChangeNotifyHandler::NewL( aObserver );
       
    87     }
       
    88 
       
    89 
       
    90 // ---------------------------------------------------------------------------
       
    91 // CPhCntFactoryImpl2::CreateContactIdL
       
    92 // ---------------------------------------------------------------------------
       
    93 //
       
    94 /*
       
    95 CPhCntContactId* CPhCntFactoryImpl2::CreateContactIdL()
       
    96     {
       
    97     return NULL;
       
    98     }
       
    99 */   
       
   100 
       
   101 // ---------------------------------------------------------------------------
       
   102 // CPhCntFactoryImpl2::CreateContactIdL
       
   103 // ---------------------------------------------------------------------------
       
   104 //    
       
   105 CPhCntContactId* CPhCntFactoryImpl2::CreateContactIdL( 
       
   106     TContactItemId /* aContactId*/)
       
   107     {
       
   108     return NULL;
       
   109     }
       
   110 
       
   111 // ---------------------------------------------------------------------------
       
   112 // CPhCntFactoryImpl2::CreateContactIdL
       
   113 // ---------------------------------------------------------------------------
       
   114 //    
       
   115 CPhCntContactId* CPhCntFactoryImpl2::CreateContactIdL( 
       
   116     const TDesC8& /*aContactId*/ )
       
   117     {
       
   118     return NULL;
       
   119     }
       
   120 
       
   121 
       
   122 // -----------------------------------------------------------------------------
       
   123 // CPhCntFactoryImpl2::CPhCntFactoryImpl2
       
   124 // C++ constructor can NOT contain any code, that
       
   125 // might leave.
       
   126 // -----------------------------------------------------------------------------
       
   127 //
       
   128 CPhCntFactoryImpl2::CPhCntFactoryImpl2()
       
   129     {
       
   130     }
       
   131 
       
   132 // -----------------------------------------------------------------------------
       
   133 // CPhCntFactoryImpl2::ConstructL
       
   134 // Symbian 2nd phase constructor can leave.
       
   135 // -----------------------------------------------------------------------------
       
   136 //
       
   137 void CPhCntFactoryImpl2::ConstructL()
       
   138     {
       
   139     FeatureManager::InitializeLibL();
       
   140     }
       
   141 
       
   142 
       
   143 // ================= OTHER EXPORTED FUNCTIONS ==============
       
   144 
       
   145 // ---------------------------------------------------------------------------
       
   146 // CreateCntFactoryL
       
   147 // 
       
   148 //  Creates instance of contact factory.
       
   149 // ---------------------------------------------------------------------------
       
   150 //
       
   151 EXPORT_C CPhCntFactory* CreateCntFactoryL()
       
   152     {
       
   153     return CPhCntFactoryImpl2::NewL();
       
   154     }
       
   155 
       
   156 // End of File