|
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: Used in creating the folders for the content classes and the corresponding results. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 #ifndef C_SEARCH_RESULT_FOLDER_H |
|
24 #define C_SEARCH_RESULT_FOLDER_H |
|
25 |
|
26 //System Includes |
|
27 #include <e32base.h> |
|
28 #include <e32des16.h> |
|
29 |
|
30 //User Includes |
|
31 #include "srchuicommondefines.h" |
|
32 #include "srchuifolderfileif.h" |
|
33 |
|
34 |
|
35 // FORWARD DECLARATIONS |
|
36 class CSrchUiResFolder; |
|
37 class CSearchLightResult; |
|
38 class CSearchIconInfo; |
|
39 class CSearchResult; |
|
40 |
|
41 // CLASS DECLARATION |
|
42 |
|
43 /** |
|
44 * Class representing the search result's as folders. |
|
45 * |
|
46 */ |
|
47 NONSHARABLE_CLASS( CSrchUiResFolder ) : public CBase, public MSrchUiFolder |
|
48 { |
|
49 public: // Constructors and destructor |
|
50 /** |
|
51 * Symbian OS 2 phased constructor. |
|
52 * |
|
53 * @return A pointer to the created instance of CSrchUiResFolder. |
|
54 */ |
|
55 IMPORT_C static CSrchUiResFolder* NewL(); |
|
56 |
|
57 /** |
|
58 * Symbian OS 2 phased constructor. |
|
59 * |
|
60 * @return A pointer to the created instance of CSrchUiResFolder. |
|
61 */ |
|
62 IMPORT_C static CSrchUiResFolder* NewLC(); |
|
63 |
|
64 /** |
|
65 * Symbian OS 2 phased constructor. |
|
66 * |
|
67 * @param aParentFolder Pointer to the parent folder. |
|
68 * @return A pointer to the created instance of CSrchUiResFolder. |
|
69 */ |
|
70 IMPORT_C static CSrchUiResFolder* NewL( |
|
71 CSrchUiResFolder* aParentFolder ); |
|
72 |
|
73 /** |
|
74 * Symbian OS 2 phased constructor. |
|
75 * |
|
76 * @param aParentFolder Pointer to the parent folder. |
|
77 * @return A pointer to the created instance of CSrchUiResFolder. |
|
78 */ |
|
79 IMPORT_C static CSrchUiResFolder* NewLC( |
|
80 CSrchUiResFolder* aParentFolder ); |
|
81 |
|
82 /** |
|
83 * Destructor |
|
84 * |
|
85 */ |
|
86 IMPORT_C ~CSrchUiResFolder(); |
|
87 |
|
88 public: // New functions (Getters and setters) |
|
89 |
|
90 /** |
|
91 * From MSrchUiFolder. |
|
92 * |
|
93 * Getter for the folder name. |
|
94 * @return Reference to the folder name. |
|
95 */ |
|
96 const TDesC& GetFolderName() const; |
|
97 |
|
98 /** |
|
99 * From MSrchUiFolder. |
|
100 * |
|
101 * Setter for the folder name. |
|
102 * |
|
103 * @param aName The new folder name. |
|
104 */ |
|
105 void SetFolderNameL( const TDesC& aName ); |
|
106 |
|
107 /** |
|
108 * From MSrchUiFolder |
|
109 * |
|
110 * Returns the subfolder, knowing the (child) folder index. |
|
111 * |
|
112 * @param aIndex Index of the subfolder. |
|
113 * @return Pointer to the subfolder. |
|
114 */ |
|
115 MSrchUiFolder* GetSubFolder( TInt aIndex ); |
|
116 |
|
117 /** |
|
118 * From MSrchUiFolder |
|
119 * |
|
120 * Returns the subfolder index knowing the (child) subfolder pointer. |
|
121 * |
|
122 * @param aFolder Pointer to the subfolder. |
|
123 * @return The index of the subfolder pointed to. |
|
124 * KErrNotFound if the sub-folder was not found. |
|
125 */ |
|
126 TInt GetSubFolderIndex( MSrchUiFolder* aFolder ); |
|
127 |
|
128 /** |
|
129 * From MSrchUiFolder |
|
130 * |
|
131 * Getter for the parent folder. |
|
132 * |
|
133 * @return Pointer to the parent folder. |
|
134 */ |
|
135 MSrchUiFolder* GetParentFolder(); |
|
136 |
|
137 /** |
|
138 * From MSrchUiFolder. |
|
139 * |
|
140 * Retuns the light result, knowing the child index. |
|
141 * |
|
142 * @param aIndex Index of the file. |
|
143 * @return Pointer to the light result. |
|
144 */ |
|
145 IMPORT_C CSearchLightResult* GetResult( TInt aIndex ); |
|
146 |
|
147 /** |
|
148 * From MSrchUiFolder. |
|
149 * |
|
150 * Retuns the number of (child) subfolders. |
|
151 * @return The number of subfolders. |
|
152 */ |
|
153 TInt GetSubFoldersCount() const; |
|
154 |
|
155 /** |
|
156 * From MSrchUiFolder. |
|
157 * |
|
158 * Returns the number of ALL (child) subfolders. This means that folders |
|
159 * inside folders |
|
160 * are added to the count. |
|
161 * @return The number of all subfolders. |
|
162 */ |
|
163 TInt GetAllSubFoldersCount() const; |
|
164 |
|
165 /** |
|
166 * From MSrchUiFolder. |
|
167 * |
|
168 * Retuns the number of light results |
|
169 * @return The number of light results |
|
170 */ |
|
171 TInt GetResultsCount() const; |
|
172 |
|
173 /** |
|
174 * From MSrchUiFolder. |
|
175 * |
|
176 * Retuns the number of ALL (child) files. This means that files |
|
177 * inside folders |
|
178 * are added to the count. |
|
179 * |
|
180 * @return The number of all light results |
|
181 */ |
|
182 IMPORT_C TInt GetAllResultsCount() const; |
|
183 |
|
184 |
|
185 public: // New functions |
|
186 /** |
|
187 * Get current folder's folders. |
|
188 * |
|
189 * @return Reference to the subfolders. |
|
190 */ |
|
191 IMPORT_C void SubFolders(RPointerArray<CSrchUiResFolder>& aFolders); |
|
192 |
|
193 /** |
|
194 * Get light results |
|
195 * |
|
196 * @return Reference to the light results |
|
197 */ |
|
198 IMPORT_C RPointerArray<CSearchLightResult>& Results(); |
|
199 |
|
200 /** |
|
201 * Get heavy results |
|
202 * |
|
203 * @return Reference to the heavy results |
|
204 */ |
|
205 IMPORT_C RPointerArray<CSearchResult>& HeavyResults(); |
|
206 |
|
207 /** |
|
208 * Set folder's subfolders |
|
209 * |
|
210 * @param aFolders pointer to name folders |
|
211 */ |
|
212 IMPORT_C void AddChildL( CSrchUiResFolder* aFolders ); |
|
213 |
|
214 /** |
|
215 * Set folder's light results |
|
216 * |
|
217 * @param aResults pointer to light results |
|
218 */ |
|
219 IMPORT_C void AddChildFileL( CSearchLightResult* aResults ); |
|
220 |
|
221 IMPORT_C void AddChildFileL( CSearchResult* aResults ); |
|
222 |
|
223 /** |
|
224 * Set folder's content type |
|
225 * |
|
226 * @param aContentType reference to content type |
|
227 */ |
|
228 IMPORT_C void SetContentClassType( const TUid& aContentType ); |
|
229 |
|
230 /** |
|
231 * Get folder's content type |
|
232 * |
|
233 * @return reference to content type |
|
234 */ |
|
235 IMPORT_C const TUid& ContentClassType() const; |
|
236 |
|
237 /** |
|
238 * Set folder's content type |
|
239 * |
|
240 * @param aContentType reference to content type |
|
241 */ |
|
242 IMPORT_C void SetContentFolderType( const TUid& aContentType ); |
|
243 |
|
244 /** |
|
245 * Get folder's content type |
|
246 * |
|
247 * @return reference to content type |
|
248 */ |
|
249 IMPORT_C const TUid& ContentFolderType() const; |
|
250 |
|
251 /** |
|
252 * Reset subfolders |
|
253 * |
|
254 */ |
|
255 IMPORT_C void ResetAndDestroy(); |
|
256 |
|
257 /** |
|
258 * Set icon info of the current folder |
|
259 * |
|
260 * @param aIconInfo icon info to be set |
|
261 */ |
|
262 IMPORT_C void SetIconInfo( const CSearchIconInfo* aIconInfo ); |
|
263 |
|
264 /** |
|
265 * Get icon info of the current folder |
|
266 * |
|
267 * @return aIconInfo icon info |
|
268 */ |
|
269 IMPORT_C const CSearchIconInfo* IconInfo() const; |
|
270 |
|
271 /** |
|
272 * Retuns the heavy result, knowing the child index. |
|
273 * |
|
274 * @param aIndex Index of the file. |
|
275 * @return Pointer to the heavy result |
|
276 */ |
|
277 IMPORT_C CSearchResult* GetHeavyResult( TInt aIndex ); |
|
278 |
|
279 /** |
|
280 * Retuns the number of heavy results |
|
281 * |
|
282 * @return The number of heavy results |
|
283 */ |
|
284 IMPORT_C TInt GetHeavyResultsCount(); |
|
285 |
|
286 /** |
|
287 * Reset all folders |
|
288 * |
|
289 */ |
|
290 IMPORT_C void CSrchUiResFolder::ResetAllFolders(); |
|
291 |
|
292 /** |
|
293 * Retuns the number of heavy results |
|
294 * |
|
295 * @return The number of all heavy results |
|
296 */ |
|
297 IMPORT_C TInt GetAllHeavyResultsCount() const; |
|
298 |
|
299 private: // More constructors |
|
300 /** |
|
301 * Performs the first phase of two phase construction. |
|
302 * |
|
303 */ |
|
304 CSrchUiResFolder(); |
|
305 |
|
306 /** |
|
307 * Performs the first phase of two phase construction. |
|
308 * |
|
309 * @param aParentFolder Pointer to the parent folder. |
|
310 */ |
|
311 CSrchUiResFolder( CSrchUiResFolder* aParentFolder ); |
|
312 |
|
313 /** |
|
314 * Performs the second phase of two phase construction. |
|
315 * |
|
316 */ |
|
317 void ConstructL(); |
|
318 |
|
319 private: //Data |
|
320 /** |
|
321 * Folder's name |
|
322 */ |
|
323 HBufC* iName; |
|
324 |
|
325 /** |
|
326 * Array of pointers to subfolders |
|
327 */ |
|
328 RPointerArray<CSrchUiResFolder> iFolders; |
|
329 |
|
330 /** |
|
331 * Array of pointers to light results |
|
332 */ |
|
333 RPointerArray<CSearchLightResult> iLightResults; |
|
334 |
|
335 /** |
|
336 * Array of pointers to heavy results |
|
337 */ |
|
338 RPointerArray<CSearchResult> iHeavyResults; |
|
339 |
|
340 /** |
|
341 * Each folder represenst a search content |
|
342 * type and therefore the unique ID. |
|
343 */ |
|
344 TUid iContentClass; |
|
345 TUid iContentFolder; |
|
346 |
|
347 /** |
|
348 * Pointer to parent folder |
|
349 */ |
|
350 CSrchUiResFolder* iParentFolder; |
|
351 |
|
352 /** |
|
353 * Icon Info of the folder |
|
354 */ |
|
355 const CSearchIconInfo* iIconInfo; |
|
356 |
|
357 public: //Data |
|
358 /** |
|
359 * Search status |
|
360 */ |
|
361 TSearchStatus iSearchStatus; |
|
362 |
|
363 /** |
|
364 * Current searched item |
|
365 */ |
|
366 TInt iCurrentSearchedItem; |
|
367 |
|
368 /** |
|
369 * The number of already searched items |
|
370 */ |
|
371 TInt iTotalItemsToBeSearched; |
|
372 }; |
|
373 |
|
374 #endif // C_SEARCH_RESULT_FOLDER_H |
|
375 |
|
376 // End of File |