|
1 /* |
|
2 * Copyright (c) 2008 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: Presentation level contact field. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CFSCPRESENTATIONCONTACTFIELD_H |
|
20 #define CFSCPRESENTATIONCONTACTFIELD_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32base.h> |
|
24 #include <MVPbkStoreContactField.h> |
|
25 |
|
26 // FORWARD DECLARATIONS |
|
27 class MPbk2FieldProperty; |
|
28 class MVPbkStoreContact; |
|
29 class MVPbkContactFieldData; |
|
30 |
|
31 // CLASS DECLARATION |
|
32 |
|
33 /** |
|
34 * Phonebook 2 presentation level contact field. |
|
35 */ |
|
36 class CFscPresentationContactField : public CBase, |
|
37 public MVPbkStoreContactField |
|
38 { |
|
39 public: |
|
40 // Constructors and destructor |
|
41 |
|
42 /** |
|
43 * Creates a new instance of this class. |
|
44 * |
|
45 * @param aFieldProperty Phonebook 2 field property. |
|
46 * @param aStoreField The field from the contact store. |
|
47 * @param aParentContact The parent contact of the field. |
|
48 * @return A new instance of this class. |
|
49 */ |
|
50 static CFscPresentationContactField* NewL( |
|
51 const MPbk2FieldProperty& aFieldProperty, |
|
52 const MVPbkStoreContactField& aStoreField, |
|
53 MVPbkStoreContact& aParentContact ); |
|
54 |
|
55 /** |
|
56 * Creates a new instance of this class. |
|
57 * |
|
58 * @param aFieldProperty Phonebook 2 field property. |
|
59 * @param aStoreField The field from the contact store. |
|
60 * @param aParentContact The parent contact of the field. |
|
61 * @return A new instance of this class. |
|
62 */ |
|
63 static CFscPresentationContactField* NewLC( |
|
64 const MPbk2FieldProperty& aFieldProperty, |
|
65 const MVPbkStoreContactField& aStoreField, |
|
66 MVPbkStoreContact& aParentContact ); |
|
67 |
|
68 /** |
|
69 * Destructor. |
|
70 */ |
|
71 ~CFscPresentationContactField(); |
|
72 |
|
73 public: // Interface |
|
74 |
|
75 /** |
|
76 * Returns the maximum length of the field data. |
|
77 * |
|
78 * @return Maximum length of field data. |
|
79 */ |
|
80 TInt MaxDataLength() const; |
|
81 |
|
82 /** |
|
83 * Checks if the field contains data. |
|
84 * |
|
85 * @return ETrue if the field doesn't contain data. |
|
86 */ |
|
87 TBool IsEmpty() const; |
|
88 |
|
89 /** |
|
90 * Checks is the field editable. |
|
91 * |
|
92 * @return ETrue if the field can be edited. |
|
93 */ |
|
94 TBool IsEditable() const; |
|
95 |
|
96 /** |
|
97 * Checks is the field removable. |
|
98 * |
|
99 * @return ETrue if the field can not be removed from the |
|
100 * contact. This is a static property of the field. |
|
101 */ |
|
102 TBool IsRemovable() const; |
|
103 |
|
104 /** |
|
105 * Returns the field's property. |
|
106 * |
|
107 * @return The field's property. |
|
108 */ |
|
109 inline const MPbk2FieldProperty& FieldProperty() const; |
|
110 |
|
111 /** |
|
112 * Returns corresponding store contact field. |
|
113 * |
|
114 * @return T he contact store field. |
|
115 */ |
|
116 inline MVPbkStoreContactField& StoreField() const; |
|
117 |
|
118 public: // From MVPbkObjectHierarchy |
|
119 MVPbkObjectHierarchy& ParentObject() const; |
|
120 |
|
121 public: // From MVPbkBaseContactField |
|
122 MVPbkBaseContact& ParentContact() const; |
|
123 const MVPbkFieldType* MatchFieldType( |
|
124 TInt aMatchPriority ) const; |
|
125 const MVPbkFieldType* BestMatchingFieldType() const; |
|
126 const MVPbkContactFieldData& FieldData() const; |
|
127 TBool IsSame( |
|
128 const MVPbkBaseContactField& aOther ) const; |
|
129 |
|
130 public: // From MVPbkStoreContactField |
|
131 TBool SupportsLabel() const; |
|
132 TPtrC FieldLabel() const; |
|
133 void SetFieldLabelL( |
|
134 const TDesC& aText ); |
|
135 TInt MaxLabelLength() const; |
|
136 MVPbkContactFieldData& FieldData(); |
|
137 MVPbkStoreContactField* CloneLC() const; |
|
138 MVPbkContactLink* CreateLinkLC() const; |
|
139 |
|
140 private: // Construction |
|
141 CFscPresentationContactField( |
|
142 const MPbk2FieldProperty& aFieldProperty, |
|
143 MVPbkStoreContact& aParentContact ); |
|
144 void ConstructL( |
|
145 const MVPbkStoreContactField& aStoreField ); |
|
146 |
|
147 private: // Data |
|
148 /// Ref: Phonebook 2 field property |
|
149 const MPbk2FieldProperty& iFieldProperty; |
|
150 /// Own: The field that is used to access actual field data |
|
151 MVPbkStoreContactField* iStoreField; |
|
152 /// Ref: The parent contact of the field |
|
153 MVPbkStoreContact& iParentContact; |
|
154 /// Ref: Presentation contact field text data |
|
155 MVPbkContactFieldData* iData; |
|
156 }; |
|
157 |
|
158 // INLINE IMPLEMENTATION |
|
159 |
|
160 // -------------------------------------------------------------------------- |
|
161 // CFscPresentationContactField::FieldProperty |
|
162 // -------------------------------------------------------------------------- |
|
163 // |
|
164 inline const MPbk2FieldProperty& CFscPresentationContactField::FieldProperty() const |
|
165 { |
|
166 return iFieldProperty; |
|
167 } |
|
168 |
|
169 // -------------------------------------------------------------------------- |
|
170 // CFscPresentationContactField::StoreField |
|
171 // -------------------------------------------------------------------------- |
|
172 // |
|
173 inline MVPbkStoreContactField& CFscPresentationContactField::StoreField() const |
|
174 { |
|
175 return *iStoreField; |
|
176 } |
|
177 |
|
178 #endif // CFSCPRESENTATIONCONTACTFIELD_H |
|
179 // End of File |