|
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: Plugin for file names search |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 #ifndef C_FILESSEARCHER_H |
|
23 #define C_FILESSEARCHER_H |
|
24 |
|
25 #include <e32std.h> |
|
26 #include <searchcontentsearcher.h> |
|
27 #include <searchcondition.h> |
|
28 |
|
29 class CSearchTextSearcher; |
|
30 |
|
31 |
|
32 /** |
|
33 * This is a class dervied from CActive which does Searching |
|
34 * |
|
35 * This class implements the asynchronous calls for searching file |
|
36 * names |
|
37 * |
|
38 */ |
|
39 class CFilesSearcher : public CActive, public MSearchContentSearcher |
|
40 { |
|
41 |
|
42 public: |
|
43 |
|
44 /** |
|
45 * 1st phase constructor |
|
46 * |
|
47 * @param aContentIdArray - content id |
|
48 * @param aCondition - condition |
|
49 * @param aPluginId - Implementation id |
|
50 * @return returns pointer to the constructed object of type CFilesSearcher |
|
51 */ |
|
52 static CFilesSearcher* NewL( const RArray<TUid>& aContentIdArray, |
|
53 const CSearchCondition& aCondition, |
|
54 const TUid& aPluginId, |
|
55 MSearchPluginObserver& aObserver ); |
|
56 /** |
|
57 * Destructor |
|
58 */ |
|
59 virtual ~CFilesSearcher(); |
|
60 |
|
61 //From base class MSearchContentSearcher |
|
62 |
|
63 /** |
|
64 * From MSearchContentSearcher |
|
65 * This function should be called before calling delete on the object |
|
66 * This fucntion releases all the resources held. |
|
67 */ |
|
68 |
|
69 /** |
|
70 * Gets the complete file path corresponding to the index in the iCompleteFilePathArray |
|
71 * |
|
72 * |
|
73 * @param aIndex - Index in the iCompleteFilePathArray |
|
74 */ |
|
75 HBufC* GetFilePathArrayIndexValue(TInt aIndex); |
|
76 |
|
77 void Destroy(); |
|
78 |
|
79 /** |
|
80 * From MSearchContentSearcher |
|
81 * Starts the searching |
|
82 * |
|
83 * @param aObserver plugin observer |
|
84 */ |
|
85 void SearchL(); |
|
86 |
|
87 /** |
|
88 * From MSearchContentSearcher |
|
89 * Returns TRUE if search is in progress else returns FALSE |
|
90 */ |
|
91 TBool IsSearching(); |
|
92 |
|
93 /** |
|
94 * From MSearchContentSearcher |
|
95 * Cancels the on going search. Nothing happens |
|
96 * if tried to cancel already canceled object.. |
|
97 * |
|
98 */ |
|
99 void CancelSearch(); |
|
100 |
|
101 |
|
102 /** |
|
103 * From MSearchContentSearcher |
|
104 * Gets the heavy results corresponding to the documentid array |
|
105 * |
|
106 * @param aDocumentIdArray |
|
107 */ |
|
108 void GetResultsL( const RPointerArray<CSearchDocumentId>& aDocumentIdArray ); |
|
109 |
|
110 /** |
|
111 * From MSearchContentSearcher |
|
112 * Cancels the result retrieval. |
|
113 * |
|
114 */ |
|
115 void CancelResultsRetrieve(); |
|
116 |
|
117 /** |
|
118 * From MSearchContentSearcher |
|
119 * gets the search progress |
|
120 * |
|
121 * @param aContentClassId |
|
122 * @param aCurrentDocument |
|
123 * @param aTotalDocuments |
|
124 */ |
|
125 void GetSearchProgressL( TUid& aContentClassId, TInt& aCurrentDocument, TInt& aTotalDocuments ); |
|
126 |
|
127 /** |
|
128 * From MSearchContentSearcher |
|
129 * Will be called by the text searcher when the result matching search criteria |
|
130 * is found |
|
131 * |
|
132 * @param aResult |
|
133 */ |
|
134 void HitL( TInt aResult ); |
|
135 |
|
136 |
|
137 |
|
138 HBufC8* LaunchInfoL( const CSearchDocumentId& aDocumentID ); |
|
139 |
|
140 private: |
|
141 |
|
142 /** |
|
143 * Constructor |
|
144 * |
|
145 * @param aPluginId |
|
146 */ |
|
147 CFilesSearcher( const TUid& aPluginId ); |
|
148 |
|
149 /** |
|
150 * 2nd phase constructor |
|
151 * |
|
152 * @param aContentIdArray |
|
153 * @param aCondition |
|
154 */ |
|
155 void ConstructL( const RArray<TUid>& aContentIdArray, |
|
156 const CSearchCondition& aCondition, |
|
157 MSearchPluginObserver& aObserver ); |
|
158 |
|
159 /** |
|
160 * Notifies the observer about the search complete |
|
161 */ |
|
162 void ReportFinishedL(); |
|
163 |
|
164 /** |
|
165 * Cleans up the memory held |
|
166 */ |
|
167 void CleanUp(); |
|
168 |
|
169 /** |
|
170 * This function returns TRUE if access to path |
|
171 * is restricted as it is a system dir/file |
|
172 */ |
|
173 TBool IsSystemPath( TDesC& aPath ); |
|
174 |
|
175 /** |
|
176 * Gets all the files and subfolders, and also does the search |
|
177 * |
|
178 * @param aFolder |
|
179 */ |
|
180 void GetFileNameArrayL(const TDesC& aFolder ); |
|
181 |
|
182 /** |
|
183 * Does actual search |
|
184 */ |
|
185 TBool DoActualSearchL(); |
|
186 |
|
187 /** |
|
188 * Called by ECOM framework |
|
189 */ |
|
190 void DoCancel() ; |
|
191 |
|
192 //From Base Class CActive |
|
193 |
|
194 /** |
|
195 * From CActive |
|
196 */ |
|
197 void RunL(); |
|
198 |
|
199 /** |
|
200 * From CActive |
|
201 */ |
|
202 TInt RunError(); |
|
203 |
|
204 private: |
|
205 /** |
|
206 * To read "KB" from resource file |
|
207 * Own |
|
208 */ |
|
209 HBufC* iSizeKB; |
|
210 |
|
211 /** |
|
212 * To read "B" from resource file |
|
213 * Own |
|
214 */ |
|
215 HBufC* iSizeB; |
|
216 |
|
217 /** |
|
218 * To read "MB" from resource file |
|
219 * Own |
|
220 */ |
|
221 HBufC* iSizeMB; |
|
222 |
|
223 /** |
|
224 * Current count of files searched |
|
225 */ |
|
226 TInt iCurrentItemCount; |
|
227 |
|
228 /** |
|
229 * total number of files matching search criteria |
|
230 */ |
|
231 TInt iTotalHits; |
|
232 |
|
233 /** |
|
234 * File session opened |
|
235 */ |
|
236 RFs iFs; |
|
237 |
|
238 /** |
|
239 * plugin Id |
|
240 */ |
|
241 TUid iPluginId; |
|
242 |
|
243 /** |
|
244 * Textsearcher which searches a given keyword |
|
245 */ |
|
246 CSearchTextSearcher* iTextSearcher; |
|
247 |
|
248 /** |
|
249 * Observer to notify found results |
|
250 */ |
|
251 MSearchPluginObserver* iObserver; |
|
252 |
|
253 /** |
|
254 * list of files to search |
|
255 */ |
|
256 CDir* iFiles; |
|
257 |
|
258 /** |
|
259 * folder under search |
|
260 */ |
|
261 HBufC* iFolder; |
|
262 |
|
263 /** |
|
264 * filename under search |
|
265 */ |
|
266 HBufC* iFileName; |
|
267 |
|
268 /** |
|
269 * Light results |
|
270 * Not own |
|
271 */ |
|
272 RPointerArray<CSearchLightResult> iLightResultsArray; |
|
273 |
|
274 /** |
|
275 * List of available drives |
|
276 */ |
|
277 TDriveList iDriveList; |
|
278 |
|
279 /** |
|
280 * Current drive under search |
|
281 */ |
|
282 TInt iCurrentDriveIndex; |
|
283 |
|
284 /** |
|
285 * True if heavy results asked |
|
286 */ |
|
287 TBool iHeavyResultsAsked; |
|
288 /** |
|
289 * The array containing the complete path of the multimedia item |
|
290 * Own. |
|
291 */ |
|
292 RPointerArray<HBufC> iCompleteFilePathArray; |
|
293 |
|
294 RPointerArray<CSearchResult> iHeavyResultsArray; |
|
295 |
|
296 }; |
|
297 |
|
298 #endif //C_FILESSEARCHER_H |
|
299 |
|
300 |
|
301 |