174 |
210 |
175 // ----------------------------------------------------------------------------- |
211 // ----------------------------------------------------------------------------- |
176 // CThumbAGProcessor::HandleQueryCompleted() |
212 // CThumbAGProcessor::HandleQueryCompleted() |
177 // ----------------------------------------------------------------------------- |
213 // ----------------------------------------------------------------------------- |
178 // |
214 // |
179 void CThumbAGProcessor::HandleQueryCompleted( CMdEQuery& /*aQuery*/, const TInt aError ) |
215 void CThumbAGProcessor::HandleQueryCompleted( CMdEQuery& aQuery, const TInt aError ) |
180 { |
216 { |
181 |
217 TN_DEBUG3( "CThumbAGProcessor::HandleQueryCompleted, aError == %d Count== %d", aError, aQuery.Count()); |
182 if( iQueryForPlaceholdersActive && iQueryForPlaceholders) |
218 |
183 { |
219 if(&aQuery == iQueryPlaceholders) |
184 TN_DEBUG3( "CThumbAGProcessor::HandleQueryCompletedv2, aError == %d Count== %d", aError, iQueryForPlaceholders->Count()); |
220 { |
185 |
221 TN_DEBUG1( "CThumbAGProcessor::HandleQueryCompleted - iQueryPlaceholders completed"); |
|
222 |
|
223 iPlaceholderQueue.Reset(); |
186 // if no errors in query |
224 // if no errors in query |
187 if (aError == KErrNone ) |
225 if (aError == KErrNone ) |
188 { |
226 { |
189 |
227 for(TInt i = 0; i < iQueryPlaceholders->Count(); i++) |
190 for(TInt i = 0; i < iQueryForPlaceholders->Count(); i++) |
228 { |
|
229 const CMdEObject* object = &iQueryPlaceholders->Result(i); |
|
230 |
|
231 if(!object) |
|
232 { |
|
233 continue; |
|
234 } |
|
235 |
|
236 if(!object->Placeholder()) |
|
237 { |
|
238 TN_DEBUG2( "CThumbAGProcessor::HandleQueryCompleted %d not placeholder", object->Id()); |
|
239 continue; |
|
240 } |
|
241 |
|
242 /*if (iPlaceholderQueue.Find( object->Id() ) == KErrNotFound) |
|
243 { |
|
244 TN_DEBUG2( "CThumbAGProcessor::HandleQueryCompleted %d added to placeholder queue", object->Id());*/ |
|
245 TRAP_IGNORE( iPlaceholderQueue.AppendL( object->Id() )); |
|
246 //} |
|
247 } |
|
248 } |
|
249 delete iQueryPlaceholders; |
|
250 iQueryPlaceholders = NULL; |
|
251 } |
|
252 else if(&aQuery == iQueryAllItems) |
|
253 { |
|
254 TN_DEBUG1( "CThumbAGProcessor::HandleQueryCompleted - QueryAllItems completed"); |
|
255 // if no errors in query |
|
256 if (aError == KErrNone ) |
|
257 { |
|
258 for(TInt i = 0; i < iQueryAllItems->Count(); i++) |
191 { |
259 { |
192 const CMdEObject* object = &iQueryForPlaceholders->Result(i); |
260 const CMdEObject* object = &iQueryAllItems->Result(i); |
193 |
261 |
194 if(!object) |
262 if(!object) |
195 continue; |
|
196 |
|
197 if(!object->Placeholder()) |
|
198 { |
263 { |
199 TN_DEBUG2( "CThumbAGProcessor::HandleQueryCompletedv2 %d not placeholder",object->Id()); |
|
200 continue; |
264 continue; |
201 } |
265 } |
202 |
266 |
203 if (iPlaceholderIDs.Find( object->Id() ) == KErrNotFound) |
267 if (iAddQueue.Find( object->Id() ) == KErrNotFound) |
204 { |
268 { |
205 TRAP_IGNORE( iPlaceholderIDs.AppendL( object->Id() )); |
269 TRAP_IGNORE( iAddQueue.AppendL( object->Id() )); |
206 } |
270 } |
207 } |
271 } |
208 |
272 #ifdef _DEBUG |
209 } |
273 TN_DEBUG2( "CThumbAGProcessor::HandleQueryCompleted IN-COUNTERS---------- Amount: %d, Add",iQueryAllItems->Count()); |
210 else |
274 #endif |
211 { |
275 } |
212 TN_DEBUG1( "CThumbAGProcessor::HandleQueryCompleted() FAILED!"); |
276 //free query |
213 } |
277 delete iQueryAllItems; |
214 |
278 iQueryAllItems = NULL; |
215 iQueryForPlaceholdersActive = EFalse; |
279 } |
216 } |
280 else if(&aQuery == iQuery ) |
217 |
281 { |
218 else if(iQueryActive) |
282 TN_DEBUG1( "CThumbAGProcessor::HandleQueryCompleted - Query completed"); |
219 { |
283 if(iQueryActive) |
220 TN_DEBUG3( "CThumbAGProcessor::HandleQueryCompleted, aError == %d Count== %d", aError, iQuery->Count()); |
284 { |
221 iQueryReady = ETrue; |
285 iQueryReady = ETrue; |
222 iQueryActive = EFalse; |
286 iQueryActive = EFalse; |
|
287 } |
223 |
288 |
224 // if no errors in query |
289 // if no errors in query |
225 if (aError == KErrNone && iQuery) |
290 if (aError == KErrNone && iQuery) |
226 { |
291 { |
227 iProcessingCount = iQuery->Count(); |
292 iProcessingCount = iQuery->Count(); |
228 } |
293 } |
229 else |
294 else |
230 { |
295 { |
|
296 delete iQuery; |
|
297 iQuery = NULL; |
231 iProcessingCount = 0; |
298 iProcessingCount = 0; |
232 TN_DEBUG1( "CThumbAGProcessor::HandleQueryCompleted() FAILED!"); |
299 TN_DEBUG1( "CThumbAGProcessor::HandleQueryCompleted() Query FAILED!"); |
233 } |
300 } |
234 } |
301 } |
235 else |
302 else |
236 { |
303 { |
237 TN_DEBUG1( "CThumbAGProcessor::HandleQueryCompleted() - NO QUERY ACTIVE"); |
304 TN_DEBUG1( "CThumbAGProcessor::HandleQueryCompleted() - NO QUERY ACTIVE"); |
|
305 __ASSERT_DEBUG((EFalse), User::Panic(_L("CThumbAGProcessor::HandleQueryCompleted()"), -1)); |
238 } |
306 } |
239 |
307 |
240 ActivateAO(); |
308 ActivateAO(); |
241 } |
309 } |
242 |
310 |
297 TRAPD( err, iDefNamespace = &iMdESession->GetDefaultNamespaceDefL() ); |
365 TRAPD( err, iDefNamespace = &iMdESession->GetDefaultNamespaceDefL() ); |
298 if (err != KErrNone) |
366 if (err != KErrNone) |
299 { |
367 { |
300 TN_DEBUG1( "CThumbAGProcessor::SetMdESession - Error: GetDefaultNamespaceDefL leave" ); |
368 TN_DEBUG1( "CThumbAGProcessor::SetMdESession - Error: GetDefaultNamespaceDefL leave" ); |
301 } |
369 } |
|
370 |
|
371 TRAP_IGNORE(QueryPlaceholdersL()); |
|
372 TRAP_IGNORE(QueryAllItemsL()); |
|
373 |
302 ActivateAO(); |
374 ActivateAO(); |
303 } |
375 } |
304 |
376 |
305 // --------------------------------------------------------------------------- |
377 // --------------------------------------------------------------------------- |
306 // CThumbAGProcessor::AddToQueue() |
378 // CThumbAGProcessor::AddToQueue() |
307 // --------------------------------------------------------------------------- |
379 // --------------------------------------------------------------------------- |
308 // |
380 // |
309 void CThumbAGProcessor::AddToQueueL( TObserverNotificationType aType, |
381 void CThumbAGProcessor::AddToQueueL( TObserverNotificationType aType, |
310 const RArray<TItemId>& aIDArray, TBool aPresent ) |
382 const RArray<TItemId>& aIDArray, TBool /*aPresent*/ ) |
311 { |
383 { |
312 TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - begin" ); |
384 TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - begin" ); |
313 |
385 |
314 if(aPresent) |
|
315 { |
|
316 TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - Add to SetPresentQueue" ); |
|
317 for (int i=0; i<aIDArray.Count(); i++) |
|
318 { |
|
319 // only add to Present queue if not already in Add or Present queue |
|
320 if (iAddQueue.Find( aIDArray[i] ) == KErrNotFound) |
|
321 { |
|
322 if (iPresentQueue.Find( aIDArray[i] ) == KErrNotFound) |
|
323 { |
|
324 iPresentQueue.AppendL(aIDArray[i]); |
|
325 } |
|
326 } |
|
327 } |
|
328 } |
|
329 // update queues |
386 // update queues |
330 else if (aType == ENotifyAdd) |
387 if (aType == ENotifyAdd) |
331 { |
388 { |
332 TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - ENotifyAdd" ); |
389 TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - ENotifyAdd" ); |
333 |
390 |
334 for (int i=0; i<aIDArray.Count(); i++) |
391 for (int i=0; i<aIDArray.Count(); i++) |
335 { |
392 { |
336 // only add to Add queue if not already in Add queue |
393 // only add to Add queue if not already in Add queue |
337 if (iAddQueue.Find( aIDArray[i] ) == KErrNotFound) |
394 if (iAddQueue.Find( aIDArray[i] ) == KErrNotFound) |
338 { |
395 { |
339 //if in Present Queue remove from there and and put to add queue |
396 iAddQueue.AppendL(aIDArray[i]); |
340 TInt index = iPresentQueue.Find( aIDArray[i] ); |
397 } |
341 if( index != KErrNotFound) |
398 } |
|
399 } |
|
400 else if (aType == ENotifyModify) |
|
401 { |
|
402 TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - ENotifyModify" ); |
|
403 |
|
404 if(iPHHarvesting) |
|
405 { |
|
406 TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - PH harvesting active, treat like add" ); |
|
407 for (int i=0; i<aIDArray.Count(); i++) |
|
408 { |
|
409 // only add to Add queue if not already in Add queue |
|
410 if (iAddQueue.Find( aIDArray[i] ) == KErrNotFound) |
342 { |
411 { |
343 iPresentQueue.Remove( index ); |
412 iAddQueue.AppendL(aIDArray[i]); |
344 } |
413 } |
345 iAddQueue.AppendL(aIDArray[i]); |
414 |
346 iTempAddQueue.AppendL(aIDArray[i]); |
415 TInt itemIndex = iPlaceholderQueue.Find( aIDArray[i] ); |
347 } |
416 |
348 } |
417 if (itemIndex >= 0) |
349 } |
418 { |
350 else if (aType == ENotifyModify) |
419 TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - remove from placeholder queue"); |
351 { |
420 iPlaceholderQueue.Remove( itemIndex ); |
352 TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - ENotifyModify" ); |
421 } |
|
422 } |
|
423 } |
|
424 else |
|
425 { |
|
426 TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - PH harvesting finished, check is real modify!" ); |
353 |
427 |
354 for (int i=0; i<aIDArray.Count(); i++) |
428 TInt itemIndex(KErrNotFound); |
355 { |
429 |
356 TInt itemIndex = iPlaceholderIDs.Find( aIDArray[i] ); |
430 for (int i=0; i<aIDArray.Count(); i++) |
357 if(itemIndex >= 0 ) |
431 { |
358 { |
432 itemIndex = iPlaceholderQueue.Find( aIDArray[i] ); |
359 TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - harvesting now ended for this placeholder - not Real ENotifyModify" ); |
433 |
360 iPlaceholderIDs.Remove(itemIndex); |
434 if (itemIndex >= 0) |
361 TN_DEBUG2( "CThumbAGProcessor::AddToQueueL() - placeholders left %d", iPlaceholderIDs.Count() ); |
435 { |
362 if (iAddQueue.Find( aIDArray[i] ) == KErrNotFound) |
436 TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - placeholder modify, remove from placeholder queue"); |
363 { |
437 iPlaceholderQueue.Remove( itemIndex ); |
364 iAddQueue.AppendL(aIDArray[i]); |
438 iAddQueue.Append( aIDArray[i] ); |
365 } |
439 } |
366 if (iTempModifyQueue.Find( aIDArray[i] ) == KErrNotFound) |
440 else |
367 { |
441 { |
368 iTempModifyQueue.AppendL( aIDArray[i] ); |
442 TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - real modify"); |
369 } |
443 itemIndex = iAddQueue.Find( aIDArray[i] ); |
370 } |
444 |
371 else if ( iTempAddQueue.Find( aIDArray[i] ) == KErrNotFound) |
445 if (itemIndex >= 0) |
372 { |
446 { |
373 TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - Real ENotifyModify, force run" ); |
447 TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - remove from add queue"); |
374 iModifyQueue.InsertL( aIDArray[i], 0 ); |
448 iAddQueue.Remove( itemIndex ); |
375 |
449 } |
376 TInt itemIndex = iAddQueue.Find( aIDArray[i] ); |
450 |
377 if(itemIndex >= 0) |
451 if( iPlaceholderQueue.Find( aIDArray[i] ) == KErrNotFound ) |
|
452 { |
|
453 TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - append to modify queue"); |
|
454 iModifyQueue.AppendL(aIDArray[i]); |
|
455 } |
|
456 |
|
457 SetForceRun( ETrue ); |
|
458 } |
|
459 } |
|
460 } |
|
461 } |
|
462 else if (aType == ENotifyRemove) |
|
463 { |
|
464 TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - ENotifyRemove, remove IDs from all queues, append to Delete" ); |
|
465 |
|
466 for (int i=0; i<aIDArray.Count(); i++) |
|
467 { |
|
468 // can be removed from Add queue |
|
469 TInt itemIndex = iAddQueue.Find( aIDArray[i] ); |
|
470 if(itemIndex >= 0) |
378 { |
471 { |
379 iAddQueue.Remove(itemIndex); |
472 iAddQueue.Remove(itemIndex); |
380 } |
473 } |
381 itemIndex = iPresentQueue.Find( aIDArray[i] ); |
474 |
382 if(itemIndex >= 0) |
475 // ..and Modify Queue |
|
476 itemIndex = iModifyQueue.Find( aIDArray[i] ); |
|
477 if(itemIndex >= 0) |
383 { |
478 { |
384 iPresentQueue.Remove(itemIndex); |
479 iModifyQueue.Remove(itemIndex); |
385 } |
480 } |
386 SetForceRun( ETrue ); |
481 |
387 } |
482 //add to remove queue |
388 else |
483 if (iRemoveQueue.Find( aIDArray[i] ) == KErrNotFound) |
389 { |
484 { |
390 if (iTempModifyQueue.Find( aIDArray[i] ) == KErrNotFound) |
485 iRemoveQueue.AppendL(aIDArray[i]); |
391 { |
486 } |
392 TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - harvesting now ended for this file - not Real ENotifyModify" ); |
487 } |
393 iTempModifyQueue.AppendL( aIDArray[i] ); |
488 } |
394 } |
489 #ifdef _DEBUG |
395 else |
490 else |
396 { |
491 { |
397 TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - harvesting ended allready for this file - Real ENotifyModify, force run" ); |
492 TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - should not come here" ); |
398 iModifyQueue.InsertL( aIDArray[i], 0 ); |
493 __ASSERT_DEBUG((EFalse), User::Panic(_L("CThumbAGProcessor::AddToQueueL()"), -2)); |
399 TInt itemIndex = iAddQueue.Find( aIDArray[i] ); |
494 return; |
400 if(itemIndex >= 0) |
495 } |
401 { |
496 #endif |
402 iAddQueue.Remove(itemIndex); |
497 |
403 } |
498 ActivateAO(); |
404 itemIndex = iPresentQueue.Find( aIDArray[i] ); |
499 |
405 if(itemIndex >= 0) |
500 TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - end" ); |
406 { |
501 } |
407 iPresentQueue.Remove(itemIndex); |
502 |
408 } |
503 // --------------------------------------------------------------------------- |
409 SetForceRun( ETrue ); |
504 // CThumbAGProcessor::CreateThumbnailsL() |
410 } |
505 // --------------------------------------------------------------------------- |
411 } |
506 // |
412 } |
507 void CThumbAGProcessor::CreateThumbnailsL( const CMdEObject* aObject ) |
413 } |
508 { |
414 else if (aType == ENotifyRemove) |
509 TN_DEBUG1( "CThumbAGProcessor::CreateThumbnailsL() - begin" ); |
415 { |
510 |
416 TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - ENotifyRemove" ); |
511 TInt orientationVal = 0; |
417 |
512 TInt64 modifiedVal = 0; |
418 for (int i=0; i<aIDArray.Count(); i++) |
513 |
419 { |
514 CMdEProperty* orientation = NULL; |
420 // only add to Remove queue if not already in Remove queue |
515 CMdEObjectDef& objDef = iDefNamespace->GetObjectDefL( MdeConstants::Image::KImageObject ); |
421 if (iRemoveQueue.Find( aIDArray[i] ) == KErrNotFound) |
516 TInt orientErr = aObject->Property( objDef.GetPropertyDefL( MdeConstants::Image::KOrientationProperty ), orientation, 0 ); |
422 { |
517 |
423 iRemoveQueue.AppendL(aIDArray[i]); |
518 if (orientErr == KErrNone) |
424 } |
519 { |
425 |
520 orientationVal = orientation->Uint16ValueL(); |
426 // can be removed from Add queue |
521 } |
427 TInt itemIndex = iAddQueue.Find( aIDArray[i] ); |
522 |
428 if(itemIndex >= 0) |
523 CMdEProperty* modified = NULL; |
429 { |
524 CMdEObjectDef& objDef2 = iDefNamespace->GetObjectDefL( MdeConstants::Object::KBaseObject ); |
430 iAddQueue.Remove(itemIndex); |
525 TInt modifyErr = aObject->Property( objDef2.GetPropertyDefL( MdeConstants::Object::KLastModifiedDateProperty ), modified, 0 ); |
431 } |
526 |
432 // ..and Present Queue |
527 if (modifyErr >= 0) |
433 itemIndex = iPresentQueue.Find( aIDArray[i] ); |
528 { |
434 if(itemIndex >= 0) |
529 modifiedVal = modified->TimeValueL().Int64(); |
435 { |
530 } |
436 iPresentQueue.Remove(itemIndex); |
531 |
437 } |
532 // modify existing thumbs |
438 // ..and Modify Queue |
533 if (iTMSession) |
439 itemIndex = iModifyQueue.Find( aIDArray[i] ); |
534 { |
440 if(itemIndex >= 0) |
535 // run as lower priority than getting but higher that creating thumbnails |
441 { |
536 TRAPD(err, iTMSession->UpdateThumbnailsL(aObject->Id(), aObject->Uri(), orientationVal, modifiedVal, CActive::EPriorityIdle )); |
442 iModifyQueue.Remove(itemIndex); |
537 |
443 } |
538 if ( err != KErrNone ) |
444 } |
539 { |
|
540 TN_DEBUG2( "CThumbAGProcessor::UpdateThumbnailsL, iTMSession error == %d", err ); |
|
541 |
|
542 iSessionDied = ETrue; |
|
543 iActive = EFalse; |
|
544 ActivateAO(); |
|
545 } |
|
546 else |
|
547 { |
|
548 iActive = ETrue; |
|
549 } |
445 } |
550 } |
446 else |
551 else |
447 { |
552 { |
448 // should not come here |
553 ActivateAO(); |
449 TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - should not come here" ); |
554 } |
450 return; |
|
451 } |
|
452 |
|
453 ActivateAO(); |
|
454 |
|
455 TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - end" ); |
|
456 } |
|
457 |
|
458 // --------------------------------------------------------------------------- |
|
459 // CThumbAGProcessor::CreateThumbnailsL() |
|
460 // --------------------------------------------------------------------------- |
|
461 // |
|
462 void CThumbAGProcessor::CreateThumbnailsL( const CMdEObject* aObject ) |
|
463 { |
|
464 TN_DEBUG1( "CThumbAGProcessor::CreateThumbnailsL() - begin" ); |
|
465 |
|
466 if( iModify ) |
|
467 { |
|
468 TInt orientationVal = 0; |
|
469 TInt64 modifiedVal = 0; |
|
470 |
|
471 CMdEProperty* orientation = NULL; |
|
472 CMdEObjectDef& objDef = iDefNamespace->GetObjectDefL( MdeConstants::Image::KImageObject ); |
|
473 TInt orientErr = aObject->Property( objDef.GetPropertyDefL( MdeConstants::Image::KOrientationProperty ), orientation, 0 ); |
|
474 |
|
475 if (orientErr == KErrNone) |
|
476 { |
|
477 orientationVal = orientation->Uint16ValueL(); |
|
478 } |
|
479 |
|
480 CMdEProperty* modified = NULL; |
|
481 CMdEObjectDef& objDef2 = iDefNamespace->GetObjectDefL( MdeConstants::Object::KBaseObject ); |
|
482 TInt modifyErr = aObject->Property( objDef2.GetPropertyDefL( MdeConstants::Object::KLastModifiedDateProperty ), modified, 0 ); |
|
483 |
|
484 if (modifyErr >= 0) |
|
485 { |
|
486 modifiedVal = modified->TimeValueL().Int64(); |
|
487 } |
|
488 |
|
489 // modify existing thumbs |
|
490 if (iTMSession) |
|
491 { |
|
492 // run as lower priority than getting but higher that creating thumbnails |
|
493 TRAPD(err, iTMSession->UpdateThumbnailsL(aObject->Id(), aObject->Uri(), orientationVal, modifiedVal, CActive::EPriorityIdle )); |
|
494 |
|
495 if ( err != KErrNone ) |
|
496 { |
|
497 TN_DEBUG2( "CThumbAGProcessor::UpdateThumbnailsL, iTMSession error == %d", err ); |
|
498 |
|
499 iSessionDied = ETrue; |
|
500 iActive = EFalse; |
|
501 ActivateAO(); |
|
502 } |
|
503 else |
|
504 { |
|
505 iActive = ETrue; |
|
506 } |
|
507 } |
|
508 else |
|
509 { |
|
510 ActivateAO(); |
|
511 } |
|
512 |
555 |
513 #ifdef _DEBUG |
556 #ifdef _DEBUG |
|
557 if(iModify) |
|
558 { |
514 iModCounter++; |
559 iModCounter++; |
|
560 } |
|
561 else |
|
562 { |
|
563 iAddCounter++; |
|
564 } |
515 #endif |
565 #endif |
516 } |
566 |
517 else |
|
518 { |
|
519 CThumbnailObjectSource* source = NULL; |
|
520 CMdEProperty* mimeType = NULL; |
|
521 CMdEObjectDef& objDef = iDefNamespace->GetObjectDefL( MdeConstants::Object::KBaseObject ); |
|
522 TInt mime = aObject->Property( objDef.GetPropertyDefL( MdeConstants::Object::KItemTypeProperty ), mimeType, 0 ); |
|
523 |
|
524 // create new thumbs |
|
525 if (mime != KErrNotFound) |
|
526 { |
|
527 source = CThumbnailObjectSource::NewLC(aObject->Uri(), aObject->Id(), mimeType->TextValueL()); |
|
528 } |
|
529 else |
|
530 { |
|
531 source = CThumbnailObjectSource::NewLC(aObject->Uri(), aObject->Id()); |
|
532 } |
|
533 |
|
534 if (iTMSession) |
|
535 { |
|
536 // run as very low priority task |
|
537 TInt id = iTMSession->CreateThumbnails(*source, CActive::EPriorityIdle ); |
|
538 if ( id < 0 ) |
|
539 { |
|
540 TN_DEBUG2( "CThumbAGProcessor::CreateThumbnailsL, iTMSession error == %d", id ); |
|
541 |
|
542 iSessionDied = ETrue; |
|
543 iActive = EFalse; |
|
544 CleanupStack::PopAndDestroy( source ); |
|
545 ActivateAO(); |
|
546 } |
|
547 else |
|
548 { |
|
549 iActive = ETrue; |
|
550 CleanupStack::PopAndDestroy( source ); |
|
551 } |
|
552 |
|
553 } |
|
554 else |
|
555 { |
|
556 ActivateAO(); |
|
557 } |
|
558 |
|
559 #ifdef _DEBUG |
|
560 iAddCounter++; |
|
561 #endif |
|
562 } |
|
563 |
|
564 #ifdef _DEBUG |
567 #ifdef _DEBUG |
565 TN_DEBUG3( "CThumbAGProcessor::OUT-COUNTERS----------, Add = %d Modify = %d", |
568 TN_DEBUG3( "CThumbAGProcessor::OUT-COUNTERS----------, Add = %d Modify = %d", |
566 iAddCounter, iModCounter ); |
569 iAddCounter, iModCounter ); |
567 #endif |
570 #endif |
568 |
571 |
639 iQueryQueue.Reset(); |
642 iQueryQueue.Reset(); |
640 |
643 |
641 TN_DEBUG1( "CThumbAGProcessor::QueryL() - end" ); |
644 TN_DEBUG1( "CThumbAGProcessor::QueryL() - end" ); |
642 } |
645 } |
643 |
646 |
|
647 |
|
648 // --------------------------------------------------------------------------- |
|
649 // CThumbAGProcessor::QueryForPlaceholders() |
|
650 // --------------------------------------------------------------------------- |
|
651 // |
|
652 |
|
653 void CThumbAGProcessor::QueryPlaceholdersL() |
|
654 { |
|
655 TN_DEBUG1( "CThumbAGProcessor::QueryPlaceholdersL" ); |
|
656 |
|
657 CMdEObjectQuery::TState state(CMdEObjectQuery::EStateFirst); |
|
658 |
|
659 if( iQueryPlaceholders ) |
|
660 { |
|
661 state = iQueryPlaceholders->State(); |
|
662 |
|
663 if(state == CMdEObjectQuery::EStateSearching ) |
|
664 { |
|
665 TN_DEBUG1( "CThumbAGProcessor::QueryPlaceholdersL active- skip" ); |
|
666 return; |
|
667 } |
|
668 |
|
669 // delete old query |
|
670 iQueryPlaceholders->Cancel(); |
|
671 delete iQueryPlaceholders; |
|
672 iQueryPlaceholders = NULL; |
|
673 } |
|
674 |
|
675 TN_DEBUG1( "CThumbAGProcessor::QueryPlaceholdersL - start" ); |
|
676 |
|
677 CMdEObjectDef& imageObjDef = iDefNamespace->GetObjectDefL( MdeConstants::Image::KImageObject ); |
|
678 CMdEObjectDef& videoObjDef = iDefNamespace->GetObjectDefL( MdeConstants::Video::KVideoObject ); |
|
679 CMdEObjectDef& audioObjDef = iDefNamespace->GetObjectDefL( MdeConstants::Audio::KAudioObject ); |
|
680 |
|
681 CMdEObjectDef& objDef = iDefNamespace->GetObjectDefL( MdeConstants::Object::KBaseObject); |
|
682 iQueryPlaceholders = iMdESession->NewObjectQueryL( *iDefNamespace, objDef, this ); |
|
683 |
|
684 iQueryPlaceholders->SetResultMode( EQueryResultModeItem ); |
|
685 |
|
686 CMdELogicCondition& rootCondition = iQueryPlaceholders->Conditions(); |
|
687 rootCondition.SetOperator( ELogicConditionOperatorOr ); |
|
688 |
|
689 CMdEObjectCondition& imagePHObjectCondition = rootCondition.AddObjectConditionL(imageObjDef); |
|
690 imagePHObjectCondition.SetPlaceholderOnly( ETrue ); |
|
691 imagePHObjectCondition.SetNotPresent( ETrue ); |
|
692 |
|
693 CMdEObjectCondition& videoPHObjectCondition = rootCondition.AddObjectConditionL(videoObjDef); |
|
694 videoPHObjectCondition.SetPlaceholderOnly( ETrue ); |
|
695 videoPHObjectCondition.SetNotPresent( ETrue ); |
|
696 |
|
697 CMdEObjectCondition& audioPHObjectCondition = rootCondition.AddObjectConditionL(audioObjDef); |
|
698 audioPHObjectCondition.SetPlaceholderOnly( ETrue ); |
|
699 audioPHObjectCondition.SetNotPresent( ETrue ); |
|
700 |
|
701 iQueryPlaceholders->FindL(); |
|
702 |
|
703 TN_DEBUG1( "CThumbAGProcessor::QueryPlaceholdersL - end" ); |
|
704 } |
|
705 |
|
706 |
644 // --------------------------------------------------------------------------- |
707 // --------------------------------------------------------------------------- |
645 // CThumbAGProcessor::RunL() |
708 // CThumbAGProcessor::RunL() |
646 // --------------------------------------------------------------------------- |
709 // --------------------------------------------------------------------------- |
647 // |
710 // |
648 void CThumbAGProcessor::RunL() |
711 void CThumbAGProcessor::RunL() |
710 else |
779 else |
711 { |
780 { |
712 iActiveCount = 0; |
781 iActiveCount = 0; |
713 } |
782 } |
714 |
783 |
715 //Iforce run can proceed from this point |
784 //force run can proceed from this point |
716 if( !iForceRun ) |
785 if( iForceRun ) |
717 { |
786 { |
718 //check if harvesting or waiting timeout |
787 CancelTimeout(); |
719 if( iHarvesting || iTimerActive || iMPXHarvesting ) |
788 TN_DEBUG1( "void CThumbAGProcessor::RunL() forced run, continue!"); |
720 { |
789 } |
721 TN_DEBUG1( "void CThumbAGProcessor::RunL() Harvester or timer active, abort"); |
790 else |
|
791 { |
|
792 if( !iLights) |
|
793 { |
|
794 iIdle = ETrue; |
|
795 } |
|
796 else |
|
797 { |
|
798 iIdle = IsInactive(); |
|
799 } |
|
800 |
|
801 if( !iIdle || iHarvesting || iMPXHarvesting || iPeriodicTimer->IsActive() ) |
|
802 { |
|
803 #ifdef _DEBUG |
|
804 TN_DEBUG5( "iIdle = %d, iHarvesting = %d, iMPXHarvesting = %d, iPeriodicTimer->IsActive() = %d", |
|
805 iIdle, iHarvesting, iMPXHarvesting, iPeriodicTimer->IsActive()); |
|
806 #endif |
|
807 TN_DEBUG1( "void CThumbAGProcessor::RunL() device not idle"); |
722 return; |
808 return; |
723 } |
809 } |
724 else |
810 else |
725 { |
811 { |
726 //check is server idle |
812 //check is server idle |
727 TInt idle(-1); |
813 TInt serveIdle(KErrNotFound); |
728 |
814 TInt ret = RProperty::Get(KServerIdle, KIdle, serveIdle); |
729 TInt ret = RProperty::Get(KServerIdle, KIdle, idle); |
815 |
730 |
816 if(ret == KErrNone ) |
731 if(ret == KErrNone ) |
817 { |
732 { |
818 if(!serveIdle) |
733 if(!idle) |
819 { |
734 { |
820 //start inactivity timer and retry on after callback |
735 //start wait timer and retry on after callback |
821 TN_DEBUG1( "void CThumbAGProcessor::RunL() server not idle"); |
736 TN_DEBUG1( "CThumbAGProcessor::RunL() server not idle, wait... " ); |
822 StartTimeout(); |
737 if( !iTimerActive) |
823 return; |
738 { |
824 } |
739 StartTimeout(); |
825 } |
740 } |
826 TN_DEBUG1( "void CThumbAGProcessor::RunL() device and server idle, process"); |
741 return; |
827 } |
742 } |
828 } |
743 } |
|
744 else |
|
745 { |
|
746 TN_DEBUG2( "CThumbAGProcessor::RunL() get KServerIdle failed %d, continue...", ret ); |
|
747 } |
|
748 } |
|
749 } |
|
750 else |
|
751 { |
|
752 TN_DEBUG1( "void CThumbAGProcessor::RunL() forced run"); |
|
753 } |
|
754 |
|
755 |
829 |
756 //Handle completed MDS Query |
830 //Handle completed MDS Query |
757 if( iQueryReady && iProcessingCount) |
831 if( iQueryReady && iProcessingCount) |
758 { |
832 { |
759 TInt err(KErrNone); |
833 TInt err(KErrNone); |
|
834 //if force or non forced |
760 if((iForceRun && iModify) || (!iForceRun && !iModify)) |
835 if((iForceRun && iModify) || (!iForceRun && !iModify)) |
761 { |
836 { |
762 TN_DEBUG1( "CThumbAGProcessor::RunL() - iQueryReady START" ); |
837 TN_DEBUG1( "CThumbAGProcessor::RunL() - iQueryReady START" ); |
763 |
838 |
764 |
|
765 const CMdEObject* object = &iQuery->Result( iProcessingCount-1 ); |
839 const CMdEObject* object = &iQuery->Result( iProcessingCount-1 ); |
766 iProcessingCount--; |
840 iProcessingCount--; |
767 |
841 |
768 // process one item at once |
842 // process one item at once |
769 if ( object ) |
843 if ( object ) |
770 { |
844 { |
771 TRAP( err, CreateThumbnailsL(object) ); |
845 TRAP( err, CreateThumbnailsL(object) ); |
772 |
846 |
773 if ( err != KErrNone ) |
847 if ( err != KErrNone ) |
774 { |
848 { |
775 TN_DEBUG2( "CThumbAGProcessor::RunL(), CreateThumbnailsL error == %d", err ); |
849 TN_DEBUG2( "CThumbAGProcessor::RunL(), CreateThumbnailsL error == %d", err ); |
776 } |
850 } |
777 } |
851 } |
778 } |
852 } |
|
853 //force is coming, but executing non-forced query complete-> cancel old |
779 else |
854 else |
780 { |
855 { |
781 TN_DEBUG1( "CThumbAGProcessor::RunL() - deleting query" ); |
856 TN_DEBUG1( "CThumbAGProcessor::RunL() - deleting query" ); |
782 delete iQuery; |
857 delete iQuery; |
783 iQuery = NULL; |
858 iQuery = NULL; |
893 HarvesterEventObserverType aHEObserverType, |
958 HarvesterEventObserverType aHEObserverType, |
894 HarvesterEventState aHarvesterEventState, |
959 HarvesterEventState aHarvesterEventState, |
895 TInt /*aItemsLeft*/ ) |
960 TInt /*aItemsLeft*/ ) |
896 { |
961 { |
897 TN_DEBUG3( "CThumbAGProcessor::HarvestingUpdated -- start() aHEObserverType = %d, aHarvesterEventState = %d", aHEObserverType, aHarvesterEventState ); |
962 TN_DEBUG3( "CThumbAGProcessor::HarvestingUpdated -- start() aHEObserverType = %d, aHarvesterEventState = %d", aHEObserverType, aHarvesterEventState ); |
898 |
963 |
|
964 #ifdef _DEBUG |
899 if( aHEObserverType == EHEObserverTypePlaceholder) |
965 if( aHEObserverType == EHEObserverTypePlaceholder) |
900 { |
966 { |
901 TRAP_IGNORE( QueryForPlaceholdersL() ); |
967 TN_DEBUG1( "CThumbAGProcessor::HarvestingUpdated -- type EHEObserverTypePlaceholder"); |
902 return; |
968 } |
903 } |
969 else if( aHEObserverType == EHEObserverTypeOverall) |
904 |
970 { |
905 if( aHEObserverType != EHEObserverTypeOverall) |
971 TN_DEBUG1( "CThumbAGProcessor::HarvestingUpdated -- type EHEObserverTypeOverall"); |
906 { |
|
907 return; |
|
908 } |
|
909 |
|
910 switch(aHarvesterEventState) |
|
911 { |
|
912 case EHEStateStarted: |
|
913 case EHEStateHarvesting: |
|
914 case EHEStatePaused: |
|
915 case EHEStateResumed: |
|
916 { |
|
917 iHarvestingTemp = ETrue; |
|
918 break; |
|
919 } |
|
920 case EHEStateFinished: |
|
921 case EHEStateUninitialized: |
|
922 { |
|
923 iHarvestingTemp = EFalse; |
|
924 break; |
|
925 } |
|
926 }; |
|
927 |
|
928 if(iHarvestingTemp == iHarvesting) |
|
929 { |
|
930 TN_DEBUG2( "CThumbAGProcessor::HarvestingUpdated -- no change %d", iHarvesting); |
|
931 } |
972 } |
932 else |
973 else |
933 { |
974 { |
934 iHarvesting = iHarvestingTemp; |
975 TN_DEBUG1( "CThumbAGProcessor::HarvestingUpdated -- type EHEObserverTypeMMC"); |
935 |
976 } |
936 if( iHarvesting ) |
977 #endif |
937 { |
978 |
938 TN_DEBUG1( "CThumbAGProcessor::HarvestingUpdated -- MDS harvesterin started"); |
979 //placeholder harvesting |
939 CancelTimeout(); |
980 if( aHEObserverType == EHEObserverTypePlaceholder) |
940 } |
981 { |
941 else |
982 switch(aHarvesterEventState) |
942 { |
983 { |
943 TN_DEBUG1( "CThumbAGProcessor::HarvestingUpdated -- MDS harvesting finished "); |
984 case EHEStateStarted: |
944 // continue processing if needed |
985 case EHEStateHarvesting: |
945 StartTimeout(); |
986 case EHEStateResumed: |
946 |
987 { |
947 iTempModifyQueue.Reset(); |
988 iPHHarvestingTemp = ETrue; |
948 iTempAddQueue.Reset(); |
989 break; |
949 iPlaceholderIDs.Reset(); |
990 } |
950 } |
991 case EHEStatePaused: |
951 } |
992 case EHEStateFinished: |
952 |
993 case EHEStateUninitialized: |
953 TN_DEBUG3( "CThumbAGProcessor::HarvestingUpdated -- end() iHarvesting == %d, iMPXHarvesting == %d", iHarvesting, iMPXHarvesting); |
994 { |
|
995 iPHHarvestingTemp = EFalse; |
|
996 break; |
|
997 } |
|
998 }; |
|
999 |
|
1000 if(iPHHarvestingTemp != iPHHarvesting) |
|
1001 { |
|
1002 iPHHarvesting = iPHHarvestingTemp; |
|
1003 |
|
1004 if( iPHHarvesting ) |
|
1005 { |
|
1006 TN_DEBUG1( "CThumbAGProcessor::HarvestingUpdated -- MDS placeholder harvesterin started"); |
|
1007 } |
|
1008 else |
|
1009 { |
|
1010 TN_DEBUG1( "CThumbAGProcessor::HarvestingUpdated -- MDS placeholder harvesting finished"); |
|
1011 TRAP_IGNORE(QueryPlaceholdersL()); |
|
1012 } |
|
1013 } |
|
1014 } |
|
1015 //overall harvesting |
|
1016 else if ( aHEObserverType == EHEObserverTypeOverall) |
|
1017 { |
|
1018 switch(aHarvesterEventState) |
|
1019 { |
|
1020 case EHEStateStarted: |
|
1021 case EHEStateHarvesting: |
|
1022 case EHEStatePaused: |
|
1023 case EHEStateResumed: |
|
1024 { |
|
1025 iHarvestingTemp = ETrue; |
|
1026 break; |
|
1027 } |
|
1028 case EHEStateFinished: |
|
1029 case EHEStateUninitialized: |
|
1030 { |
|
1031 iHarvestingTemp = EFalse; |
|
1032 break; |
|
1033 } |
|
1034 }; |
|
1035 |
|
1036 if(iHarvestingTemp != iHarvesting) |
|
1037 { |
|
1038 iHarvesting = iHarvestingTemp; |
|
1039 |
|
1040 if( iHarvesting ) |
|
1041 { |
|
1042 TN_DEBUG1( "CThumbAGProcessor::HarvestingUpdated -- MDS harvesterin started"); |
|
1043 CancelTimeout(); |
|
1044 } |
|
1045 else |
|
1046 { |
|
1047 TN_DEBUG1( "CThumbAGProcessor::HarvestingUpdated -- MDS harvesting finished "); |
|
1048 // continue processing if needed |
|
1049 StartTimeout(); |
|
1050 } |
|
1051 } |
|
1052 } |
|
1053 else if( aHEObserverType == EHEObserverTypeMMC) |
|
1054 { |
|
1055 switch(aHarvesterEventState) |
|
1056 { |
|
1057 case EHEStateStarted: |
|
1058 case EHEStateHarvesting: |
|
1059 case EHEStateResumed: |
|
1060 TN_DEBUG1( "CThumbAGProcessor::HarvestingUpdated -- MMC harvesting started "); |
|
1061 break; |
|
1062 case EHEStateFinished: |
|
1063 TN_DEBUG1( "CThumbAGProcessor::HarvestingUpdated -- MMC harvesting finished "); |
|
1064 TRAP_IGNORE(QueryAllItemsL()); |
|
1065 break; |
|
1066 }; |
|
1067 } |
|
1068 |
|
1069 TN_DEBUG3( "CThumbAGProcessor::HarvestingUpdated -- end() iHarvesting == %d, iPHHarvesting == %d ", iHarvesting, iPHHarvesting); |
954 } |
1070 } |
955 |
1071 |
956 // --------------------------------------------------------------------------- |
1072 // --------------------------------------------------------------------------- |
957 // CThumbAGProcessor::StartTimeout() |
1073 // CThumbAGProcessor::StartTimeout() |
958 // --------------------------------------------------------------------------- |
1074 // --------------------------------------------------------------------------- |
959 // |
1075 // |
960 void CThumbAGProcessor::StartTimeout() |
1076 void CThumbAGProcessor::StartTimeout() |
961 { |
1077 { |
|
1078 TN_DEBUG1( "CThumbAGProcessor::StartTimeout()"); |
962 CancelTimeout(); |
1079 CancelTimeout(); |
963 |
1080 |
964 if(!iHarvesting && !iMPXHarvesting && !iPeriodicTimer->IsActive()) |
1081 if(!iHarvesting && !iMPXHarvesting && !iPeriodicTimer->IsActive()) |
965 { |
1082 { |
966 iPeriodicTimer->Start( KHarvestingCompleteTimeout, KHarvestingCompleteTimeout, |
1083 iPeriodicTimer->Start( KHarvestingCompleteTimeout, KHarvestingCompleteTimeout, |
967 TCallBack(PeriodicTimerCallBack, this)); |
1084 TCallBack(PeriodicTimerCallBack, this)); |
968 iTimerActive = ETrue; |
|
969 } |
|
970 else |
|
971 { |
|
972 iTimerActive = EFalse; |
|
973 } |
1085 } |
974 } |
1086 } |
975 |
1087 |
976 // --------------------------------------------------------------------------- |
1088 // --------------------------------------------------------------------------- |
977 // CThumbAGProcessor::StopTimeout() |
1089 // CThumbAGProcessor::StopTimeout() |
978 // --------------------------------------------------------------------------- |
1090 // --------------------------------------------------------------------------- |
979 // |
1091 // |
980 void CThumbAGProcessor::CancelTimeout() |
1092 void CThumbAGProcessor::CancelTimeout() |
981 { |
1093 { |
982 if(iTimerActive) |
1094 if(iPeriodicTimer->IsActive()) |
983 { |
1095 { |
984 iPeriodicTimer->Cancel(); |
1096 iPeriodicTimer->Cancel(); |
985 } |
1097 } |
986 iTimerActive = EFalse; |
|
987 } |
1098 } |
988 |
1099 |
989 // --------------------------------------------------------------------------- |
1100 // --------------------------------------------------------------------------- |
990 // CThumbAGProcessor::RunError() |
1101 // CThumbAGProcessor::RunError() |
991 // --------------------------------------------------------------------------- |
1102 // --------------------------------------------------------------------------- |
992 // |
1103 // |
993 TInt CThumbAGProcessor::RunError(TInt aError) |
1104 TInt CThumbAGProcessor::RunError(TInt aError) |
994 { |
1105 { |
|
1106 TN_DEBUG1( "CThumbAGProcessor::RunError()"); |
995 if (aError != KErrNone) |
1107 if (aError != KErrNone) |
996 { |
1108 { |
997 TN_DEBUG2( "CThumbAGProcessor::RunError = %d", aError ); |
1109 TN_DEBUG2( "CThumbAGProcessor::RunError = %d", aError ); |
998 } |
1110 } |
999 |
1111 |
1061 TBool audioGrid( EFalse ); |
1177 TBool audioGrid( EFalse ); |
1062 TBool audioList( EFalse ); |
1178 TBool audioList( EFalse ); |
1063 TBool audioFull( EFalse ); |
1179 TBool audioFull( EFalse ); |
1064 |
1180 |
1065 // get cenrep values |
1181 // get cenrep values |
1066 rep->Get( KAutoCreateImageGrid, imageGrid ); |
1182 TInt ret = rep->Get( KAutoCreateImageGrid, imageGrid ); |
1067 rep->Get( KAutoCreateImageList, imageList ); |
1183 TN_DEBUG2( "CThumbAGProcessor::CheckAutoCreateValuesL() KAutoCreateImageGrid %d", ret); |
1068 rep->Get( KAutoCreateImageFullscreen, imageFull ); |
1184 ret = rep->Get( KAutoCreateImageList, imageList ); |
1069 rep->Get( KAutoCreateVideoGrid, videoGrid ); |
1185 TN_DEBUG2( "CThumbAGProcessor::CheckAutoCreateValuesL() KAutoCreateImageList %d", ret); |
1070 rep->Get( KAutoCreateVideoList, videoList ); |
1186 ret = rep->Get( KAutoCreateImageFullscreen, imageFull ); |
1071 rep->Get( KAutoCreateVideoFullscreen, videoFull ); |
1187 TN_DEBUG2( "CThumbAGProcessor::CheckAutoCreateValuesL() KAutoCreateImageFullscreen %d", ret); |
1072 rep->Get( KAutoCreateAudioGrid, audioGrid ); |
1188 ret = rep->Get( KAutoCreateVideoGrid, videoGrid ); |
1073 rep->Get( KAutoCreateAudioList, audioList ); |
1189 TN_DEBUG2( "CThumbAGProcessor::CheckAutoCreateValuesL() KAutoCreateVideoGrid %d", ret); |
1074 rep->Get( KAutoCreateAudioFullscreen, audioFull ); |
1190 ret = rep->Get( KAutoCreateVideoList, videoList ); |
|
1191 TN_DEBUG2( "CThumbAGProcessor::CheckAutoCreateValuesL() KAutoCreateVideoList %d", ret); |
|
1192 ret = rep->Get( KAutoCreateVideoFullscreen, videoFull ); |
|
1193 TN_DEBUG2( "CThumbAGProcessor::CheckAutoCreateValuesL() KAutoCreateVideoFullscreen %d", ret); |
|
1194 ret = rep->Get( KAutoCreateAudioGrid, audioGrid ); |
|
1195 TN_DEBUG2( "CThumbAGProcessor::CheckAutoCreateValuesL() KAutoCreateAudioGrid %d", ret); |
|
1196 ret = rep->Get( KAutoCreateAudioList, audioList ); |
|
1197 TN_DEBUG2( "CThumbAGProcessor::CheckAutoCreateValuesL() KAutoCreateAudioList %d", ret); |
|
1198 ret = rep->Get( KAutoCreateAudioFullscreen, audioFull ); |
|
1199 TN_DEBUG2( "CThumbAGProcessor::CheckAutoCreateValuesL() KAutoCreateAudioFullscreen %d", ret); |
1075 |
1200 |
1076 iAutoImage = EFalse; |
1201 iAutoImage = EFalse; |
1077 iAutoVideo = EFalse; |
1202 iAutoVideo = EFalse; |
1078 iAutoAudio = EFalse; |
1203 iAutoAudio = EFalse; |
1079 |
1204 |
1171 iForceRun = aForceRun; |
1295 iForceRun = aForceRun; |
1172 } |
1296 } |
1173 } |
1297 } |
1174 |
1298 |
1175 // --------------------------------------------------------------------------- |
1299 // --------------------------------------------------------------------------- |
1176 // CThumbAGProcessor::SetFormat() |
|
1177 // --------------------------------------------------------------------------- |
|
1178 // |
|
1179 |
|
1180 void CThumbAGProcessor::SetFormat(TBool aStatus) |
|
1181 { |
|
1182 TN_DEBUG2( "CThumbAGProcessor::SetFormat(%d) - end", aStatus ); |
|
1183 |
|
1184 iFormatting = aStatus; |
|
1185 if(!aStatus) |
|
1186 { |
|
1187 ActivateAO(); |
|
1188 } |
|
1189 } |
|
1190 |
|
1191 // --------------------------------------------------------------------------- |
|
1192 // CThumbAGProcessor::QueryForPlaceholders() |
1300 // CThumbAGProcessor::QueryForPlaceholders() |
1193 // --------------------------------------------------------------------------- |
1301 // --------------------------------------------------------------------------- |
1194 // |
1302 // |
1195 |
1303 void CThumbAGProcessor::QueryAllItemsL() |
1196 void CThumbAGProcessor::QueryForPlaceholdersL() |
1304 { |
1197 { |
1305 TN_DEBUG1( "CThumbAGProcessor::QueryAllItemsL" ); |
1198 TN_DEBUG1( "CThumbAGProcessor::QueryForPlaceholders" ); |
1306 |
1199 if(iQueryForPlaceholdersActive) |
1307 CMdEObjectQuery::TState state(CMdEObjectQuery::EStateFirst); |
1200 { |
1308 |
1201 TN_DEBUG1( "CThumbAGProcessor::QueryForPlaceholders - skip" ); |
1309 if( iQueryAllItems ) |
1202 return; |
1310 { |
1203 } |
1311 state = iQueryAllItems->State(); |
1204 |
1312 |
1205 TN_DEBUG1( "CThumbAGProcessor::QueryForPlaceholders - start" ); |
1313 if(state == CMdEObjectQuery::EStateSearching ) |
1206 |
1314 { |
1207 // delete old query |
1315 TN_DEBUG1( "CThumbAGProcessor::QueryAllItemsL active- skip" ); |
1208 if (iQueryForPlaceholders) |
1316 return; |
1209 { |
1317 } |
1210 iQueryForPlaceholdersActive = EFalse; |
1318 |
1211 iQueryForPlaceholders->Cancel(); |
1319 // delete old query |
1212 delete iQueryForPlaceholders; |
1320 iQueryAllItems->Cancel(); |
1213 iQueryForPlaceholders = NULL; |
1321 delete iQueryAllItems; |
1214 } |
1322 iQueryAllItems = NULL; |
|
1323 } |
|
1324 |
|
1325 TN_DEBUG1( "CThumbAGProcessor::QueryAllItemsL - start" ); |
1215 |
1326 |
1216 CMdEObjectDef& imageObjDef = iDefNamespace->GetObjectDefL( MdeConstants::Image::KImageObject ); |
1327 CMdEObjectDef& imageObjDef = iDefNamespace->GetObjectDefL( MdeConstants::Image::KImageObject ); |
1217 CMdEObjectDef& videoObjDef = iDefNamespace->GetObjectDefL( MdeConstants::Video::KVideoObject ); |
1328 CMdEObjectDef& videoObjDef = iDefNamespace->GetObjectDefL( MdeConstants::Video::KVideoObject ); |
1218 CMdEObjectDef& audioObjDef = iDefNamespace->GetObjectDefL( MdeConstants::Audio::KAudioObject ); |
1329 CMdEObjectDef& audioObjDef = iDefNamespace->GetObjectDefL( MdeConstants::Audio::KAudioObject ); |
1219 |
1330 |
1220 CMdEObjectDef& objDef = iDefNamespace->GetObjectDefL( MdeConstants::Object::KBaseObject); |
1331 CMdEObjectDef& objDef = iDefNamespace->GetObjectDefL( MdeConstants::Object::KBaseObject); |
1221 iQueryForPlaceholders = iMdESession->NewObjectQueryL( *iDefNamespace, objDef, this ); |
1332 iQueryAllItems = iMdESession->NewObjectQueryL( *iDefNamespace, objDef, this ); |
1222 |
1333 |
1223 iQueryForPlaceholders->SetResultMode( EQueryResultModeItem ); |
1334 iQueryAllItems->SetResultMode( EQueryResultModeItem ); |
1224 |
1335 |
1225 CMdELogicCondition& rootCondition = iQueryForPlaceholders->Conditions(); |
1336 CMdELogicCondition& rootCondition = iQueryAllItems->Conditions(); |
1226 rootCondition.SetOperator( ELogicConditionOperatorOr ); |
1337 rootCondition.SetOperator( ELogicConditionOperatorOr ); |
1227 |
1338 |
1228 CMdEObjectCondition& imagePHObjectCondition = rootCondition.AddObjectConditionL(imageObjDef); |
1339 CMdEObjectCondition& imagePHObjectCondition = rootCondition.AddObjectConditionL(imageObjDef); |
1229 imagePHObjectCondition.SetPlaceholderOnly( ETrue ); |
|
1230 imagePHObjectCondition.SetNotPresent( ETrue ); |
|
1231 |
1340 |
1232 CMdEObjectCondition& videoPHObjectCondition = rootCondition.AddObjectConditionL(videoObjDef); |
1341 CMdEObjectCondition& videoPHObjectCondition = rootCondition.AddObjectConditionL(videoObjDef); |
1233 videoPHObjectCondition.SetPlaceholderOnly( ETrue ); |
|
1234 videoPHObjectCondition.SetNotPresent( ETrue ); |
|
1235 |
1342 |
1236 CMdEObjectCondition& audioPHObjectCondition = rootCondition.AddObjectConditionL(audioObjDef); |
1343 CMdEObjectCondition& audioPHObjectCondition = rootCondition.AddObjectConditionL(audioObjDef); |
1237 audioPHObjectCondition.SetPlaceholderOnly( ETrue ); |
1344 |
1238 audioPHObjectCondition.SetNotPresent( ETrue ); |
1345 iQueryAllItems->FindL(); |
1239 |
1346 |
1240 iQueryForPlaceholders->FindL(); |
1347 TN_DEBUG1( "CThumbAGProcessor::QueryAllItemsL - end" ); |
1241 |
|
1242 iQueryForPlaceholdersActive = ETrue; |
|
1243 |
|
1244 TN_DEBUG1( "CThumbAGProcessor::QueryForPlaceholders - end" ); |
|
1245 } |
1348 } |
1246 |
1349 |
1247 // ----------------------------------------------------------------------------- |
1350 // ----------------------------------------------------------------------------- |
1248 // CThumbAGProcessor::HandleCollectionMessage |
1351 // CThumbAGProcessor::HandleCollectionMessage |
1249 // From MMPXCollectionObserver |
1352 // From MMPXCollectionObserver |
1250 // Handle collection message. |
1353 // Handle collection message. |
1251 // ----------------------------------------------------------------------------- |
1354 // ----------------------------------------------------------------------------- |
1252 // |
1355 // |
1253 |
1356 void CThumbAGProcessor::HandleCollectionMessage( CMPXMessage* aMessage, TInt aError ) |
1254 void CThumbAGProcessor::HandleCollectionMessage( CMPXMessage* aMessage, |
|
1255 TInt aError ) |
|
1256 { |
1357 { |
1257 if ( aError != KErrNone || !aMessage ) |
1358 if ( aError != KErrNone || !aMessage ) |
1258 { |
1359 { |
1259 return; |
1360 return; |
1260 } |
1361 } |
1269 TInt event( *aMessage->Value<TInt>( KMPXMessageGeneralEvent ) ); |
1370 TInt event( *aMessage->Value<TInt>( KMPXMessageGeneralEvent ) ); |
1270 if ( event == TMPXCollectionMessage::EBroadcastEvent ) |
1371 if ( event == TMPXCollectionMessage::EBroadcastEvent ) |
1271 { |
1372 { |
1272 TInt op( *aMessage->Value<TInt>( KMPXMessageGeneralType ) ); |
1373 TInt op( *aMessage->Value<TInt>( KMPXMessageGeneralType ) ); |
1273 |
1374 |
1274 switch( op ) |
1375 switch( op ) |
1275 { |
1376 { |
1276 //when MTP sync or music collection is started then pause processing |
1377 //when MTP sync or music collection is started then pause processing |
1277 case EMcMsgRefreshStart: |
1378 case EMcMsgRefreshStart: |
1278 case EMcMsgUSBMTPStart: |
1379 case EMcMsgUSBMTPStart: |
1279 TN_DEBUG1("CThumbAGProcessor::HandleCollectionMessage MPX refresh started" ); |
1380 TN_DEBUG1("CThumbAGProcessor::HandleCollectionMessage MPX refresh started" ); |
1280 iMPXHarvesting = ETrue; |
1381 iMPXHarvesting = ETrue; |
1281 CancelTimeout(); |
1382 CancelTimeout(); |
1282 break; |
1383 break; |
1283 //when MTP sync or music collection refresh is complete then resume processing |
1384 //when MTP sync or music collection refresh is complete then resume processing |
1284 case EMcMsgRefreshEnd: |
1385 case EMcMsgRefreshEnd: |
1285 case EMcMsgUSBMTPEnd: |
1386 case EMcMsgUSBMTPEnd: |
1286 case EMcMsgUSBMTPNotActive: |
1387 case EMcMsgUSBMTPNotActive: |
1287 TN_DEBUG1("CThumbAGProcessor::HandleCollectionMessage MPX refresh finished/not active" ); |
1388 TN_DEBUG1("CThumbAGProcessor::HandleCollectionMessage MPX refresh finished/not active" ); |
1288 iMPXHarvesting = EFalse; |
1389 iMPXHarvesting = EFalse; |
1289 StartTimeout(); |
1390 StartTimeout(); |
1290 break; |
1391 break; |
1291 default: |
1392 default: |
1292 break; |
1393 break; |
1293 } |
1394 } |
1294 TN_DEBUG3( "CThumbAGProcessor::HandleCollectionMessage -- end() iHarvesting == %d, iMPXHarvesting == %d", iHarvesting, iMPXHarvesting); |
1395 TN_DEBUG3( "CThumbAGProcessor::HandleCollectionMessage -- end() iHarvesting == %d, iMPXHarvesting == %d", iHarvesting, iMPXHarvesting); |
1295 } |
1396 } |
1296 } |
1397 } |
1297 } |
1398 } |
|
1399 |
1298 // ----------------------------------------------------------------------------- |
1400 // ----------------------------------------------------------------------------- |
1299 // CThumbAGProcessor::HandleOpenL |
1401 // CThumbAGProcessor::HandleOpenL |
1300 // From MMPXCollectionObserver |
1402 // From MMPXCollectionObserver |
1301 // Handles the collection entries being opened. |
1403 // Handles the collection entries being opened. |
1302 // ----------------------------------------------------------------------------- |
1404 // ----------------------------------------------------------------------------- |
1303 // |
1405 // |
1304 void CThumbAGProcessor::HandleOpenL( const CMPXMedia& /*aEntries*/, |
1406 void CThumbAGProcessor::HandleOpenL( const CMPXMedia& /*aEntries*/, TInt /*aIndex*/, |
1305 TInt /*aIndex*/, |
1407 TBool /*aComplete*/, TInt /*aError*/ ) |
1306 TBool /*aComplete*/, |
|
1307 TInt /*aError*/ ) |
|
1308 { |
1408 { |
1309 // not needed here |
1409 // not needed here |
1310 } |
1410 } |
1311 |
1411 |
1312 // ----------------------------------------------------------------------------- |
1412 // ----------------------------------------------------------------------------- |