|
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: A container class for CSrchUiResFolderView. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 #ifndef C_SEARCH_RESULT_FOLDER_CONTAINER_H |
|
23 #define C_SEARCH_RESULT_FOLDER_CONTAINER_H |
|
24 |
|
25 #include <eiklbo.h> |
|
26 #include <aknnavide.h> |
|
27 |
|
28 #include "srchuiresfolder.h" |
|
29 |
|
30 class CSrchUiResFolderView; |
|
31 class CAknDoubleGraphicStyleListBox; |
|
32 class CAknSingleGraphicStyleListBox; |
|
33 class CAknTabGroup; |
|
34 class MSrchUiFolder; |
|
35 class MFile; |
|
36 class CSrchUiResFolder; |
|
37 class CSrchUiResFolderModel; |
|
38 class CAknNavigationControlContainer; |
|
39 class CSrchUiGeneral; |
|
40 |
|
41 |
|
42 /** |
|
43 * Container class for CSrchUiResFolderView. |
|
44 * |
|
45 */ |
|
46 NONSHARABLE_CLASS( CSrchUiResFolderContainer ) : public CCoeControl , |
|
47 public MEikListBoxObserver |
|
48 { |
|
49 |
|
50 public:// DATA TYPES |
|
51 /** |
|
52 * Enumerate for indicating if an item in the listbox represents a |
|
53 * folder or a file. |
|
54 */ |
|
55 enum TFolderListBoxItem |
|
56 { |
|
57 EListBoxFolder, |
|
58 EListBoxFile |
|
59 }; |
|
60 |
|
61 /** |
|
62 * Performs the first phase of two phase construction. |
|
63 * |
|
64 * @param aView Reference to CSrchUiResFolderView. |
|
65 */ |
|
66 CSrchUiResFolderContainer( CSrchUiResFolderView& aView, |
|
67 CSrchUiGeneral* aGeneralsrchUi ); |
|
68 |
|
69 /** |
|
70 * Performs the second phase construction. |
|
71 * |
|
72 */ |
|
73 void ConstructL( const TRect& aRect ); |
|
74 |
|
75 /** |
|
76 * Destructor |
|
77 */ |
|
78 virtual ~CSrchUiResFolderContainer(); |
|
79 |
|
80 /** |
|
81 * Handles the selection of the currently selected item. |
|
82 * When a folder is selected the subfolder will be opened and displayed. |
|
83 * When a "file" is selected the action is depending on the implementation of |
|
84 * the FileSelectedL() method. |
|
85 * |
|
86 */ |
|
87 TInt HandleItemSelectionL(); |
|
88 |
|
89 /** |
|
90 * Returns EListBoxFolder when the selected item is a folder item. |
|
91 * Returns EListBoxFile when the selected item is a file item. |
|
92 * |
|
93 * @param aIndex Index in the listbox |
|
94 * |
|
95 * @return EFolderListBoxItem |
|
96 */ |
|
97 TInt GetListBoxType( TInt aIndex ); |
|
98 |
|
99 /** |
|
100 * Folders and Files are stored into 1 array for use with the listbox. First the |
|
101 * folders are listed and then files. |
|
102 * The function returns a folder or file index. |
|
103 * To know if the selected item was a folder or file the GetListBoxType method can be used. |
|
104 * |
|
105 * Example: 3 Folders and 2 Files are being displayed. |
|
106 * |
|
107 * When the 2nd item is selected this function returns 1. |
|
108 * 1 meaning the 2nd folder item. |
|
109 * |
|
110 * When the 4th item is selected this function returns 0. |
|
111 * 0 meaning the 1st file item. |
|
112 * |
|
113 * @param aIndex Index in the listbox (folders/files) |
|
114 * |
|
115 * @return Folder index or File index |
|
116 */ |
|
117 TInt GetItemIndex( TInt aIndex ); |
|
118 |
|
119 /** |
|
120 * Getter for iOpenFolder. |
|
121 * |
|
122 * @return A pointer to the currently opened folder. |
|
123 */ |
|
124 MSrchUiFolder* GetOpenFolder() const; |
|
125 |
|
126 /** |
|
127 * Handles changes to the title pane text. |
|
128 * |
|
129 */ |
|
130 void UpdateTitlePaneL(); |
|
131 |
|
132 /** |
|
133 * Handles the changes needed to the Navigation Pane. |
|
134 * |
|
135 */ |
|
136 void UpdateNaviPaneL( const TDesC& aBuf ); |
|
137 |
|
138 /** |
|
139 * Will go 1 step higher in the directory structure. |
|
140 * |
|
141 */ |
|
142 TBool GoUpOneLevelL(); |
|
143 |
|
144 /** |
|
145 * Checks if directory structure is empty |
|
146 * |
|
147 * @return ETrue when the directory structure is empty (no folders and no files), |
|
148 * EFalse otherwise. |
|
149 */ |
|
150 TBool IsEmpty(); |
|
151 |
|
152 /** |
|
153 * Sets the root folder for this directory structure. |
|
154 * |
|
155 * @param aFolder A pointer to the root folder. |
|
156 */ |
|
157 void SetRoot( MSrchUiFolder* aFolder ); |
|
158 |
|
159 /** |
|
160 * Informs the control(listbox) that search results were added. |
|
161 * |
|
162 */ |
|
163 void ResultsAddedL(); |
|
164 |
|
165 /** |
|
166 * Informs the control(listbox) that the previous results were deleted. |
|
167 * |
|
168 */ |
|
169 void ResultsClearedL(); |
|
170 |
|
171 /** |
|
172 * Called from the application ui class after some search status change. |
|
173 * |
|
174 */ |
|
175 void SearchStatusChangedL(); |
|
176 |
|
177 /** |
|
178 * Informs the control(listbox) that one of the searches has finished. |
|
179 * |
|
180 */ |
|
181 void SearchFinishedL(); |
|
182 |
|
183 /** |
|
184 * Calls the HandleItemAdditionL method on the correct listbox |
|
185 * (single or double line). |
|
186 * |
|
187 */ |
|
188 void HandleItemAdditionL(); |
|
189 |
|
190 /** |
|
191 * Asks the item index from the correct listbox (single or double line). |
|
192 * |
|
193 * @return The current item index in the listbox. |
|
194 */ |
|
195 TInt CurrentItemIndex(); |
|
196 |
|
197 /** |
|
198 * Calls the SetCurrentItemIndex method on the correct listbox |
|
199 * (single or double line). |
|
200 * |
|
201 * @param The index for the new current item. |
|
202 */ |
|
203 void SetCurrentItemIndex( TInt aIndex ); |
|
204 |
|
205 /** |
|
206 * Calls the SetCurrentItemIndexAndDraw method on the correct listbox |
|
207 * (single or double line). |
|
208 * |
|
209 * @param The index for the new current item. |
|
210 */ |
|
211 void SetCurrentItemIndexAndDrawL( TInt aIndex ); |
|
212 |
|
213 /** |
|
214 * Sets the error note |
|
215 * |
|
216 */ |
|
217 void SetErrorNoteL(); |
|
218 |
|
219 /** |
|
220 * Checks whether the selected folder has any elements |
|
221 * |
|
222 */ |
|
223 TBool IsElementValid(); |
|
224 |
|
225 // Functions from base class CCoeControl |
|
226 |
|
227 /** |
|
228 * From CCoeControl. |
|
229 * |
|
230 * Called by the framework when a key event needs to be processed. |
|
231 */ |
|
232 TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ); |
|
233 |
|
234 /** |
|
235 * From MEikListBoxObserver |
|
236 * Called by the framework when a list box event needs to be processed. |
|
237 * |
|
238 * @param aListBox List box |
|
239 * @param aEventType Event type |
|
240 */ |
|
241 void HandleListBoxEventL( CEikListBox* aListBox, |
|
242 TListBoxEvent aEventType ); |
|
243 |
|
244 /** |
|
245 * From CCoeControl. |
|
246 * Called by the framework when a pointer event needs to be processed. |
|
247 * |
|
248 * @param aPointerEvent Pointer event |
|
249 * |
|
250 */ |
|
251 |
|
252 void HandlePointerEventL(const TPointerEvent &aPointerEvent); |
|
253 |
|
254 |
|
255 /** |
|
256 * From CCoeControl. |
|
257 * |
|
258 * Called by the framework when the view size is changed. |
|
259 */ |
|
260 void SizeChanged(); |
|
261 |
|
262 /** |
|
263 * From CCoeControl. |
|
264 * |
|
265 * Gets the number of controls contained in a compound control. |
|
266 */ |
|
267 TInt CountComponentControls() const; |
|
268 |
|
269 /** |
|
270 * From CCoeControl. |
|
271 * |
|
272 * Gets the specified component of a compound control. |
|
273 */ |
|
274 CCoeControl* ComponentControl( TInt aIndex ) const; |
|
275 |
|
276 /** |
|
277 * From CCoeControl |
|
278 * |
|
279 * Handles a change to the application's resources which are shared |
|
280 * across the environment. |
|
281 * |
|
282 * @param aType The type of resources that have changed. |
|
283 */ |
|
284 void HandleResourceChange( TInt aType ); |
|
285 |
|
286 /** |
|
287 * From CCoeControl |
|
288 * |
|
289 * Handles a change to the application's resources which are shared |
|
290 * across the environment. |
|
291 * |
|
292 * @param aType The type of resources that have changed. |
|
293 */ |
|
294 void HandleResourceChangeL( TInt aType ); |
|
295 |
|
296 private: // New functions |
|
297 /** |
|
298 * Handles the selection of the currently selected Folder. |
|
299 * Called by HandleItemSelectionL(). |
|
300 * The result is that the folder will be opened and the view will be redrawed. |
|
301 * |
|
302 * @param aFolder A pointer to the currently selected folder. |
|
303 */ |
|
304 void FolderSelectedL( MSrchUiFolder* aFolder ); |
|
305 |
|
306 /** |
|
307 * Handles the selection of the currently selected File. |
|
308 * Called by HandleItemSelectionL(). |
|
309 * Not implemented in this class. |
|
310 * |
|
311 * @param aFile A pointer to the currently selected file. |
|
312 */ |
|
313 void FileSelected( MFile* aFile ); |
|
314 |
|
315 /** |
|
316 * Constructs and prepares the list box control. |
|
317 * |
|
318 */ |
|
319 void SetupListBoxL(); |
|
320 |
|
321 /** |
|
322 * Returns an array of icons for use in the listbox. |
|
323 * |
|
324 * @param folders |
|
325 */ |
|
326 CArrayPtr<CGulIcon>* ListBoxIconsArrayL( RPointerArray<CSrchUiResFolder>& |
|
327 folders ); |
|
328 |
|
329 private: // Data |
|
330 // Reference to the view. |
|
331 CSrchUiResFolderView& iView; |
|
332 |
|
333 // (Single line) list box control. |
|
334 CAknSingleGraphicStyleListBox* iSingleLineListBox; |
|
335 |
|
336 // Model data for the listbox. |
|
337 CSrchUiResFolderModel* iModel; |
|
338 |
|
339 // Pointer to the general search ui |
|
340 CSrchUiGeneral* iGeneralsrchUi; |
|
341 |
|
342 // Pointer to the navigation control container needed for TAB groups |
|
343 CAknNavigationControlContainer* iNaviPane; //Not owned |
|
344 |
|
345 // Pointer to tab group |
|
346 CAknTabGroup* iTabGroup; //Not owned |
|
347 |
|
348 // Pointer to navigation decorator |
|
349 CAknNavigationDecorator* iNaviDecorator; |
|
350 |
|
351 // Pointer to the currently open folder |
|
352 CSrchUiResFolder* iOpenFolder; |
|
353 |
|
354 // Name of the title in the title pane |
|
355 HBufC* iSrchUiResTitle; |
|
356 |
|
357 HBufC* iNaviPaneSearchStatus; |
|
358 //Touch |
|
359 TBool iTouchFlag; |
|
360 |
|
361 }; |
|
362 |
|
363 #endif // C_SEARCH_RESULT_FOLDER_CONTAINER_H |
|
364 |
|
365 // End of File |