harvester/harvesterplugins/ImagePlugin/src/harvesterimageplugin.cpp
branchRCL_3
changeset 9 82c0024438c8
parent 7 3cebc1a84278
child 13 4a4892eec172
equal deleted inserted replaced
8:50de4d668bb6 9:82c0024438c8
   383         CMdEObjectDef& objectDef = *aFileData.iImageDef;
   383         CMdEObjectDef& objectDef = *aFileData.iImageDef;
   384         
   384         
   385         if( !iPropDefs )
   385         if( !iPropDefs )
   386         	{
   386         	{
   387         	iPropDefs = CHarvesterImagePluginPropertyDefs::NewL( objectDef );
   387         	iPropDefs = CHarvesterImagePluginPropertyDefs::NewL( objectDef );
       
   388         	// Prefetch max text lengt for validity checking
       
   389         	iMaxTextLength = iPropDefs->iCopyrightPropertyDef->MaxTextLengthL();
   388         	}
   390         	}
   389         
   391         
   390         aMetadataObject.Property( *iPropDefs->iSizePropertyDef, prop );
   392         aMetadataObject.Property( *iPropDefs->iSizePropertyDef, prop );
   391         if( prop )
   393         if( prop )
   392             {
   394             {
   677     CMdEObject& mdeObject = aHarvesterData.MdeObject();
   679     CMdEObject& mdeObject = aHarvesterData.MdeObject();
   678     
   680     
   679     if( !iPropDefs )
   681     if( !iPropDefs )
   680     	{
   682     	{
   681     	iPropDefs = CHarvesterImagePluginPropertyDefs::NewL( mdeObject.Def() );
   683     	iPropDefs = CHarvesterImagePluginPropertyDefs::NewL( mdeObject.Def() );
       
   684     	// Prefetch max text lengt for validity checking
       
   685     	iMaxTextLength = iPropDefs->iCopyrightPropertyDef->MaxTextLengthL();
   682     	}
   686     	}
   683 
   687 
   684     TTimeIntervalSeconds timeOffsetSeconds = User::UTCOffset();
   688     TTimeIntervalSeconds timeOffsetSeconds = User::UTCOffset();
   685 
   689 
   686     TTime localModifiedDate = aFileData.iModified + timeOffsetSeconds;
   690     TTime localModifiedDate = aFileData.iModified + timeOffsetSeconds;
   773 
   777 
   774     // If is jpeg write EXIF data
   778     // If is jpeg write EXIF data
   775     if ( aFileData.iExifSupported )
   779     if ( aFileData.iExifSupported )
   776         {
   780         {
   777        	// MediaObject - Description
   781        	// MediaObject - Description
   778        	CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iDescriptionPropertyDef, aHd.iDescription16, aIsAdd );
   782         if( aHd.iDescription16 && aHd.iDescription16->Length() < iMaxTextLength )
       
   783             {
       
   784             CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iDescriptionPropertyDef, aHd.iDescription16, aIsAdd );
       
   785             }     	
   779 
   786 
   780         // MediaObject - Comment (user comment)
   787         // MediaObject - Comment (user comment)
   781     	CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iCommentPropertyDef, aHd.iComment16, aIsAdd );
   788         if( aHd.iComment16 && aHd.iComment16->Length() < iMaxTextLength )
       
   789             {
       
   790             CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iCommentPropertyDef, aHd.iComment16, aIsAdd );
       
   791             }
   782         
   792         
   783         // MediaObject - Release date
   793         // MediaObject - Release date
   784     	CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iReleaseDatePropertyDef, &localModifiedDate, aIsAdd );
   794     	CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iReleaseDatePropertyDef, &localModifiedDate, aIsAdd );
   785 
   795 
   786         // MediaObject - Copyright
   796         // MediaObject - Copyright
   787     	CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iCopyrightPropertyDef, aHd.iCopyright16, aIsAdd );
   797         if( aHd.iCopyright16 && aHd.iCopyright16->Length() < iMaxTextLength )
       
   798             {
       
   799             CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iCopyrightPropertyDef, aHd.iCopyright16, aIsAdd );
       
   800             }
   788         
   801         
   789         // Data & time original
   802         // Data & time original
   790         if ( aHd.iDateOriginal8 )
   803         if ( aHd.iDateOriginal8 )
   791             {
   804             {
   792             TTime originalTime = iExifUtil->ConvertExifDateTimeToSymbianTimeL( aHd.iDateOriginal8->Des() );
   805             TTime originalTime = iExifUtil->ConvertExifDateTimeToSymbianTimeL( aHd.iDateOriginal8->Des() );
   816             		aHd.iDateModified8->Des() );
   829             		aHd.iDateModified8->Des() );
   817             CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iDateTimePropertyDef, &modifiedTime, aIsAdd );
   830             CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iDateTimePropertyDef, &modifiedTime, aIsAdd );
   818             }
   831             }
   819         
   832         
   820         // Artist    
   833         // Artist    
   821         CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iArtistPropertyDef, aHd.iArtist, aIsAdd );
   834         if( aHd.iArtist && aHd.iArtist->Length() < iMaxTextLength )
       
   835             {
       
   836             CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iArtistPropertyDef, aHd.iArtist, aIsAdd );
       
   837             }
   822 
   838 
   823         // Image - White balance
   839         // Image - White balance
   824         if ( aHd.iStoreWhiteBalance )
   840         if ( aHd.iStoreWhiteBalance )
   825             {
   841             {
   826             CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iWhiteBalancePropertyDef, &aHd.iWhiteBalance, aIsAdd );
   842             CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iWhiteBalancePropertyDef, &aHd.iWhiteBalance, aIsAdd );
   836         if ( aHd.iStoreExposureProgram )
   852         if ( aHd.iStoreExposureProgram )
   837             {
   853             {
   838             CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iExposureProgramPropertyDef, &aHd.iExposureProgram, aIsAdd );
   854             CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iExposureProgramPropertyDef, &aHd.iExposureProgram, aIsAdd );
   839             }     
   855             }     
   840          
   856          
   841          // Make string            
   857          // Make string   
   842         CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iMakePropertyDef, aHd.iMake, aIsAdd );
   858         if( aHd.iMake && aHd.iMake->Length() < iMaxTextLength )
       
   859             {
       
   860             CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iMakePropertyDef, aHd.iMake, aIsAdd );
       
   861             }
   843             
   862             
   844         // Model string
   863         // Model string
   845         CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iModelPropertyDef, aHd.iModel, aIsAdd );
   864         if( aHd.iModel && aHd.iModel->Length() < iMaxTextLength )
       
   865             {
       
   866             CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iModelPropertyDef, aHd.iModel, aIsAdd );
       
   867             }
   846                     
   868                     
   847         // Orientation
   869         // Orientation
   848         if ( aHd.iStoreOrientation )
   870         if ( aHd.iStoreOrientation )
   849             {
   871             {
   850             CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iOrientationPropertyDef, &aHd.iOrientation, aIsAdd );
   872             CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iOrientationPropertyDef, &aHd.iOrientation, aIsAdd );
   978             {
  1000             {
   979             CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iMeteringModePropertyDef, &aHd.iMeteringMode, aIsAdd );
  1001             CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iMeteringModePropertyDef, &aHd.iMeteringMode, aIsAdd );
   980             }
  1002             }
   981             
  1003             
   982         // Related soundfile            
  1004         // Related soundfile            
   983         if ( aHd.iRelatedSoundFile && aHd.iRelatedSoundFile->Length() > 0 )
  1005         if ( aHd.iRelatedSoundFile && aHd.iRelatedSoundFile->Length() > 0 && aHd.iRelatedSoundFile->Length() < iMaxTextLength )
   984             {
  1006             {
   985             CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iRelatedSoundFilePropertyDef, aHd.iRelatedSoundFile, aIsAdd );
  1007             CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iRelatedSoundFilePropertyDef, aHd.iRelatedSoundFile, aIsAdd );
   986             }
  1008             }
   987         
  1009         
   988         // Focal plane resolution unit
  1010         // Focal plane resolution unit