2 * Copyright (c) 2004-2007 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
14 * Description: An interface for a view contact
19 #ifndef MVPBKVIEWCONTACT_H
20 #define MVPBKVIEWCONTACT_H
25 #include <mvpbkbasecontact.h>
28 // FORWARD DECLARATIONS
29 class MVPbkContactViewBase;
30 class MVPbkContactStore;
31 class MVPbkExpandable;
36 * An interface for a view contact.
38 * As the name already says the view contact is a contact in a view.
39 * It contains the fields that were defined in the sort order of the view.
40 * However, a store implementation possibly have limitations of field types
41 * that can be used in the sort order. If the store doesn't support the given
42 * field type in a view contact it sets the data of those fields to zero length.
43 * The order of the fields are same as in a sort order.
45 * @see MVPbkContactViewBase
47 class MVPbkViewContact : public MVPbkBaseContact
49 protected: // destructor
53 virtual ~MVPbkViewContact() { }
55 public: // New functions
57 * Returns the parent view of the contact.
59 * @return The parent view of the contact.
61 virtual MVPbkContactViewBase& ParentView() const = 0;
64 * Reads the whole contact from the store asynchronously.
66 * A client can use this if it has a reference of the view contact but
67 * it needs all the data fields instead of only those that are included
68 * in the view contact.
70 * The contact is returned in a call back.
72 * @param aObserver An observer to call back when this operation
73 * completes. The observer will not be called if this
75 * @exception KErrInUse If another asynchronous operation is already
78 virtual void ReadL( MVPbkContactObserver& aObserver ) const = 0;
81 * Reads the whole contact and locks it for modification
84 * A client can use this if it has a reference of the view contact and
85 * it needs to modify the contact.
87 * The contact is returned in a call back.
89 * @param aObserver An observer to call back when this operation
90 * completes. The observer will not be called if this
92 * @exception KErrInUse If another asynchronous operation is already
94 * @exception KErrAccessDenied if contact is read-only
96 virtual void ReadAndLockL( MVPbkContactObserver& aObserver ) const = 0;
99 * Returns expandable interface for this object or NULL if expanding is
102 * Examples are a contact group that can be expanded to its members view
103 * or a folding view that can be extended to its internals. Client can
104 * get the type of the view from MVPbkContactViewBase::Type which is useful
105 * for knowing the type of expansion.
107 * @return An expansion or NULL.
109 virtual MVPbkExpandable* Expandable() const = 0;
112 * Returns ETrue if two contacts are same.
114 * @param aOtherContact A contact to be compared.
115 * @param aContactStore The store of the aOtherContact.
116 * @return ETrue if two contacts are same.
118 virtual TBool IsSame( const MVPbkViewContact& aOtherContact,
119 const MVPbkContactStore* aContactStore ) const = 0;
122 * Returns ETrue if two contacts are same.
124 * @param aOtherContact A contact to be compared.
125 * @param aContactStore The store of the aOtherContact.
126 * @return ETrue if two contacts are same.
128 virtual TBool IsSame( const MVPbkStoreContact& aOtherContact,
129 const MVPbkContactStore* aContactStore ) const = 0;
132 * Returns an extension point for this interface or NULL.
134 * @param aExtensionUid no extensions defined currently.
135 * @return An extension point for this interface or NULL.
137 virtual TAny* ViewContactExtension( TUid /*aExtensionUid*/ )
140 public: // from MVPbkBaseContact
142 virtual TBool IsSame( const MVPbkBaseContact& aOtherContact ) const
144 return aOtherContact.IsSame(*this);
150 #endif // MVPBKVIEWCONTACT_H