phoneengine/contacthandling/src/cpecontacthandlingproxy.cpp
changeset 0 5f000ab63145
equal deleted inserted replaced
-1:000000000000 0:5f000ab63145
       
     1 /*
       
     2 * Copyright (c) 2006 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:  This module contains the implementation of CPEContactHandlingProxy class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 //  INCLUDE FILES
       
    20 #include "cpecontacthandling.h"
       
    21 #include "cpecontacthandlingproxy.h"
       
    22 #include "cpecontacthandlingdummy.h"
       
    23 #include "cpecontactmatch.h"
       
    24 #include <mpedatastore.h>
       
    25 #include <e32std.h>
       
    26 #include <mpephonemodelinternal.h>
       
    27 #include <pepanic.pan>
       
    28 #include <barsc.h> 
       
    29 #include <barsread.h>
       
    30 #include <talogger.h>
       
    31 #include <bldvariant.hrh>
       
    32 #include <featmgr.h>
       
    33 
       
    34 // ================= MEMBER FUNCTIONS =======================================
       
    35 // -----------------------------------------------------------------------------
       
    36 // CPEContactHandlingProxy::CreateFirstPhaseL
       
    37 // This method creates the contact handling proxy and dummy implementation
       
    38 // -----------------------------------------------------------------------------
       
    39 //
       
    40 EXPORT_C MPEContactHandling* CPEContactHandlingProxy::CreateFirstPhaseL()
       
    41     {
       
    42     TEFLOGSTRING( KTAOBJECT, "CNT CPEContactHandlingProxy::CreateFirstPhaseL start." );
       
    43     CPEContactHandlingProxy* self = new ( ELeave ) CPEContactHandlingProxy();
       
    44     CleanupStack::PushL( self );
       
    45     self->ConstructL();
       
    46     CleanupStack::Pop( self );
       
    47     TEFLOGSTRING( KTAOBJECT, "CNT CPEContactHandlingProxy::CreateFirstPhaseL Complete." );
       
    48     return self;
       
    49     }
       
    50 
       
    51 // -----------------------------------------------------------------------------
       
    52 // CPEContactHandlingProxy::CreateSecondPhaseL
       
    53 // This method creates the actual contact handling implementation
       
    54 // -----------------------------------------------------------------------------
       
    55 //
       
    56 EXPORT_C void CPEContactHandlingProxy::CreateSecondPhaseL(
       
    57         MPEPhoneModelInternal& aModel,
       
    58         RFs& aFsSession
       
    59         )
       
    60     {
       
    61     TEFLOGSTRING( KTAOBJECT, "LOG CPELogHandlingProxy::CreateSecondPhaseL start." );
       
    62     iContactHandling = CPEContactHandling::NewL( aModel, aFsSession );
       
    63     TEFLOGSTRING( KTAOBJECT, "LOG CPELogHandlingProxy::CreateSecondPhaseL complete." );
       
    64     }
       
    65 
       
    66 // -----------------------------------------------------------------------------
       
    67 // CPEContactHandlingProxy::CPEContactHandlingProxy
       
    68 // C++ default constructor can NOT contain any code, that
       
    69 // might leave.
       
    70 // -----------------------------------------------------------------------------
       
    71 //
       
    72 CPEContactHandlingProxy::CPEContactHandlingProxy()
       
    73         {
       
    74         }
       
    75 
       
    76 // -----------------------------------------------------------------------------
       
    77 // CPEContactHandlingProxy::ConstructL
       
    78 // Symbian 2nd phase constructor can leave.
       
    79 // -----------------------------------------------------------------------------
       
    80 //
       
    81 void CPEContactHandlingProxy::ConstructL()
       
    82     {
       
    83     TEFLOGSTRING( KTAOBJECT, "LOG CPEContactHandlingProxy::ConstructL" );
       
    84     // Create an instance of the log handling dummy implementation
       
    85     iContactHandlingDummy = CPEContactHandlingDummy::NewL();  
       
    86     }
       
    87 
       
    88 // Destructor
       
    89 CPEContactHandlingProxy::~CPEContactHandlingProxy()
       
    90     {
       
    91     TEFLOGSTRING( KTAOBJECT, "LOG CPELogHandlingProxy::~CPEContactHandlingProxy" );
       
    92     delete iContactHandling;
       
    93     delete iContactHandlingDummy;
       
    94     }
       
    95 
       
    96 // -----------------------------------------------------------------------------
       
    97 // CPEContactHandlingProxy::FindContactInfoSync
       
    98 // Calls method FindContactInfoSyncL which can leave. This leave is trapped in 
       
    99 // this function.
       
   100 // (other items were commented in a header).
       
   101 // -----------------------------------------------------------------------------
       
   102 //
       
   103 EXPORT_C TInt CPEContactHandlingProxy::FindContactInfoSync
       
   104         ( 
       
   105         const TInt aCallId,
       
   106         const TPEFindContactKey aFindKey
       
   107         )     
       
   108     {
       
   109     if ( iContactHandling )
       
   110         {
       
   111         TEFLOGSTRING( KTAINT, "CNT CPEContactHandlingProxy::FindContactInfoSync > CPEContactHandling::FindContactInfoSync" );
       
   112         return iContactHandling->FindContactInfoSync( aCallId, aFindKey );
       
   113         }
       
   114     else if ( iContactHandlingDummy )
       
   115         {
       
   116         TEFLOGSTRING( KTAINT, "CNT CPEContactHandlingProxy::FindContactInfoSync > CPEContactHandlingDummy::FindContactInfoSync" );
       
   117         return iContactHandlingDummy->FindContactInfoSync( aCallId, aFindKey );
       
   118         }
       
   119     else
       
   120         {
       
   121         TEFLOGSTRING( KTAERROR, "CNT CPECONTACTHANDLINGPROXY::FINDCONTACTINFOSYNC ! NEITHER CONTACT HANDLING NOR CONTACT HANDLING DUMMY EXISTS" );
       
   122         User::Invariant();
       
   123         }
       
   124     return KErrBadHandle;
       
   125     }
       
   126 
       
   127 // -----------------------------------------------------------------------------
       
   128 // CPEContactHandlingProxy::GetSpeedDialLocation
       
   129 // Get's phone number and contact id from given location.
       
   130 // -----------------------------------------------------------------------------
       
   131 //
       
   132 EXPORT_C TInt CPEContactHandlingProxy::GetSpeedDialLocation( 
       
   133     TInt aLocationIndex, 
       
   134     TPEPhoneNumber& aNumber )
       
   135     {
       
   136     if ( iContactHandling )
       
   137         {
       
   138         TEFLOGSTRING( 
       
   139             KTAINT, 
       
   140             "CNT CPEContactHandlingProxy::GetSpeedDialLocation > CPEContactHandling::GetSpeedDialLocation" );
       
   141         return iContactHandling->GetSpeedDialLocation( aLocationIndex, aNumber );
       
   142         }
       
   143     else if ( iContactHandlingDummy )
       
   144         {
       
   145         TEFLOGSTRING( 
       
   146             KTAINT, 
       
   147             "CNT CPEContactHandlingProxy::GetSpeedDialLocation > CPEContactHandlingDummy::GetSpeedDialLocation" );
       
   148         return iContactHandlingDummy->GetSpeedDialLocation( 
       
   149             aLocationIndex, 
       
   150             aNumber );
       
   151         }
       
   152     else
       
   153         {
       
   154         TEFLOGSTRING( 
       
   155             KTAERROR, 
       
   156             "CNT CPECONTACTHANDLINGPROXY::GETSPEEDDIALLOCATION ! NEITHER CONTACT HANDLING NOR CONTACT HANDLING DUMMY EXISTS" );
       
   157         User::Invariant();
       
   158         }
       
   159     return KErrBadHandle;
       
   160     }
       
   161 
       
   162 // ================= OTHER EXPORTED FUNCTIONS ===============================
       
   163 
       
   164 //  End of File