phoneengine/PhoneCntFinder/ContactService/inc/CPhCntSingleItemFetchService.h
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:  Service for fetching single contact field.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CPHCNTSINGLEITEMFETCHSERVICE_H
       
    20 #define CPHCNTSINGLEITEMFETCHSERVICE_H
       
    21 
       
    22 #include <e32base.h>
       
    23 #include "CPhCntSingleItemFetch.h"
       
    24 
       
    25 class MPhCntContactStores;
       
    26 class MPhCntPhonebookServices;
       
    27 class MPhCntContactManager;
       
    28 class CPhCntServiceRequestParamFactory;
       
    29 
       
    30 NONSHARABLE_CLASS( CPhCntSelectionImpl ) : public CPhCntSelection
       
    31     {
       
    32 public:
       
    33     
       
    34     /**
       
    35      * Static constructor.
       
    36      * Takes ownership of the parameters.
       
    37      */
       
    38     static CPhCntSelectionImpl* NewL( 
       
    39         const TDesC& aNumber,
       
    40         const CPhCntContactId& aContactId );
       
    41         
       
    42     ~CPhCntSelectionImpl();
       
    43     
       
    44     /**
       
    45      * From CPhCntSelection
       
    46      * @since s60 v3.2
       
    47      * @see CPhCntSelection
       
    48      */
       
    49     const TDesC& Number() const;
       
    50 
       
    51     /**
       
    52      * From CPhCntSelection
       
    53      * @since s60 v3.2
       
    54      * @see CPhCntSelection
       
    55      */
       
    56     const CPhCntContactId& ContactId() const;
       
    57     
       
    58 private:
       
    59 
       
    60     CPhCntSelectionImpl();
       
    61     
       
    62     void ConstructL(
       
    63         const TDesC& aNumber,
       
    64         const CPhCntContactId& aContactId );
       
    65         
       
    66 private: // Data
       
    67 
       
    68     /**
       
    69      * Number.
       
    70      * Own.
       
    71      */
       
    72     HBufC* iNumber;
       
    73 
       
    74     /**
       
    75      * Contact identifier.
       
    76      * Own.
       
    77      */
       
    78     CPhCntContactId* iContactId;
       
    79     
       
    80     };
       
    81 
       
    82 /**
       
    83  * Service for fetching single contact item from phonebook.
       
    84  *
       
    85  * @since S60 v3.1
       
    86  * @lib PhoneCntFinder.lib
       
    87  */
       
    88 NONSHARABLE_CLASS( CPhCntSingleItemFetchService ): public CPhCntSingleItemFetch
       
    89     {
       
    90 public:
       
    91    	
       
    92    	/**
       
    93    	 * Static constructor.
       
    94    	 *
       
    95    	 * @since S60 v3.1
       
    96    	 * @param aServices Phonebooks services
       
    97    	 * @param aContactManager Contact manager
       
    98    	 */     
       
    99     static CPhCntSingleItemFetchService* NewL(
       
   100         MPhCntContactStores& aServices,
       
   101         MPhCntContactManager& aContactManager );
       
   102 
       
   103     /**
       
   104      * Destructor.
       
   105      * 
       
   106      * @since S60 v3.1
       
   107      */
       
   108     ~CPhCntSingleItemFetchService();
       
   109     
       
   110 // From base class CPhCntSingleItemFetch
       
   111 
       
   112     /**
       
   113     * From base class CPhCntSingleItemFetch
       
   114     *
       
   115     * @see CPhCntSingleItemFetch
       
   116     * @since S60 3.1
       
   117     */
       
   118     TInt FetchLD( TFetchParams& aParams );
       
   119     
       
   120     /**
       
   121 	* From base class CPhCntSingleItemFetch
       
   122     *
       
   123     * @see CPhCntSingleItemFetch
       
   124     * @since S60 3.1
       
   125 	*/
       
   126     TInt FetchPhoneNumberLD( 
       
   127     	const TDesC8& aContactLink, 
       
   128     	const CPhCntSingleItemFetch::TCallType aCallType,
       
   129     	HBufC*& aNumber,
       
   130     	HBufC8*& aFieldLink );
       
   131     
       
   132     /**
       
   133 	 * From base class CPhCntSingleItemFetch
       
   134      *
       
   135      * @see CPhCntSingleItemFetch
       
   136      * @since S60 3.2
       
   137 	 */	
       
   138     CPhCntSelection* SelectPhoneNumberLD();
       
   139         
       
   140 private:
       
   141 
       
   142     /**
       
   143     * Sets return values (aParams) for client when fetching
       
   144     * is completed.
       
   145     * 
       
   146     * @since S60 3.1
       
   147     * @param aParams Parameters from client.
       
   148     * @returns Possible error value
       
   149     */
       
   150     TInt SetFetchParams( TFetchParams& aParams,
       
   151         const TDesC& aPhoneNumber ) const;
       
   152         
       
   153 protected:
       
   154         
       
   155     CPhCntSingleItemFetchService();
       
   156     
       
   157     void ConstructL( 
       
   158         MPhCntContactStores& aContactStores,
       
   159         MPhCntContactManager& aContactManage );
       
   160         
       
   161 protected:
       
   162 
       
   163     /**
       
   164      * Service to fetch the phone number.
       
   165      * Own.
       
   166      */
       
   167     MPhCntPhonebookServices* iServices;
       
   168     
       
   169     /** 
       
   170      * Indication if this is destroyed.
       
   171      */
       
   172     TBool* iDestroyed;
       
   173     
       
   174     /**
       
   175      * Factory to create request params.
       
   176      * Own.
       
   177      */
       
   178     CPhCntServiceRequestParamFactory* iParamFactory;
       
   179 
       
   180     };
       
   181 
       
   182 #endif // CPHCNTSINGLEITEMFETCHSERVICE_H