epoc32/include/app/MVPbkContactAttributeManager.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
     1 /*
     2 * Copyright (c) 2002-2007 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:  Virtual Phonebook manager class for contact attributes.
    15 *
    16 */
    17  
    18 
    19 #ifndef MVPBKCONTACTATTRIBUTEMANAGER_H
    20 #define MVPBKCONTACTATTRIBUTEMANAGER_H
    21 
    22 // INCLUDE FILES
    23 #include <e32cmn.h>
    24 #include <e32std.h>
    25 
    26 // FORWARD DECLARATIONS
    27 class MVPbkContactOperationBase;
    28 class MVPbkContactLink;
    29 class MVPbkContactFindObserver;
    30 class MVPbkStoreContact;
    31 class MVPbkStoreContactField;
    32 class MVPbkContactAttribute;
    33 class MVPbkStoreContactFieldCollection;
    34 
    35 /**
    36  * Virtual Phonebook single attribute presense observer interface.
    37  */
    38 class MVPbkSingleAttributePresenceObserver
    39     {
    40     public:
    41         /**
    42          * Attribute presence query operation completed.
    43          * @param aOperation    Contact operation that was completed.
    44          * @param aResult   Result of the query.
    45          */
    46         virtual void AttributePresenceOperationComplete(
    47             MVPbkContactOperationBase& aOperation, TBool aResult ) = 0;
    48 
    49         /**
    50          * Attribute presence query operation failed.
    51          * @param aOperation    Contact operation that failed.
    52          * @param aError        Error code.
    53          */
    54         virtual void AttributePresenceOperationFailed(
    55             MVPbkContactOperationBase& aOperation, TInt aError) = 0;
    56 
    57         /**
    58          * Returns an extension point for this interface or NULL.
    59          * @param aExtensionUid Extension identifier.
    60          * @return Extension object.
    61          */
    62         virtual TAny* AttributeSinglePresenceOperationExtension(
    63             TUid /*aExtensionUid*/) { return NULL; }
    64 
    65     protected:  // Destructor
    66         /**
    67          * Destructor.
    68          */
    69         virtual ~MVPbkSingleAttributePresenceObserver() { }
    70     };
    71 
    72 /**
    73  * Virtual Phonebook multiple attribute presense observer interface.
    74  */
    75 class MVPbkMultiAttributePresenceObserver
    76     {
    77     public:
    78         /**
    79          * Attribute presence query operation completed.
    80          * @param aOperation    Contact operation that was completed.
    81          * @param aResult   Fields with attribute aAttribute, 
    82          *                  or NULL if there is no fields with that 
    83          *                  attribute in this contact.
    84          */
    85         virtual void AttributePresenceOperationComplete(
    86             MVPbkContactOperationBase& aOperation, 
    87             MVPbkStoreContactFieldCollection* aResult) = 0;
    88 
    89         /**
    90          * Attribute presence query operation failed.
    91          * @param aOperation    Contact operation that failed.
    92          * @param aError        Error code.
    93          */
    94         virtual void AttributePresenceOperationFailed(
    95             MVPbkContactOperationBase& aOperation, TInt aError) = 0;
    96 
    97         /**
    98          * Returns an extension point for this interface or NULL.
    99          * @param aExtensionUid Extension identifier.
   100          * @return Extension object.
   101          */
   102         virtual TAny* AttributeMultiPresenceOperationExtension(
   103             TUid /*aExtensionUid*/) { return NULL; }
   104 
   105     protected:  // Destructor
   106         /**
   107          * Destructor.
   108          */
   109         virtual ~MVPbkMultiAttributePresenceObserver() { }
   110     };
   111 
   112 
   113 /**
   114  * Virtual Phonebook Set attribute observer interface.
   115  */
   116 class MVPbkSetAttributeObserver
   117     {
   118     public:
   119         /**
   120          * Attribute operation completed.
   121          * @param aOperation    Contact operation that was completed.
   122          */
   123         virtual void AttributeOperationComplete(
   124             MVPbkContactOperationBase& aOperation) = 0;
   125 
   126         /**
   127          * Attribute operation failed.
   128          * @param aOperation    Contact operation that failed.
   129          * @param aError        Error code.
   130          */
   131         virtual void AttributeOperationFailed(
   132             MVPbkContactOperationBase& aOperation, TInt aError) = 0;
   133 
   134         /**
   135          * Returns an extension point for this interface or NULL.
   136          * @param aExtensionUid Extension identifier.
   137          * @return Extension object.
   138          */
   139         virtual TAny* SetAttributeObserverExtension(
   140                 TUid /*aExtensionUid*/) { return NULL; }
   141 
   142     protected:  // Destructor
   143         /**
   144          * Destructor.
   145          */
   146         ~MVPbkSetAttributeObserver() { }
   147     };
   148 
   149 /**
   150  * Abstract interface for contact attribute manager.
   151  *
   152  * Contact attribute manager can be used to set global attributes such as speed dials 
   153  * for contacts or fields of contacts. The attributes can be stored in external 
   154  * databases so that some kind of mapping is maintained between contacts and 
   155  * attributes. This interface provides unified access to all global attributes.
   156  */
   157 class MVPbkContactAttributeManager
   158     {
   159     public:
   160         /**
   161          * Destructor.
   162          */
   163         virtual ~MVPbkContactAttributeManager() { }
   164         
   165         /**
   166          * Lists all contacts having the requested type of 
   167          * attribute asynchronously.
   168          *
   169          * @param aAttributeType    Type of the attribute to search for.
   170          * @param aObserver Observer for the asynchronous process.
   171          * @return Newly created handle to the process.
   172          */
   173         virtual MVPbkContactOperationBase* ListContactsL(
   174                 TUid aAttributeType, 
   175                 MVPbkContactFindObserver& aObserver) = 0;
   176                 
   177         /**
   178          * Lists all contacts matching the given attribute asynchronously.
   179          *
   180          * @param aAttribute    Attribute prototype to match against.
   181          * @param aObserver Observer for the asynchronous process.
   182          * @return Newly created handle to the process.
   183          */
   184         virtual MVPbkContactOperationBase* ListContactsL(
   185                 const MVPbkContactAttribute& aAttribute, 
   186                 MVPbkContactFindObserver& aObserver) = 0;
   187             
   188         /**
   189          * Checks if the given contact has the given attribute.
   190          *
   191          * @param aAttributeType    Type of the attribute to check for.
   192          * @param aContact  Contact whose attributes are checked.
   193          * @return ETrue if aContact has an attribute of aAttributeType,
   194          *         EFalse otherwise.
   195          */
   196         virtual TBool HasContactAttributeL(
   197                 TUid aAttributeType, 
   198                 const MVPbkStoreContact& aContact) const = 0;
   199                 
   200         /**
   201          * Checks if the given contact has an attribute matching the 
   202          * given attribute.
   203          *
   204          * @param aAttribute    Attribute prototype to match against.
   205          * @param aContact  Contact whose attributes are checked.
   206          * @return ETrue if aContact has an attribute matching the aAttribute,
   207          *         EFalse otherwise.
   208          */
   209         virtual TBool HasContactAttributeL(
   210                 const MVPbkContactAttribute& aAttribute, 
   211                 const MVPbkStoreContact& aContact) const = 0;
   212 
   213         /**
   214          * Checks if the given contact field has the given attribute.
   215          * 
   216          * @param aAttributeType    Type of the attribute to check for.
   217          * @param aField    Field whose attributes are checked.
   218          * @return ETrue if aField has an attribute of aAttributeType,
   219          *         EFalse otherwise.
   220          */
   221         virtual TBool HasFieldAttributeL(
   222                 TUid aAttributeType, 
   223                 const MVPbkStoreContactField& aField) const = 0;
   224                 
   225         /**
   226          * Checks if the given contact field has an attribute matching 
   227          * the given attribute.
   228          *
   229          * @param aAttribute Attribute prototype to match against.
   230          * @param aField Contact field whose attribute is checked.
   231          * @return ETrue if aField has an attribute matching the aAttribute,
   232          *         EFalse otherwise.
   233          */
   234         virtual TBool HasFieldAttributeL(
   235                 const MVPbkContactAttribute& aAttribute, 
   236                 const MVPbkStoreContactField& aField) const = 0;
   237             
   238         /**
   239          * Returns fields with attribute type aAttributeType, or 
   240          * NULL if there is no fields with that attribute in this 
   241          * contact.
   242          *
   243          * @param aAttributeType Type of the attribute to find for.
   244          * @param aContact Contact whose attributes are checked.
   245          */
   246         virtual MVPbkStoreContactFieldCollection* FindFieldsWithAttributeLC(
   247                 TUid aAttributeType,
   248                 MVPbkStoreContact& aContact) const = 0;
   249 
   250         /**
   251          * Returns fields with attribute aAttribute, or NULL if there is no
   252          * fields with that attribute in this contact.
   253          *
   254          * @param aAttribute Attribute prototype to match against.
   255          * @param aContact Contact whose attributes are checked.
   256          */
   257         virtual MVPbkStoreContactFieldCollection* FindFieldsWithAttributeLC(
   258                 const MVPbkContactAttribute& aAttribute,
   259                 MVPbkStoreContact& aContact) const = 0;
   260         
   261         /**
   262          * Finds the first field that has the aAttr and returns
   263          * a reference to the field or NULL if not found.
   264          *
   265          * Note: the returned reference will become invalid if 
   266          * MVPbkStoreContactFieldCollection::FieldAt is called for
   267          * different field. If this is a problem then use
   268          * MVPbkStoreContactField::CloneLC for permanent copy of
   269          * the field.
   270          *
   271          * @param aAttr The attribute that is looked for.
   272          * @param aContact  Contact whose fields are iterated.
   273          * @return Returns a reference to the field or NULL if not found.
   274          */
   275         virtual MVPbkStoreContactField* FindFieldWithAttributeL(
   276                 const MVPbkContactAttribute& aAttr,
   277                 MVPbkStoreContact& aContact) const = 0;
   278 
   279         /**
   280          * Asynchronously sets the contact attribute for the contact referred 
   281          * by the given contact link.
   282          *
   283          * @param aContactLink  Link to contact whose attribute to set.
   284          * @param aAttribute    Attribute to set for the contact.
   285          * @param aObserver Observer for the asynchronous process.
   286          * @return Newly created handle to the operation.
   287          */          
   288         virtual MVPbkContactOperationBase* SetContactAttributeL(
   289                 const MVPbkContactLink& aContactLink, 
   290                 const MVPbkContactAttribute& aAttribute,
   291                 MVPbkSetAttributeObserver& aObserver) = 0;
   292         /**
   293          * Asynchronously sets the contact field attribute for the 
   294          * give contact field.
   295          *
   296          * @param aField    Contact field whose attribute to set.
   297          * @param aAttribute    Attribute to set for the contact field.
   298          * @param aObserver Observer for the asynchronous process.
   299          * @return Newly created handle to the operation.
   300          */
   301         virtual MVPbkContactOperationBase* SetFieldAttributeL(
   302                 MVPbkStoreContactField& aField, 
   303                 const MVPbkContactAttribute& aAttribute,
   304                 MVPbkSetAttributeObserver& aObserver) = 0;
   305 
   306         /**
   307          * asynchronously removes the given attribute from the contact 
   308          * referred by the aContactLink.
   309          * 
   310          * @param aContactLink  Link to the contact whose attribute 
   311          *                      to remove.
   312          * @param aAttribute    Attribute to remove from the contact.
   313          * @param aObserver Observer for the asynchronous process.
   314          * @return Newly created handle to the operation.
   315          */
   316         virtual MVPbkContactOperationBase* RemoveContactAttributeL(
   317                 const MVPbkContactLink& aContactLink, 
   318                 const MVPbkContactAttribute& aAttribute,
   319                 MVPbkSetAttributeObserver& aObserver) = 0;
   320                 
   321         /**
   322          * asynchronously removes all attributes having the attribute 
   323          * type aAttributeType from the contact.
   324          * 
   325          * @param aContactLink  Link to the contact whose attribute 
   326          *                      to remove.
   327          * @param aAttributeType    Type of the attributes to remove 
   328          *                          from the contact.
   329          * @param aObserver Observer for the asynchronous process.
   330          * @return Newly created handle to the operation.
   331          */
   332         virtual MVPbkContactOperationBase* RemoveContactAttributeL(
   333                 const MVPbkContactLink& aContactLink, 
   334                 TUid aAttributeType,
   335                 MVPbkSetAttributeObserver& aObserver) = 0;
   336 
   337         /**
   338          * Asynchronously removes the given attribute from the 
   339          * given contact field.
   340          *
   341          * @param aField    Field whose attribute to remove.
   342          * @param aAttribute    Attribute to remove from the contact field.
   343          * @param aObserver Observer for the asynchronous process.
   344          * @return Newly created handle to the operation.
   345          */
   346         virtual MVPbkContactOperationBase* RemoveFieldAttributeL(
   347                 MVPbkStoreContactField& aField, 
   348                 const MVPbkContactAttribute& aAttribute,
   349                 MVPbkSetAttributeObserver& aObserver) = 0;
   350                 
   351         /**
   352          * Asynchronously removes all attributes having the attribute 
   353          * type aAttributeType from the contact field.
   354          *
   355          * @param aField    Field whose attribute to remove.
   356          * @param aAttributeType    Type of the attributes to remove 
   357          *                          from the contact field.
   358          * @param aObserver Observer for the asynchronous process.
   359          * @return Newly created handle to the operation.
   360          */
   361         virtual MVPbkContactOperationBase* RemoveFieldAttributeL(
   362                 MVPbkStoreContactField& aField, 
   363                 TUid aAttributeType,
   364                 MVPbkSetAttributeObserver& aObserver) = 0;
   365 
   366         /**
   367          * Checks if the given contact has the given attribute asynchronously.
   368          *
   369          * @param aAttributeType    Type of the attribute to check for.
   370          * @param aContact  Contact whose attributes are checked.
   371          * @param aObserver Observer for the asynchronous process.
   372          * @return Newly created handle to the operation.
   373          */
   374         virtual MVPbkContactOperationBase* HasContactAttributeL(
   375                 TUid aAttributeType, 
   376                 const MVPbkStoreContact& aContact,
   377                 MVPbkSingleAttributePresenceObserver& aObserver) const = 0;
   378                 
   379         /**
   380          * Checks if the given contact has an attribute matching the 
   381          * given attribute asynchronously.
   382          *
   383          * @param aAttribute    Attribute prototype to match against.
   384          * @param aContact  Contact whose attributes are checked.
   385          * @param aObserver Observer for the asynchronous process.
   386          * @return Newly created handle to the operation.
   387          */
   388         virtual MVPbkContactOperationBase* HasContactAttributeL(
   389                 const MVPbkContactAttribute& aAttribute, 
   390                 const MVPbkStoreContact& aContact,
   391                 MVPbkSingleAttributePresenceObserver& aObserver) const = 0;
   392 
   393         /**
   394          * Checks if the given contact field has the given attribute 
   395          * asynchronously.
   396          * 
   397          * @param aAttributeType    Type of the attribute to check for.
   398          * @param aField    Field whose attributes are checked.
   399          * @param aObserver Observer for the asynchronous process.
   400          * @return Newly created handle to the operation.
   401          */
   402         virtual MVPbkContactOperationBase* HasFieldAttributeL(
   403                 TUid aAttributeType, 
   404                 const MVPbkStoreContactField& aField,
   405                 MVPbkSingleAttributePresenceObserver& aObserver) const = 0;
   406                 
   407         /**
   408          * Checks if the given contact field has an attribute matching 
   409          * the given attribute asynchronously.
   410          *
   411          * @param aAttribute Attribute prototype to match against.
   412          * @param aField Contact field whose attribute is checked.
   413          * @param aObserver Observer for the asynchronous process.
   414          * @return Newly created handle to the operation.
   415          */
   416         virtual MVPbkContactOperationBase* HasFieldAttributeL(
   417                 const MVPbkContactAttribute& aAttribute, 
   418                 const MVPbkStoreContactField& aField,
   419                 MVPbkSingleAttributePresenceObserver& aObserver) const = 0;
   420             
   421         /**
   422          * Initiates an asynchronous operation, which finds the aAttribute type 
   423          * attributed fields from the contact.
   424          *
   425          * @param aAttributeType Type of the attribute to find for.
   426          * @param aContact Contact whose attributes are checked.
   427          * @param aObserver Observer for the asynchronous process.
   428          * @return Newly created handle to the operation.
   429          */
   430         virtual MVPbkContactOperationBase* FindFieldsWithAttributeL(
   431                 TUid aAttributeType,
   432                 MVPbkStoreContact& aContact,
   433                 MVPbkMultiAttributePresenceObserver& aObserver) const = 0;
   434 
   435         /**
   436          * Initiates an asynchronous operation, which finds the aAttribute type 
   437          * attributed fields from the contact.
   438          *
   439          * @param aAttribute Attribute prototype to match against.
   440          * @param aContact Contact whose attributes are checked.
   441          * @param aObserver Observer for the asynchronous process.
   442          * @return Newly created handle to the operation.
   443          */
   444         virtual MVPbkContactOperationBase* FindFieldsWithAttributeL(
   445                 const MVPbkContactAttribute& aAttribute,
   446                 MVPbkStoreContact& aContact,
   447                 MVPbkMultiAttributePresenceObserver& aObserver) const = 0;
   448 
   449         /**
   450          * Returns an extension point for this interface or NULL.
   451          * @param aExtensionUid Extension identifier.
   452          * @return Extension point or NULL
   453          */
   454         virtual TAny* ContactAttributeManagerExtension(
   455                 TUid /*aExtensionUid*/) { return NULL; }
   456     };
   457     
   458 #endif // MVPBKCONTACTATTRIBUTEMANAGER_H
   459 
   460 // End of File