phoneengine/PhoneCntFinder/ContactService/inc/CPhCntContactManager.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:  Offers services from phonebook.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef CPHCNTCONTACTMANAGER_H
       
    19 #define CPHCNTCONTACTMANAGER_H
       
    20 
       
    21 #include <e32base.h>
       
    22 #include <MVPbkContactStoreListObserver.h>
       
    23 #include "MPhCntContactManager.h"
       
    24 #include "mphcntvoipcontactfinder.h"
       
    25 
       
    26 class CVPbkContactManager;
       
    27 class CVPbkContactStoreUriArray;
       
    28 class MPbk2ContactNameFormatter;
       
    29 class CPbk2SortOrderManager;
       
    30 class CVPbkContactIdConverter;
       
    31 class CVPbkSpeedDialAttribute;
       
    32 class CPbk2ImageManager;
       
    33 class CVPbkFieldTypeRefsList;
       
    34 class CPhCntContactStoreUris;
       
    35 class MPhCntStoreLoaderObserver;
       
    36 
       
    37 /**
       
    38  *  Offers services from phonebook.
       
    39  *
       
    40  *  @lib PhoneCntFinder
       
    41  *  @since S60 v3.1
       
    42  */
       
    43 NONSHARABLE_CLASS( CPhCntContactManager ): 
       
    44     public CBase, 
       
    45     public MPhCntContactManager, 
       
    46     public MVPbkContactStoreListObserver,
       
    47     public MPhCntVoipContactFinder
       
    48     {
       
    49 public:
       
    50     
       
    51     /**
       
    52      * Static constructor.
       
    53      *
       
    54      * @since S60 v3.1
       
    55      */
       
    56     static CPhCntContactManager* NewL();
       
    57     
       
    58     /**
       
    59      * Destructor.
       
    60      *
       
    61      * @Since S60 v3.1
       
    62      */
       
    63     ~CPhCntContactManager();
       
    64     
       
    65     /**
       
    66      * Gives reference to contact manager.
       
    67      *
       
    68      * @since S60 v3.2
       
    69      * @return Contact manager.
       
    70      */
       
    71     CVPbkContactManager& ContactManager() const;
       
    72     
       
    73     /**
       
    74      * Return list of additional contact stores
       
    75      * @since S60 v3.2
       
    76      * @return Array of additional contact stores
       
    77      */
       
    78     const CVPbkContactStoreUriArray& AdditionalContactStoreUris();
       
    79 
       
    80     
       
    81 // From base class MPhCntContactManager
       
    82 
       
    83 	/**
       
    84 	 * From MPhCntContactManager.
       
    85 	 *
       
    86 	 * @since S60 v3.1
       
    87 	 * @see MPhCntContactManager.
       
    88 	 */
       
    89     MVPbkContactOperationBase* RetrieveContactL(
       
    90         const MVPbkContactLink& aLink,
       
    91         MVPbkSingleContactOperationObserver& aObserver );
       
    92        
       
    93     /**
       
    94 	 * From MPhCntContactManager.
       
    95 	 *
       
    96 	 * @since S60 v3.1
       
    97 	 * @see MPhCntContactManager.
       
    98 	 */ 
       
    99     MVPbkContactStoreList& ContactStoresL() const;
       
   100    
       
   101     /**
       
   102      * From MPhCntContactManager.
       
   103 	 *
       
   104 	 * @since S60 v3.1
       
   105 	 * @see MPhCntContactManager.
       
   106 	 */
       
   107     MPhCntContactMatchStrategy* CreateContactMatchStrategyL(
       
   108             MVPbkContactFindObserver& aObserver,
       
   109             TDuplicateRemovalStrategy aStrategy );
       
   110    
       
   111     /**
       
   112      * From MPhCntContactManager.
       
   113      *
       
   114      * @since S60 v3.1
       
   115      * @see MPhCntContactManager.
       
   116      */         
       
   117     MPbk2ContactNameFormatter& ContactNameFormatter();
       
   118    
       
   119     /**
       
   120      * From MPhCntContactManager.
       
   121      *
       
   122      * @since S60 v3.1
       
   123      * @see MPhCntContactManager.
       
   124      */
       
   125     MVPbkContactLinkArray* ConvertContactIdsToLinksL(  
       
   126         const CArrayFix<TContactItemId>& aContactId ) const;
       
   127     
       
   128     /**
       
   129      * From MPhCntContactManager.
       
   130      *
       
   131      * @since S60 v3.1
       
   132      * @see MPhCntContactManager.
       
   133      */    
       
   134     MVPbkContactLink* ConvertContactIdToLinkL( 
       
   135         TContactItemId aContactId ) const;   
       
   136         
       
   137     /**
       
   138      * From MPhCntContactManager.
       
   139      *
       
   140      * @since S60 v3.1
       
   141      * @see MPhCntContactManager.
       
   142      */
       
   143     TContactItemId ConvertContactLinkToContactId(
       
   144         const MVPbkContactLink& aContactLink ) const;
       
   145     
       
   146     /**
       
   147      * From MPhCntContactManager.
       
   148      *
       
   149      * @since S60 v3.2
       
   150      * @see MPhCntContactManager.
       
   151      */   
       
   152     MVPbkContactLink* ConvertDescriptorToLinkL( const TDesC8& aPackedLink ) const;
       
   153      
       
   154     /**
       
   155      * From MPhCntContactManager.
       
   156      *
       
   157      * @since S60 v3.1
       
   158      * @see MPhCntContactManager.
       
   159      */   
       
   160     MVPbkContactOperationBase* RetrieveSpeedDialContactLinkL(
       
   161         const TInt aSpeedDialPosition,
       
   162         MVPbkContactFindObserver& aObserver );
       
   163         
       
   164     /**
       
   165      * From MPhCntContactManager.
       
   166      *
       
   167      * @since S60 v3.2
       
   168      * @see MPhCntContactManager.
       
   169      */   
       
   170 	TBool HasSpeedDialL(        
       
   171 		const TInt aSpeedDialPosition,
       
   172 		const MVPbkStoreContactField& aField );
       
   173     
       
   174     /**
       
   175      * Retrieves contacts thumbnail. To cancel the thumbnail
       
   176      * fetch, delete operation.
       
   177      *
       
   178      * @since S60 v3.1
       
   179      * @param aContact Contact, which thumbnail is fetched.
       
   180      * @param aThumbnailFieldType Thumbnails field type.
       
   181      * @param aObserver Observer of the fetch.
       
   182      */
       
   183     MPbk2ImageOperation* RetrieveImageL(
       
   184         MVPbkStoreContact& aStoreContact,
       
   185         const MVPbkFieldType& aThumbnailFieldType,
       
   186         MPbk2ImageGetObserver& aObserver );
       
   187     
       
   188     /**
       
   189      * From MPhCntContactManager.
       
   190      *
       
   191      * @since S60 v3.2
       
   192      * @see MPhCntContactManager.
       
   193      */   
       
   194     CVPbkFieldTypeSelector* CreateFieldTypeSelectorL() const;
       
   195     
       
   196     /**
       
   197      * From MPhCntContactManager.
       
   198      *
       
   199      * @since S60 v3.2
       
   200      * @see MPhCntContactManager.
       
   201      */  
       
   202     void AppendFilterToSelectorL( CVPbkFieldTypeSelector& aSelector,
       
   203         TVPbkContactViewFilter aFilter );
       
   204 
       
   205     /**
       
   206      * From MPhCntContactManager. 
       
   207      *
       
   208      * @since   S60 v9.1
       
   209      * @see MPhCntContactManager.
       
   210      */
       
   211     void LoadContactStoreL( const TDesC8& aContactLink,
       
   212         MPhCntStoreLoaderObserver& aObserver );
       
   213 
       
   214     /**
       
   215      * From MPhCntContactManager. 
       
   216      *
       
   217      * @since   S60 v9.1
       
   218      * @see MPhCntContactManager.
       
   219      */    
       
   220     void LoadContactStoreWithUriL(
       
   221         const TDesC& aStoreUri,
       
   222         MPhCntStoreLoaderObserver& aObserver );
       
   223  
       
   224     /**
       
   225      * From MPhCntContactManager. 
       
   226      *
       
   227      * @since   S60 v9.1
       
   228      * @see MPhCntContactManager.
       
   229      */
       
   230     CPhCntContactStoreUris& ContactStoreUrisL();
       
   231 	
       
   232 // From base class MPhCntContactFinder
       
   233     
       
   234     /**
       
   235      * From base class MPhCntVoipContactFinder
       
   236      * Finds voip contacts, with given URI or partial URI. To cancel
       
   237      * the find, destroy the returned operation.
       
   238      * @since S60 v3.1
       
   239      * @param aSipURI Sip uri defining wanted matches.
       
   240      * @param aObserver Observer of the operation.
       
   241      * @return Operation.
       
   242      */
       
   243     MVPbkContactOperationBase* FindVoipContactsL( 
       
   244         const TDesC& aSipURI,
       
   245         MVPbkContactFindObserver& aObserver ) const;
       
   246 
       
   247 // From base class MVPbkContactStoreListObserver
       
   248     
       
   249     /**
       
   250      * From MVPbkContactStoreListObserver.
       
   251      * 
       
   252      * @since S60 v3.1
       
   253      * @see MVPbkContactStoreListObserver
       
   254      */	
       
   255     void OpenComplete();
       
   256     
       
   257 // From base class MVPbkContactStoreObserver 
       
   258 
       
   259     /**
       
   260      * From MVPbkContactStoreObserver.
       
   261      * 
       
   262      * @since S60 v3.1
       
   263      * @see MVPbkContactStoreObserver
       
   264      */
       
   265     void StoreReady( MVPbkContactStore& aContactStore );
       
   266     
       
   267     /**
       
   268      * From MVPbkContactStoreObserver.
       
   269      * 
       
   270      * @since S60 v3.1
       
   271      * @see MVPbkContactStoreObserver
       
   272      */
       
   273     void StoreUnavailable( MVPbkContactStore& aContactStore, TInt aReason );
       
   274     
       
   275     /**
       
   276      * From MVPbkContactStoreObserver.
       
   277      * 
       
   278      * @since S60 v3.1
       
   279      * @see MVPbkContactStoreObserver
       
   280      */
       
   281     void HandleStoreEventL(
       
   282         MVPbkContactStore& aContactStore, 
       
   283         TVPbkContactStoreEvent aStoreEvent);
       
   284     
       
   285 private:
       
   286         
       
   287     CPhCntContactManager();
       
   288     
       
   289     void ConstructL();
       
   290     
       
   291     /**
       
   292      * Adds voip field types.
       
   293      * 
       
   294      * @since S60 v3.1
       
   295      * @param aVoipFieldType VoIP field type.
       
   296      */
       
   297     void AddVoipFieldTypeL( const MVPbkFieldType* aVoipFieldType );
       
   298     
       
   299 private:
       
   300 
       
   301     /**
       
   302      * Contact manager.
       
   303      * Own.
       
   304      */
       
   305     CVPbkContactManager* iContactManager;
       
   306     
       
   307     /**
       
   308      * Contact name formatter.
       
   309      * Own.
       
   310      */
       
   311     MPbk2ContactNameFormatter* iContactNameFormatter;
       
   312     
       
   313     /**
       
   314      * Sort order.
       
   315      * Own.
       
   316      */
       
   317     CPbk2SortOrderManager* iSortOrder;
       
   318     
       
   319     /**
       
   320      * Contact id converter.
       
   321      * Own.
       
   322      */
       
   323     CVPbkContactIdConverter* iContactIdConverter;
       
   324     
       
   325     /**
       
   326      * Contact store.
       
   327      * Not own.
       
   328      */
       
   329     MVPbkContactStore* iContactDBStore;
       
   330     
       
   331     /**
       
   332      * Speed dial.
       
   333      * Own 
       
   334      */
       
   335      CVPbkSpeedDialAttribute* iSpeedDialAttribute;
       
   336      
       
   337      /**
       
   338       * For retrieveing thumbnail from contact.
       
   339       * own.
       
   340       */
       
   341      CPbk2ImageManager* iImageManager;
       
   342      
       
   343      /**
       
   344       * For finding voip contacts.
       
   345       * Own.
       
   346       */
       
   347      CVPbkFieldTypeRefsList* iVoipFieldTypeList;
       
   348     
       
   349      /**
       
   350       * Contact store uris
       
   351       * Own.
       
   352       */
       
   353      CPhCntContactStoreUris* iContactStoreUris;
       
   354     
       
   355      /**
       
   356       * Store loader observer.
       
   357       * Not own.
       
   358       */
       
   359      MPhCntStoreLoaderObserver* iStoreLoaderObserver;
       
   360      
       
   361      /**
       
   362      * Stored contact store for callback usage.
       
   363      */
       
   364      MVPbkContactStore* iContactStore;
       
   365      
       
   366     };
       
   367 
       
   368 #endif // CPHCNTCONTACTMANAGER_H