phoneengine/PhoneCntFinder/ContactService/inc/cphcntphonebookservices.h
branchRCL_3
changeset 62 5266b1f337bd
parent 0 5f000ab63145
child 16 4393b07b8c5d
equal deleted inserted replaced
61:41a7f70b3818 62:5266b1f337bd
       
     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:  Phonebook services wrapper.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CPHCNTPHONEBOOKSERVICES_H
       
    20 #define CPHCNTPHONEBOOKSERVICES_H
       
    21 
       
    22 #include <e32base.h>
       
    23 
       
    24 #include "MPhCntPhonebookServices.h"
       
    25 
       
    26 class MPhCntService;
       
    27 class MPhCntContactStores;
       
    28 class CPhCntFetchContact;
       
    29 class CPhCntContactId;
       
    30 class MPhCntContactManager;
       
    31 class MPhCntServiceRequestParam;
       
    32 class CPhCntContact;
       
    33 class MVPbkContactLinkArray;
       
    34 class CPhCntServiceRequestParamFactory;
       
    35 
       
    36 /**
       
    37  *  Phonebook services.
       
    38  *
       
    39  *  @lib PhoneCntFinder.lib
       
    40  *  @since S60 v3.2
       
    41  */
       
    42 NONSHARABLE_CLASS( CPhCntPhonebookServices )
       
    43     : public CBase, 
       
    44     public MPhCntPhonebookServices
       
    45     {
       
    46 public:
       
    47 
       
    48     /**
       
    49      * Static constructor.
       
    50      *
       
    51      * @since S60 v3.2
       
    52      * @param aContactStores Reference of contact stores.
       
    53      * @param aContactManager Reference to contact manager.
       
    54      */
       
    55     static CPhCntPhonebookServices* NewL( 
       
    56         MPhCntContactStores& aContactStores,
       
    57         MPhCntContactManager& aContactManager );
       
    58 
       
    59     /**
       
    60      * Destructor.
       
    61      *
       
    62      * @since S60 v3.2
       
    63      */     
       
    64     virtual ~CPhCntPhonebookServices();
       
    65 
       
    66 // From base class MPhCntPhonebookServices
       
    67 
       
    68     /**
       
    69      * From MPhCntPhonebookServices
       
    70      *
       
    71      * @since S60 v3.2
       
    72      * @see MPhCntPhonebookServices
       
    73      */
       
    74     void GetUserSelectedPhoneNumberL( 
       
    75         CPhCntContactId*& aContactId, 
       
    76         HBufC*& aPhoneNumber );
       
    77 
       
    78     /**
       
    79      * From MPhCntPhonebookServices
       
    80      *
       
    81      * @since S60 v3.2
       
    82      * @see MPhCntPhonebookServices
       
    83      */
       
    84     void GetUserSelectedVoIPAddressL( 
       
    85         CPhCntContactId*& aContactId, 
       
    86         HBufC*& aVoIPAddress );
       
    87     
       
    88     /**
       
    89      * From MPhCntPhonebookServices
       
    90      *
       
    91      * @since S60 v3.2
       
    92      * @see MPhCntPhonebookServices
       
    93      */    
       
    94     void GetUserSelectedDtmfNumberL(
       
    95         CPhCntContactId*& aContactId,
       
    96         HBufC*& aDtmfNumber );
       
    97         
       
    98     /**
       
    99      * From MPhCntPhonebookServices
       
   100      *
       
   101      * @since S60 v3.2
       
   102      * @see MPhCntPhonebookServices
       
   103      */
       
   104     void CreateNewContactL( const TDesC& aPhoneNumber );
       
   105     
       
   106     /**
       
   107      * From MPhCntPhonebookServices
       
   108      *
       
   109      * @since S60 v3.2
       
   110      * @see MPhCntPhonebookServices
       
   111      */
       
   112     void UpdateExistingContactL( const TDesC& aPhoneNumber );
       
   113     
       
   114     /**
       
   115      * From MPhCntPhonebookServices
       
   116      *
       
   117      * @since S60 v3.2
       
   118      * @see MPhCntPhonebookServices
       
   119      */
       
   120     void CPhCntPhonebookServices::GetPhoneNumberL(
       
   121 	    const TDesC8& aContactLink,
       
   122 	    const CPhCntSingleItemFetch::TCallType aCallType,
       
   123     	HBufC*& aNumber,
       
   124     	HBufC8*& aFieldLink );    
       
   125     	
       
   126     /**
       
   127      * From MPhCntPhonebookServices
       
   128      *
       
   129      * @since S60 v3.2
       
   130      * @see MPhCntPhonebookServices
       
   131      */   
       
   132     CPhCntContact* GetUserSelectedContactLC( 
       
   133         MPhCntServiceRequestParam& aParam );
       
   134     
       
   135     /**
       
   136      * From MPhCntPhonebookServices
       
   137      *
       
   138      * @since S60 v3.2
       
   139      * @see MPhCntPhonebookServices
       
   140      */     
       
   141     void CancelRequest();
       
   142 
       
   143 protected:
       
   144 
       
   145     CPhCntPhonebookServices( MPhCntContactManager& aContactManager );
       
   146 
       
   147     void ConstructL( 
       
   148         MPhCntContactStores& aContactStores );
       
   149     
       
   150 private:
       
   151 
       
   152     /**
       
   153      * Gets link to a contact, that user selects.
       
   154      * 
       
   155      * @since S60 v3.2
       
   156      * @param aParam Service request parameters.
       
   157      * @return Array of contact links.
       
   158      */
       
   159     HBufC8* GetContactLinksLC(
       
   160         MPhCntServiceRequestParam& aParam );
       
   161     
       
   162        
       
   163     /**
       
   164      * Sets result to client.
       
   165      *
       
   166      * @since S60 v3.2
       
   167      * @param aReceivedNumber Received number.
       
   168      * @param aReceivedContactId Received contact id.
       
   169      * @param aClientResultNumber Number given to client.
       
   170      * @param aClientResultContactId Id given to client.
       
   171      */
       
   172     void SetResultsL( 
       
   173         const TDesC& aReceivedNumber, 
       
   174         const CPhCntContactId* const aReceivedContactId,
       
   175         HBufC*& aClinetResultNumber,
       
   176         CPhCntContactId*& aClientResultContactId ) const;
       
   177      
       
   178     /**
       
   179      * Gets user selected number from phonebook.
       
   180      *
       
   181      * @param aContactId Contact id of the contact where the number is got.
       
   182      * @param aNumber Number user selected.
       
   183      * @param aDTMFWanted ETrue - User is selecting DTMF or phone number.
       
   184      *                    EFalse - User is selecting phone number.
       
   185      */
       
   186     void GetUserSelectedNumberL(
       
   187         CPhCntContactId*& aContactId,
       
   188         HBufC*& aNumber, TBool aDTMFWanted );
       
   189      
       
   190     /**
       
   191      * Creates CPhCntService if needed.
       
   192      * 
       
   193      * @since S60 v3.2
       
   194      */
       
   195     void CreateCntServiceL();
       
   196 
       
   197     /**
       
   198      * Gets user selected voip address from phonebook.
       
   199      *
       
   200      * @param aContactId Contact id of the contact where the number is got.
       
   201      * @param aVoIPAddress Address user selected.
       
   202      */
       
   203     void GetUserSelectedAddressL(
       
   204         CPhCntContactId*& aContactId,
       
   205         HBufC*& aVoIPAddress );
       
   206 
       
   207 protected: // data
       
   208 
       
   209     /**
       
   210      * AIW service wrapper.
       
   211      * Own.
       
   212      */
       
   213     MPhCntService* iService;
       
   214     
       
   215     /**
       
   216      * For fetching contact from phonebook.
       
   217      * Own.
       
   218      */
       
   219     CPhCntFetchContact* iFetchContact;
       
   220     
       
   221     /**
       
   222      * Contact manager.
       
   223      * Not own.
       
   224      */
       
   225     MPhCntContactManager& iContactManager;
       
   226     
       
   227     /**
       
   228      * Factory to create params.
       
   229      * Own.
       
   230      */
       
   231     CPhCntServiceRequestParamFactory* iParamFactory;
       
   232     
       
   233     };
       
   234 
       
   235 #endif // CPHCNTPHONEBOOKSERVICES_H