22 #include <mdeobjectdef.h> |
22 #include <mdeobjectdef.h> |
23 #include <mdeobject.h> |
23 #include <mdeobject.h> |
24 #include "harvesterlog.h" |
24 #include "harvesterlog.h" |
25 #include "harvestercommon.h" |
25 #include "harvestercommon.h" |
26 #include "harvesterblacklist.h" |
26 #include "harvesterblacklist.h" |
27 #include "harvestereventmanager.h" |
27 #include "harvesterpluginfactory.h" |
28 #include "mdsutils.h" |
28 #include "mdsutils.h" |
29 |
|
30 const TInt KCacheItemCountForEventCaching = 1; |
|
31 |
29 |
32 // --------------------------------------------------------------------------- |
30 // --------------------------------------------------------------------------- |
33 // NewL |
31 // NewL |
34 // --------------------------------------------------------------------------- |
32 // --------------------------------------------------------------------------- |
35 // |
33 // |
50 // |
48 // |
51 void CHarvesterPlugin::ConstructL() |
49 void CHarvesterPlugin::ConstructL() |
52 { |
50 { |
53 User::LeaveIfError( iFs.Connect() ); |
51 User::LeaveIfError( iFs.Connect() ); |
54 iState = EHarvesterIdle; |
52 iState = EHarvesterIdle; |
55 iHarvesterEventManager = CHarvesterEventManager::GetInstanceL(); |
|
56 CActiveScheduler::Add( this ); |
53 CActiveScheduler::Add( this ); |
57 } |
54 } |
58 |
55 |
59 // --------------------------------------------------------------------------- |
56 // --------------------------------------------------------------------------- |
60 // Constructor |
57 // Constructor |
65 iState( EHarvesterIdle ), |
62 iState( EHarvesterIdle ), |
66 iQueue( NULL ), |
63 iQueue( NULL ), |
67 iBlacklist( NULL ), |
64 iBlacklist( NULL ), |
68 iDtor_ID_Key( KNullUid ), |
65 iDtor_ID_Key( KNullUid ), |
69 iOriginPropertyDef( NULL ), |
66 iOriginPropertyDef( NULL ), |
70 iTitlePropertyDef( NULL ) |
67 iTitlePropertyDef( NULL ), |
71 { |
68 iHarvesting( NULL ) |
72 |
69 { |
73 } |
70 } |
74 |
71 |
75 // --------------------------------------------------------------------------- |
72 // --------------------------------------------------------------------------- |
76 // ListImplementationsL |
73 // ListImplementationsL |
77 // --------------------------------------------------------------------------- |
74 // --------------------------------------------------------------------------- |
146 case EHarvesterGathering: |
138 case EHarvesterGathering: |
147 { |
139 { |
148 if( iQueue->Count() == 0 ) |
140 if( iQueue->Count() == 0 ) |
149 { |
141 { |
150 SetNextRequest( EHarvesterIdle ); |
142 SetNextRequest( EHarvesterIdle ); |
151 iHarvesting = EFalse; |
143 if( iHarvesting ) |
152 iHarvesterEventManager->SendEventL( EHEObserverTypeOverall, EHEStateFinished ); |
144 { |
153 iHarvesterEventManager->DecreaseItemCountL( EHEObserverTypeOverall, KCacheItemCountForEventCaching ); |
145 TRAP_IGNORE( iFactory->SendHarvestingStatusEventL( EFalse ) ); |
|
146 iHarvesting = EFalse; |
|
147 } |
154 iQueue->Compress(); |
148 iQueue->Compress(); |
155 } |
149 } |
156 else |
150 else |
157 { |
151 { |
158 if ( !iHarvesting ) |
152 if ( !iHarvesting ) |
159 { |
153 { |
|
154 TRAP_IGNORE( iFactory->SendHarvestingStatusEventL( ETrue ) ); |
160 iHarvesting = ETrue; |
155 iHarvesting = ETrue; |
161 iHarvesterEventManager->SendEventL( EHEObserverTypeOverall, EHEStateStarted ); |
|
162 // This next line is for caching the harvester started event for observers registering |
|
163 // after harvesting has already started |
|
164 iHarvesterEventManager->IncreaseItemCount( EHEObserverTypeOverall, KCacheItemCountForEventCaching ); |
|
165 } |
156 } |
166 |
157 |
167 CHarvesterData* hd = (*iQueue)[0]; |
158 CHarvesterData* hd = (*iQueue)[0]; |
168 iQueue->Remove( 0 ); |
159 iQueue->Remove( 0 ); |
169 const TDesC& uri = hd->Uri(); |
160 const TDesC& uri = hd->Uri(); |
170 TUint32 mediaId = hd->MdeObject().MediaId(); |
161 TUint32 mediaId = hd->MdeObject().MediaId(); |
|
162 |
|
163 if( hd->ObjectType() == EFastHarvest || hd->Origin() == MdeConstants::Object::ECamera ) |
|
164 { |
|
165 iFastModeEnabled = ETrue; |
|
166 } |
|
167 else if( iFastModeEnabled ) |
|
168 { |
|
169 iFastModeEnabled = EFalse; |
|
170 SetPriority( KHarvesterPriorityHarvestingPlugin ); |
|
171 } |
171 |
172 |
172 if( iBlacklist ) |
173 if( iBlacklist ) |
173 { |
174 { |
174 WRITELOG( "CHarvesterPlugin::RunL - Adding URI to blacklist" ); |
175 WRITELOG( "CHarvesterPlugin::RunL - Adding URI to blacklist" ); |
175 TTime modified ( 0 ); |
176 TTime modified ( 0 ); |
311 { |
312 { |
312 iBlacklist = &aBlacklist; |
313 iBlacklist = &aBlacklist; |
313 } |
314 } |
314 |
315 |
315 // --------------------------------------------------------------------------- |
316 // --------------------------------------------------------------------------- |
|
317 // GetMimeType |
|
318 // --------------------------------------------------------------------------- |
|
319 // |
|
320 EXPORT_C void CHarvesterPlugin::GetMimeType( const TDesC& /*aUri*/, TDes& aMimeType ) |
|
321 { |
|
322 aMimeType.Zero(); |
|
323 } |
|
324 |
|
325 // --------------------------------------------------------------------------- |
|
326 // SetHarvesterPluginFactory |
|
327 // --------------------------------------------------------------------------- |
|
328 // |
|
329 EXPORT_C void CHarvesterPlugin::SetHarvesterPluginFactory( CHarvesterPluginFactory& aFactory ) |
|
330 { |
|
331 iFactory = &aFactory; |
|
332 } |
|
333 |
|
334 // --------------------------------------------------------------------------- |
316 // E32Dll |
335 // E32Dll |
317 // --------------------------------------------------------------------------- |
336 // --------------------------------------------------------------------------- |
318 // |
337 // |
319 GLDEF_C TInt E32Dll() |
338 GLDEF_C TInt E32Dll() |
320 { |
339 { |