|
1 /* |
|
2 * Copyright (c) 2007-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: Define dialog for user DB management |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 #ifndef C_CAKNFEPUSERDBDLG_H |
|
30 #define C_CAKNFEPUSERDBDLG_H |
|
31 |
|
32 // INCLUDES |
|
33 #include <e32std.h> |
|
34 #include <e32base.h> |
|
35 #include <aknselectionlist.h> //CAknMarkableListDialog |
|
36 #include <AknProgressDialog.h> |
|
37 #include <eiklbo.h> // MEikListBoxObserver |
|
38 #include <eiklbx.h> //MListBoxItemChangeObserver |
|
39 |
|
40 const TInt KMaxInputSize(7); |
|
41 const TInt KMaxCharSize(7); |
|
42 |
|
43 // CLASS DECLARATION |
|
44 class CDBManagement; |
|
45 class CPtiEngine; |
|
46 class CAknFepManager; |
|
47 class CAknProgressDialog; |
|
48 class CEikProgressInfo; |
|
49 class CAknFepUserDBQueryDlg; |
|
50 |
|
51 /** |
|
52 * Dialog for user DB management |
|
53 * In this Dialog of user DB management, it has add,remove, |
|
54 * edit and mark/unmark function |
|
55 * |
|
56 * @code |
|
57 * ?good_class_usage_example(s) |
|
58 * @endcode |
|
59 * |
|
60 * @lib ?library |
|
61 * @since S60 v3.1 |
|
62 */ |
|
63 class CAknFepUserdbDlg : public CAknMarkableListDialog, |
|
64 public MListBoxItemChangeObserver |
|
65 { |
|
66 public: |
|
67 // Constructors and destructor |
|
68 |
|
69 /** |
|
70 * Destructor. |
|
71 */ |
|
72 ~CAknFepUserdbDlg(); |
|
73 |
|
74 /** |
|
75 * Two-phased constructor. |
|
76 * @param aOpenedItem Index of the item focusing on |
|
77 * @param aSelectedItems Selected of list items |
|
78 * @param aArray Content of list items |
|
79 * @param aMenuBarResourceId Menu bar id |
|
80 * @param aCommand Default value is zero |
|
81 */ |
|
82 static CAknFepUserdbDlg* NewL( TInt &aOpenedItem, |
|
83 CArrayFix< TInt > *aSelectedItems, MDesCArray *aArray, |
|
84 TInt aMenuBarResourceId, CPtiEngine* aPtiEngine, CAknFepManager* aOwner, |
|
85 MEikCommandObserver *aObserver=0 ); |
|
86 |
|
87 /** |
|
88 * Refresh user db view |
|
89 * |
|
90 * @since S60 v3.1 |
|
91 * @param none |
|
92 * @return none |
|
93 */ |
|
94 void OnChangeLanguageL( TInt aInputLanguage ); |
|
95 |
|
96 /** |
|
97 * Refresh user db view when the screen size was changed. |
|
98 * |
|
99 * @since S60 vTB9.1 |
|
100 * @param none |
|
101 * @return none |
|
102 */ |
|
103 void SizeChanged(); |
|
104 /** |
|
105 * Refresh user db view when the screen size was changed, will |
|
106 * be called by SizeChanged. |
|
107 * |
|
108 * @since S60 vTB9.1 |
|
109 * @param none |
|
110 * @return none |
|
111 */ |
|
112 void SizeChangedL(); |
|
113 |
|
114 /** |
|
115 * Return control to application framework. |
|
116 * |
|
117 * @since S60 vTB9.2 |
|
118 * @param TInt aIndex is the index of control |
|
119 * @return CCoeControl object pointer |
|
120 */ |
|
121 CCoeControl* ComponentControl(TInt aIndex) const; |
|
122 |
|
123 /** |
|
124 * Return number of controls in this dialog |
|
125 * |
|
126 * @since S60 vTB9.2 |
|
127 * @param none |
|
128 * @return number of controls |
|
129 */ |
|
130 TInt CountComponentControls() const; |
|
131 |
|
132 private: |
|
133 |
|
134 /** |
|
135 * C++ constructor. |
|
136 * @param aOpenedItem Index of the item focusing on |
|
137 * @param aSelectedItems Selected of list items |
|
138 * @param aArray Content of list items |
|
139 * @param aCommand Default value is zero |
|
140 */ |
|
141 CAknFepUserdbDlg( TInt &aValue, CArrayFix< TInt > *aSelectedItems, |
|
142 MDesCArray *aArray, CPtiEngine* aPtiEngine, CAknFepManager* aOwner, |
|
143 MEikCommandObserver *aObserver ); |
|
144 |
|
145 /** |
|
146 * Symbian second-phase constructor. |
|
147 * @param aMenuBarResourceId Menu bar id |
|
148 */ |
|
149 void ConstructL( TInt aMenuBarResourceId ); |
|
150 |
|
151 /** |
|
152 * Construct Context Menu |
|
153 * |
|
154 * @since S60 v3.1 |
|
155 * @param None |
|
156 * @return None |
|
157 */ |
|
158 void ConstructContextMenuL(); |
|
159 |
|
160 /** |
|
161 * Init items in the list from user DB |
|
162 * |
|
163 * @since S60 v3.1 |
|
164 * @param None |
|
165 * @return Whether there are any items in list, ETrue is have items |
|
166 */ |
|
167 TBool InitListBoxItemL( ); |
|
168 |
|
169 /** |
|
170 * Add phrase to listbox and user DB |
|
171 * |
|
172 * @since S60 v3.1 |
|
173 * @param none |
|
174 * @return none |
|
175 */ |
|
176 void AddItemL(); |
|
177 |
|
178 /** |
|
179 * Delete phrase in listbox and user DB |
|
180 * |
|
181 * @since S60 v3.1 |
|
182 * @param none |
|
183 * @return none |
|
184 */ |
|
185 void RemoveItemL(); |
|
186 |
|
187 /** |
|
188 * Edit phrase in listbox and user DB |
|
189 * |
|
190 * @@since S60 v3.1 |
|
191 * @param none |
|
192 * @return none |
|
193 */ |
|
194 void EditItemL(); |
|
195 |
|
196 /** |
|
197 * Mark/Unmark phrase in listbox and user DB |
|
198 * |
|
199 * @since S60 v3.1 |
|
200 * @param aItemIndex item's index which would be mark or unmark |
|
201 * @return aMark set for the item mark |
|
202 */ |
|
203 void CmdMarkL( TInt aItemIndex, TBool aMark ); |
|
204 |
|
205 /** |
|
206 * Change the current cba to the specific cba |
|
207 * |
|
208 * @since S60 v3.1 |
|
209 * @param aCbaResourceId cba id |
|
210 * @return none |
|
211 */ |
|
212 void ChangeCurrentCbaL ( TInt aCbaResourceId ); |
|
213 |
|
214 /** |
|
215 * Show context menu |
|
216 * |
|
217 * @since S60 v3.1 |
|
218 * @param none |
|
219 * @return none |
|
220 */ |
|
221 void ShowContextMenuL(); |
|
222 |
|
223 /** |
|
224 * Set the Search Field blank |
|
225 * |
|
226 * @since S60 v3.1 |
|
227 * @param none |
|
228 * @return none |
|
229 */ |
|
230 void ResetSearchFieldL(); |
|
231 |
|
232 /** |
|
233 * Find item's real Index in list |
|
234 * |
|
235 * @since S60 v3.1 |
|
236 * @param aItemIndex Item's index in the view which want to find the actual index |
|
237 * @return The actual index of the item |
|
238 */ |
|
239 TInt FindActualIndex( const TInt aItemIndex ); |
|
240 /** |
|
241 * Mark or unmark item in list |
|
242 * |
|
243 * @since S60 v3.1 |
|
244 * @param none |
|
245 * @return none |
|
246 */ |
|
247 void MarkOrUnmarkItemL(); |
|
248 |
|
249 /** |
|
250 * Add '\t' to item array |
|
251 * |
|
252 * @since S60 v3.1 |
|
253 * @param aDataArray array which want to be inserted '\t' |
|
254 * @return none |
|
255 */ |
|
256 void InsertIconL( CDesC16Array* aDataArray ); |
|
257 |
|
258 /** |
|
259 * To update cba of dialg |
|
260 * |
|
261 * @since S60 v3.1 |
|
262 * @param aCommandId command id from menu, 0 for command except mark |
|
263 * @return none |
|
264 */ |
|
265 void UpdateListBoxL( TInt aCommandId = 0); |
|
266 |
|
267 //From base class CAknMarkableListDialog |
|
268 /** |
|
269 * From base class CAknMarkableListDialog |
|
270 * Deal the commands that have recevied |
|
271 * @param aCommandId Commands' Id |
|
272 * @return None |
|
273 */ |
|
274 void ProcessCommandL( TInt aCommandId ); |
|
275 |
|
276 /** |
|
277 * From base class CAknMarkableListDialog |
|
278 * Deal the softkey event |
|
279 * @param aButtonId softkey Id |
|
280 * @return ETrue to validate and exit the dialog, EFalse to keep the dialog active. |
|
281 */ |
|
282 TBool OkToExitL( TInt aButtonId ); |
|
283 |
|
284 /** |
|
285 * From base class CAknMarkableListDialog |
|
286 * Dynamically initialises a menu pane. |
|
287 * @param aResourceId Menu pane id |
|
288 * @param aMenuPane The in-memory representation of the menu pane. |
|
289 * @return None |
|
290 */ |
|
291 void DynInitMenuPaneL( TInt aResourceId,CEikMenuPane* aMenuPane ); |
|
292 |
|
293 void FocusChanged(TDrawNow aDrawNow); |
|
294 |
|
295 /** |
|
296 * From base class CAknMarkableListDialog |
|
297 * Initializes the dialog's controls after the |
|
298 * dialog has been sized but before it has been activated |
|
299 * @param None |
|
300 * @return None |
|
301 */ |
|
302 void PostLayoutDynInitL(); |
|
303 |
|
304 /** |
|
305 * From base class CAknMarkableListDialog |
|
306 * @param aKeyEvent The key event. |
|
307 * @param aType The type of key event: EEventKey, EEventKeyUp or EEventKeyDown |
|
308 * @return Indicates whether or not the key event was used by this control |
|
309 */ |
|
310 TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ); |
|
311 |
|
312 //From base class MEikListBoxObserver |
|
313 /** |
|
314 * From base class MEikListBoxObserver |
|
315 * Observer callback from the listbox.. |
|
316 * @param aListBox ptr to listbox that is calling the method |
|
317 * @param aEventType type of event; defined by MEikListBoxObserver |
|
318 * @return None |
|
319 */ |
|
320 void HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType); |
|
321 |
|
322 //From base class MListBoxItemChangeObserver |
|
323 /** |
|
324 * From base class MListBoxItemChangeObserver |
|
325 * Item change observer will be notified when list box items have been |
|
326 * added or removed or the list box has been reset. |
|
327 * @param aListBox ptr to listbox that is calling the method |
|
328 * @return None |
|
329 */ |
|
330 void ListBoxItemsChanged( CEikListBox* aListBox ); |
|
331 |
|
332 private: //data |
|
333 |
|
334 /** |
|
335 * Engine |
|
336 * Own |
|
337 */ |
|
338 CDBManagement* iDBEngine; |
|
339 |
|
340 /** |
|
341 * Progress dialog |
|
342 * Own, but doesn't need delete by myself |
|
343 */ |
|
344 CAknProgressDialog* iProgressDialog; |
|
345 |
|
346 /** |
|
347 * progress info |
|
348 * Own, but doesn't need delete by myself |
|
349 */ |
|
350 CEikProgressInfo* iProgressInfo; |
|
351 |
|
352 /** |
|
353 * Item array |
|
354 * Own, but doesn't need delete by myself,listbox would free it automatic |
|
355 */ |
|
356 CDesC16Array* iItems; |
|
357 |
|
358 /** |
|
359 * Pti Engine |
|
360 * Not Own |
|
361 */ |
|
362 CPtiEngine* iPtiEngine; |
|
363 |
|
364 /** |
|
365 * AknFepManager need by DBEngine |
|
366 * Not own |
|
367 */ |
|
368 CAknFepManager* iOwner; |
|
369 |
|
370 /** |
|
371 * Context menu bar |
|
372 * Own |
|
373 */ |
|
374 CEikMenuBar* iContextMenuBar; |
|
375 |
|
376 /** |
|
377 * Old highLight postion |
|
378 */ |
|
379 TInt iOldIndex; |
|
380 |
|
381 /** |
|
382 * Old Language |
|
383 */ |
|
384 TInt iOldLanguage; |
|
385 |
|
386 /** |
|
387 * Query for add and edit. Not Own. |
|
388 */ |
|
389 CAknFepUserDBQueryDlg* iQueryDlg; |
|
390 |
|
391 /** |
|
392 * Old cba resouce |
|
393 */ |
|
394 TInt iOldCbaRes; |
|
395 }; |
|
396 |
|
397 #endif // C_CAKNFEPUSERDBDLG_H |