equal
deleted
inserted
replaced
27 #include "harvestercenreputil.h" |
27 #include "harvestercenreputil.h" |
28 #include "fsutil.h" |
28 #include "fsutil.h" |
29 #include "harvesterplugininfo.h" |
29 #include "harvesterplugininfo.h" |
30 #include "harvesterpluginfactory.h" |
30 #include "harvesterpluginfactory.h" |
31 |
31 |
32 const TInt KEntryBufferSize = 100; |
|
33 |
|
34 //----------------------------------------------------------------------------- |
32 //----------------------------------------------------------------------------- |
35 // CMMCMountTaskAO |
33 // CMMCMountTaskAO |
36 //----------------------------------------------------------------------------- |
34 //----------------------------------------------------------------------------- |
37 CMMCMountTaskAO* CMMCMountTaskAO::NewL() |
35 CMMCMountTaskAO* CMMCMountTaskAO::NewL() |
38 { |
36 { |
56 iCacheEvents = EFalse; |
54 iCacheEvents = EFalse; |
57 iHEM = CHarvesterEventManager::GetInstanceL(); |
55 iHEM = CHarvesterEventManager::GetInstanceL(); |
58 } |
56 } |
59 |
57 |
60 CMMCMountTaskAO::CMMCMountTaskAO() : |
58 CMMCMountTaskAO::CMMCMountTaskAO() : |
61 CActive( KHarvesterPriorityMonitorPlugin ) |
59 CActive( KHarvesterCustomImportantPriority ) |
62 { |
60 { |
63 WRITELOG( "CMMCMountTaskAO::CMMCMountTaskAO" ); |
61 WRITELOG( "CMMCMountTaskAO::CMMCMountTaskAO" ); |
64 } |
62 } |
65 |
63 |
66 CMMCMountTaskAO::~CMMCMountTaskAO() |
64 CMMCMountTaskAO::~CMMCMountTaskAO() |
79 { |
77 { |
80 iHEM->ReleaseInstance(); |
78 iHEM->ReleaseInstance(); |
81 } |
79 } |
82 |
80 |
83 delete iMmcFileList; |
81 delete iMmcFileList; |
|
82 iHdArray.ResetAndDestroy(); |
|
83 iHdArray.Close(); |
84 } |
84 } |
85 |
85 |
86 void CMMCMountTaskAO::SetMonitorObserver( MMonitorPluginObserver& aObserver ) |
86 void CMMCMountTaskAO::SetMonitorObserver( MMonitorPluginObserver& aObserver ) |
87 { |
87 { |
88 WRITELOG( "CMMCMountTaskAO::SetMonitorObserver" ); |
88 WRITELOG( "CMMCMountTaskAO::SetMonitorObserver" ); |
153 if ( iMountData ) |
153 if ( iMountData ) |
154 { |
154 { |
155 delete iMountData; |
155 delete iMountData; |
156 iMountData = NULL; |
156 iMountData = NULL; |
157 } |
157 } |
|
158 |
|
159 iHdArray.ResetAndDestroy(); |
158 |
160 |
159 if( iMountDataQueue.Count() > 0 ) |
161 if( iMountDataQueue.Count() > 0 ) |
160 { |
162 { |
161 iMountData = iMountDataQueue[0]; |
163 iMountData = iMountDataQueue[0]; |
162 iMountDataQueue.Remove(0); |
164 iMountDataQueue.Remove(0); |
277 iMountDataQueue.Insert( iMountData, 0 ); |
279 iMountDataQueue.Insert( iMountData, 0 ); |
278 iMountData = NULL; |
280 iMountData = NULL; |
279 } |
281 } |
280 Deinitialize(); |
282 Deinitialize(); |
281 SetNextRequest( ERequestStartTask ); |
283 SetNextRequest( ERequestStartTask ); |
282 break; |
284 return; |
283 } |
285 } |
284 |
286 |
285 if ( iEntryArray.Count() > 0 ) |
287 if ( iEntryArray.Count() > 0 ) |
286 { |
288 { |
287 SetNextRequest( ERequestHandleFileEntry ); |
289 SetNextRequest( ERequestHandleFileEntry ); |
300 RemoveNotPresentFromMDE(); |
302 RemoveNotPresentFromMDE(); |
301 SetNextRequest( ERequestCleanup ); |
303 SetNextRequest( ERequestCleanup ); |
302 break; |
304 break; |
303 } |
305 } |
304 } |
306 } |
305 break; |
|
306 |
307 |
307 case ERequestHandleReharvest: |
308 case ERequestHandleReharvest: |
308 { |
309 { |
309 WRITELOG( "CMMCMountTaskAO::RunL - ERequestHandleReharvest" ); |
310 WRITELOG( "CMMCMountTaskAO::RunL - ERequestHandleReharvest" ); |
310 |
311 |
316 } |
317 } |
317 else if ( iHarvestEntryArray.Count() > 0 ) |
318 else if ( iHarvestEntryArray.Count() > 0 ) |
318 { |
319 { |
319 HandleReharvestL( iHarvestEntryArray ); |
320 HandleReharvestL( iHarvestEntryArray ); |
320 SetNextRequest( ERequestHandleReharvest ); |
321 SetNextRequest( ERequestHandleReharvest ); |
|
322 break; |
321 } |
323 } |
322 else |
324 else |
323 { |
325 { |
|
326 if ( iObserver ) |
|
327 { |
|
328 if( iHdArray.Count() > 0) |
|
329 { |
|
330 iObserver->MonitorEvent( iHdArray ); |
|
331 } |
|
332 } |
|
333 iHdArray.Reset(); |
|
334 iHdArray.Compress(); |
324 SetNextRequest( ERequestHandleFileEntry ); |
335 SetNextRequest( ERequestHandleFileEntry ); |
325 } |
336 break; |
326 } |
337 } |
327 break; |
338 } |
328 |
339 |
329 case ERequestCleanup: |
340 case ERequestCleanup: |
330 { |
341 { |
331 WRITELOG( "CMMCMountTaskAO::RunL - ERequestCleanup" ); |
342 WRITELOG( "CMMCMountTaskAO::RunL - ERequestCleanup" ); |
332 TBool present = (iMountData->iMountType == TMountData::EMount); |
343 TBool present = (iMountData->iMountType == TMountData::EMount); |
392 |
403 |
393 void CMMCMountTaskAO::HandleReharvestL( RPointerArray<CPlaceholderData>& aArray ) |
404 void CMMCMountTaskAO::HandleReharvestL( RPointerArray<CPlaceholderData>& aArray ) |
394 { |
405 { |
395 WRITELOG("CMMCMountTaskAO::HandleReharvestL"); |
406 WRITELOG("CMMCMountTaskAO::HandleReharvestL"); |
396 |
407 |
397 TInt batchSize( 0 ); |
408 const TInt count( aArray.Count() ); |
398 RPointerArray<CHarvesterData> hdArray; |
409 TInt batchSize( KMmcEntryBufferSize ); |
399 CleanupClosePushL( hdArray ); |
410 if ( count < KMmcEntryBufferSize ) |
400 |
411 { |
401 if ( aArray.Count() >= KEntryBufferSize ) |
412 batchSize = count; |
402 { |
413 } |
403 batchSize = KEntryBufferSize; |
414 |
404 } |
415 const TInt endIndex( count - batchSize ); |
405 else |
416 |
406 { |
417 for ( TInt i = count; --i >= endIndex; ) |
407 batchSize = aArray.Count(); |
418 { |
408 } |
419 CPlaceholderData* ei = aArray[i]; |
409 |
|
410 for ( TInt i = 0; i < batchSize; i++ ) |
|
411 { |
|
412 CPlaceholderData* ei = aArray[0]; |
|
413 |
420 |
414 HBufC* fileName = ei->Uri().AllocLC(); |
421 HBufC* fileName = ei->Uri().AllocLC(); |
415 CHarvesterData* hd = CHarvesterData::NewL( fileName ); |
422 CHarvesterData* hd = CHarvesterData::NewL( fileName ); |
416 hd->SetOrigin( MdeConstants::Object::EOther ); |
423 hd->SetOrigin( MdeConstants::Object::EOther ); |
417 CleanupStack::Pop( fileName ); |
424 CleanupStack::Pop( fileName ); |
428 hd->SetEventType( EHarvesterAdd ); |
435 hd->SetEventType( EHarvesterAdd ); |
429 hd->SetObjectType( EPlaceholder ); |
436 hd->SetObjectType( EPlaceholder ); |
430 hd->SetClientData( ei ); |
437 hd->SetClientData( ei ); |
431 } |
438 } |
432 |
439 |
433 hdArray.Append( hd ); |
440 iHdArray.Append( hd ); |
434 aArray.Remove( 0 ); |
441 aArray.Remove( i ); |
435 } |
442 } |
436 |
443 |
437 if( aArray.Count() == 0 ) |
444 if( aArray.Count() == 0 ) |
438 { |
445 { |
439 aArray.Compress(); |
446 aArray.Compress(); |
440 } |
447 } |
441 |
|
442 if ( iObserver ) |
|
443 { |
|
444 if( hdArray.Count() > 0) |
|
445 { |
|
446 iObserver->MonitorEvent( hdArray ); |
|
447 } |
|
448 } |
|
449 |
|
450 CleanupStack::PopAndDestroy( &hdArray ); |
|
451 } |
448 } |
452 |
449 |
453 void CMMCMountTaskAO::RemoveNotPresentFromMDE() |
450 void CMMCMountTaskAO::RemoveNotPresentFromMDE() |
454 { |
451 { |
455 WRITELOG( "CMMCMountTaskAO::RemoveNotPresentFromMDE" ); |
452 WRITELOG( "CMMCMountTaskAO::RemoveNotPresentFromMDE" ); |