41 aProcessor, CThumbnailServer& aServer, RFile64* aFile, TDesC8* aBuffer, |
41 aProcessor, CThumbnailServer& aServer, RFile64* aFile, TDesC8* aBuffer, |
42 const TDataType* aMimeType, CThumbnailManager::TThumbnailFlags aFlags, |
42 const TDataType* aMimeType, CThumbnailManager::TThumbnailFlags aFlags, |
43 const TSize& aSize, TDisplayMode aDisplayMode, TInt aPriority, |
43 const TSize& aSize, TDisplayMode aDisplayMode, TInt aPriority, |
44 RArray < TThumbnailPersistentSize >* aMissingSizes, const TDesC& aTargetUri, |
44 RArray < TThumbnailPersistentSize >* aMissingSizes, const TDesC& aTargetUri, |
45 TThumbnailSize aThumbnailSize, const TInt64 aModified, |
45 TThumbnailSize aThumbnailSize, const TInt64 aModified, |
46 const CThumbnailManager::TThumbnailQualityPreference aQualityPreference ): |
46 const CThumbnailManager::TThumbnailQualityPreference aQualityPreference, |
|
47 TBool aVirtualUri ): |
47 CThumbnailTask( aProcessor, aPriority ), iServer( aServer ), |
48 CThumbnailTask( aProcessor, aPriority ), iServer( aServer ), |
48 iFlags( aFlags ), iSize( aSize ), iDisplayMode( aDisplayMode ), |
49 iFlags( aFlags ), iSize( aSize ), iDisplayMode( aDisplayMode ), |
49 iMissingSizes( aMissingSizes ), iTargetUri( aTargetUri ), |
50 iMissingSizes( aMissingSizes ), iTargetUri( aTargetUri ), |
50 iThumbnailSize( aThumbnailSize ), iModified(aModified), |
51 iThumbnailSize( aThumbnailSize ), iModified(aModified), |
51 iQualityPreference( aQualityPreference ) |
52 iQualityPreference( aQualityPreference ), iVirtualUri( aVirtualUri ) |
52 { |
53 { |
53 TN_DEBUG2( "CThumbnailGenerateTask(0x%08x)::CThumbnailGenerateTask()", this); |
54 TN_DEBUG2( "CThumbnailGenerateTask(0x%08x)::CThumbnailGenerateTask()", this); |
54 |
55 |
55 if ( !aBuffer && aFile) |
56 if ( !aBuffer && aFile) |
56 { |
57 { |
123 |
125 |
124 #ifdef _DEBUG |
126 #ifdef _DEBUG |
125 aStart.UniversalTime(); |
127 aStart.UniversalTime(); |
126 #endif |
128 #endif |
127 |
129 |
128 TParsePtrC parse(iFilename); |
130 TBuf8< KMaxDataTypeLength > mimeType; |
129 TPtrC ext(parse.Ext()); |
131 |
130 TBuf8< KMaxDataTypeLength > mimeType; |
132 if ( (!iVirtualUri && iFilename.Right(KExtLength).CompareF(KNonEmbeddedArtExt) == 0) || |
131 if (ext.CompareF(KNonEmbeddedArtExt)== 0) |
133 (iVirtualUri && iTargetUri.Right(KExtLength).CompareF(KContactExt) == 0) ) // tparse panics with virtual URI |
132 { |
134 { |
133 mimeType.Copy( KImageMime ); |
135 mimeType.Copy( KImageMime ); |
134 } |
136 } |
135 else |
137 else |
136 { |
138 { |
137 mimeType = iMimeType.Des8(); |
139 mimeType = iMimeType.Des8(); |
138 } |
140 } |
139 iProvider = iServer.ResolveProviderL(mimeType); |
141 iProvider = iServer.ResolveProviderL(mimeType); |
140 |
142 |
141 TN_DEBUG3( "CThumbnailGenerateTask(0x%08x) -- provider UID 0x%08x", this, |
143 TN_DEBUG3( "CThumbnailGenerateTask(0x%08x) -- provider UID 0x%08x", this, iProvider->Uid()); |
142 iProvider->Uid()); |
|
143 |
144 |
144 __ASSERT_DEBUG(( iProvider ), ThumbnailPanic( EThumbnailNullPointer )); |
145 __ASSERT_DEBUG(( iProvider ), ThumbnailPanic( EThumbnailNullPointer )); |
145 |
146 |
146 iProvider->CancelGetThumbnail(); |
147 iProvider->CancelGetThumbnail(); |
147 iProvider->Reset(); |
148 iProvider->Reset(); |
326 CleanupStack::Pop( aBitmap ); |
328 CleanupStack::Pop( aBitmap ); |
327 |
329 |
328 // compTask is the scale task which returns the bitmap to the client |
330 // compTask is the scale task which returns the bitmap to the client |
329 CThumbnailScaleTask* complTask = NULL; |
331 CThumbnailScaleTask* complTask = NULL; |
330 |
332 |
|
333 TInt err1 = KErrNone; |
|
334 TInt err2 = KErrNone; |
|
335 TBool isPublic = ETrue; |
|
336 TBool isPublic2 = ETrue; |
|
337 |
|
338 if(iFilename != KNullDesC) |
|
339 { |
|
340 TRAP(err1, iServer.StoreForPathL(iFilename)); |
|
341 |
|
342 isPublic = iServer.IsPublicPath( iFilename ); |
|
343 } |
|
344 if(iTargetUri != KNullDesC ) |
|
345 { |
|
346 TRAP(err2, iServer.StoreForPathL(iTargetUri)); |
|
347 |
|
348 isPublic2 = iServer.IsPublicPath( iTargetUri ); |
|
349 } |
|
350 |
|
351 // check if need to create more than one scale task |
331 if ( iMissingSizes ) |
352 if ( iMissingSizes ) |
332 { |
353 { |
333 const TInt count = iMissingSizes->Count(); |
354 const TInt count = iMissingSizes->Count(); |
334 |
355 |
335 for ( TInt i( 0 ); i < count; i++ ) |
356 for ( TInt i( 0 ); i < count; i++ ) |
357 } |
378 } |
358 |
379 |
359 CThumbnailScaleTask* complTask = CThumbnailScaleTask::NewL( iProcessor, iServer, iFilename, |
380 CThumbnailScaleTask* complTask = CThumbnailScaleTask::NewL( iProcessor, iServer, iFilename, |
360 aBitmap, iOriginalSize, (*iMissingSizes)[ i ].iSize, (*iMissingSizes)[ i ].iCrop, iDisplayMode, |
381 aBitmap, iOriginalSize, (*iMissingSizes)[ i ].iSize, (*iMissingSizes)[ i ].iCrop, iDisplayMode, |
361 KMaxPriority, iTargetUri, (*iMissingSizes)[ i ].iType, iModified, iScaledBitmapToPool, iEXIF, |
382 KMaxPriority, iTargetUri, (*iMissingSizes)[ i ].iType, iModified, iScaledBitmapToPool, iEXIF, |
362 iRequestId); |
383 iRequestId, iVirtualUri); |
363 CleanupStack::PushL( complTask ); |
384 CleanupStack::PushL( complTask ); |
364 |
385 |
365 TInt err1 = KErrNone; |
|
366 TInt err2 = KErrNone; |
|
367 |
|
368 if(iFilename != KNullDesC) |
|
369 { |
|
370 TRAP(err1, iServer.StoreForPathL(iFilename)); |
|
371 } |
|
372 |
|
373 if(iTargetUri != KNullDesC ) |
|
374 { |
|
375 TRAP(err2, iServer.StoreForPathL(iTargetUri)); |
|
376 } |
|
377 // if trying to access Z drive, don't try to store |
386 // if trying to access Z drive, don't try to store |
378 // don't want to store custom sizes |
387 // don't want to store custom sizes |
379 if( err1 == KErrAccessDenied || err2 == KErrAccessDenied || |
388 // don't store if from private directory |
380 (*iMissingSizes)[ i ].iType == ECustomThumbnailSize || |
389 if( !isPublic || !isPublic2 || |
381 (*iMissingSizes)[ i ].iType == EUnknownThumbnailSize ) |
390 err1 == KErrAccessDenied || err2 == KErrAccessDenied || |
|
391 (*iMissingSizes)[ i ].iType == ECustomThumbnailSize || |
|
392 (*iMissingSizes)[ i ].iType == EUnknownThumbnailSize ) |
382 { |
393 { |
383 complTask->SetDoStore( EFalse ); |
394 complTask->SetDoStore( EFalse ); |
384 TN_DEBUG2( "CThumbnailGenerateTask(0x%08x)::CreateScaleTasksL() - do not store", this ); |
395 TN_DEBUG2( "CThumbnailGenerateTask(0x%08x)::CreateScaleTasksL() - do not store", this ); |
385 } |
396 } |
386 else |
397 else |
387 { |
398 { |
388 if(iFilename != KNullDesC) |
399 complTask->SetDoStore( ETrue ); |
389 { |
|
390 complTask->SetDoStore(iServer.IsPublicPath( iFilename )); |
|
391 } |
|
392 |
|
393 if(iTargetUri != KNullDesC) |
|
394 { |
|
395 complTask->SetDoStore(iServer.IsPublicPath( iTargetUri )); |
|
396 } |
|
397 } |
400 } |
398 |
401 |
399 iProcessor.AddTaskL( complTask ); |
402 iProcessor.AddTaskL( complTask ); |
400 CleanupStack::Pop( complTask ); |
403 CleanupStack::Pop( complTask ); |
401 |
404 |
424 } |
427 } |
425 |
428 |
426 complTask = CThumbnailScaleTask::NewL( iProcessor, iServer, iFilename, |
429 complTask = CThumbnailScaleTask::NewL( iProcessor, iServer, iFilename, |
427 aBitmap, iOriginalSize, iSize, iFlags& CThumbnailManager |
430 aBitmap, iOriginalSize, iSize, iFlags& CThumbnailManager |
428 ::ECropToAspectRatio, iDisplayMode, KMaxPriority, iTargetUri, |
431 ::ECropToAspectRatio, iDisplayMode, KMaxPriority, iTargetUri, |
429 iThumbnailSize, iModified, iScaledBitmapToPool, iEXIF, iRequestId ); |
432 iThumbnailSize, iModified, iScaledBitmapToPool, iEXIF, iRequestId, |
|
433 iVirtualUri); |
430 CleanupStack::PushL( complTask ); |
434 CleanupStack::PushL( complTask ); |
431 |
435 |
432 TInt err1 = KErrNone; |
|
433 TInt err2 = KErrNone; |
|
434 if(iFilename != KNullDesC) |
|
435 { |
|
436 TRAP(err1, iServer.StoreForPathL(iFilename)); |
|
437 } |
|
438 if(iTargetUri != KNullDesC) |
|
439 { |
|
440 TRAP(err2, iServer.StoreForPathL(iTargetUri)); |
|
441 } |
|
442 // if trying to access Z drive, don't try to store |
436 // if trying to access Z drive, don't try to store |
443 // don't want to store custom sizes |
437 // don't want to store custom sizes |
444 if( err1 == KErrAccessDenied || err2 == KErrAccessDenied || |
438 if( !isPublic || !isPublic2 || |
|
439 err1 == KErrAccessDenied || err2 == KErrAccessDenied || |
445 iThumbnailSize == ECustomThumbnailSize || |
440 iThumbnailSize == ECustomThumbnailSize || |
446 iThumbnailSize == EUnknownThumbnailSize ) |
441 iThumbnailSize == EUnknownThumbnailSize ) |
447 { |
442 { |
448 complTask->SetDoStore( EFalse ); |
443 complTask->SetDoStore( EFalse ); |
449 TN_DEBUG2( "CThumbnailGenerateTask(0x%08x)::CreateScaleTasksL() - do not store", this ); |
444 TN_DEBUG2( "CThumbnailGenerateTask(0x%08x)::CreateScaleTasksL() - do not store", this ); |
450 } |
445 } |
451 else |
446 else |
452 { |
447 { |
453 if(iFilename != KNullDesC) |
448 complTask->SetDoStore( ETrue ); |
454 { |
|
455 complTask->SetDoStore(iServer.IsPublicPath( iFilename )); |
|
456 } |
|
457 |
|
458 if(iTargetUri != KNullDesC) |
|
459 { |
|
460 complTask->SetDoStore(iServer.IsPublicPath( iTargetUri )); |
|
461 } |
|
462 } |
449 } |
463 |
450 |
464 iProcessor.AddTaskL( complTask ); |
451 iProcessor.AddTaskL( complTask ); |
465 CleanupStack::Pop( complTask ); |
452 CleanupStack::Pop( complTask ); |
466 |
453 |
504 // of requested size only meaningful. |
491 // of requested size only meaningful. |
505 |
492 |
506 if(iFilename != KNullDesC) |
493 if(iFilename != KNullDesC) |
507 { |
494 { |
508 iServer.StoreForPathL( iFilename )->StoreThumbnailL( |
495 iServer.StoreForPathL( iFilename )->StoreThumbnailL( |
509 iFilename, tempBitmap, aOriginalSize, EFalse, iThumbnailSize, iModified, EFalse, ETrue ); |
496 iFilename, tempBitmap, aOriginalSize, EFalse, iThumbnailSize, iModified, !iVirtualUri, ETrue ); |
510 //remove result from fetched checker |
497 //remove result from fetched checker |
511 iServer.FetchedChecker().SetFetchResult( iFilename, KErrNone ); |
498 iServer.FetchedChecker().SetFetchResult( iFilename, iThumbnailSize, KErrNone ); |
512 } |
499 } |
513 else if(iTargetUri != KNullDesC) |
500 else if(iTargetUri != KNullDesC) |
514 { |
501 { |
515 iServer.StoreForPathL( iTargetUri )->StoreThumbnailL( |
502 iServer.StoreForPathL( iTargetUri )->StoreThumbnailL( |
516 iTargetUri, tempBitmap, aOriginalSize, EFalse, iThumbnailSize, iModified, EFalse, ETrue ); |
503 iTargetUri, tempBitmap, aOriginalSize, EFalse, iThumbnailSize, iModified, !iVirtualUri, ETrue ); |
517 //remove result from fetched checker |
504 //remove result from fetched checker |
518 iServer.FetchedChecker().SetFetchResult( iTargetUri, KErrNone ); |
505 iServer.FetchedChecker().SetFetchResult( iTargetUri, iThumbnailSize, KErrNone ); |
519 } |
506 } |
520 |
507 |
521 CleanupStack::PopAndDestroy( tempBitmap ); |
508 CleanupStack::PopAndDestroy( tempBitmap ); |
522 } |
509 } |
523 |
510 |