|
1 /* |
|
2 * Copyright (c) 2002 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: |
|
15 * Phonebook contact editor field array. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef __CPbkContactEditorFieldArray_H__ |
|
21 #define __CPbkContactEditorFieldArray_H__ |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32base.h> |
|
25 #include "MPbkContactEditorCreateField.h" |
|
26 |
|
27 // FORWARD DECLARATIONS |
|
28 class MPbkContactEditorField; |
|
29 class CPbkContactItem; |
|
30 class MPbkContactEditorUiBuilder; |
|
31 class TPbkContactItemField; |
|
32 class CPbkIconInfoContainer; |
|
33 class CPbkReadingEditorBinderVisitor; |
|
34 class MPbkFieldEditorVisitor; |
|
35 |
|
36 // CLASS DECLARATION |
|
37 |
|
38 /** |
|
39 * Phonebook Contact editor field array. |
|
40 */ |
|
41 NONSHARABLE_CLASS(CPbkContactEditorFieldArray) : |
|
42 public CBase, |
|
43 public MPbkContactEditorCreateField |
|
44 { |
|
45 public: // Constructors and destructor |
|
46 /** |
|
47 * Creates an editor for aContactItem. |
|
48 * @param aContactItem edited contact item |
|
49 * @param aUiBuilder reference to the UI creator |
|
50 */ |
|
51 static CPbkContactEditorFieldArray* NewL |
|
52 (CPbkContactItem& aContactItem, |
|
53 MPbkContactEditorUiBuilder& aUiBuilder); |
|
54 |
|
55 /** |
|
56 * Destructor. |
|
57 */ |
|
58 ~CPbkContactEditorFieldArray(); |
|
59 |
|
60 public: // Interface |
|
61 /** |
|
62 * 2nd part constructor. |
|
63 * Create dialog lines from iContactItem. |
|
64 */ |
|
65 void CreateFieldsFromContactL(); |
|
66 |
|
67 /** |
|
68 * Returns ETrue if all the fields of this contact are empty |
|
69 * or contain only whitespace characters. |
|
70 */ |
|
71 TBool AreAllFieldsEmpty() const; |
|
72 |
|
73 /** |
|
74 * Adds aField to the editor. |
|
75 * NOTE: it does not add them to the contact item. |
|
76 * this done by the add item manager. |
|
77 * @see TPbkAddItemManager |
|
78 */ |
|
79 void AddFieldL(TPbkContactItemField& aField); |
|
80 |
|
81 /** |
|
82 * Removes aField from the contact item and editor. |
|
83 */ |
|
84 void RemoveField(MPbkContactEditorField& aField); |
|
85 |
|
86 /** |
|
87 * Returns the amount of fields in the contact item. |
|
88 */ |
|
89 TInt ContactItemFieldCount() const; |
|
90 |
|
91 /** |
|
92 * Returns the amount of editors. |
|
93 */ |
|
94 TInt EditorCount() const; |
|
95 |
|
96 /** |
|
97 * Returns the aFieldIndex field. |
|
98 * @precond aFieldIndex >= 0 && aFieldIndex < EditorCount() |
|
99 */ |
|
100 const MPbkContactEditorField& FieldAt(TInt aFieldIndex); |
|
101 |
|
102 /** |
|
103 * Returns the editor field for aField. |
|
104 * @return NULL if not found. |
|
105 */ |
|
106 MPbkContactEditorField* Find(const TPbkContactItemField& aField) const; |
|
107 |
|
108 /** |
|
109 * Returns the contact editor field corresponding to aControlId. |
|
110 * @return NULL if not found. |
|
111 */ |
|
112 MPbkContactEditorField* Find(TInt aControlId) const; |
|
113 |
|
114 /** |
|
115 * Returns the contact items fields index corresponding to aField. |
|
116 */ |
|
117 TInt FindContactItemFieldIndex(const TPbkContactItemField& aField) const; |
|
118 |
|
119 /** |
|
120 * Saves all fields in the editor to the contact item. |
|
121 */ |
|
122 void SaveFieldsL(); |
|
123 |
|
124 /** |
|
125 * Returns ETrue if any of the fields have changed. |
|
126 * EFalse otherwise. |
|
127 */ |
|
128 TBool FieldsChanged() const; |
|
129 |
|
130 /** |
|
131 * Set the focus onto the aFocusIndex control. |
|
132 */ |
|
133 void SetFocusToIndex(TInt aFocusIndex); |
|
134 |
|
135 /** |
|
136 * Accepts the given visitor, ie. calls accept for each field |
|
137 * of the array. |
|
138 * @param aVisitor Visitor to accept. |
|
139 */ |
|
140 void AcceptL(MPbkFieldEditorVisitor& aVisitor); |
|
141 |
|
142 private: // from MPbkContactEditorCreateField |
|
143 MPbkContactEditorField& CreateFieldL(CPbkFieldInfo& aFieldInfo); |
|
144 |
|
145 private: // Implementation |
|
146 CPbkContactEditorFieldArray( |
|
147 CPbkContactItem& aContactItem, |
|
148 MPbkContactEditorUiBuilder& aUiBuilder); |
|
149 void ConstructL(); |
|
150 MPbkContactEditorField& DoAddFieldL( |
|
151 TPbkContactItemField& aField, TInt aFieldInsertIndex); |
|
152 |
|
153 void __DbgTestInvariant() const; |
|
154 |
|
155 private: // Data |
|
156 /// Ref: edited contact item |
|
157 CPbkContactItem& iContactItem; |
|
158 /// Ref: editor UI creator |
|
159 MPbkContactEditorUiBuilder& iUiBuilder; |
|
160 /// Own: Contact editor fields |
|
161 CArrayPtrFlat<MPbkContactEditorField> iFieldArray; |
|
162 /// Own: icon info container |
|
163 CPbkIconInfoContainer* iIconInfoContainer; |
|
164 /// Own: contact field editor binder for japanese reading fields |
|
165 CPbkReadingEditorBinderVisitor* iReadingFieldBinder; |
|
166 }; |
|
167 |
|
168 #endif // __CPbkContactEditorFieldArray_H__ |
|
169 |
|
170 // End of File |