80 LOCAL_C TBool IgnoreDir( RFs& aFs, TFileName& aDir ) |
80 LOCAL_C TBool IgnoreDir( RFs& aFs, TFileName& aDir ) |
81 { |
81 { |
82 TInt driveNumber( -1 ); |
82 TInt driveNumber( -1 ); |
83 TChar driveLetter; |
83 TChar driveLetter; |
84 DriveInfo::GetDefaultDrive( DriveInfo::EDefaultSystem, driveNumber ); |
84 DriveInfo::GetDefaultDrive( DriveInfo::EDefaultSystem, driveNumber ); |
85 aFs.DriveToChar( driveNumber, driveLetter ); |
85 aFs.DriveToChar( driveNumber, driveLetter ); |
86 |
86 |
87 TFileName ignore1; |
87 TFileName ignore1; |
88 TFileName ignore2; |
88 TFileName ignore2; |
89 |
89 |
90 ignore1.Format( KIgnoreDir1, (TUint)driveLetter ); |
90 ignore1.Format( KIgnoreDir1, (TUint)driveLetter ); |
91 ignore2.Format( KIgnoreDir2, (TUint)driveLetter ); |
91 ignore2.Format( KIgnoreDir2, (TUint)driveLetter ); |
92 |
92 |
93 if ( !aDir.CompareF( ignore1 ) || |
93 if ( !aDir.CompareF( ignore1 ) || |
94 !aDir.CompareF( ignore2 ) ) |
94 !aDir.CompareF( ignore2 ) ) |
95 { |
95 { |
96 return ETrue; |
96 return ETrue; |
97 } |
97 } |
98 return EFalse; |
98 return EFalse; |
99 } |
99 } |
100 #endif |
100 #endif |
101 |
101 |
102 // ============================ MEMBER FUNCTIONS =============================== |
102 // ============================ MEMBER FUNCTIONS =============================== |
103 |
103 |
104 // ----------------------------------------------------------------------------- |
104 // ----------------------------------------------------------------------------- |
105 // CFileScan::CFileScan |
105 // CFileScan::CFileScan |
106 // C++ default constructor can NOT contain any code, that |
106 // C++ default constructor can NOT contain any code, that |
107 // might leave. |
107 // might leave. |
108 // ----------------------------------------------------------------------------- |
108 // ----------------------------------------------------------------------------- |
109 // |
109 // |
110 CFileScan::CFileScan( RFs& aFs ) : |
110 CFileScan::CFileScan( RFs& aFs ) : |
111 CActive( CActive::EPriorityStandard ),iServer(NULL),iFs(&aFs),iCurrentLeaf(NULL) |
111 CActive( CActive::EPriorityStandard ),iServer(NULL),iFs(&aFs),iCurrentLeaf(NULL) |
112 { |
112 { |
113 CleanInternal(); |
113 CleanInternal(); |
114 } |
114 } |
115 |
115 |
116 // ----------------------------------------------------------------------------- |
116 // ----------------------------------------------------------------------------- |
117 // CFileScan::ConstructL |
117 // CFileScan::ConstructL |
118 // Symbian 2nd phase constructor can leave. |
118 // Symbian 2nd phase constructor can leave. |
119 // ----------------------------------------------------------------------------- |
119 // ----------------------------------------------------------------------------- |
120 // |
120 // |
121 void CFileScan::ConstructL() |
121 void CFileScan::ConstructL() |
122 { |
122 { |
123 TInt err = 0; |
123 TInt err = 0; |
124 if ( !iFs ) |
124 if ( !iFs ) |
125 { |
125 { |
126 err = KErrArgument; |
126 err = KErrArgument; |
127 } |
127 } |
128 else |
128 else |
129 { |
129 { |
130 err = KErrNone; |
130 err = KErrNone; |
131 } |
131 } |
132 User::LeaveIfError( err ); |
132 User::LeaveIfError( err ); |
133 } |
133 } |
134 |
134 |
135 // ----------------------------------------------------------------------------- |
135 // ----------------------------------------------------------------------------- |
136 // CFileScan::NewL |
136 // CFileScan::NewL |
137 // Two-phased constructor. |
137 // Two-phased constructor. |
138 // ----------------------------------------------------------------------------- |
138 // ----------------------------------------------------------------------------- |
139 // |
139 // |
140 CFileScan* CFileScan::NewL( RFs& aFs ) |
140 CFileScan* CFileScan::NewL( RFs& aFs ) |
141 { |
141 { |
142 CFileScan* self = new( ELeave ) CFileScan( aFs ); |
142 CFileScan* self = new( ELeave ) CFileScan( aFs ); |
143 CleanupStack::PushL( self ); |
143 CleanupStack::PushL( self ); |
144 self->ConstructL(); |
144 self->ConstructL(); |
145 CleanupStack::Pop(self); |
145 CleanupStack::Pop(self); |
146 return self; |
146 return self; |
147 } |
147 } |
148 |
148 |
149 |
149 |
150 // Destructor |
150 // Destructor |
151 CFileScan::~CFileScan() |
151 CFileScan::~CFileScan() |
152 { |
152 { |
153 CleanInternal(); |
153 CleanInternal(); |
154 iServer = NULL; |
154 iServer = NULL; |
155 iFs = NULL; |
155 iFs = NULL; |
156 } |
156 } |
157 |
157 |
158 |
158 |
159 |
159 |
160 // ----------------------------------------------------------------------------- |
160 // ----------------------------------------------------------------------------- |
162 // Function is called when the request is completed |
162 // Function is called when the request is completed |
163 // (other items were commented in a header). |
163 // (other items were commented in a header). |
164 // ----------------------------------------------------------------------------- |
164 // ----------------------------------------------------------------------------- |
165 // |
165 // |
166 void CFileScan::DoCancel() |
166 void CFileScan::DoCancel() |
167 { |
167 { |
168 CleanInternal(); |
168 CleanInternal(); |
169 } |
169 } |
170 |
170 |
171 |
171 |
172 // ----------------------------------------------------------------------------- |
172 // ----------------------------------------------------------------------------- |
173 // CFileScan::IsProtected |
173 // CFileScan::IsProtected |
174 // Function returns whether the specific file is protected or not |
174 // Function returns whether the specific file is protected or not |
175 // (other items were commented in a header). |
175 // (other items were commented in a header). |
176 // ----------------------------------------------------------------------------- |
176 // ----------------------------------------------------------------------------- |
177 // |
177 // |
178 TInt CFileScan::IsProtected( const TDesC& aFileName , TBool& aIsDCF ) |
178 TInt CFileScan::IsProtected( const TDesC& aFileName , TBool& aIsDCF ) |
179 { |
179 { |
180 TInt err = KErrNone; |
180 TInt err = KErrNone; |
181 aIsDCF = EFalse; |
181 aIsDCF = EFalse; |
182 err = iServer->ProcessFile( aFileName , aIsDCF ); |
182 err = iServer->ProcessFile( aFileName , aIsDCF ); |
183 if ( err && err != KErrNoMemory ) |
183 if ( err && err != KErrNoMemory ) |
184 { |
184 { |
185 err = KErrNone; |
185 err = KErrNone; |
186 } |
186 } |
187 return err; |
187 return err; |
188 } |
188 } |
189 |
189 |
190 |
190 |
191 // ----------------------------------------------------------------------------- |
191 // ----------------------------------------------------------------------------- |
192 // CFileScan::RunL |
192 // CFileScan::RunL |
193 // Function is called when the request is completed |
193 // Function is called when the request is completed |
194 // (other items were commented in a header). |
194 // (other items were commented in a header). |
195 // ----------------------------------------------------------------------------- |
195 // ----------------------------------------------------------------------------- |
196 // |
196 // |
197 void CFileScan::RunL() |
197 void CFileScan::RunL() |
198 { |
198 { |
199 TInt err = KErrNone; |
199 TInt err = KErrNone; |
200 if ( iSearching && iServer->State()!=EStateIdle ) |
200 if ( iSearching && iServer->State()!=EStateIdle ) |
201 { |
201 { |
202 err = SearchNext(); |
202 err = SearchNext(); |
203 if ( err == KErrCancel ) |
203 if ( err == KErrCancel ) |
204 { |
204 { |
205 err = KErrNone; |
205 err = KErrNone; |
206 } |
206 } |
207 if ( !err ) |
207 if ( !err ) |
208 { |
208 { |
209 SetActive(); |
209 SetActive(); |
210 TRequestStatus* status = &iStatus; |
210 TRequestStatus* status = &iStatus; |
211 User::RequestComplete( status , err ); |
211 User::RequestComplete( status , err ); |
212 } |
212 } |
213 } |
213 } |
214 else |
214 else |
215 { |
215 { |
216 CleanInternal(); |
216 CleanInternal(); |
217 iServer->CompleteScanning(err); |
217 iServer->CompleteScanning(err); |
218 Deque(); |
218 Deque(); |
219 } |
219 } |
220 if ( err ) |
220 if ( err ) |
221 { |
221 { |
222 CleanInternal(); |
222 CleanInternal(); |
223 iServer->CompleteScanning(err); |
223 iServer->CompleteScanning(err); |
224 Deque(); |
224 Deque(); |
225 } |
225 } |
226 } |
226 } |
227 |
227 |
228 |
228 |
229 |
229 |
230 // ----------------------------------------------------------------------------- |
230 // ----------------------------------------------------------------------------- |
231 // CFileScan::SearchContent |
231 // CFileScan::SearchContent |
232 // Function starts the active objects to search protected file through whole file system |
232 // Function starts the active objects to search protected file through whole file system |
233 // (other items were commented in a header). |
233 // (other items were commented in a header). |
234 // ----------------------------------------------------------------------------- |
234 // ----------------------------------------------------------------------------- |
235 // |
235 // |
236 TInt CFileScan::SearchContent( CDcfRepSrv* aServer ) |
236 TInt CFileScan::SearchContent( CDcfRepSrv* aServer ) |
237 { |
237 { |
238 TInt err = KErrNone; |
238 TInt err = KErrNone; |
239 |
239 |
240 iServer = aServer; |
240 iServer = aServer; |
241 CActiveScheduler::Add( this ); |
241 CActiveScheduler::Add( this ); |
242 |
242 |
243 iSearching = ETrue; |
243 iSearching = ETrue; |
244 err = SearchNext(); |
244 err = SearchNext(); |
245 if ( err ) |
245 if ( err ) |
246 { |
246 { |
247 return err; |
247 return err; |
248 } |
248 } |
249 SetActive(); |
249 SetActive(); |
250 TRequestStatus* status = &iStatus; |
250 TRequestStatus* status = &iStatus; |
251 User::RequestComplete( status , KErrNone ); |
251 User::RequestComplete( status , KErrNone ); |
252 return err; |
252 return err; |
253 } |
253 } |
254 |
254 |
255 // ----------------------------------------------------------------------------- |
255 // ----------------------------------------------------------------------------- |
256 // CFileScan::SearchDrive |
256 // CFileScan::SearchDrive |
257 // This function searches for the DCF files on target device |
257 // This function searches for the DCF files on target device |
258 // (other items were commented in a header). |
258 // (other items were commented in a header). |
259 // ----------------------------------------------------------------------------- |
259 // ----------------------------------------------------------------------------- |
260 // |
260 // |
261 TInt CFileScan::SearchDrive() |
261 TInt CFileScan::SearchDrive() |
262 { |
262 { |
263 _LIT( KDrive, "%c:"); |
263 _LIT( KDrive, "%c:"); |
264 TDriveList drivelist; |
264 TDriveList drivelist; |
265 TChar driveLetter; |
265 TChar driveLetter; |
266 TInt driveNumber = EDriveA - 1; |
266 TInt driveNumber = EDriveA - 1; |
267 TInt err = KErrNone; |
267 TInt err = KErrNone; |
268 |
268 |
269 #ifdef RD_MULTIPLE_DRIVE |
269 #ifdef RD_MULTIPLE_DRIVE |
270 |
270 |
271 TInt ramDrive( -1 ); |
271 TInt ramDrive( -1 ); |
272 TInt romDrive( -1 ); |
272 TInt romDrive( -1 ); |
273 |
273 |
274 DriveInfo::GetDefaultDrive( DriveInfo::EDefaultRam, ramDrive ); |
274 DriveInfo::GetDefaultDrive( DriveInfo::EDefaultRam, ramDrive ); |
275 DriveInfo::GetDefaultDrive( DriveInfo::EDefaultRom, romDrive ); |
275 DriveInfo::GetDefaultDrive( DriveInfo::EDefaultRom, romDrive ); |
276 |
276 |
277 #endif |
277 #endif |
278 |
278 |
279 err = iFs->DriveList( drivelist ); |
279 err = iFs->DriveList( drivelist ); |
280 |
280 |
281 if ( iLastPosition != KNullDesC ) |
281 if ( iLastPosition != KNullDesC ) |
282 { |
282 { |
283 driveLetter = iLastPosition[0]; |
283 driveLetter = iLastPosition[0]; |
284 err = iFs->CharToDrive( driveLetter, driveNumber ); |
284 err = iFs->CharToDrive( driveLetter, driveNumber ); |
285 } |
285 } |
286 |
286 |
287 driveNumber++; |
287 driveNumber++; |
288 |
288 |
289 for ( ; driveNumber < KMaxDrives ; driveNumber++ ) |
289 for ( ; driveNumber < KMaxDrives ; driveNumber++ ) |
290 { |
290 { |
291 |
291 |
292 #ifndef RD_MULTIPLE_DRIVE |
292 #ifndef RD_MULTIPLE_DRIVE |
293 |
293 |
294 if ( driveNumber == EDriveD || driveNumber == EDriveZ ) |
294 if ( driveNumber == EDriveD || driveNumber == EDriveZ ) |
295 { |
295 { |
296 } |
296 } |
297 |
297 |
298 #else // RD_MULTIPLE_DRIVE |
298 #else // RD_MULTIPLE_DRIVE |
299 |
299 |
300 if ( driveNumber == ramDrive || driveNumber == romDrive ) |
300 if ( driveNumber == ramDrive || driveNumber == romDrive ) |
301 { |
301 { |
302 } |
302 } |
303 |
303 |
304 #endif |
304 #endif |
305 |
305 |
306 else if ( drivelist[driveNumber] ) |
306 else if ( drivelist[driveNumber] ) |
307 { |
307 { |
308 err = iFs->DriveToChar( driveNumber, driveLetter ); |
308 err = iFs->DriveToChar( driveNumber, driveLetter ); |
309 iLastPosition.Format( KDrive, (TUint)driveLetter ); |
309 iLastPosition.Format( KDrive, (TUint)driveLetter ); |
310 iDeeper = ETrue; |
310 iDeeper = ETrue; |
311 return err; |
311 return err; |
312 } |
312 } |
313 } |
313 } |
314 CleanInternal(); |
314 CleanInternal(); |
315 return err; |
315 return err; |
316 } |
316 } |
317 |
317 |
318 |
318 |
319 |
319 |
320 // ----------------------------------------------------------------------------- |
320 // ----------------------------------------------------------------------------- |
321 // CFileScan::SearchFolder |
321 // CFileScan::SearchFolder |
322 // This function create Leaves for the current leaf |
322 // This function create Leaves for the current leaf |
323 // (other items were commented in a header). |
323 // (other items were commented in a header). |
324 // ----------------------------------------------------------------------------- |
324 // ----------------------------------------------------------------------------- |
325 // |
325 // |
326 TInt CFileScan::SearchFolder( CDir*& aFolderList ) |
326 TInt CFileScan::SearchFolder( CDir*& aFolderList ) |
327 { |
327 { |
328 TInt err = KErrNone; |
328 TInt err = KErrNone; |
329 TRAP( err , iCurrentLeaf->SetLeafL( aFolderList ) ); |
329 TRAP( err , iCurrentLeaf->SetLeafL( aFolderList ) ); |
330 return err; |
330 return err; |
331 } |
331 } |
332 |
332 |
333 // ----------------------------------------------------------------------------- |
333 // ----------------------------------------------------------------------------- |
334 // CFileScan::SearchFile |
334 // CFileScan::SearchFile |
335 // This function searches for the DCF files under specific folder |
335 // This function searches for the DCF files under specific folder |
336 // (other items were commented in a header). |
336 // (other items were commented in a header). |
337 // ----------------------------------------------------------------------------- |
337 // ----------------------------------------------------------------------------- |
338 // |
338 // |
339 TInt CFileScan::SearchFile( CDir*& aFileList ) |
339 TInt CFileScan::SearchFile( CDir*& aFileList ) |
340 { |
340 { |
341 TInt err = KErrNone; |
341 TInt err = KErrNone; |
342 TInt i = 0; |
342 TInt i = 0; |
343 TBool isDCF; |
343 TBool isDCF; |
344 _LIT ( KFullFileName , "%S\\%S"); |
344 _LIT ( KFullFileName , "%S\\%S"); |
345 TFileName fileName; |
345 TFileName fileName; |
346 |
346 |
347 for ( ; i < aFileList->Count() && !err ; i++ ) |
347 for ( ; i < aFileList->Count() && !err ; i++ ) |
348 { |
348 { |
349 if (!( *aFileList )[i].IsDir()) |
349 if (!( *aFileList )[i].IsDir()) |
350 { |
350 { |
351 TPtrC extension = (*aFileList)[i].iName.Right( 4 ); |
351 TPtrC extension = (*aFileList)[i].iName.Right( 4 ); |
352 if( !extension.CompareF( KWma ) || |
352 if( !extension.CompareF( KWma ) || |
353 !extension.CompareF( KWmv ) || |
353 !extension.CompareF( KWmv ) || |
354 !extension.CompareF( KAsf ) ) |
354 !extension.CompareF( KAsf ) ) |
355 { |
355 { |
356 |
356 |
357 } |
357 } |
358 else |
358 else |
359 { |
359 { |
360 fileName.Format( KFullFileName , &iLastPosition , &( *aFileList )[i].iName ); |
360 fileName.Format( KFullFileName , &iLastPosition , &( *aFileList )[i].iName ); |
361 err = IsProtected( fileName , isDCF ); |
361 err = IsProtected( fileName , isDCF ); |
362 } |
362 } |
363 } |
363 } |
364 } |
364 } |
365 return err; |
365 return err; |
366 } |
366 } |
367 |
367 |
368 // ----------------------------------------------------------------------------- |
368 // ----------------------------------------------------------------------------- |
369 // CFileScan::SearchNext |
369 // CFileScan::SearchNext |
370 // This function searches for the DCF files under specific folder or drive |
370 // This function searches for the DCF files under specific folder or drive |
371 // (other items were commented in a header). |
371 // (other items were commented in a header). |
372 // ----------------------------------------------------------------------------- |
372 // ----------------------------------------------------------------------------- |
373 // |
373 // |
374 TInt CFileScan::SearchNext() |
374 TInt CFileScan::SearchNext() |
375 { |
375 { |
376 TInt err = KErrNone; |
376 TInt err = KErrNone; |
377 |
377 |
378 err = CheckDrive(); |
378 err = CheckDrive(); |
379 if ( !err && iSearching ) |
379 if ( !err && iSearching ) |
380 { |
380 { |
381 if ( iDeeper ) |
381 if ( iDeeper ) |
382 { |
382 { |
383 err = CheckFolder(); |
383 err = CheckFolder(); |
384 } |
384 } |
385 if ( !err && iSearching ) |
385 if ( !err && iSearching ) |
386 { |
386 { |
387 err = ToNextLeaf(); |
387 err = ToNextLeaf(); |
388 } |
388 } |
389 } |
389 } |
390 return err; |
390 return err; |
391 } |
391 } |
392 |
392 |
393 TInt CFileScan::CheckDrive() |
393 TInt CFileScan::CheckDrive() |
394 { |
394 { |
395 // check if current drive is end of searching |
395 // check if current drive is end of searching |
396 TInt err = KErrNone; |
396 TInt err = KErrNone; |
397 |
397 |
398 if( !iCurrentLeaf ) |
398 if( !iCurrentLeaf ) |
399 { |
399 { |
400 err = SearchDrive(); |
400 err = SearchDrive(); |
401 if ( err || !iSearching ) |
401 if ( err || !iSearching ) |
402 { |
402 { |
403 return err; |
403 return err; |
404 } |
404 } |
405 CSearchLeaf* root = NULL; |
405 CSearchLeaf* root = NULL; |
406 TRAP( err , iCurrentLeaf = CSearchLeaf::NewL( root , iLastPosition ) ); |
406 TRAP( err , iCurrentLeaf = CSearchLeaf::NewL( root , iLastPosition ) ); |
407 } |
407 } |
408 return err; |
408 return err; |
409 } |
409 } |
410 |
410 |
411 TInt CFileScan::CheckFolder() |
411 TInt CFileScan::CheckFolder() |
412 { |
412 { |
413 // check current folder |
413 // check current folder |
414 _LIT ( KSearchDir , "%S\\*"); |
414 _LIT ( KSearchDir , "%S\\*"); |
415 |
415 |
416 TInt err = KErrNone; |
416 TInt err = KErrNone; |
417 CDir* fileList = NULL; |
417 CDir* fileList = NULL; |
418 CDir* dirList = NULL; |
418 CDir* dirList = NULL; |
419 TFileName temp; |
419 TFileName temp; |
420 |
420 |
421 #ifndef RD_MULTIPLE_DRIVE |
421 #ifndef RD_MULTIPLE_DRIVE |
422 if ( IgnoreDir( iLastPosition ) ) |
422 if ( IgnoreDir( iLastPosition ) ) |
423 #else // RD_MULTIPLE_DRIVE |
423 #else // RD_MULTIPLE_DRIVE |
424 if ( IgnoreDir( *iFs, iLastPosition ) ) |
424 if ( IgnoreDir( *iFs, iLastPosition ) ) |
425 #endif |
425 #endif |
426 { |
426 { |
427 return err; |
427 return err; |
428 } |
428 } |
429 |
429 |
430 if( iLastPosition.Length() + KSearchDir().Length() < iLastPosition.MaxLength() ) |
430 if( iLastPosition.Length() + KSearchDir().Length() < iLastPosition.MaxLength() ) |
431 { |
431 { |
432 temp.Format( KSearchDir , &iLastPosition ); |
432 temp.Format( KSearchDir , &iLastPosition ); |
433 err = iFs->GetDir( temp |
433 err = iFs->GetDir( temp |
434 , KEntryAttMaskSupported |
434 , KEntryAttMaskSupported |
435 , ESortByName |
435 , ESortByName |
436 , fileList , dirList ); |
436 , fileList , dirList ); |
437 |
437 |
438 if ( !err ) |
438 if ( !err ) |
439 { |
439 { |
440 err = SearchFolder( dirList ); |
440 err = SearchFolder( dirList ); |
441 if ( !err ) |
441 if ( !err ) |
442 { |
442 { |
443 err = SearchFile( fileList ); |
443 err = SearchFile( fileList ); |
444 } |
444 } |
445 } |
445 } |
446 delete fileList; |
446 delete fileList; |
447 fileList = NULL; |
447 fileList = NULL; |
448 delete dirList; |
448 delete dirList; |
449 dirList = NULL; |
449 dirList = NULL; |
450 } |
450 } |
451 return err; |
451 return err; |
452 } |
452 } |
453 |
453 |
454 TInt CFileScan::ToNextLeaf() |
454 TInt CFileScan::ToNextLeaf() |
455 { |
455 { |
456 _LIT ( KChildDir , "%S\\%S"); |
456 _LIT ( KChildDir , "%S\\%S"); |
457 TInt err = KErrNone; |
457 TInt err = KErrNone; |
458 TFileName file; |
458 TFileName file; |
459 CSearchLeaf* temp = NULL; |
459 CSearchLeaf* temp = NULL; |
460 |
460 |
461 file.Format( iLastPosition ); |
461 file.Format( iLastPosition ); |
462 |
462 |
463 if ( iCurrentLeaf->LeafList().Count() > 0 ) |
463 if ( iCurrentLeaf->LeafList().Count() > 0 ) |
464 { |
464 { |
465 iDeeper = ETrue; |
465 iDeeper = ETrue; |
466 iCurrentLeaf = iCurrentLeaf->LeafList()[0]; |
466 iCurrentLeaf = iCurrentLeaf->LeafList()[0]; |
467 iLastPosition.Format( KChildDir , &file , &iCurrentLeaf->FolderName() ); |
467 iLastPosition.Format( KChildDir , &file , &iCurrentLeaf->FolderName() ); |
468 } |
468 } |
469 else |
469 else |
470 { |
470 { |
471 iDeeper = EFalse; |
471 iDeeper = EFalse; |
472 temp = iCurrentLeaf; |
472 temp = iCurrentLeaf; |
473 iCurrentLeaf = iCurrentLeaf->Root(); |
473 iCurrentLeaf = iCurrentLeaf->Root(); |
474 if ( iCurrentLeaf ) |
474 if ( iCurrentLeaf ) |
475 { |
475 { |
476 iCurrentLeaf->RemoveLeaf( temp ); |
476 iCurrentLeaf->RemoveLeaf( temp ); |
477 } |
477 } |
478 delete temp; |
478 delete temp; |
479 temp = NULL; |
479 temp = NULL; |
480 err = UpFolder(); |
480 err = UpFolder(); |
481 } |
481 } |
482 return err; |
482 return err; |
483 } |
483 } |
484 |
484 |
485 TInt CFileScan::UpFolder() |
485 TInt CFileScan::UpFolder() |
486 { |
486 { |
487 TInt err = KErrNone; |
487 TInt err = KErrNone; |
488 TParse file; |
488 TParse file; |
489 if ( iLastPosition.Length()<3 ) |
489 if ( iLastPosition.Length()<3 ) |
490 { |
490 { |
491 return err; |
491 return err; |
492 } |
492 } |
493 err = file.Set( iLastPosition , NULL , NULL ); |
493 err = file.Set( iLastPosition , NULL , NULL ); |
494 iLastPosition.Format( file.DriveAndPath() ); |
494 iLastPosition.Format( file.DriveAndPath() ); |
495 iLastPosition.SetLength( iLastPosition.Length() - 1 ); |
495 iLastPosition.SetLength( iLastPosition.Length() - 1 ); |
496 return err; |
496 return err; |
497 } |
497 } |
498 |
498 |
499 |
499 |
500 void CFileScan::CleanInternal() |
500 void CFileScan::CleanInternal() |
501 { |
501 { |
502 CSearchLeaf* root = iCurrentLeaf; |
502 CSearchLeaf* root = iCurrentLeaf; |
503 iLastPosition = KNullDesC; |
503 iLastPosition = KNullDesC; |
504 iSearching = EFalse; |
504 iSearching = EFalse; |
505 root = GetRootLeaf(); |
505 root = GetRootLeaf(); |
506 delete root; |
506 delete root; |
507 root = NULL; |
507 root = NULL; |
508 iCurrentLeaf = NULL; |
508 iCurrentLeaf = NULL; |
509 iDeeper = ETrue; |
509 iDeeper = ETrue; |
510 } |
510 } |
511 |
511 |
512 CSearchLeaf* CFileScan::GetRootLeaf() |
512 CSearchLeaf* CFileScan::GetRootLeaf() |
513 { |
513 { |
514 CSearchLeaf* root = iCurrentLeaf; |
514 CSearchLeaf* root = iCurrentLeaf; |
515 if ( iCurrentLeaf ) |
515 if ( iCurrentLeaf ) |
516 { |
516 { |
517 while ( root->Root() ) |
517 while ( root->Root() ) |
518 { |
518 { |
519 root = root->Root(); |
519 root = root->Root(); |
520 } |
520 } |
521 } |
521 } |
522 return root; |
522 return root; |
523 } |
523 } |
524 |
524 |
525 // End of File |
525 // End of File |
526 |
526 |