|
1 /* |
|
2 * Copyright (c) 2004-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: An interface for a view contact |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef MVPBKVIEWCONTACT_H |
|
20 #define MVPBKVIEWCONTACT_H |
|
21 |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32def.h> |
|
25 #include <MVPbkBaseContact.h> |
|
26 |
|
27 |
|
28 // FORWARD DECLARATIONS |
|
29 class MVPbkContactViewBase; |
|
30 class MVPbkContactStore; |
|
31 class MVPbkExpandable; |
|
32 |
|
33 // CLASS DECLARATIONS |
|
34 |
|
35 /** |
|
36 * An interface for a view contact. |
|
37 * |
|
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. |
|
44 * |
|
45 * @see MVPbkContactViewBase |
|
46 */ |
|
47 class MVPbkViewContact : public MVPbkBaseContact |
|
48 { |
|
49 protected: // destructor |
|
50 /** |
|
51 * Destructor. |
|
52 */ |
|
53 virtual ~MVPbkViewContact() { } |
|
54 |
|
55 public: // New functions |
|
56 /** |
|
57 * Returns the parent view of the contact. |
|
58 * |
|
59 * @return The parent view of the contact. |
|
60 */ |
|
61 virtual MVPbkContactViewBase& ParentView() const = 0; |
|
62 |
|
63 /** |
|
64 * Reads the whole contact from the store asynchronously. |
|
65 * |
|
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. |
|
69 * |
|
70 * The contact is returned in a call back. |
|
71 * |
|
72 * @param aObserver An observer to call back when this operation |
|
73 * completes. The observer will not be called if this |
|
74 * function leaves. |
|
75 * @exception KErrInUse If another asynchronous operation is already |
|
76 * in progress. |
|
77 */ |
|
78 virtual void ReadL( MVPbkContactObserver& aObserver ) const = 0; |
|
79 |
|
80 /** |
|
81 * Reads the whole contact and locks it for modification |
|
82 * asynchronously. |
|
83 * |
|
84 * A client can use this if it has a reference of the view contact and |
|
85 * it needs to modify the contact. |
|
86 * |
|
87 * The contact is returned in a call back. |
|
88 * |
|
89 * @param aObserver An observer to call back when this operation |
|
90 * completes. The observer will not be called if this |
|
91 * function leaves. |
|
92 * @exception KErrInUse If another asynchronous operation is already |
|
93 * in progress. |
|
94 * @exception KErrAccessDenied if contact is read-only |
|
95 */ |
|
96 virtual void ReadAndLockL( MVPbkContactObserver& aObserver ) const = 0; |
|
97 |
|
98 /** |
|
99 * Returns expandable interface for this object or NULL if expanding is |
|
100 * not supported. |
|
101 * |
|
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. |
|
106 * |
|
107 * @return An expansion or NULL. |
|
108 */ |
|
109 virtual MVPbkExpandable* Expandable() const = 0; |
|
110 |
|
111 /** |
|
112 * Returns ETrue if two contacts are same. |
|
113 * |
|
114 * @param aOtherContact A contact to be compared. |
|
115 * @param aContactStore The store of the aOtherContact. |
|
116 * @return ETrue if two contacts are same. |
|
117 */ |
|
118 virtual TBool IsSame( const MVPbkViewContact& aOtherContact, |
|
119 const MVPbkContactStore* aContactStore ) const = 0; |
|
120 |
|
121 /** |
|
122 * Returns ETrue if two contacts are same. |
|
123 * |
|
124 * @param aOtherContact A contact to be compared. |
|
125 * @param aContactStore The store of the aOtherContact. |
|
126 * @return ETrue if two contacts are same. |
|
127 */ |
|
128 virtual TBool IsSame( const MVPbkStoreContact& aOtherContact, |
|
129 const MVPbkContactStore* aContactStore ) const = 0; |
|
130 |
|
131 /** |
|
132 * Returns an extension point for this interface or NULL. |
|
133 * |
|
134 * @param aExtensionUid no extensions defined currently. |
|
135 * @return An extension point for this interface or NULL. |
|
136 */ |
|
137 virtual TAny* ViewContactExtension( TUid /*aExtensionUid*/ ) |
|
138 { return NULL; } |
|
139 |
|
140 public: // from MVPbkBaseContact |
|
141 /// Do not override |
|
142 virtual TBool IsSame( const MVPbkBaseContact& aOtherContact ) const |
|
143 { |
|
144 return aOtherContact.IsSame(*this); |
|
145 } |
|
146 |
|
147 }; |
|
148 |
|
149 |
|
150 #endif // MVPBKVIEWCONTACT_H |
|
151 |
|
152 //End of file |
|
153 |
|
154 |