16 */ |
16 */ |
17 |
17 |
18 |
18 |
19 #include <bautils.h> |
19 #include <bautils.h> |
20 #include <e32std.h> |
20 #include <e32std.h> |
21 #include <mtp/mmtpdataproviderframework.h> |
21 |
22 #include <mtp/mmtpobjectmgr.h> |
22 #include <mtp/mmtpobjectmgr.h> |
23 #include <mtp/cmtptypeobjectproplist.h> |
23 #include <mtp/cmtptypeobjectproplist.h> |
24 #include <mtp/cmtptypestring.h> |
24 #include <mtp/cmtptypestring.h> |
25 #include <mtp/cmtptypearray.h> |
25 #include <mtp/cmtptypearray.h> |
26 #include <mtp/cmtpobjectmetadata.h> |
|
27 |
26 |
28 #include "tobjectdescription.h" |
27 #include "tobjectdescription.h" |
29 #include "cgetobjectproplist.h" |
28 #include "cgetobjectproplist.h" |
30 #include "tmmmtpdppanic.h" |
29 #include "tmmmtpdppanic.h" |
31 #include "mmmtpdplogger.h" |
30 #include "mmmtpdplogger.h" |
550 GetPropertiesL( iPropertyArray, groupCode, formatCode ); |
549 GetPropertiesL( iPropertyArray, groupCode, formatCode ); |
551 |
550 |
552 const TInt count = iPropertyArray.Count(); |
551 const TInt count = iPropertyArray.Count(); |
553 |
552 |
554 TInt err = KErrNone; |
553 TInt err = KErrNone; |
555 TBool successQuery = EFalse; |
|
556 for ( TInt i = 0; i < count; i++ ) |
554 for ( TInt i = 0; i < count; i++ ) |
557 { |
555 { |
558 err = ServiceOneObjectPropertyL( aHandle, iPropertyArray[i] ); |
556 err = ServiceOneObjectPropertyL( aHandle, iPropertyArray[i] ); |
559 if ( err == KErrNone ) |
|
560 successQuery = ETrue; |
|
561 if ( err == KErrNotSupported || err == KErrNotFound ) // Skip |
557 if ( err == KErrNotSupported || err == KErrNotFound ) // Skip |
562 err = KErrNone; |
558 err = KErrNone; |
563 if ( err != KErrNone ) |
559 if ( err != KErrNone ) |
564 break; |
560 break; |
565 } |
561 } |
566 |
|
567 // In PC Suite combined mode, a file that was found at the beginning could be deleted by PC Suite protocol |
|
568 // Need to fail it here. |
|
569 if ( successQuery == EFalse ) |
|
570 err = KErrNotFound; |
|
571 |
562 |
572 PRINT1( _L( "MM MTP <= CGetObjectPropList::ServiceGroupPropertiesL err = %d" ), err ); |
563 PRINT1( _L( "MM MTP <= CGetObjectPropList::ServiceGroupPropertiesL err = %d" ), err ); |
573 |
564 |
574 return err; |
565 return err; |
575 } |
566 } |
668 } |
659 } |
669 break; |
660 break; |
670 |
661 |
671 case EMTPObjectPropCodeName: |
662 case EMTPObjectPropCodeName: |
672 case EMTPObjectPropCodeDateAdded: |
663 case EMTPObjectPropCodeDateAdded: |
673 { |
664 case EMTPObjectPropCodeAlbumArtist: |
674 if ( ( aPropCode == EMTPObjectPropCodeName ) |
665 { |
675 || ( ( !MmMtpDpUtility::IsVideoL( iObject->DesC( CMTPObjectMetaData::ESuid ), iFramework ) ) |
666 textData = CMTPTypeString::NewLC(); // + textData |
676 && ( aPropCode == EMTPObjectPropCodeDateAdded ) ) ) |
667 |
677 { |
668 TRAP( err, iDpConfig.GetWrapperL().GetObjectMetadataValueL( aPropCode, |
678 textData = CMTPTypeString::NewLC(); // + textData |
669 *textData, |
679 |
670 *iObject ) ); |
680 TRAP( err, iDpConfig.GetWrapperL().GetObjectMetadataValueL( aPropCode, |
671 |
681 *textData, |
672 PRINT1( _L( "MM MTP <> CGetObjectPropList::ServiceOneObjectPropertyL err = %d" ), err ); |
682 *iObject ) ); |
673 |
683 |
674 iPropertyElement = &( iPropertyList->ReservePropElemL( aHandle, aPropCode ) ); |
684 PRINT1( _L( "MM MTP <> CGetObjectPropList::ServiceOneObjectPropertyL err = %d" ), err ); |
675 iPropertyElement->SetStringL( CMTPTypeObjectPropListElement::EValue, textData->StringChars() ); |
685 |
676 |
686 iPropertyElement = &(iPropertyList->ReservePropElemL( aHandle, aPropCode ) ); |
677 CleanupStack::PopAndDestroy( textData ); // - textData |
687 iPropertyElement->SetStringL( CMTPTypeObjectPropListElement::EValue, textData->StringChars() ); |
678 } |
688 |
679 break; |
689 CleanupStack::PopAndDestroy( textData ); // - textData |
|
690 break; |
|
691 } |
|
692 // Else, video DB does not support DateAdded field, use the file system date! |
|
693 // It's the same behavior with DateCreated and DateModified. |
|
694 // Fall through intentional. |
|
695 } |
|
696 |
680 |
697 case EMTPObjectPropCodeDateCreated: |
681 case EMTPObjectPropCodeDateCreated: |
698 case EMTPObjectPropCodeDateModified: |
682 case EMTPObjectPropCodeDateModified: |
699 { |
683 { |
700 TTime dataModified; |
|
701 dataModified = MmMtpDpUtility::GetObjectDateModifiedL( iFramework.Fs(), |
|
702 iObject->DesC( CMTPObjectMetaData::ESuid ) ); |
|
703 |
|
704 TBuf<KMtpMaxDateTimeStringLength> timeStr; |
684 TBuf<KMtpMaxDateTimeStringLength> timeStr; |
705 dataModified.FormatL( timeStr, KMtpDateTimeFormat ); |
685 MmMtpDpUtility::GetObjectDateModifiedL( iFramework.Fs(), |
|
686 iObject->DesC( CMTPObjectMetaData::ESuid ), |
|
687 timeStr ); |
706 PRINT1( _L( "MM MTP <> CGetObjectPropList::ServiceOneObjectPropertyL Date time %S" ), &timeStr ); |
688 PRINT1( _L( "MM MTP <> CGetObjectPropList::ServiceOneObjectPropertyL Date time %S" ), &timeStr ); |
|
689 |
707 CMTPTypeString* datastring = CMTPTypeString::NewLC( timeStr ); // + datastring |
690 CMTPTypeString* datastring = CMTPTypeString::NewLC( timeStr ); // + datastring |
708 |
691 iPropertyElement = &(iPropertyList->ReservePropElemL( aHandle, aPropCode ) ); |
709 iPropertyElement = &(iPropertyList->ReservePropElemL(aHandle, aPropCode)); |
692 iPropertyElement->SetStringL( CMTPTypeObjectPropListElement::EValue, datastring->StringChars() ); |
710 iPropertyElement->SetStringL(CMTPTypeObjectPropListElement::EValue, datastring->StringChars()); |
|
711 CleanupStack::PopAndDestroy( datastring ); // - datastring |
693 CleanupStack::PopAndDestroy( datastring ); // - datastring |
712 } |
694 } |
713 break; |
695 break; |
714 |
696 |
715 // Consumable Value |
697 // Consumable Value |