epoc32/include/app/MVPbkBaseContact.h
branchSymbian3
changeset 4 837f303aceeb
equal deleted inserted replaced
3:e1b950c65cb4 4:837f303aceeb
       
     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 base interface for contacts.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef MVPBKBASECONTACT_H
       
    20 #define MVPBKBASECONTACT_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <e32cmn.h>
       
    24 #include <e32def.h>
       
    25 
       
    26 // FORWARD DECLARATIONS
       
    27 class MVPbkContactObserver;
       
    28 class MVPbkBaseContactFieldCollection;
       
    29 class MVPbkContactLink;
       
    30 class MVPbkContactBookmark;
       
    31 class MVPbkViewContact;
       
    32 class MVPbkStoreContact;
       
    33 
       
    34 // CLASS DECLARATIONS
       
    35 
       
    36 /**
       
    37  * Virtual Phonebook read-only base contact interface.
       
    38  * This class is used as a high-level interface for contacts in the
       
    39  * Virtual Phonebook.
       
    40  */
       
    41 class MVPbkBaseContact
       
    42     {
       
    43     protected:  // Destructor
       
    44         /**
       
    45          * Destructor.
       
    46          */
       
    47         virtual ~MVPbkBaseContact() { }
       
    48 
       
    49     public:  // Interface
       
    50         /**
       
    51          * Returns this contact's fields (read only).
       
    52          * @return This contact's fields in read only mode.
       
    53          */
       
    54         virtual const MVPbkBaseContactFieldCollection& Fields() const =0;
       
    55 
       
    56         /**
       
    57          * Returns true if this a representation of the same contact.
       
    58          *
       
    59          * @param aOtherContact a contact this contact is compared against.
       
    60          * @return ETrue if this and aOtherContact represent the same contact.
       
    61          */
       
    62         virtual TBool IsSame(const MVPbkBaseContact& aOtherContact) const =0;
       
    63 
       
    64         /**
       
    65          * Returns true if this a representation of the same contact.
       
    66          *
       
    67          * @param aOtherContact a contact this contact is compared against.
       
    68          * @return ETrue if this and aOtherContact represent the same contact.
       
    69          */
       
    70         virtual TBool IsSame(const MVPbkStoreContact& aOtherContact) const =0;
       
    71 
       
    72         /**
       
    73          * Returns true if this a representation of the same contact.
       
    74          *
       
    75          * @param aOtherContact a contact this contact is compared against.
       
    76          * @return ETrue if this and aOtherContact represent the same contact.
       
    77          */
       
    78         virtual TBool IsSame(const MVPbkViewContact& aOtherContact) const =0;
       
    79 
       
    80         /**
       
    81          * Creates link representing this contact.
       
    82          *
       
    83          * @return A link or NULL if the contact doesn't exist in the store,
       
    84          *         e.g. a folding contact in the view could be that kind or
       
    85          *         a new contact that hasn't been committed to the store.
       
    86          *         NULL is not put into the CleanupStack.
       
    87          */
       
    88         virtual MVPbkContactLink* CreateLinkLC() const =0;
       
    89 
       
    90         /**
       
    91          * Deletes this contact from store asynchronously.
       
    92          *
       
    93          * @param aObserver The observer to call back when this operation
       
    94          *                  completes. The observer will not be called
       
    95          *                  if this function leaves.
       
    96          * @exception KErrInUse If another asynchronous operation is already
       
    97          *                      in progress.
       
    98          * @exception KErrAccessDenied if the contact can not be modified.
       
    99          */
       
   100         virtual void DeleteL(MVPbkContactObserver& aObserver) const =0;
       
   101 
       
   102         /**
       
   103          * Returns ETrue if this view contact is from given store
       
   104          *
       
   105          * @param aContactStoreUri the URI of the store to compare
       
   106          * @return ETrue if the view contact was from the given store
       
   107          */
       
   108         virtual TBool MatchContactStore(
       
   109                 const TDesC& aContactStoreUri) const =0;
       
   110 
       
   111         /**
       
   112          * Returns ETrue if this contact is from the same store
       
   113          * domain as the given one.
       
   114          *
       
   115          * @param aContactStoreDomain the the store domain
       
   116          * @return ETrue if the contact was from the same store domain.
       
   117          */
       
   118         virtual TBool MatchContactStoreDomain(
       
   119                 const TDesC& aContactStoreDomain) const =0;
       
   120 
       
   121         /**
       
   122          * Creates and returns a bookmark that points to the contact.
       
   123          * Bookmark can be used to retrieve an index of the contact in
       
   124          * the view.
       
   125          *
       
   126          * @return A new bookmark to the contact
       
   127          */
       
   128         virtual MVPbkContactBookmark* CreateBookmarkLC() const =0;
       
   129 
       
   130         /**
       
   131          * Returns an extension point for this interface or NULL.
       
   132          * @param aExtensionUid Extension identifier.
       
   133          */
       
   134         virtual TAny* BaseContactExtension(TUid /*aExtensionUid*/)
       
   135                 { return NULL; }
       
   136     };
       
   137 
       
   138 //Use this UID to access base contact extension 2.
       
   139 // Used as a parameter to BaseContactExtension() method.
       
   140 const TUid KVPbkBaseContactExtension2Uid = { 2 };
       
   141 
       
   142 /**
       
   143  * This class is an extension to MVPbkBaseContact.
       
   144  * See documentation of MVPbkBaseContact from header MVPbkBaseContact.h
       
   145  *
       
   146  * @see MVPbkBaseContact
       
   147  *
       
   148  */
       
   149 class MVPbkBaseContact2
       
   150     {
       
   151     protected:  // Destructor
       
   152         virtual ~MVPbkBaseContact2() { }
       
   153 
       
   154     public:
       
   155 
       
   156         /**
       
   157          * Function returns true if contact is the store's current own contact.
       
   158          *
       
   159          * @param aError KErrNotSupported If store does not support own contact
       
   160          */
       
   161         virtual TBool IsOwnContact( TInt& aError ) const =0;
       
   162 
       
   163     };
       
   164 
       
   165 
       
   166 #endif  // MVPBKBASECONTACT_H
       
   167 
       
   168 // End of file