|
1 /* |
|
2 * Copyright (c) 2005-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: Phonebook 2 contact info view control. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CPBK2CONTACTINFOCONTROL_H |
|
20 #define CPBK2CONTACTINFOCONTROL_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <coecntrl.h> |
|
24 #include <coecobs.h> |
|
25 #include "MPbk2ContactDetailsControl.h" |
|
26 #include <Pbk2IconId.hrh> |
|
27 #include <MVPbkSingleContactOperationObserver.h> |
|
28 #include <MPbk2PointerEventInspector.h> |
|
29 #include <eiksbobs.h> |
|
30 #include <eiklbo.h> |
|
31 |
|
32 |
|
33 // FORWARD DECLARATIONS |
|
34 class MVPbkStoreContact; |
|
35 class MVPbkStoreContactField; |
|
36 class CVPbkContactManager; |
|
37 class MVPbkBaseContactField; |
|
38 class CPbk2ContactInfoListBox; |
|
39 class MPbk2ContactNameFormatter; |
|
40 class CAknTitlePane; |
|
41 class MPbk2ControlObserver; |
|
42 class TPbk2ControlEvent; |
|
43 class CPbk2ContactInfoDataSwapper; |
|
44 class CPbk2PresentationContact; |
|
45 class CPbk2PresentationContactFieldCollection; |
|
46 class MPbk2FieldPropertyArray; |
|
47 class MVPbkContactOperationBase; |
|
48 class MVPbkContactLink; |
|
49 class CPbk2ThumbnailLoader; |
|
50 class MPbk2ContactNavigation; |
|
51 class CPbk2StorePropertyArray; |
|
52 class CPbk2StoreSpecificFieldPropertyArray; |
|
53 class CPbk2ContactFieldDynamicProperties; |
|
54 class MPbk2Command; |
|
55 |
|
56 |
|
57 // CLASS DECLARATION |
|
58 |
|
59 /** |
|
60 * Phonebook 2 contact info view control. |
|
61 * Presents the fields of a contact as a list. |
|
62 */ |
|
63 class CPbk2ContactInfoControl : |
|
64 public CCoeControl, |
|
65 public MPbk2ContactDetailsControl, |
|
66 public MCoeControlObserver, |
|
67 public MVPbkSingleContactOperationObserver, |
|
68 public MPbk2PointerEventInspector, |
|
69 public MEikScrollBarObserver, |
|
70 public MEikListBoxObserver |
|
71 { |
|
72 public: // Constructors and destructor |
|
73 |
|
74 /** |
|
75 * Creates a new instance of this class. |
|
76 * |
|
77 * @param aContainer This control's container. |
|
78 * @param aManager Virtual Phonebook contact manager. |
|
79 * @param aNameFormatter Name formatter. |
|
80 * @param aFieldProperties Field properties. |
|
81 * @param aStoreProperties Store properties. |
|
82 * @param aNavigation Optional contact navigator. |
|
83 * @return A new instance of this class. |
|
84 */ |
|
85 IMPORT_C static CPbk2ContactInfoControl* NewL( |
|
86 const CCoeControl* aContainer, |
|
87 CVPbkContactManager& aManager, |
|
88 MPbk2ContactNameFormatter& aNameFormatter, |
|
89 MPbk2FieldPropertyArray& aFieldProperties, |
|
90 CPbk2StorePropertyArray& aStoreProperties, |
|
91 MPbk2ContactNavigation* aNavigation ); |
|
92 |
|
93 /** |
|
94 * Destructor. |
|
95 */ |
|
96 ~CPbk2ContactInfoControl(); |
|
97 |
|
98 public: // Interface |
|
99 /** |
|
100 * Adds an observer to this control. |
|
101 * |
|
102 * @param aObserver The observer to add. |
|
103 */ |
|
104 IMPORT_C void AddObserverL( |
|
105 MPbk2ControlObserver& aObserver ); |
|
106 |
|
107 /** |
|
108 * Removes an observer from this control. |
|
109 * |
|
110 * @param aObserver The observer to remove. |
|
111 */ |
|
112 IMPORT_C void RemoveObserver( |
|
113 MPbk2ControlObserver& aObserver ); |
|
114 |
|
115 public: // From MPbk2ContactUiControl |
|
116 MPbk2ContactUiControl* ParentControl() const; |
|
117 TInt NumberOfContacts() const; |
|
118 const MVPbkBaseContact* FocusedContactL() const; |
|
119 const MVPbkViewContact* FocusedViewContactL() const; |
|
120 const MVPbkStoreContact* FocusedStoreContact() const; |
|
121 void SetFocusedContactL( |
|
122 const MVPbkBaseContact& aContact ); |
|
123 void SetFocusedContactL( |
|
124 const MVPbkContactBookmark& aContactBookmark ); |
|
125 void SetFocusedContactL( |
|
126 const MVPbkContactLink& aContactLink ); |
|
127 TInt FocusedContactIndex() const; |
|
128 void SetFocusedContactIndexL( |
|
129 TInt aIndex ); |
|
130 TInt NumberOfContactFields() const; |
|
131 const MVPbkBaseContactField* FocusedField() const; |
|
132 TInt FocusedFieldIndex() const; |
|
133 void SetFocusedFieldIndex( |
|
134 TInt aIndex ); |
|
135 TBool ContactsMarked() const; |
|
136 MVPbkContactLinkArray* SelectedContactsL() const; |
|
137 MVPbkContactLinkArray* SelectedContactsOrFocusedContactL() const; |
|
138 MPbk2ContactLinkIterator* SelectedContactsIteratorL() const; |
|
139 CArrayPtr<MVPbkContactStore>* SelectedContactStoresL() const; |
|
140 void ClearMarks(); |
|
141 void SetSelectedContactL( |
|
142 TInt aIndex, |
|
143 TBool aSelected ); |
|
144 void SetSelectedContactL( |
|
145 const MVPbkContactBookmark& aContactBookmark, |
|
146 TBool aSelected ); |
|
147 void SetSelectedContactL( |
|
148 const MVPbkContactLink& aContactLink, |
|
149 TBool aSelected ); |
|
150 |
|
151 void DynInitMenuPaneL( |
|
152 TInt aResourceId, |
|
153 CEikMenuPane* aMenuPane ) const; |
|
154 void ProcessCommandL( |
|
155 TInt aCommandId ) const; |
|
156 void UpdateAfterCommandExecution(); |
|
157 TInt GetMenuFilteringFlagsL() const; |
|
158 CPbk2ViewState* ControlStateL() const; |
|
159 void RestoreControlStateL( |
|
160 CPbk2ViewState* aState ); |
|
161 const TDesC& FindTextL(); |
|
162 void ResetFindL(); |
|
163 void ShowThumbnail(); |
|
164 void HideThumbnail(); |
|
165 void SetBlank( |
|
166 TBool aBlank ); |
|
167 void RegisterCommand( |
|
168 MPbk2Command* aCommand ); |
|
169 void SetTextL( |
|
170 const TDesC& aText ); |
|
171 TAny* ContactUiControlExtension(TUid aExtensionUid ); |
|
172 |
|
173 public: // From MPbk2ContactUiControl2 |
|
174 TInt CommandItemCount() const; |
|
175 const MPbk2UiControlCmdItem& CommandItemAt( TInt aIndex ) const; |
|
176 const MPbk2UiControlCmdItem* FocusedCommandItem() const; |
|
177 void DeleteCommandItemL( TInt aIndex ); |
|
178 void AddCommandItemL(MPbk2UiControlCmdItem* /*aCommand*/, TInt /*aIndex*/); |
|
179 |
|
180 |
|
181 public: // From MPbk2ContactDetailsControl |
|
182 void UpdateL( |
|
183 MVPbkStoreContact* aContact ); |
|
184 TInt FieldCount() const; |
|
185 TInt FieldPos( |
|
186 const MVPbkStoreContactField& aField ) const; |
|
187 |
|
188 private: // From CCoeControl |
|
189 TKeyResponse OfferKeyEventL( |
|
190 const TKeyEvent& aKeyEvent, |
|
191 TEventCode aType ); |
|
192 void SizeChanged(); |
|
193 TInt CountComponentControls() const; |
|
194 CCoeControl* ComponentControl( |
|
195 TInt aIndex ) const; |
|
196 void FocusChanged( |
|
197 TDrawNow aDrawNow ); |
|
198 void HandleResourceChange( |
|
199 TInt aType ); |
|
200 void HandlePointerEventL( const TPointerEvent& aPointerEvent ); |
|
201 |
|
202 private: // From MCoeControlObserver |
|
203 void HandleControlEventL( |
|
204 CCoeControl* aControl, |
|
205 TCoeEvent aEventType ); |
|
206 |
|
207 private: // From MVPbkSingleContactOperationObserver |
|
208 void VPbkSingleContactOperationComplete( |
|
209 MVPbkContactOperationBase& aOperation, |
|
210 MVPbkStoreContact* aContact ); |
|
211 void VPbkSingleContactOperationFailed( |
|
212 MVPbkContactOperationBase& aOperation, |
|
213 TInt aError ); |
|
214 |
|
215 public: // MPbk2PointerEventInspector |
|
216 TBool FocusedItemPointed(); |
|
217 TBool FocusableItemPointed(); |
|
218 TBool SearchFieldPointed(); |
|
219 |
|
220 public: // from MEikScrollBarObserver |
|
221 void HandleScrollEventL(CEikScrollBar* aScrollBar, TEikScrollEvent aEventType); |
|
222 |
|
223 private: // from MEikListboxObserver |
|
224 void HandleListBoxEventL( CEikListBox* aListBox, TListBoxEvent aEventType ); |
|
225 |
|
226 private: // Implementation |
|
227 CPbk2ContactInfoControl( |
|
228 CVPbkContactManager& aManager, |
|
229 MPbk2ContactNameFormatter& aNameFormatter, |
|
230 MPbk2FieldPropertyArray& aFieldProperties, |
|
231 CPbk2StorePropertyArray& aStoreProperties, |
|
232 MPbk2ContactNavigation* aNavigator ); |
|
233 void ConstructL( const CCoeControl* aContainer ); |
|
234 void StorePanesL( |
|
235 CPbk2ContactInfoDataSwapper& aSwapper, |
|
236 const CPbk2PresentationContact* aContact ); |
|
237 void SendEventToObserversL( |
|
238 const TPbk2ControlEvent& aEvent ); |
|
239 CPbk2ContactFieldDynamicProperties* CreateDynamicFieldPropertiesLC( |
|
240 CPbk2PresentationContact& aContact ); |
|
241 void DoHandleResourceChangeL( |
|
242 TInt aType ); |
|
243 void RetrieveContactL( const MVPbkContactLink& aContactLink ); |
|
244 |
|
245 private: // Data |
|
246 /// Ref: Virtual Phonebook contact manager |
|
247 CVPbkContactManager& iContactManager; |
|
248 /// Ref: Name formatter |
|
249 MPbk2ContactNameFormatter& iNameFormatter; |
|
250 /// Ref: Contact navigator |
|
251 MPbk2ContactNavigation* iNavigator; |
|
252 /// Ref: Field property array |
|
253 MPbk2FieldPropertyArray& iFieldProperties; |
|
254 /// Ref: Store properties for store specific field properties |
|
255 CPbk2StorePropertyArray& iStoreProperties; |
|
256 /// Own: List box |
|
257 CPbk2ContactInfoListBox* iListBox; |
|
258 /// Own: Flags |
|
259 TUint iFlags; |
|
260 /// Ref: Array of fields |
|
261 CPbk2PresentationContactFieldCollection* iFields; |
|
262 /// Own: Store contact |
|
263 MVPbkStoreContact* iStoreContact; |
|
264 /// Own: Presentation contact to display |
|
265 CPbk2PresentationContact* iContact; |
|
266 /// Own: Observers of this object |
|
267 RPointerArray<MPbk2ControlObserver> iObservers; |
|
268 /// Own: Contact retrieve process |
|
269 MVPbkContactOperationBase* iRetriever; |
|
270 /// Own: Contact link, needed in contact retrieve process |
|
271 MVPbkContactLink* iContactLink; |
|
272 /// Own: Thumbnail handling |
|
273 CPbk2ThumbnailLoader* iThumbnailLoader; |
|
274 /// Own: Store specific field properties |
|
275 CPbk2StoreSpecificFieldPropertyArray* iSpecificFieldProperties; |
|
276 /// Own: Focused field index |
|
277 TInt iFocusedFieldIndex; |
|
278 /// Ref: command in execution |
|
279 MPbk2Command* iCommand; |
|
280 /// Ref: Title pane |
|
281 CAknTitlePane* iTitlePane; |
|
282 /// flag whether pointer moved or not for the thumbnail |
|
283 TBool iDidMove; |
|
284 |
|
285 }; |
|
286 |
|
287 #endif // CPBK2CONTACTINFOCONTROL_H |
|
288 |
|
289 // End of File |