williamr@4: /* williamr@4: * Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). williamr@4: * All rights reserved. williamr@4: * This component and the accompanying materials are made available williamr@4: * under the terms of "Eclipse Public License v1.0" williamr@4: * which accompanies this distribution, and is available williamr@4: * at the URL "http://www.eclipse.org/legal/epl-v10.html". williamr@4: * williamr@4: * Initial Contributors: williamr@4: * Nokia Corporation - initial contribution. williamr@4: * williamr@4: * Contributors: williamr@4: * williamr@4: * Description: Virtual Phonebook manager class for contact attributes. williamr@4: * williamr@4: */ williamr@4: williamr@4: williamr@4: #ifndef MVPBKCONTACTATTRIBUTEMANAGER_H williamr@4: #define MVPBKCONTACTATTRIBUTEMANAGER_H williamr@4: williamr@4: // INCLUDE FILES williamr@4: #include williamr@4: #include williamr@4: williamr@4: // FORWARD DECLARATIONS williamr@4: class MVPbkContactOperationBase; williamr@4: class MVPbkContactLink; williamr@4: class MVPbkContactFindObserver; williamr@4: class MVPbkStoreContact; williamr@4: class MVPbkStoreContactField; williamr@4: class MVPbkContactAttribute; williamr@4: class MVPbkStoreContactFieldCollection; williamr@4: williamr@4: /** williamr@4: * Virtual Phonebook single attribute presense observer interface. williamr@4: */ williamr@4: class MVPbkSingleAttributePresenceObserver williamr@4: { williamr@4: public: williamr@4: /** williamr@4: * Attribute presence query operation completed. williamr@4: * @param aOperation Contact operation that was completed. williamr@4: * @param aResult Result of the query. williamr@4: */ williamr@4: virtual void AttributePresenceOperationComplete( williamr@4: MVPbkContactOperationBase& aOperation, TBool aResult ) = 0; williamr@4: williamr@4: /** williamr@4: * Attribute presence query operation failed. williamr@4: * @param aOperation Contact operation that failed. williamr@4: * @param aError Error code. williamr@4: */ williamr@4: virtual void AttributePresenceOperationFailed( williamr@4: MVPbkContactOperationBase& aOperation, TInt aError) = 0; williamr@4: williamr@4: /** williamr@4: * Returns an extension point for this interface or NULL. williamr@4: * @param aExtensionUid Extension identifier. williamr@4: * @return Extension object. williamr@4: */ williamr@4: virtual TAny* AttributeSinglePresenceOperationExtension( williamr@4: TUid /*aExtensionUid*/) { return NULL; } williamr@4: williamr@4: protected: // Destructor williamr@4: /** williamr@4: * Destructor. williamr@4: */ williamr@4: virtual ~MVPbkSingleAttributePresenceObserver() { } williamr@4: }; williamr@4: williamr@4: /** williamr@4: * Virtual Phonebook multiple attribute presense observer interface. williamr@4: */ williamr@4: class MVPbkMultiAttributePresenceObserver williamr@4: { williamr@4: public: williamr@4: /** williamr@4: * Attribute presence query operation completed. williamr@4: * @param aOperation Contact operation that was completed. williamr@4: * @param aResult Fields with attribute aAttribute, williamr@4: * or NULL if there is no fields with that williamr@4: * attribute in this contact. williamr@4: */ williamr@4: virtual void AttributePresenceOperationComplete( williamr@4: MVPbkContactOperationBase& aOperation, williamr@4: MVPbkStoreContactFieldCollection* aResult) = 0; williamr@4: williamr@4: /** williamr@4: * Attribute presence query operation failed. williamr@4: * @param aOperation Contact operation that failed. williamr@4: * @param aError Error code. williamr@4: */ williamr@4: virtual void AttributePresenceOperationFailed( williamr@4: MVPbkContactOperationBase& aOperation, TInt aError) = 0; williamr@4: williamr@4: /** williamr@4: * Returns an extension point for this interface or NULL. williamr@4: * @param aExtensionUid Extension identifier. williamr@4: * @return Extension object. williamr@4: */ williamr@4: virtual TAny* AttributeMultiPresenceOperationExtension( williamr@4: TUid /*aExtensionUid*/) { return NULL; } williamr@4: williamr@4: protected: // Destructor williamr@4: /** williamr@4: * Destructor. williamr@4: */ williamr@4: virtual ~MVPbkMultiAttributePresenceObserver() { } williamr@4: }; williamr@4: williamr@4: williamr@4: /** williamr@4: * Virtual Phonebook Set attribute observer interface. williamr@4: */ williamr@4: class MVPbkSetAttributeObserver williamr@4: { williamr@4: public: williamr@4: /** williamr@4: * Attribute operation completed. williamr@4: * @param aOperation Contact operation that was completed. williamr@4: */ williamr@4: virtual void AttributeOperationComplete( williamr@4: MVPbkContactOperationBase& aOperation) = 0; williamr@4: williamr@4: /** williamr@4: * Attribute operation failed. williamr@4: * @param aOperation Contact operation that failed. williamr@4: * @param aError Error code. williamr@4: */ williamr@4: virtual void AttributeOperationFailed( williamr@4: MVPbkContactOperationBase& aOperation, TInt aError) = 0; williamr@4: williamr@4: /** williamr@4: * Returns an extension point for this interface or NULL. williamr@4: * @param aExtensionUid Extension identifier. williamr@4: * @return Extension object. williamr@4: */ williamr@4: virtual TAny* SetAttributeObserverExtension( williamr@4: TUid /*aExtensionUid*/) { return NULL; } williamr@4: williamr@4: protected: // Destructor williamr@4: /** williamr@4: * Destructor. williamr@4: */ williamr@4: ~MVPbkSetAttributeObserver() { } williamr@4: }; williamr@4: williamr@4: /** williamr@4: * Abstract interface for contact attribute manager. williamr@4: * williamr@4: * Contact attribute manager can be used to set global attributes such as speed dials williamr@4: * for contacts or fields of contacts. The attributes can be stored in external williamr@4: * databases so that some kind of mapping is maintained between contacts and williamr@4: * attributes. This interface provides unified access to all global attributes. williamr@4: */ williamr@4: class MVPbkContactAttributeManager williamr@4: { williamr@4: public: williamr@4: /** williamr@4: * Destructor. williamr@4: */ williamr@4: virtual ~MVPbkContactAttributeManager() { } williamr@4: williamr@4: /** williamr@4: * Lists all contacts having the requested type of williamr@4: * attribute asynchronously. williamr@4: * williamr@4: * @param aAttributeType Type of the attribute to search for. williamr@4: * @param aObserver Observer for the asynchronous process. williamr@4: * @return Newly created handle to the process. williamr@4: */ williamr@4: virtual MVPbkContactOperationBase* ListContactsL( williamr@4: TUid aAttributeType, williamr@4: MVPbkContactFindObserver& aObserver) = 0; williamr@4: williamr@4: /** williamr@4: * Lists all contacts matching the given attribute asynchronously. williamr@4: * williamr@4: * @param aAttribute Attribute prototype to match against. williamr@4: * @param aObserver Observer for the asynchronous process. williamr@4: * @return Newly created handle to the process. williamr@4: */ williamr@4: virtual MVPbkContactOperationBase* ListContactsL( williamr@4: const MVPbkContactAttribute& aAttribute, williamr@4: MVPbkContactFindObserver& aObserver) = 0; williamr@4: williamr@4: /** williamr@4: * Checks if the given contact has the given attribute. williamr@4: * williamr@4: * @param aAttributeType Type of the attribute to check for. williamr@4: * @param aContact Contact whose attributes are checked. williamr@4: * @return ETrue if aContact has an attribute of aAttributeType, williamr@4: * EFalse otherwise. williamr@4: */ williamr@4: virtual TBool HasContactAttributeL( williamr@4: TUid aAttributeType, williamr@4: const MVPbkStoreContact& aContact) const = 0; williamr@4: williamr@4: /** williamr@4: * Checks if the given contact has an attribute matching the williamr@4: * given attribute. williamr@4: * williamr@4: * @param aAttribute Attribute prototype to match against. williamr@4: * @param aContact Contact whose attributes are checked. williamr@4: * @return ETrue if aContact has an attribute matching the aAttribute, williamr@4: * EFalse otherwise. williamr@4: */ williamr@4: virtual TBool HasContactAttributeL( williamr@4: const MVPbkContactAttribute& aAttribute, williamr@4: const MVPbkStoreContact& aContact) const = 0; williamr@4: williamr@4: /** williamr@4: * Checks if the given contact field has the given attribute. williamr@4: * williamr@4: * @param aAttributeType Type of the attribute to check for. williamr@4: * @param aField Field whose attributes are checked. williamr@4: * @return ETrue if aField has an attribute of aAttributeType, williamr@4: * EFalse otherwise. williamr@4: */ williamr@4: virtual TBool HasFieldAttributeL( williamr@4: TUid aAttributeType, williamr@4: const MVPbkStoreContactField& aField) const = 0; williamr@4: williamr@4: /** williamr@4: * Checks if the given contact field has an attribute matching williamr@4: * the given attribute. williamr@4: * williamr@4: * @param aAttribute Attribute prototype to match against. williamr@4: * @param aField Contact field whose attribute is checked. williamr@4: * @return ETrue if aField has an attribute matching the aAttribute, williamr@4: * EFalse otherwise. williamr@4: */ williamr@4: virtual TBool HasFieldAttributeL( williamr@4: const MVPbkContactAttribute& aAttribute, williamr@4: const MVPbkStoreContactField& aField) const = 0; williamr@4: williamr@4: /** williamr@4: * Returns fields with attribute type aAttributeType, or williamr@4: * NULL if there is no fields with that attribute in this williamr@4: * contact. williamr@4: * williamr@4: * @param aAttributeType Type of the attribute to find for. williamr@4: * @param aContact Contact whose attributes are checked. williamr@4: */ williamr@4: virtual MVPbkStoreContactFieldCollection* FindFieldsWithAttributeLC( williamr@4: TUid aAttributeType, williamr@4: MVPbkStoreContact& aContact) const = 0; williamr@4: williamr@4: /** williamr@4: * Returns fields with attribute aAttribute, or NULL if there is no williamr@4: * fields with that attribute in this contact. williamr@4: * williamr@4: * @param aAttribute Attribute prototype to match against. williamr@4: * @param aContact Contact whose attributes are checked. williamr@4: */ williamr@4: virtual MVPbkStoreContactFieldCollection* FindFieldsWithAttributeLC( williamr@4: const MVPbkContactAttribute& aAttribute, williamr@4: MVPbkStoreContact& aContact) const = 0; williamr@4: williamr@4: /** williamr@4: * Finds the first field that has the aAttr and returns williamr@4: * a reference to the field or NULL if not found. williamr@4: * williamr@4: * Note: the returned reference will become invalid if williamr@4: * MVPbkStoreContactFieldCollection::FieldAt is called for williamr@4: * different field. If this is a problem then use williamr@4: * MVPbkStoreContactField::CloneLC for permanent copy of williamr@4: * the field. williamr@4: * williamr@4: * @param aAttr The attribute that is looked for. williamr@4: * @param aContact Contact whose fields are iterated. williamr@4: * @return Returns a reference to the field or NULL if not found. williamr@4: */ williamr@4: virtual MVPbkStoreContactField* FindFieldWithAttributeL( williamr@4: const MVPbkContactAttribute& aAttr, williamr@4: MVPbkStoreContact& aContact) const = 0; williamr@4: williamr@4: /** williamr@4: * Asynchronously sets the contact attribute for the contact referred williamr@4: * by the given contact link. williamr@4: * williamr@4: * @param aContactLink Link to contact whose attribute to set. williamr@4: * @param aAttribute Attribute to set for the contact. williamr@4: * @param aObserver Observer for the asynchronous process. williamr@4: * @return Newly created handle to the operation. williamr@4: */ williamr@4: virtual MVPbkContactOperationBase* SetContactAttributeL( williamr@4: const MVPbkContactLink& aContactLink, williamr@4: const MVPbkContactAttribute& aAttribute, williamr@4: MVPbkSetAttributeObserver& aObserver) = 0; williamr@4: /** williamr@4: * Asynchronously sets the contact field attribute for the williamr@4: * give contact field. williamr@4: * williamr@4: * @param aField Contact field whose attribute to set. williamr@4: * @param aAttribute Attribute to set for the contact field. williamr@4: * @param aObserver Observer for the asynchronous process. williamr@4: * @return Newly created handle to the operation. williamr@4: */ williamr@4: virtual MVPbkContactOperationBase* SetFieldAttributeL( williamr@4: MVPbkStoreContactField& aField, williamr@4: const MVPbkContactAttribute& aAttribute, williamr@4: MVPbkSetAttributeObserver& aObserver) = 0; williamr@4: williamr@4: /** williamr@4: * asynchronously removes the given attribute from the contact williamr@4: * referred by the aContactLink. williamr@4: * williamr@4: * @param aContactLink Link to the contact whose attribute williamr@4: * to remove. williamr@4: * @param aAttribute Attribute to remove from the contact. williamr@4: * @param aObserver Observer for the asynchronous process. williamr@4: * @return Newly created handle to the operation. williamr@4: */ williamr@4: virtual MVPbkContactOperationBase* RemoveContactAttributeL( williamr@4: const MVPbkContactLink& aContactLink, williamr@4: const MVPbkContactAttribute& aAttribute, williamr@4: MVPbkSetAttributeObserver& aObserver) = 0; williamr@4: williamr@4: /** williamr@4: * asynchronously removes all attributes having the attribute williamr@4: * type aAttributeType from the contact. williamr@4: * williamr@4: * @param aContactLink Link to the contact whose attribute williamr@4: * to remove. williamr@4: * @param aAttributeType Type of the attributes to remove williamr@4: * from the contact. williamr@4: * @param aObserver Observer for the asynchronous process. williamr@4: * @return Newly created handle to the operation. williamr@4: */ williamr@4: virtual MVPbkContactOperationBase* RemoveContactAttributeL( williamr@4: const MVPbkContactLink& aContactLink, williamr@4: TUid aAttributeType, williamr@4: MVPbkSetAttributeObserver& aObserver) = 0; williamr@4: williamr@4: /** williamr@4: * Asynchronously removes the given attribute from the williamr@4: * given contact field. williamr@4: * williamr@4: * @param aField Field whose attribute to remove. williamr@4: * @param aAttribute Attribute to remove from the contact field. williamr@4: * @param aObserver Observer for the asynchronous process. williamr@4: * @return Newly created handle to the operation. williamr@4: */ williamr@4: virtual MVPbkContactOperationBase* RemoveFieldAttributeL( williamr@4: MVPbkStoreContactField& aField, williamr@4: const MVPbkContactAttribute& aAttribute, williamr@4: MVPbkSetAttributeObserver& aObserver) = 0; williamr@4: williamr@4: /** williamr@4: * Asynchronously removes all attributes having the attribute williamr@4: * type aAttributeType from the contact field. williamr@4: * williamr@4: * @param aField Field whose attribute to remove. williamr@4: * @param aAttributeType Type of the attributes to remove williamr@4: * from the contact field. williamr@4: * @param aObserver Observer for the asynchronous process. williamr@4: * @return Newly created handle to the operation. williamr@4: */ williamr@4: virtual MVPbkContactOperationBase* RemoveFieldAttributeL( williamr@4: MVPbkStoreContactField& aField, williamr@4: TUid aAttributeType, williamr@4: MVPbkSetAttributeObserver& aObserver) = 0; williamr@4: williamr@4: /** williamr@4: * Checks if the given contact has the given attribute asynchronously. williamr@4: * williamr@4: * @param aAttributeType Type of the attribute to check for. williamr@4: * @param aContact Contact whose attributes are checked. williamr@4: * @param aObserver Observer for the asynchronous process. williamr@4: * @return Newly created handle to the operation. williamr@4: */ williamr@4: virtual MVPbkContactOperationBase* HasContactAttributeL( williamr@4: TUid aAttributeType, williamr@4: const MVPbkStoreContact& aContact, williamr@4: MVPbkSingleAttributePresenceObserver& aObserver) const = 0; williamr@4: williamr@4: /** williamr@4: * Checks if the given contact has an attribute matching the williamr@4: * given attribute asynchronously. williamr@4: * williamr@4: * @param aAttribute Attribute prototype to match against. williamr@4: * @param aContact Contact whose attributes are checked. williamr@4: * @param aObserver Observer for the asynchronous process. williamr@4: * @return Newly created handle to the operation. williamr@4: */ williamr@4: virtual MVPbkContactOperationBase* HasContactAttributeL( williamr@4: const MVPbkContactAttribute& aAttribute, williamr@4: const MVPbkStoreContact& aContact, williamr@4: MVPbkSingleAttributePresenceObserver& aObserver) const = 0; williamr@4: williamr@4: /** williamr@4: * Checks if the given contact field has the given attribute williamr@4: * asynchronously. williamr@4: * williamr@4: * @param aAttributeType Type of the attribute to check for. williamr@4: * @param aField Field whose attributes are checked. williamr@4: * @param aObserver Observer for the asynchronous process. williamr@4: * @return Newly created handle to the operation. williamr@4: */ williamr@4: virtual MVPbkContactOperationBase* HasFieldAttributeL( williamr@4: TUid aAttributeType, williamr@4: const MVPbkStoreContactField& aField, williamr@4: MVPbkSingleAttributePresenceObserver& aObserver) const = 0; williamr@4: williamr@4: /** williamr@4: * Checks if the given contact field has an attribute matching williamr@4: * the given attribute asynchronously. williamr@4: * williamr@4: * @param aAttribute Attribute prototype to match against. williamr@4: * @param aField Contact field whose attribute is checked. williamr@4: * @param aObserver Observer for the asynchronous process. williamr@4: * @return Newly created handle to the operation. williamr@4: */ williamr@4: virtual MVPbkContactOperationBase* HasFieldAttributeL( williamr@4: const MVPbkContactAttribute& aAttribute, williamr@4: const MVPbkStoreContactField& aField, williamr@4: MVPbkSingleAttributePresenceObserver& aObserver) const = 0; williamr@4: williamr@4: /** williamr@4: * Initiates an asynchronous operation, which finds the aAttribute type williamr@4: * attributed fields from the contact. williamr@4: * williamr@4: * @param aAttributeType Type of the attribute to find for. williamr@4: * @param aContact Contact whose attributes are checked. williamr@4: * @param aObserver Observer for the asynchronous process. williamr@4: * @return Newly created handle to the operation. williamr@4: */ williamr@4: virtual MVPbkContactOperationBase* FindFieldsWithAttributeL( williamr@4: TUid aAttributeType, williamr@4: MVPbkStoreContact& aContact, williamr@4: MVPbkMultiAttributePresenceObserver& aObserver) const = 0; williamr@4: williamr@4: /** williamr@4: * Initiates an asynchronous operation, which finds the aAttribute type williamr@4: * attributed fields from the contact. williamr@4: * williamr@4: * @param aAttribute Attribute prototype to match against. williamr@4: * @param aContact Contact whose attributes are checked. williamr@4: * @param aObserver Observer for the asynchronous process. williamr@4: * @return Newly created handle to the operation. williamr@4: */ williamr@4: virtual MVPbkContactOperationBase* FindFieldsWithAttributeL( williamr@4: const MVPbkContactAttribute& aAttribute, williamr@4: MVPbkStoreContact& aContact, williamr@4: MVPbkMultiAttributePresenceObserver& aObserver) const = 0; williamr@4: williamr@4: /** williamr@4: * Returns an extension point for this interface or NULL. williamr@4: * @param aExtensionUid Extension identifier. williamr@4: * @return Extension point or NULL williamr@4: */ williamr@4: virtual TAny* ContactAttributeManagerExtension( williamr@4: TUid /*aExtensionUid*/) { return NULL; } williamr@4: }; williamr@4: williamr@4: #endif // MVPBKCONTACTATTRIBUTEMANAGER_H williamr@4: williamr@4: // End of File