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 the field of the store contact
18 #ifndef MVPBKSTORECONTACTFIELD_H
19 #define MVPBKSTORECONTACTFIELD_H
23 #include <mvpbkbasecontactfield.h>
26 /// A constant that indicates that the store doesn't set limits
27 /// to the length of the label
28 const TInt KVPbkUnlimitedLabelLength = -1;
30 // FORWARD DECLARATIONS
31 class MVPbkContactLink;
36 * An interface for the field of the store contact.
38 * Client can access the contact field using this interface. The field
39 * can have a label and a data.
41 * A new field can be created using the MVPbkStoreContact interface.
42 * For looping the contact fields see MVPbkStoreContactFieldCollection.
43 * The parent of the field in the object hierarchy is the store contact.
45 * @see CVPbkContactFieldTypeIterator
46 * @see CVPbkFieldTypeSelector
48 class MVPbkStoreContactField : public MVPbkBaseContactField,
49 public MVPbkObjectHierarchy
55 virtual ~MVPbkStoreContactField() { }
57 public: // From MVPbkBaseContactField
58 virtual const MVPbkContactFieldData& FieldData() const = 0;
60 public: // New functions
62 * Returns ETrue if the field supports label.
64 * Overwrites the global setting in MVPbkContactStoreProperties.
65 * This must be confirmed before using SetFieldLabelL or
68 * @return ETrue if the field supports label. Otherwise EFalse.
70 virtual TBool SupportsLabel() const = 0;
73 * Returns the label of the field or KNullDesC if there is no field
76 * @return The label of the field or KNullDesC
78 virtual TPtrC FieldLabel() const = 0;
81 * Sets this field's label.
83 * SupportsLabel must be true for using this.
85 * @param aText The label for the field.
87 virtual void SetFieldLabelL( const TDesC& aText ) = 0;
90 * Gets the maximum length of the label.
92 * SupportsLabel must be true for using this.
94 * @return The maximum length of the label or KVPbkUnlimitedLabelLength
95 * if the store has no limits. Zero should be returned in other
96 * cases though this shouldn't be called if labels are
99 virtual TInt MaxLabelLength() const = 0;
102 * Returns the data storage (read-write) of the field.
104 * The data type depends on the field and it's client's responsibility
105 * to check the type before casting the type.
107 * @return The data storage of the field.
108 * @see MVPbkContactFieldTextData::Cast
109 * @see MVPbkContactFieldDateTimeData::Cast
110 * @see MVPbkContactFieldBinaryData::Cast
112 virtual MVPbkContactFieldData& FieldData() = 0;
117 * Pushes the created copy to the cleanup stack.
119 * @return A copy of the field.
120 * @see MVPbkStoreContactFieldCollection::FieldAt
122 virtual MVPbkStoreContactField* CloneLC() const = 0;
125 * Creates a link representing the contact and the field.
127 * The field can be later retrieved using the RetrieveField of
128 * MVPbkStoreContactFieldCollection interface.
130 * NOTE: implementations of stores are possibly using an index
131 * of the field as an identifier so clients should prefer not
132 * to save field links permanently. E.g modifying the contact
133 * can invalidate the link in some store implementations.
134 * A field link is practical in use cases where the link is
135 * created and immediately given to another component.
137 * @return A link representing the contact and the field or NULL
138 * if the contact doesn't exist in the store. E.g a new
139 * contact that hasn't been committed has no unique
141 * NULL is not put into the CleanupStack.
143 virtual MVPbkContactLink* CreateLinkLC() const = 0;
146 * Returns an extension point for this interface or NULL.
148 * @param aExtensionUid no extensions defined currently.
149 * @return An extension point for this interface or NULL.
151 virtual TAny* StoreContactFieldExtension( TUid /*aExtensionUid*/ )
156 #endif // MVPBKSTORECONTACTFIELD_H