locationsystemui/locationsysui/locutils/inc/locrequestorutilsresolver.h
branchRCL_3
changeset 44 2b4ea9893b66
parent 42 02ba3f1733c6
child 45 6b6920c56e2f
equal deleted inserted replaced
42:02ba3f1733c6 44:2b4ea9893b66
     1 /*
       
     2 * Copyright (c) 2005-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:  Requestor utilities, supports Resolving of Requestors.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CLOCREQUESTORUTILSRESOLVER_H_
       
    20 #define CLOCREQUESTORUTILSRESOLVER_H_
       
    21 
       
    22 //  INCLUDES
       
    23 #include <cntdb.h>                  // MIdleFindObserver
       
    24 #include <PbkFields.hrh>            // TPbkFieldId
       
    25 #include <centralrepository.h>
       
    26 #include <cenrepnotifyhandler.h>
       
    27 
       
    28 //FORWARD DECLARATION
       
    29 class CPbkFieldIdArray;
       
    30 class CPbkIdleFinder;
       
    31 class CPbkContactEngine;
       
    32 class CActiveSchedulerWait;
       
    33 class CPosRequestor;
       
    34 class MVPbkContactOperationBase;
       
    35 class MVPbkContactLinkArray;
       
    36 class MVPbkStoreContact;
       
    37 class MVPbkFieldTypeList;
       
    38 class CPbk2SortOrderManager;
       
    39 class MPbk2ContactNameFormatter;
       
    40 
       
    41 // CLASS DECLARATION
       
    42 
       
    43 /**
       
    44 *   This class is a version requestor utilities with resolving.
       
    45 *  @lib locutils.lib
       
    46 *  @since 3.0
       
    47 */
       
    48 class CLocRequestorUtilsResolver  :	public CBase,
       
    49                                     public MCenRepNotifyHandlerCallback 
       
    50     {
       
    51     public: // Constructors and destructor
       
    52 
       
    53         /**
       
    54         * Symbian OS constructor
       
    55         * @param None
       
    56         * @return new object
       
    57         */
       
    58         IMPORT_C static CLocRequestorUtilsResolver* NewL();
       
    59 
       
    60         /**
       
    61         * Destructor.
       
    62         */
       
    63         virtual ~CLocRequestorUtilsResolver();
       
    64 
       
    65 	public: // Implement base class virtual methods
       
    66        /**
       
    67         * Processes the requestors. In this case there is no processing done.
       
    68         * @param aRequestors Array of Requestors
       
    69         * @return name descriptor, ownership is transferred to caller
       
    70         */
       
    71         IMPORT_C void ProcessRequestorsL( 
       
    72         				RPointerArray<CPosRequestor>& aRequestors );
       
    73 
       
    74         /**
       
    75         * This static method tells if requestor's name should be formatted
       
    76         * according to phone number formatting rules.
       
    77         * @param aRequestor who's name and id are investigated
       
    78         * @return ETrue if requestor has no name and id is of type 
       
    79         *               phone number.
       
    80         */
       
    81         IMPORT_C static TBool PhoneNumberAsName(
       
    82                         const CPosRequestor& aRequestor );
       
    83 
       
    84         /**
       
    85         * Static method for checking whether requestor id is valid or not.
       
    86         * Valid id means that a contact or service item can be created.
       
    87         * @param aRequestor requestor to be checked
       
    88         * @return ETrue if requestor id is valid, EFalse otherwise
       
    89         */
       
    90         IMPORT_C static TBool RequestorIdValid(
       
    91                         const CPosRequestor& aRequestor );
       
    92 
       
    93         /**
       
    94         * Returns requestor name. In this case the requestor Id String.
       
    95         * @param aRequestor Reference to the requestor for which
       
    96         *					the name is required.
       
    97         * @return name descriptor, ownership is transferred to caller
       
    98         */
       
    99         IMPORT_C HBufC* RequestorNameL( const CPosRequestor& aRequestor );
       
   100 		    
       
   101     private: // Constructors
       
   102         /**
       
   103         * C++ default constructor.
       
   104         */
       
   105         CLocRequestorUtilsResolver();
       
   106 
       
   107 		/**
       
   108 		* The Symbian 2nd Phase Constructor is always Private
       
   109 		*/
       
   110 		void ConstructL();
       
   111 
       
   112     private:
       
   113         /** 
       
   114         * From base class MCenRepNotifyHandlerCallback
       
   115         * This callback method is used to notify the client about
       
   116         * changes for integer value keys, i.e. key type is EIntKey.
       
   117         *
       
   118         * @param aId Id of the key that has changed.
       
   119         * @param aNewValue The new value of the key.
       
   120         */
       
   121         virtual void HandleNotifyInt( TUint32 aId, TInt aNewValue );
       
   122 
       
   123         /** 
       
   124         * This callback method is used to notify the client about errors
       
   125         * in the handler. Any error in handling causes the handler to stop
       
   126         * handling any more notifications.
       
   127         *
       
   128         * @param aId Id of the key this instance listens for or if 
       
   129         *            notifications for whole repository are listened, could 
       
   130         *            also be KInvalidNotificationId.
       
   131         * @param aError Error code.
       
   132         * @param aHandler Pointer to the handler instance. 
       
   133         */
       
   134         virtual void HandleNotifyError( TUint32 aId, TInt aError, 
       
   135                                         CCenRepNotifyHandler* aHandler );
       
   136 
       
   137     private: // New Methods
       
   138 		/**
       
   139         * This resolves the requestor by searching the contacts database
       
   140         * based on the requestor Id Information.
       
   141         * This searches only the default contact database now.
       
   142         */
       
   143         void ResolveRequestorNameL( CPosRequestor& aRequestor );
       
   144 
       
   145 		/**
       
   146         * This resolves the requestor by searching the contacts database
       
   147         * based on Phone Number. This searches only the default contact
       
   148         * database now.
       
   149         */
       
   150 		void SearchByPhoneNumberL( CPosRequestor& aRequestor );
       
   151 
       
   152 		/**
       
   153         * This resolves the requestor by searching the contacts database
       
   154         * based on Other Fields. Used to search E-mail , SIP URL and Web URL 
       
   155         * type fields. This searches only the default contact database now.
       
   156         */
       
   157 		void SearchByOtherFieldsL( CPosRequestor& aRequestor, 
       
   158 		                           TPbkFieldId aFieldType );
       
   159 
       
   160 		/**
       
   161         * This resolves the requestor by searching for the requestor 
       
   162         * string in al the fields in the contacts database.
       
   163         * This searches only the default contact database now.
       
   164         */
       
   165 		void SearchByAllFieldsL( CPosRequestor& aRequestor );
       
   166 
       
   167 		/**
       
   168 		* The Contact Searchs based on other fields can return contact cards
       
   169 		* that do not match in the specified field but in some other field.
       
   170 		* This method checks if the match occurs in the exact specified field.
       
   171 		*/
       
   172 		TBool IsContactExactRequestorMatchL( CPosRequestor& aRequestor,
       
   173 								             TContactItemId& aCntItemId,
       
   174 								             TPbkFieldId aFieldType );
       
   175 
       
   176 		/**
       
   177 		* This sets the contact card name in the requestor.
       
   178 		* Also the Requestor Format is changes to GenericName
       
   179 		*/
       
   180 		void SetContactNameToRequestorL( CPosRequestor& aRequestor,
       
   181 									     TContactItemId& aCntItemId );
       
   182 			
       
   183     private: // member data
       
   184     	// Own : Handle to the Contact Engine used to resolve the requestors
       
   185 		CPbkContactEngine* iPbkContactEngine;
       
   186 
       
   187         // Central repository instance.
       
   188         CRepository* iCenRepSession;
       
   189 
       
   190         // Central repository notify handler instance.
       
   191         CCenRepNotifyHandler* iCenRepNotifyHandler;
       
   192         
       
   193         // Matched numbers
       
   194         TInt iNumDigitsToMatch;
       
   195     };
       
   196 
       
   197 #endif // CLOCREQUESTORUTILSRESOLVER_H_
       
   198             
       
   199 // End of File