phoneengine/PhoneCntFinder/ContactService/inc/MPhCntContactManager.h
branchRCL_3
changeset 62 5266b1f337bd
child 81 c26cc2a7c548
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:  Interface for phonebook services.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef MPHCNTCONTACTMANAGER_H
       
    20 #define MPHCNTCONTACTMANAGER_H
       
    21 
       
    22 #include <cntdef.h>
       
    23 #include <VPbkContactView.hrh>
       
    24 
       
    25 class MVPbkContactLink;
       
    26 class MVPbkSingleContactOperationObserver;
       
    27 class MVPbkContactOperationBase;
       
    28 class MVPbkContactStoreList;
       
    29 class MVPbkContactFindObserver;
       
    30 class MPhCntContactMatchStrategy;
       
    31 class MPbk2ContactNameFormatter;
       
    32 class CVPbkContactIdConverter;
       
    33 class MVPbkContactLinkArray;
       
    34 class MVPbkContactFindObserver;
       
    35 class MPbk2ImageOperation;
       
    36 class MPbk2ImageGetObserver;
       
    37 class MVPbkFieldType;
       
    38 class MVPbkStoreContact;
       
    39 class MVPbkStoreContactField;
       
    40 class CVPbkFieldTypeSelector;
       
    41 class MPhCntStoreLoaderObserver;
       
    42 class CPhCntContactStoreUris;
       
    43 
       
    44 /**
       
    45  * Interface for phonebook services.
       
    46  *
       
    47  * @since S60 v3.1
       
    48  * @lib PhoneCntFinder.lib
       
    49  */
       
    50 NONSHARABLE_CLASS(  MPhCntContactManager )
       
    51     {
       
    52 public:
       
    53     
       
    54     enum TDuplicateRemovalStrategy {
       
    55         ERemoveDuplicates,
       
    56         EDontRemoveDuplicates
       
    57     };
       
    58     
       
    59     /**
       
    60      * Retrieves contact from phonebook.
       
    61      * 
       
    62      * @since S60 v3.1
       
    63      * @param aLink Link to the contact.
       
    64      * @param aObserver Observer for the retrieval.
       
    65      * @return Handle to the retrieval operation.
       
    66      */
       
    67     virtual MVPbkContactOperationBase* RetrieveContactL(
       
    68         const MVPbkContactLink& aLink,
       
    69         MVPbkSingleContactOperationObserver& aObserver) = 0;
       
    70         
       
    71     /**
       
    72      * Gives the list of contact stores.
       
    73      * 
       
    74      * @since S60 v3.1
       
    75      * @return List of contact stores.
       
    76      */
       
    77     virtual MVPbkContactStoreList& ContactStoresL() const = 0;
       
    78     
       
    79     /**
       
    80      * Factory method for creating contact match strategy.
       
    81      *
       
    82      * @since S60 v3.1
       
    83      * @param aObserver Contact match strategy observer.
       
    84      * @param aStrategy Contact dupe removal strategy
       
    85      * @return New contact match strategy instance.
       
    86      */
       
    87     virtual MPhCntContactMatchStrategy* CreateContactMatchStrategyL(
       
    88         MVPbkContactFindObserver& aObserver,
       
    89         TDuplicateRemovalStrategy aStrategy )= 0;
       
    90     
       
    91     /**
       
    92      * Gives access to contact name formatter.
       
    93      *
       
    94      * @since S60 v3.1
       
    95      * @return Contact name formatter.
       
    96      */    
       
    97     virtual MPbk2ContactNameFormatter& ContactNameFormatter() = 0;
       
    98     
       
    99     /**
       
   100      * Converts contact ids to contact links.
       
   101      * 
       
   102      * @since S60 v3.1
       
   103      * @param aContactId Array of contact ids.
       
   104      * @return Array of contact links. Ownership given.
       
   105      */
       
   106     virtual MVPbkContactLinkArray* ConvertContactIdsToLinksL(  
       
   107         const CArrayFix<TContactItemId>& aContactId ) const = 0;
       
   108         
       
   109     /**
       
   110      * Converts contact id to contact link.
       
   111      * 
       
   112      * @since S60 v3.1
       
   113      * @param aContactId Contact id from Contact DB.
       
   114      * @return Concact link, ownership is given to caller.
       
   115      * If the aContactId is KNullContactId then then returned value is NULL.
       
   116      */
       
   117     virtual MVPbkContactLink* ConvertContactIdToLinkL( 
       
   118         TContactItemId aContactId ) const = 0;
       
   119         
       
   120     /**
       
   121      * Converts contact link to contact id.
       
   122      *
       
   123      * @since S60 v3.1
       
   124      * @param aContactLink Reference to contactlink.
       
   125      * @return Contact id.
       
   126      */
       
   127     virtual TContactItemId ConvertContactLinkToContactId(
       
   128         const MVPbkContactLink& aContactLink ) const = 0;
       
   129         
       
   130     /**
       
   131      * Converts packed link descriptor to contact link.
       
   132      * 
       
   133      * @since S60 v3.2
       
   134      * @param aPackeLink Link prepresented as desctiptor.
       
   135      * @return Contact link. Returns null if aPackedLink length is 0.
       
   136      */
       
   137     virtual MVPbkContactLink* ConvertDescriptorToLinkL( 
       
   138         const TDesC8& aPackedLink ) const = 0;
       
   139         
       
   140     /**
       
   141      * Retrieves contact, which has been assinged to speeddial position
       
   142      * aSpeedDialPosition.
       
   143      *
       
   144      * @since S60 v3.1
       
   145      * @param aSpeedDialPosition Speed dial position.
       
   146      * @param aObserver Observer for operation.
       
   147      * @return Operation, ownership is given to caller.
       
   148      */
       
   149     virtual MVPbkContactOperationBase* RetrieveSpeedDialContactLinkL(
       
   150         const TInt aSpeedDialPosition,
       
   151         MVPbkContactFindObserver& aObserver ) = 0;
       
   152 
       
   153 	/**
       
   154      * Indicates whether the speed dial attribute has been set for the given position.
       
   155      *
       
   156      * @since S60 v3.2
       
   157      * @see MPhCntContactManager.
       
   158      * @param aSpeedDialPosition Speed dial position.
       
   159      * @param aField Field to be evaluated.
       
   160      * @return ETrue if aField has a matching speed dial position,
       
   161      *         EFalse otherwise.     
       
   162      */    
       
   163 	virtual TBool HasSpeedDialL(      
       
   164 		const TInt aSpeedDialPosition,  
       
   165 		const MVPbkStoreContactField& aField ) = 0;        
       
   166 
       
   167     /**
       
   168      * Retrieves contacts image. To cancel the thumbnail
       
   169      * fetch, delete operation.
       
   170      *
       
   171      * @since S60 v3.1
       
   172      * @param aContact Contact, which image is fetched.
       
   173      * @param aFieldType Field type.
       
   174      * @param aObserver Observer of the fetch.
       
   175      */
       
   176     virtual MPbk2ImageOperation* RetrieveImageL(
       
   177         MVPbkStoreContact& aStoreContact,
       
   178         const MVPbkFieldType& aFieldType,
       
   179         MPbk2ImageGetObserver& aObserver ) = 0;
       
   180         
       
   181     /** 
       
   182      * Creates field type selector.
       
   183      *
       
   184      * @since S60 v3.2
       
   185      */    
       
   186     virtual CVPbkFieldTypeSelector* CreateFieldTypeSelectorL() const = 0;
       
   187     
       
   188     /**
       
   189      * Appends filter to selector.
       
   190      *
       
   191      * @since S60 v3.2
       
   192      * @param aSelector Selector to append the filter.
       
   193      * @param aFilter The filter to be appended.
       
   194      */
       
   195     virtual void AppendFilterToSelectorL( CVPbkFieldTypeSelector& aSelector,
       
   196         TVPbkContactViewFilter aFilter ) = 0;
       
   197    
       
   198     /**
       
   199      * Loads the store specified in the contact link and adds the store to 
       
   200      * the list of stores handled by this manager.
       
   201      *
       
   202      * @since   S60 v9.1
       
   203      * @param   aContactLink    A contact link containing store to load.
       
   204      * @param   aObserver       An observer for the loading process.
       
   205      */
       
   206     virtual void LoadContactStoreL( const TDesC8& aContactLink,
       
   207         MPhCntStoreLoaderObserver& aObserver ) = 0;
       
   208    
       
   209     /**
       
   210      * Loads the store specified by the URI and adds the store to 
       
   211      * the list of stores handled by this manager.
       
   212      *
       
   213      * @since   S60 v9.1
       
   214      * @param   aStoreUri       A URI of the store to load.
       
   215      * @param   aObserver       An observer for the loading process.
       
   216      */
       
   217     virtual void LoadContactStoreWithUriL( 
       
   218         const TDesC& aStoreUri,
       
   219         MPhCntStoreLoaderObserver& aObserver ) = 0;
       
   220 		
       
   221     /** 
       
   222      * Return contact store uri's.
       
   223      *
       
   224      * @since S60 v9.1
       
   225      */ 
       
   226     virtual CPhCntContactStoreUris& ContactStoreUrisL() = 0;
       
   227 	
       
   228 protected:
       
   229 
       
   230     MPhCntContactManager(){};
       
   231     
       
   232     virtual ~MPhCntContactManager() {};
       
   233     };
       
   234 
       
   235 #endif