phoneengine/contacthandling/inc/cpecontactmatch.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:  Manager for contacts.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CPECONTACTMATCH_H
       
    20 #define CPECONTACTMATCH_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <cntdef.h>
       
    24 #include <e32base.h>
       
    25 #include <pevirtualengine.h>
       
    26 #include <mphcntthumbnailloaderobserver.h>
       
    27 
       
    28 // CONSTANTS
       
    29 // Number of languages that use lastname-firstname order
       
    30 const TInt KPENumberOfSwappedLanguages = 7;
       
    31 
       
    32 // Languages which use lastname-firstname order
       
    33 const TLanguage KPESwappedLanguages[ KPENumberOfSwappedLanguages ] = 
       
    34     {
       
    35     ELangHungarian,       // 17
       
    36     ELangTaiwanChinese,   // 29
       
    37     ELangHongKongChinese, // 30
       
    38     ELangPrcChinese,      // 31
       
    39     ELangJapanese,		  // 32
       
    40     ELangKorean,          // 65
       
    41     ELangVietnamese       // 96
       
    42     };
       
    43 
       
    44 // FORWARD DECLARATIONS
       
    45 class CPEContactHandling;
       
    46 class CPhCntContactId;
       
    47 class CPhCntFactory;
       
    48 class CPhCntSingleItemFetch;
       
    49 class CPhCntSpeedDialMonitor;
       
    50 class CPhCntThumbnailLoader;
       
    51 class MPEDataStore;
       
    52 class MPhCntMatch;
       
    53 class CPhCntMatcher;
       
    54 class CPhCntThumbnailLoader;
       
    55 class MPESimContactMatch;
       
    56 class CTelMatchingExtension;
       
    57 class CPEContactExtensionWrapper;
       
    58 
       
    59 // CLASS DECLARATION
       
    60 
       
    61 /**
       
    62 *  Container for all Contact Handling owned instances of Phone Contact Finder
       
    63 */
       
    64 class CPEContactMatch
       
    65     : public CBase,
       
    66       public MPhCntThumbnailLoaderObserver
       
    67     {
       
    68     public:  // Constructors and destructor      
       
    69 
       
    70         /**
       
    71         * Two-phased constructor.
       
    72         * @param aOwner, handle to contact handling interface / owner of this class
       
    73         * @param aDataStore, handle to internal engine info interface
       
    74         * @return an instance of class CPEContactMatch
       
    75         */
       
    76         IMPORT_C static CPEContactMatch* NewL(
       
    77             CPEContactHandling& aOwner,
       
    78             MPEDataStore& aDataStore );
       
    79         
       
    80         /**
       
    81         * Destructor.
       
    82         */
       
    83         ~CPEContactMatch();
       
    84 
       
    85     public: // New functions
       
    86 
       
    87         /**
       
    88         * Synchronous method for finding contact data specified with aContactId
       
    89         * @param aCallId, the call this contact is associated with
       
    90         * @return None
       
    91         */
       
    92         void MatchWithContactIdL( const TInt aCallId ); 
       
    93 
       
    94         /**
       
    95         * Search contact information synchronously matching with aPhoneNumber
       
    96         * @param aCallId, the call this contact is associated with
       
    97         * @return None (leaves with KErrNotFound if no match found or db in use)
       
    98         */
       
    99         void MatchWithNumberL( const TInt aCallId );
       
   100 
       
   101         /**
       
   102         * Returns contact picture data and call id association
       
   103         * NOTE! Ownership of the picture is transfered to caller.
       
   104         * @return contact thumbnail, equals NULL if not found
       
   105         */
       
   106         CFbsBitmap* ContactThumbnail();
       
   107 
       
   108         /**
       
   109         * Fetch number from speed dial location
       
   110         * @param aLocationIndex Index to look for
       
   111         * @param aNumber Filled with speed dial location phone number
       
   112         */
       
   113         void GetSpeedDialLocationL( 
       
   114             TInt aLocationIndex, 
       
   115             TPEPhoneNumber& aNumber );
       
   116 
       
   117     private:
       
   118 
       
   119         /**
       
   120         * C++ constructor.
       
   121         */
       
   122         CPEContactMatch(
       
   123             CPEContactHandling& aOwner,
       
   124             MPEDataStore& aDataStore );
       
   125         
       
   126         /**
       
   127         * Symbian OS constructor.
       
   128         */
       
   129         void ConstructL();
       
   130 
       
   131         /**
       
   132         * Create thumbnail loader.
       
   133         */
       
   134         void ConstructThumbnailLoaderL();
       
   135 
       
   136         /**
       
   137         * Create speed dial command
       
   138         */
       
   139         void ConstructSpeedDialCommandL();
       
   140 
       
   141         /**
       
   142         * Copies contact information to remote info struct
       
   143         * @param aMatch a contact item 
       
   144         * @param aCallId, the call this contact is associated with
       
   145         */
       
   146         void CopyContactFieldsDataL(
       
   147             const MPhCntMatch& aMatch,
       
   148             const TInt aCallId );
       
   149 
       
   150         /**
       
   151         * Creates single item fetch.
       
   152         *
       
   153         * Ownership is passed to the client.
       
   154         *
       
   155         * @return instance of single item fetch.
       
   156         */
       
   157         CPhCntSingleItemFetch* CreateSingleItemFetchL();
       
   158 
       
   159         /**
       
   160          * Creates contact id.
       
   161          */
       
   162         CPhCntContactId* CreateContactIdL( const TDesC8& aContactId );
       
   163 
       
   164         /**
       
   165          * Creates contact id.
       
   166          */
       
   167         CPhCntContactId* CreateContactIdL( TContactItemId aContactId );
       
   168 
       
   169         /**
       
   170         * Starts loading thumbnail image
       
   171         * @param aContactId contact item with the desired thumbnail
       
   172         * @param aCallId call id for identifying which thumbnail is loaded
       
   173         * @return Symbian OS error code
       
   174         */
       
   175         TInt LoadThumbnail( const CPhCntContactId& aContactId, const TInt aCallId );
       
   176 
       
   177         /**
       
   178         * From MPhCntThumbnailLoaderObserver
       
   179         *
       
   180         * Called when thumbnail loading has been completed.
       
   181         * Ownership of the bitmap is transferred to the observer.
       
   182         *
       
   183         * @param aId id, never KPhCntThumbnailNullId.
       
   184         * @param aResult error code.
       
   185         * @param aBitmap bitmap.
       
   186         */
       
   187         void MpctloThumbnailLoaded(
       
   188             CPhCntThumbnailLoader::TThumbnailId aId,
       
   189             TInt aResult, 
       
   190             CFbsBitmap* aBitmap );
       
   191 
       
   192         /**
       
   193         * Resolves services implementation uid for matching (ECom plugin).
       
   194         * @leave Leaves with KErrNotFound if UID not found.
       
   195         * @param aServiceId Unique service id used in current call.
       
   196         * @return Implementation UID
       
   197         */       
       
   198         TUid ResolveServicesImplementationUidL( TUint32 aServiceId );
       
   199  
       
   200         /**
       
   201         * Makes voip contact matching.
       
   202         * @param aCallId Id of the currently used call
       
   203         * @param aMatch Contact match
       
   204         * @param aRemotePartyName Remote party name.
       
   205         */  
       
   206         void MatchWithVoipAdressL( 
       
   207                 const TInt aCallId, 
       
   208                 MPhCntMatch*& aMatch, 
       
   209                 RBuf& aRemotePartyName );
       
   210         
       
   211         /**
       
   212         * Returns contact store uris that should be opened
       
   213         * before contact match. Store uris are fetched by service id.
       
   214         * @param aServiceId Service id of the ongoing call.
       
   215         * @return Array of uri's. NULL if not found for current service.
       
   216         */
       
   217         CDesCArray* StoreUrisForServiceL( TUint aServiceId );
       
   218         
       
   219         /**
       
   220         * Makes voip contact matching using extension plugin.
       
   221         * @since    S60 v5.1
       
   222         * @param    aCallId            Identifier of the currently used call.
       
   223         * @param    aMatch             Contact match.
       
   224         * @param    aRemotePartyName   Remote party name.
       
   225         */  
       
   226         void MatchWithVoipAddressUsingExtensionL( TInt aCallId, 
       
   227             MPhCntMatch*& aMatch, RBuf& aRemotePartyName );
       
   228         
       
   229         /**
       
   230          * Returns matching extension plugin for the given service. A new 
       
   231          * plugin is created if extension is not yet created for the service.
       
   232          * @since   S60 v5.1
       
   233          * @param   aServiceId  Service identifier.
       
   234          * @return  A matching extension instance.
       
   235          */
       
   236         CTelMatchingExtension& MatchingExtensionL( TUint aServiceId );
       
   237         
       
   238     private:    // Data
       
   239 
       
   240         // Handle to contact handling interface / owner of this class
       
   241         CPEContactHandling& iOwner;
       
   242 
       
   243         // Handle to internal engine info interface
       
   244         MPEDataStore& iDataStore;
       
   245 
       
   246         // Owned: library
       
   247         RLibrary iLibrary;
       
   248 
       
   249         // Owned: contact factory
       
   250         CPhCntFactory* iContactFactory;
       
   251 
       
   252         // Owned: contact matcher
       
   253         CPhCntMatcher* iContactMatcher;
       
   254 
       
   255         // Owned: sim contact matcher
       
   256         MPESimContactMatch* iSimContactMatcher;
       
   257 
       
   258         // Owned: thumbnail loader
       
   259         CPhCntThumbnailLoader* iContactThumbnailLoader;
       
   260 
       
   261         // Owned: speed dial monitor
       
   262         CPhCntSpeedDialMonitor* iSpeedDialCommand;
       
   263 
       
   264         // Owned: thumbnail image
       
   265         // Ownership is passed to client when it calls ContactThumbnail()
       
   266         CFbsBitmap* iThumbnailImage;
       
   267 
       
   268         // Identifier of the currently loading thumbnail
       
   269         // Used *exlusively* by this class to associate a thumbnail to a contact
       
   270         // This class uses a call id (TInt) for this purpose
       
   271         CPhCntThumbnailLoader::TThumbnailId iThumbnailId;
       
   272         
       
   273         /**
       
   274          * Contact extension plugins.
       
   275          * Own.
       
   276          */
       
   277         RPointerArray<CPEContactExtensionWrapper> iPlugins;
       
   278     };
       
   279 
       
   280 #endif // CPECONTACTMATCH_H
       
   281 
       
   282 // End of File