401 break; |
401 break; |
402 case EMTPObjectPropCodeRepresentativeSampleFormat: |
402 case EMTPObjectPropCodeRepresentativeSampleFormat: |
403 aValue = KThumbFormatCode; |
403 aValue = KThumbFormatCode; |
404 break; |
404 break; |
405 case EMTPObjectPropCodeProtectionStatus: |
405 case EMTPObjectPropCodeProtectionStatus: |
406 iFs.Entry(iObjectInfo->DesC(CMTPObjectMetaData::ESuid), entry); |
406 { |
407 if (entry.IsReadOnly()) |
407 TInt err = iFs.Entry(iObjectInfo->DesC(CMTPObjectMetaData::ESuid), entry); |
|
408 if ( err == KErrNone && entry.IsReadOnly()) |
408 { |
409 { |
409 aValue = EMTPProtectionReadOnly; |
410 aValue = EMTPProtectionReadOnly; |
410 } |
411 } |
411 else |
412 else |
412 { |
413 { |
413 aValue = EMTPProtectionNoProtection; |
414 aValue = EMTPProtectionNoProtection; |
414 } |
415 } |
415 break; |
416 } |
|
417 break; |
416 default: |
418 default: |
417 aValue = 0;//initialization |
419 aValue = 0;//initialization |
418 //ingore the failure if we can't get properties form MdS |
420 //ingore the failure if we can't get properties form MdS |
419 TRAP_IGNORE(GetPropertyFromMdsL(aProperty, &aValue)); |
421 TRAP_IGNORE(GetPropertyFromMdsL(aProperty, &aValue)); |
420 break; |
422 break; |
435 |
437 |
436 case EMTPObjectPropCodeParentObject: |
438 case EMTPObjectPropCodeParentObject: |
437 aValue = iObjectInfo->Uint(CMTPObjectMetaData::EParentHandle); |
439 aValue = iObjectInfo->Uint(CMTPObjectMetaData::EParentHandle); |
438 break; |
440 break; |
439 |
441 |
440 case EMTPObjectPropCodeRepresentativeSampleSize: |
442 case EMTPObjectPropCodeRepresentativeSampleSize: |
441 aValue = MTPImageDpUtilits::GetThumbnailSize(*iObjectInfo); |
443 { |
442 if (aValue == 0) |
444 __FLOG_VA((_L16("Query smaple size from MdS - URI:%S"), &iObjectInfo->DesC(CMTPObjectMetaData::ESuid))); |
443 { |
445 ClearThumnailCache(); |
444 __FLOG_VA((_L16("Query smaple size from MdS - URI:%S"), &iObjectInfo->DesC(CMTPObjectMetaData::ESuid))); |
446 /** |
445 ClearThumnailCache(); |
447 * try to query thumbnail from TNM, and then store thumbnail to cache |
|
448 */ |
|
449 TEntry fileEntry; |
|
450 TInt err = iFs.Entry(iObjectInfo->DesC(CMTPObjectMetaData::ESuid), fileEntry); |
|
451 if (err == KErrNone) |
|
452 { |
|
453 if(fileEntry.FileSize() > KFileSizeMax || !alwaysCreate) |
|
454 { |
|
455 iDataProvider.ThumbnailManager().GetThumbMgr()->SetFlagsL(CThumbnailManager::EDoNotCreate); |
|
456 } |
|
457 else |
|
458 { |
|
459 iDataProvider.ThumbnailManager().GetThumbMgr()->SetFlagsL(CThumbnailManager::EDefaultFlags); |
|
460 } |
|
461 |
446 /** |
462 /** |
447 * try to query thumbnail from TNM, and then store thumbnail to cache |
463 * trap the leave to avoid return general error when PC get object property list |
448 */ |
464 */ |
449 TEntry fileEntry; |
465 TRAP(err, iDataProvider.ThumbnailManager().GetThumbnailL(iObjectInfo->DesC(CMTPObjectMetaData::ESuid), iThumbnailCache.iThumbnailData, err)); |
450 TInt err = iFs.Entry(iObjectInfo->DesC(CMTPObjectMetaData::ESuid), fileEntry); |
|
451 if (err == KErrNone) |
466 if (err == KErrNone) |
452 { |
467 { |
453 if(fileEntry.FileSize() > KFileSizeMax || !alwaysCreate) |
468 iThumbnailCache.iObjectHandle = iObjectInfo->Uint(CMTPObjectMetaData::EHandle); |
454 { |
469 if (iThumbnailCache.iThumbnailData != NULL) |
455 iDataProvider.ThumbnailManager().GetThumbMgr()->SetFlagsL(CThumbnailManager::EDoNotCreate); |
470 { |
456 } |
471 aValue = static_cast<TUint32>(iThumbnailCache.iThumbnailData->Size()); |
457 else |
472 } |
458 { |
473 |
459 iDataProvider.ThumbnailManager().GetThumbMgr()->SetFlagsL(CThumbnailManager::EDefaultFlags); |
474 if (aValue <= 0) |
460 } |
475 { |
461 |
476 //trigger initiator to re-query thumbnail again if the thumbnail size of response is zero |
462 /** |
477 aValue = KThumbCompressedSize; |
463 * trap the leave to avoid return general error when PC get object property list |
478 } |
464 */ |
479 } |
465 TRAP(err, iDataProvider.ThumbnailManager().GetThumbnailL(iObjectInfo->DesC(CMTPObjectMetaData::ESuid), iThumbnailCache.iThumbnailData, err)); |
480 } |
466 if (err == KErrNone) |
481 } |
467 { |
|
468 iThumbnailCache.iObjectHandle = iObjectInfo->Uint(CMTPObjectMetaData::EHandle); |
|
469 if (iThumbnailCache.iThumbnailData != NULL) |
|
470 { |
|
471 aValue = static_cast<TUint32>(iThumbnailCache.iThumbnailData->Size()); |
|
472 } |
|
473 |
|
474 if (aValue > 0) |
|
475 { |
|
476 //update metadata column |
|
477 MTPImageDpUtilits::UpdateObjectThumbnailSizeL(iFramework, *iObjectInfo, aValue); |
|
478 } |
|
479 else |
|
480 { |
|
481 //trigger initiator to re-query thumbnail again if the thumbnail size of response is zero |
|
482 aValue = KThumbCompressedSize; |
|
483 } |
|
484 |
|
485 __FLOG_VA((_L16("Cache miss:GetThumbnailSize - URI:%S, Size:%u"), &iObjectInfo->DesC(CMTPObjectMetaData::ESuid), aValue)); |
|
486 } |
|
487 } |
|
488 } |
|
489 break; |
482 break; |
490 |
483 |
491 case EMTPObjectPropCodeRepresentativeSampleHeight: |
484 case EMTPObjectPropCodeRepresentativeSampleHeight: |
492 aValue = KThumbHeigth; |
485 aValue = KThumbHeigth; |
493 break; |
486 break; |
616 * trap the leave to avoid return general error when PC get object property list |
609 * trap the leave to avoid return general error when PC get object property list |
617 */ |
610 */ |
618 TRAP(err, iDataProvider.ThumbnailManager().GetThumbnailL(iObjectInfo->DesC(CMTPObjectMetaData::ESuid), iThumbnailCache.iThumbnailData, err)); |
611 TRAP(err, iDataProvider.ThumbnailManager().GetThumbnailL(iObjectInfo->DesC(CMTPObjectMetaData::ESuid), iThumbnailCache.iThumbnailData, err)); |
619 if (err == KErrNone) |
612 if (err == KErrNone) |
620 { |
613 { |
621 TInt size = MTPImageDpUtilits::GetThumbnailSize(*iObjectInfo); |
|
622 iThumbnailCache.iObjectHandle = iObjectInfo->Uint(CMTPObjectMetaData::EHandle); |
614 iThumbnailCache.iObjectHandle = iObjectInfo->Uint(CMTPObjectMetaData::EHandle); |
623 if (iThumbnailCache.iThumbnailData != NULL) |
615 if (iThumbnailCache.iThumbnailData != NULL) |
624 { |
616 { |
625 aValue.SetByDesL(*iThumbnailCache.iThumbnailData); |
617 aValue.SetByDesL(*iThumbnailCache.iThumbnailData); |
626 if (size == 0) |
|
627 { |
|
628 //update metadata column |
|
629 MTPImageDpUtilits::UpdateObjectThumbnailSizeL(iFramework, *iObjectInfo, iThumbnailCache.iThumbnailData->Size()); |
|
630 __FLOG_VA((_L16("Cache miss:GetThumbnailSize - URI:%S, Size:%u"), &iObjectInfo->DesC(CMTPObjectMetaData::ESuid), size)); |
|
631 } |
|
632 } |
618 } |
633 } |
619 } |
634 } |
620 } |
635 } |
621 } |
636 } |
622 } |