equal
deleted
inserted
replaced
63 iQueue( NULL ), |
63 iQueue( NULL ), |
64 iBlacklist( NULL ), |
64 iBlacklist( NULL ), |
65 iDtor_ID_Key( KNullUid ), |
65 iDtor_ID_Key( KNullUid ), |
66 iOriginPropertyDef( NULL ), |
66 iOriginPropertyDef( NULL ), |
67 iTitlePropertyDef( NULL ), |
67 iTitlePropertyDef( NULL ), |
68 iHarvesting( EFalse ), |
68 iHarvesting( EFalse ) |
69 iPaused( EFalse ) |
|
70 { |
69 { |
71 } |
70 } |
72 |
71 |
73 // --------------------------------------------------------------------------- |
72 // --------------------------------------------------------------------------- |
74 // ListImplementationsL |
73 // ListImplementationsL |
108 // |
107 // |
109 EXPORT_C void CHarvesterPlugin::StartHarvest() |
108 EXPORT_C void CHarvesterPlugin::StartHarvest() |
110 { |
109 { |
111 if( iState == EHarvesterIdle ) |
110 if( iState == EHarvesterIdle ) |
112 { |
111 { |
113 iPaused = EFalse; |
|
114 SetNextRequest( EHarvesterGathering ); |
112 SetNextRequest( EHarvesterGathering ); |
115 } |
113 } |
116 } |
114 } |
117 |
115 |
118 // --------------------------------------------------------------------------- |
116 // --------------------------------------------------------------------------- |
144 |
142 |
145 case EHarvesterGathering: |
143 case EHarvesterGathering: |
146 { |
144 { |
147 if( iQueue->Count() == 0 ) |
145 if( iQueue->Count() == 0 ) |
148 { |
146 { |
|
147 SetNextRequest( EHarvesterIdle ); |
149 if( iHarvesting ) |
148 if( iHarvesting ) |
150 { |
149 { |
151 TRAP_IGNORE( iFactory->SendHarvestingStatusEventL( EFalse ) ); |
150 TRAP_IGNORE( iFactory->SendHarvestingStatusEventL( EFalse ) ); |
152 iHarvesting = EFalse; |
151 iHarvesting = EFalse; |
153 } |
152 } |
154 iQueue->Compress(); |
153 iQueue->Compress(); |
155 SetNextRequest( EHarvesterIdle ); |
|
156 } |
154 } |
157 else |
155 else |
158 { |
156 { |
159 WRITELOG( "CHarvesterPlugin::RunL EHarvesterGathering - items in queue" ); |
|
160 if ( !iHarvesting ) |
157 if ( !iHarvesting ) |
161 { |
158 { |
162 TRAP_IGNORE( iFactory->SendHarvestingStatusEventL( ETrue ) ); |
159 TRAP_IGNORE( iFactory->SendHarvestingStatusEventL( ETrue ) ); |
163 iHarvesting = ETrue; |
160 iHarvesting = ETrue; |
164 } |
161 } |
165 |
162 |
166 CHarvesterData* hd = (*iQueue)[0]; |
163 CHarvesterData* hd = (*iQueue)[0]; |
167 iQueue->Remove( 0 ); |
164 iQueue->Remove( 0 ); |
168 if( !hd ) |
|
169 { |
|
170 SetNextRequest( EHarvesterGathering ); |
|
171 break; |
|
172 } |
|
173 const TDesC& uri = hd->Uri(); |
165 const TDesC& uri = hd->Uri(); |
174 TUint32 mediaId = hd->MdeObject().MediaId(); |
166 TUint32 mediaId = hd->MdeObject().MediaId(); |
175 |
167 |
176 if( hd->ObjectType() == EFastHarvest || hd->Origin() == MdeConstants::Object::ECamera ) |
168 if( hd->ObjectType() == EFastHarvest || hd->Origin() == MdeConstants::Object::ECamera ) |
177 { |
169 { |
200 } |
192 } |
201 |
193 |
202 TRAP_IGNORE( SetDefaultPropertiesL( *hd ) ); |
194 TRAP_IGNORE( SetDefaultPropertiesL( *hd ) ); |
203 |
195 |
204 WRITELOG1("CHarvesterPlugin::RunL - Calling HarvestL for file: %S", &uri); |
196 WRITELOG1("CHarvesterPlugin::RunL - Calling HarvestL for file: %S", &uri); |
205 TRAPD( err, HarvestL( hd ) ); |
197 TRAPD(err, HarvestL( hd ) ); |
206 |
198 |
207 if ( iBlacklist ) |
199 if ( iBlacklist ) |
208 { |
200 { |
209 WRITELOG( "CHarvesterPlugin::RunL - Removing URI from blacklist" ); |
201 WRITELOG( "CHarvesterPlugin::RunL - Removing URI from blacklist" ); |
210 iBlacklist->RemoveFile( uri, mediaId ); |
202 iBlacklist->RemoveFile( uri, mediaId ); |
245 SetNextRequest( EHarvesterGathering ); |
237 SetNextRequest( EHarvesterGathering ); |
246 return KErrNone; |
238 return KErrNone; |
247 } |
239 } |
248 |
240 |
249 // --------------------------------------------------------------------------- |
241 // --------------------------------------------------------------------------- |
250 // StartHarvest |
|
251 // --------------------------------------------------------------------------- |
|
252 // |
|
253 EXPORT_C void CHarvesterPlugin::StopHarvest() |
|
254 { |
|
255 Cancel(); |
|
256 iState = EHarvesterIdle; |
|
257 if( iHarvesting ) |
|
258 { |
|
259 TRAP_IGNORE( iFactory->SendHarvestingStatusEventL( EFalse ) ); |
|
260 iHarvesting = EFalse; |
|
261 } |
|
262 iPaused = ETrue; |
|
263 } |
|
264 |
|
265 // --------------------------------------------------------------------------- |
|
266 // SetNextRequest |
242 // SetNextRequest |
267 // --------------------------------------------------------------------------- |
243 // --------------------------------------------------------------------------- |
268 // |
244 // |
269 void CHarvesterPlugin::SetNextRequest( THarvesterState aState ) |
245 void CHarvesterPlugin::SetNextRequest( THarvesterState aState ) |
270 { |
246 { |
271 if ( !IsActive() && !iPaused ) |
247 if ( ! IsActive() ) |
272 { |
248 { |
273 iState = aState; |
249 iState = aState; |
274 SetActive(); |
250 SetActive(); |
275 TRequestStatus* status = &iStatus; |
251 TRequestStatus* status = &iStatus; |
276 User::RequestComplete( status, KErrNone ); |
252 User::RequestComplete( status, KErrNone ); |