phoneengine/PhoneCntFinder/ContactService/src/tphcntservicerequestparamfactory.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:  Factory for creating service request params.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <CVPbkContactLinkArray.h>
       
    20 #include "tphcntservicerequestparamfactory.h"
       
    21 #include "tphcntservicerequestparams.h"
       
    22 #include "MPhCntContactManager.h"
       
    23 
       
    24 // ---------------------------------------------------------------------------
       
    25 // Constructor
       
    26 // ---------------------------------------------------------------------------
       
    27 //
       
    28 CPhCntServiceRequestParamFactory::CPhCntServiceRequestParamFactory(
       
    29     MPhCntContactManager* aContactManager ) : 
       
    30     iContactManager( aContactManager )
       
    31     {
       
    32     }
       
    33     
       
    34 // ---------------------------------------------------------------------------
       
    35 // Destructor
       
    36 // ---------------------------------------------------------------------------
       
    37 //
       
    38 CPhCntServiceRequestParamFactory::~CPhCntServiceRequestParamFactory()
       
    39     {
       
    40     }
       
    41     
       
    42 // ---------------------------------------------------------------------------
       
    43 // Constructor
       
    44 // ---------------------------------------------------------------------------
       
    45 //
       
    46 CPhCntServiceRequestParamFactory* CPhCntServiceRequestParamFactory::NewL(
       
    47     MPhCntContactManager& aContactManager )
       
    48     {
       
    49     CPhCntServiceRequestParamFactory* self = 
       
    50         CPhCntServiceRequestParamFactory::NewLC( aContactManager );
       
    51     CleanupStack::Pop( self );
       
    52     return self;
       
    53     }
       
    54 
       
    55 // ---------------------------------------------------------------------------
       
    56 // Constructor
       
    57 // ---------------------------------------------------------------------------
       
    58 //
       
    59 CPhCntServiceRequestParamFactory* CPhCntServiceRequestParamFactory::NewLC(
       
    60     MPhCntContactManager& aContactManager )
       
    61     {
       
    62     CPhCntServiceRequestParamFactory* self = 
       
    63         new( ELeave )CPhCntServiceRequestParamFactory( &aContactManager );
       
    64     CleanupStack::PushL( self );
       
    65     return self;
       
    66     }
       
    67 
       
    68 // ---------------------------------------------------------------------------
       
    69 // From MPhCntServiceRequestParamFactory
       
    70 // Creates new instance.
       
    71 // ---------------------------------------------------------------------------
       
    72 //
       
    73 MPhCntServiceRequestParam* 
       
    74     CPhCntServiceRequestParamFactory::CreateCreateNewContactRequestParamLC( 
       
    75         const TDesC& aPhoneNumber ) const
       
    76     {
       
    77     return CPhCntCreateNewContactParams::NewLC( aPhoneNumber );
       
    78     }
       
    79 
       
    80 // ---------------------------------------------------------------------------
       
    81 // From MPhCntServiceRequestParamFactory
       
    82 // Creates new instance.
       
    83 // ---------------------------------------------------------------------------
       
    84 //    
       
    85 MPhCntServiceRequestParam* 
       
    86     CPhCntServiceRequestParamFactory::CreateUpdateContactRequestParamLC( 
       
    87         const TDesC& aPhoneNumber ) const
       
    88     {
       
    89     return CPhCntUpdateExistingContact::NewLC( aPhoneNumber );
       
    90     }
       
    91     
       
    92 // ---------------------------------------------------------------------------
       
    93 // From MPhCntServiceRequestParamFactory
       
    94 // Creates new instance.
       
    95 // ---------------------------------------------------------------------------
       
    96 // 
       
    97 MPhCntServiceRequestParam* 
       
    98     CPhCntServiceRequestParamFactory::
       
    99         CreateGetUserSelectedPhoneNumberLinkParamLC() const
       
   100     {
       
   101     return CPhCntGetUserSelectedPhoneNumberLink::NewLC( ETrue, 
       
   102                                                         *iContactManager );
       
   103     }
       
   104 
       
   105 // ---------------------------------------------------------------------------
       
   106 // Creates new instance param instance
       
   107 // ---------------------------------------------------------------------------
       
   108 // 
       
   109 MPhCntServiceRequestParam* 
       
   110     CPhCntServiceRequestParamFactory::
       
   111         CreateGetUserSelectedPhoneNumberLC() const
       
   112     {
       
   113     return CPhCntGetUserSelectedPhoneNumberLink::NewLC( EFalse, 
       
   114                                                         *iContactManager );
       
   115     }
       
   116 
       
   117 // ---------------------------------------------------------------------------
       
   118 // From MPhCntServiceRequestParamFactory
       
   119 // Creates new instance.
       
   120 // ---------------------------------------------------------------------------
       
   121 // 
       
   122 MPhCntServiceRequestParam* 
       
   123     CPhCntServiceRequestParamFactory::
       
   124         CreateGetUserSelectedVoIPAddressLinkParamLC(
       
   125             MPhCntContactManager& aContactManager ) const
       
   126     {
       
   127     return CPhCntGetUserSelectedVoIPAddressLink::NewLC( aContactManager );
       
   128     }
       
   129 
       
   130 // ---------------------------------------------------------------------------
       
   131 // Creates new instance param instance
       
   132 // ---------------------------------------------------------------------------
       
   133 // 
       
   134 MPhCntServiceRequestParam* 
       
   135     CPhCntServiceRequestParamFactory::
       
   136         CreateGetUserSelectedVoIPAddressLC(
       
   137             MPhCntContactManager& aContactManager ) const
       
   138     {
       
   139     return CPhCntGetUserSelectedVoIPAddressLink::NewLC( aContactManager, EFalse );
       
   140     }
       
   141 
       
   142 // ---------------------------------------------------------------------------
       
   143 // From MPhCntServiceRequestParamFactory
       
   144 // Creates new instance.
       
   145 // ---------------------------------------------------------------------------
       
   146 //     
       
   147 MPhCntServiceRequestParam* 
       
   148     CPhCntServiceRequestParamFactory::CreateGetUserSelectedDtmfNumberLinkLC( 
       
   149         MPhCntContactManager& aContactManager ) const
       
   150     {
       
   151     return CPhCntGetUserSelectedDtmfNumberLink::NewLC( aContactManager );
       
   152     }
       
   153     
       
   154 // ---------------------------------------------------------------------------
       
   155 // From MPhCntServiceRequestParamFactory
       
   156 // Creates new instance.
       
   157 // ---------------------------------------------------------------------------
       
   158 //    
       
   159 MPhCntServiceRequestParam* 
       
   160     CPhCntServiceRequestParamFactory::
       
   161         CreateGetPhoneNumberFromContactParamLC( const TDesC8& aContactLink,
       
   162             const CPhCntSingleItemFetch::TCallType aCallType ) const
       
   163     {
       
   164     CVPbkContactLinkArray* linkArray = CVPbkContactLinkArray::NewLC( 
       
   165         aContactLink, iContactManager->ContactStoresL() );
       
   166     CPhCntGetPhoneNumberReqParam* param = 
       
   167         CPhCntGetPhoneNumberReqParam::NewL( *iContactManager, 
       
   168             *linkArray, aCallType );
       
   169     CleanupStack::PopAndDestroy( linkArray );
       
   170     CleanupStack::PushL( param );
       
   171     return param;   
       
   172     }
       
   173 
       
   174 // ---------------------------------------------------------------------------
       
   175 // From MPhCntServiceRequestParamFactory
       
   176 // Creates new instance.
       
   177 // ---------------------------------------------------------------------------
       
   178 //    
       
   179 MPhCntServiceRequestParam* 
       
   180     CPhCntServiceRequestParamFactory::CreateGetPhoneNumberFromContactParamL(
       
   181     const TDesC8& aContactLink,
       
   182     const CPhCntSingleItemFetch::TCallType aCallType ) const
       
   183     {
       
   184     CVPbkContactLinkArray* linkArray = CVPbkContactLinkArray::NewLC( 
       
   185         aContactLink, iContactManager->ContactStoresL() );
       
   186     CPhCntGetPhoneNumberReqParam* param = 
       
   187         CPhCntGetPhoneNumberReqParam::NewL( *iContactManager, 
       
   188             *linkArray, aCallType );
       
   189     CleanupStack::PopAndDestroy( linkArray );
       
   190     return param;        
       
   191     }
       
   192