mmappcomponents/mmmtpdataprovider/src/cmmmtpdpmetadatavideoaccess.cpp
branchRCL_3
changeset 14 05b0d2323768
parent 4 d45095c2f4f3
child 17 780c925249c1
equal deleted inserted replaced
9:bee149131e4b 14:05b0d2323768
    36 #include "cmmmtpdpmetadatavideoaccess.h"
    36 #include "cmmmtpdpmetadatavideoaccess.h"
    37 #include "mmmtpdplogger.h"
    37 #include "mmmtpdplogger.h"
    38 #include "mmmtpdputility.h"
    38 #include "mmmtpdputility.h"
    39 #include "tmmmtpdppanic.h"
    39 #include "tmmmtpdppanic.h"
    40 #include "mmmtpvideodbdefs.h"
    40 #include "mmmtpvideodbdefs.h"
    41 
    41 #include "tobjectdescription.h"
    42 static const TInt KMtpMaxStringLength = 255;
    42 
    43 static const TInt KMtpMaxDescriptionLength = 0x200;
       
    44 const TInt KStorageRootMaxLength = 10;
    43 const TInt KStorageRootMaxLength = 10;
    45 
    44 
    46 #ifdef _DEBUG
    45 #ifdef _DEBUG
    47 static const TInt KMtpMaxStringDescLength = KMtpMaxStringLength - 1;
    46 static const TInt KMtpMaxStringDescLength = KMtpMaxStringLength - 1;
    48 #endif
    47 #endif
  1085     if ( !IsDatabaseOpened() )
  1084     if ( !IsDatabaseOpened() )
  1086         OpenDatabaseL();
  1085         OpenDatabaseL();
  1087 
  1086 
  1088     // Get file path
  1087     // Get file path
  1089     TPtrC suid( aObjectMetaData.DesC( CMTPObjectMetaData::ESuid ) );
  1088     TPtrC suid( aObjectMetaData.DesC( CMTPObjectMetaData::ESuid ) );
  1090     TParsePtrC parse( suid );
       
  1091     SetRecordL( suid, ERecordWrite );
  1089     SetRecordL( suid, ERecordWrite );
  1092     TRAPD( err, SetMetadataL( aPropCode, aNewData ) );
  1090     SetMetadataL( aPropCode, aNewData );
  1093 
       
  1094     if ( err < KErrNone ) // EPOC error condition
       
  1095         {
       
  1096         PRINT1( _L( "MM MTP <> Metadata write failed, with error %d" ), err );
       
  1097         SetRecordL( suid, EFailedWrite );
       
  1098         }
       
  1099 
       
  1100     if ( err != KErrNone )
       
  1101         User::Leave( err );
       
  1102 
  1091 
  1103     PRINT( _L( "MM MTP <= CMmMtpDpMetadataVideoAccess::SetObjectMetadataValueL" ) );
  1092     PRINT( _L( "MM MTP <= CMmMtpDpMetadataVideoAccess::SetObjectMetadataValueL" ) );
  1104     }
  1093     }
  1105 
  1094 
  1106 // ---------------------------------------------------------------------------
  1095 // ---------------------------------------------------------------------------
  1148             // WriteMusicIdsL(*longString);
  1137             // WriteMusicIdsL(*longString);
  1149 #else
  1138 #else
  1150             desData = CMTPTypeArray::NewLC( EMTPTypeAUINT16 ); // + desData
  1139             desData = CMTPTypeArray::NewLC( EMTPTypeAUINT16 ); // + desData
  1151             MMTPType::CopyL( aNewData, *desData );
  1140             MMTPType::CopyL( aNewData, *desData );
  1152             TUint length = desData->NumElements();
  1141             TUint length = desData->NumElements();
  1153             PRINT1( _L( "MM MTP <> CMmMtpDpMetadataVideoAccess::SetMetadataL length = %d" ), length );
  1142             PRINT1( _L( "MM MTP <> CMmMtpDpMetadataMpxAccess::SetMetadataValueL length = %d" ),
       
  1143                 length );
  1154             if ( length != 0 )
  1144             if ( length != 0 )
  1155                 {
  1145                 {
  1156                 TBuf<KMtpMaxDescriptionLength> text;
  1146                 length = ( length < KMTPMaxDescriptionLen ) ? length : KMTPMaxDescriptionLen;
  1157                 text.Zero();
  1147                 HBufC* text = HBufC::NewLC( length );    // + text
       
  1148                 TPtr ptr = text->Des();
       
  1149 
  1158                 for ( TUint i = 0; i < length; i++ )
  1150                 for ( TUint i = 0; i < length; i++ )
  1159                     {
  1151                     ptr.Append( desData->ElementUint( i ) );
  1160                     text.Append( desData->ElementUint( i ) );
  1152                 PRINT1( _L( "MM MTP <> CMmMtpDpMetadataMpxAccess::SetMetadataValueL text = %S" ),
  1161                     }
  1153                     text );
  1162                 PRINT1( _L( "MM MTP <> CMmMtpDpMetadataVideoAccess::SetMetadataL text = %S" ),
  1154 
  1163                     &text );
  1155                 WriteLongTextL( KMtpVideoComment, *text );
  1164                 WriteLongTextL( KMtpVideoComment, text );
  1156                 CleanupStack::PopAndDestroy( text );    // - text
  1165                 }
  1157                 }
  1166             else
  1158             else
  1167                 {
  1159                 {
  1168                 WriteLongTextL( KMtpVideoComment, KEmptyText );
  1160                 WriteLongTextL( KMtpVideoComment, KEmptyText );
  1169                 }
  1161                 }
  1531 void CMmMtpDpMetadataVideoAccess::SetStorageRootL( const TDesC& aStorageRoot )
  1523 void CMmMtpDpMetadataVideoAccess::SetStorageRootL( const TDesC& aStorageRoot )
  1532     {
  1524     {
  1533     PRINT1( _L( "MM MTP => CMmMtpDpMetadataVideoAccess::SetStorageRoot aStoreRoot = %S" ), &aStorageRoot );
  1525     PRINT1( _L( "MM MTP => CMmMtpDpMetadataVideoAccess::SetStorageRoot aStoreRoot = %S" ), &aStorageRoot );
  1534 
  1526 
  1535     // get the drive number
  1527     // get the drive number
  1536     TParse pathParser;
  1528     TParsePtrC pathParser( aStorageRoot );
  1537     User::LeaveIfError( pathParser.Set( aStorageRoot, NULL, NULL ) );
       
  1538     TChar driveChar( pathParser.Drive()[0] );
  1529     TChar driveChar( pathParser.Drive()[0] );
  1539 
  1530 
  1540     User::LeaveIfError( RFs::CharToDrive( driveChar, iStoreNum ) );
  1531     User::LeaveIfError( RFs::CharToDrive( driveChar, iStoreNum ) );
  1541     PRINT1( _L( "MM MTP <= CMmMtpDpMetadataVideoAccess::SetStorageRoot drive number = %d" ), iStoreNum );
  1532     PRINT1( _L( "MM MTP <= CMmMtpDpMetadataVideoAccess::SetStorageRoot drive number = %d" ), iStoreNum );
  1542     }
  1533     }