|
1 /* |
|
2 * Copyright (c) 2006-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: This class implements the function of |
|
15 * common "Search UI" settings view. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef C_SRCHUISETTINGSVIEW_H |
|
21 #define C_SRCHUISETTINGSVIEW_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <coecntrl.h> |
|
25 #include <eikenv.h> |
|
26 #include <aknview.h> |
|
27 #include <aknlists.h> |
|
28 #include <gulicon.h> |
|
29 #include <gsbaseview.h> |
|
30 |
|
31 // CONSTANTS |
|
32 const TInt KMaxItemLength=128; |
|
33 const TInt KMaxValueLength=64; |
|
34 const TUid KMainViewId = {1}; |
|
35 |
|
36 const TUid KSettingsUIViewId = {0x10282E06}; |
|
37 |
|
38 //SearchProject ViewIds.. |
|
39 |
|
40 //const TUid KSearchViewUid1 = { 5 }; |
|
41 const TUid KSearchResultViewUid1 = { 2 }; |
|
42 const TUid KSearchResultFolderViewUid1 = { 3 }; |
|
43 const TUid KSearchServiceViewUid1 = { 0x10282DFF }; |
|
44 |
|
45 _LIT(KSrchUiSettingsResFile, "Z:srchuisettingsview.rsc"); |
|
46 |
|
47 |
|
48 // DATA TYPES |
|
49 class TSettingsUIInfo |
|
50 { |
|
51 public: |
|
52 TInt iLimit; |
|
53 TInt iGranularity; |
|
54 TInt iShortTimer; |
|
55 TInt iLongTimer; |
|
56 }; |
|
57 |
|
58 enum TSettingsUIViewPanic |
|
59 { |
|
60 ESettingsUIViewBadLocale, |
|
61 ESettingsUIViewBadCommandId, |
|
62 ESettingsUIViewBadItemIndex |
|
63 }; |
|
64 |
|
65 #ifdef _DEBUG |
|
66 // FUNCTION PROTOTYPES |
|
67 GLREF_C void Panic(TSettingsUIViewPanic aPanic); |
|
68 #endif // _DEBUG |
|
69 |
|
70 |
|
71 // FORWARD DECLARATION |
|
72 class CGulIcon; |
|
73 class CSrchUiSettingsContainer; |
|
74 class RConeResourceLoader; |
|
75 class CSearchGSPlugIn; |
|
76 |
|
77 |
|
78 /** |
|
79 * Search settings view. |
|
80 * |
|
81 * @lib srchuisettingsplugin.lib |
|
82 */ |
|
83 |
|
84 class CSrchUiSettingsView : public CGSPluginInterface, |
|
85 public MEikListBoxObserver |
|
86 { |
|
87 public: // Constructors and destructor |
|
88 |
|
89 /** |
|
90 * Destructor. |
|
91 */ |
|
92 ~CSrchUiSettingsView(); |
|
93 |
|
94 /** |
|
95 *Invoked by GS to create object of search setting. |
|
96 * |
|
97 */ |
|
98 static CGSPluginInterface* NewSettingsUIViewPluginL(); |
|
99 |
|
100 /** |
|
101 * Called by GS to show the caption in the listbox view. |
|
102 * @param aCaption Main caption of the search setting. |
|
103 */ |
|
104 void GetCaptionL( TDes& aCaption ) const; |
|
105 |
|
106 /** CreateIconL called by GS to retrieve the icon |
|
107 * to show in the listbox view |
|
108 * @param aIconType Type of the Icon to create. |
|
109 */ |
|
110 CGulIcon* CreateIconL( const TUid /*aIconType*/ ); |
|
111 |
|
112 /** |
|
113 * Moves the current item to the top of the list items. |
|
114 */ |
|
115 void InitCurrentItem(); |
|
116 |
|
117 /** |
|
118 * Increments the current list item to handle the task swapping event. |
|
119 */ |
|
120 void IncCurrentItem(); |
|
121 |
|
122 /** |
|
123 * Decrements the current list item to handle the task swapping event. |
|
124 */ |
|
125 void DecCurrentItem(); |
|
126 |
|
127 /** |
|
128 * Gets a flag meaning that Search application is using. |
|
129 * @return ETrue means the Search uses this object. |
|
130 * EFalse means the Search doesn't use this object. |
|
131 */ |
|
132 TBool IsSearchInUse() const; |
|
133 |
|
134 /* |
|
135 * Gets a previous view id. |
|
136 * @return TVwsViewId |
|
137 */ |
|
138 TVwsViewId PrevViewId() const; |
|
139 |
|
140 /** |
|
141 * Handles a softkey event "Change". |
|
142 * @param aItemId The current item id of the settings list box. |
|
143 */ |
|
144 void HandleChangeCmdL(const TInt aItemId); |
|
145 |
|
146 /** |
|
147 * Dynamically initialises a menu pane. |
|
148 * @param aResourceId ID of the resource. |
|
149 * @param aMenuPane representation of the menu pane. |
|
150 */ |
|
151 void DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane); |
|
152 |
|
153 /** |
|
154 * Changes the CBA buttons. |
|
155 * |
|
156 * @param aResourceId Resource of the new CBA buttons. |
|
157 */ |
|
158 void SetCbaButtonsL( TInt aResourceId ); |
|
159 |
|
160 public: // Functions from base classes |
|
161 |
|
162 /** |
|
163 * From CAknView Returns this view Id. |
|
164 */ |
|
165 TUid Id() const; |
|
166 |
|
167 /** |
|
168 * Handles the commands given by the user. |
|
169 * @param aCommand ID of the command |
|
170 */ |
|
171 void HandleCommandL(TInt aCommandId); |
|
172 |
|
173 /** |
|
174 * Launches the View. |
|
175 */ |
|
176 void LaunchViewL(); |
|
177 |
|
178 protected: // from CGSBaseView |
|
179 |
|
180 /* |
|
181 * Creates new iContainer. |
|
182 */ |
|
183 void NewContainerL(); |
|
184 |
|
185 /* |
|
186 * Handles the selection of the list box. |
|
187 */ |
|
188 void HandleListBoxSelectionL(); |
|
189 |
|
190 protected: // Functions from base classes |
|
191 /** |
|
192 * From CAknView Activates this view. |
|
193 * @param aPrevViewId Previous View ID before activation. |
|
194 * @param aCustomMessageId ID of the Custom Message. |
|
195 * @param aCustomMessage Actual Custom Message. |
|
196 */ |
|
197 void DoActivateL(const TVwsViewId& aPrevViewId, |
|
198 TUid aCustomMessageId, const TDesC8& aCustomMessage); |
|
199 |
|
200 /** |
|
201 * From CAknView Deactivates this view. |
|
202 */ |
|
203 void DoDeactivate(); |
|
204 |
|
205 /** |
|
206 * Handles the commands given with keys. |
|
207 * @param aListbox is the listbox concerned. |
|
208 * @param aEventType is the corrent event that needs to be handled. |
|
209 */ |
|
210 void HandleListBoxEventL( |
|
211 CEikListBox* aListBox, TListBoxEvent aEventType); |
|
212 |
|
213 protected: |
|
214 |
|
215 /** |
|
216 * Constructor. |
|
217 */ |
|
218 CSrchUiSettingsView(); |
|
219 |
|
220 /** |
|
221 * Two Phased Constructor. |
|
222 */ |
|
223 void ConstructL(); |
|
224 |
|
225 private: // New functions |
|
226 /** |
|
227 * Reads the resources for settings list. |
|
228 */ |
|
229 void GetResourcesL(); |
|
230 |
|
231 /** |
|
232 * Populates the list box items. |
|
233 */ |
|
234 void PopulateListBoxL(); |
|
235 |
|
236 /** |
|
237 * Updates the list box items. |
|
238 * @param aItemId An item id of the listbox. |
|
239 */ |
|
240 void UpdateListBoxL(TInt aItemId); |
|
241 |
|
242 /** |
|
243 * Updates all items. |
|
244 */ |
|
245 void UpdateAllL(); |
|
246 |
|
247 /** |
|
248 * Makes the limit item in the list box. |
|
249 */ |
|
250 void MakeLimitItemL(); |
|
251 |
|
252 /** |
|
253 * Makes the granularity item in the list box. |
|
254 */ |
|
255 void MakeGranularityItemL(); |
|
256 |
|
257 /** |
|
258 * Makes the short timer item in the list box. |
|
259 */ |
|
260 void MakeShortTimerItem(); |
|
261 |
|
262 /** |
|
263 * Makes the long timer item in the list box. |
|
264 */ |
|
265 void MakeLongTimerItem(); |
|
266 |
|
267 /** |
|
268 * Appends the item. |
|
269 * @param aDes Item to insert. |
|
270 */ |
|
271 void AppendToItem(const TDesC& aDes); |
|
272 |
|
273 /** |
|
274 * Inserts the item. |
|
275 * @param aDes Item to insert. |
|
276 */ |
|
277 void InsertToItem(const TDesC& aDes); |
|
278 |
|
279 /** |
|
280 * Deletes the buffers used for the list box resources. |
|
281 */ |
|
282 void DeleteResourceBuf(); |
|
283 |
|
284 /** |
|
285 * Handles a back softkey command. |
|
286 */ |
|
287 void HandleBackCmdL(); |
|
288 |
|
289 /** |
|
290 * Handles a Limit command. |
|
291 */ |
|
292 void HandleLimitCmdL(); |
|
293 |
|
294 /** |
|
295 * Handles a Granularity command. |
|
296 */ |
|
297 void HandleGranularityCmdL(); |
|
298 |
|
299 /** |
|
300 * Handles a Short timer command. |
|
301 */ |
|
302 void HandleShortTimeCmdL(); |
|
303 |
|
304 /** |
|
305 * Handles a Long timer command. |
|
306 */ |
|
307 void HandleLongTimeCmdL(); |
|
308 |
|
309 /** |
|
310 * Shows a popup setting page. |
|
311 * @param aItemArray containing setting items. |
|
312 * @param aIndex an index of initial item. |
|
313 * @param aLabel a text of label. |
|
314 * @return an index of selected item. |
|
315 */ |
|
316 TInt QueryPopupSettingPageL( |
|
317 CDesCArray& aItemArray, TInt aIndex, const TDesC& aLabel); |
|
318 |
|
319 /** |
|
320 * Deletes ProfileApp's resource file. |
|
321 * @param aThis This class. |
|
322 */ |
|
323 static void DeleteResFile(TAny* aThis); |
|
324 |
|
325 /** |
|
326 * Handles changes to the application when it switches to |
|
327 * or from the foreground |
|
328 * @param aForeground ETrue to switch to the foreground. |
|
329 * EFalse to switch from the foreground. |
|
330 */ |
|
331 void HandleForegroundEventL( TBool aForeground ); |
|
332 |
|
333 private: // Data |
|
334 |
|
335 /** |
|
336 * A static CEikonEnv. |
|
337 * not own. |
|
338 */ |
|
339 CEikonEnv* iSrchEikonEnv; |
|
340 |
|
341 /** |
|
342 * Container for the setting view. |
|
343 * own. |
|
344 */ |
|
345 CSrchUiSettingsContainer* iContainer; |
|
346 |
|
347 /** |
|
348 * Array of resource ids. |
|
349 * not own. |
|
350 */ |
|
351 MDesCArray* iItemList; |
|
352 |
|
353 /** |
|
354 * Array of the items. |
|
355 * own. |
|
356 */ |
|
357 CDesCArray* iItemArray; |
|
358 |
|
359 /** |
|
360 * UI settings param. |
|
361 */ |
|
362 TSettingsUIInfo iSettingsUIInfo; |
|
363 |
|
364 /** |
|
365 * Previous View ID. |
|
366 */ |
|
367 TVwsViewId iPrevViewId; |
|
368 |
|
369 /** |
|
370 * Current View ID. |
|
371 */ |
|
372 TUid iViewId; |
|
373 |
|
374 /** |
|
375 * List of the items. |
|
376 * own. |
|
377 */ |
|
378 CDesCArrayFlat* iLimitItemLists; // Owned |
|
379 |
|
380 /** |
|
381 * List of the granularity items. |
|
382 * own. |
|
383 */ |
|
384 CDesCArrayFlat* iGranularityItemLists; // Owned |
|
385 |
|
386 /** |
|
387 * List of the short timer items. |
|
388 * own. |
|
389 */ |
|
390 CDesCArrayFlat* iShortTimerItemLists; // Owned |
|
391 |
|
392 /** |
|
393 * List of the long timer items. |
|
394 * own. |
|
395 */ |
|
396 CDesCArrayFlat* iLongTimerItemLists; // Owned |
|
397 |
|
398 /** |
|
399 * used to control key event. |
|
400 */ |
|
401 TBool iIsSearchInUse; |
|
402 |
|
403 /** |
|
404 * current item. |
|
405 */ |
|
406 TInt iCurrentItem; |
|
407 |
|
408 /** |
|
409 * top item on the list. |
|
410 */ |
|
411 TInt iTopItem; |
|
412 |
|
413 /** |
|
414 * index of the top item on the list |
|
415 */ |
|
416 TInt iTopItemIndex; |
|
417 |
|
418 /** |
|
419 * Number of the items in the view. |
|
420 */ |
|
421 TInt iNumOfItemsInView; |
|
422 |
|
423 /** |
|
424 * used to control menu event. |
|
425 */ |
|
426 TBool iMenuChange; |
|
427 |
|
428 /** |
|
429 * Used in setting list item. |
|
430 * own. |
|
431 */ |
|
432 HBufC* iItem; // Owned |
|
433 |
|
434 /** |
|
435 * Limit resource. |
|
436 * own. |
|
437 */ |
|
438 HBufC* iLimit; |
|
439 |
|
440 /** |
|
441 * Granularity resource. |
|
442 * own. |
|
443 */ |
|
444 HBufC* iGranularity; |
|
445 |
|
446 /** |
|
447 * Short timer resource. |
|
448 * own. |
|
449 */ |
|
450 HBufC* iShortTimer; |
|
451 |
|
452 /** |
|
453 * Long timer resource. |
|
454 * own. |
|
455 */ |
|
456 HBufC* iLongTimer; |
|
457 |
|
458 /** |
|
459 * offset of the resource file. |
|
460 */ |
|
461 TInt iResourceOffset; |
|
462 |
|
463 /** |
|
464 * How many items in the list. |
|
465 */ |
|
466 TInt iListItemCount; |
|
467 |
|
468 /** |
|
469 * Not used any more but kept to preserve BC. |
|
470 */ |
|
471 TAny* iDummy; |
|
472 |
|
473 /** |
|
474 * offset of the resource file. |
|
475 */ |
|
476 RArray<TInt> iResourceFileOffset; |
|
477 }; |
|
478 |
|
479 #endif // C_SEARCHSETTINGSCONTAINER_H |
|
480 |
|
481 // End of File |