harvester/common/src/harvesterexifutil.cpp
branchRCL_3
changeset 21 85f623e1ef41
parent 20 f23c07ec56e2
child 22 29d87345eaeb
equal deleted inserted replaced
20:f23c07ec56e2 21:85f623e1ef41
   431 // ---------------------------------------------------------------------------
   431 // ---------------------------------------------------------------------------
   432 //
   432 //
   433 EXPORT_C TTime CHarvesterExifUtil::ConvertExifDateTimeToSymbianTimeL(
   433 EXPORT_C TTime CHarvesterExifUtil::ConvertExifDateTimeToSymbianTimeL(
   434 		const TDesC8& aDateTime )
   434 		const TDesC8& aDateTime )
   435     {
   435     {
   436     WRITELOG( "CHarvesterExifUtil::ConvertExifDateTimeToSymbianTimeL()" );
   436     WRITELOG( "CHarvesterImagePluginAO::ConvertExifDateTimeToSymbianTimeL()" );
   437     OstTrace0( TRACE_NORMAL, CHARVESTEREXIFUTIL_CONVERTEXIFDATETIMETOSYMBIANTIMEL, "CHarvesterExifUtil::ConvertExifDateTimeToSymbianTimeL" );    
   437     OstTrace0( TRACE_NORMAL, CHARVESTEREXIFUTIL_CONVERTEXIFDATETIMETOSYMBIANTIMEL, "CHarvesterExifUtil::ConvertExifDateTimeToSymbianTimeL" );    
   438     
   438     
   439     TDateTime datetime( 0, EJanuary, 0, 0, 0, 0, 0 );
   439     TDateTime datetime( 0, EJanuary, 0, 0, 0, 0, 0 );
   440     TBuf<4> text;
   440     TBuf<4> text;
   441     
   441     
   444     TLex8 lex( textPart );
   444     TLex8 lex( textPart );
   445     TInt number = 0;
   445     TInt number = 0;
   446     TInt error = lex.Val( number );
   446     TInt error = lex.Val( number );
   447     if ( error != KErrNone )
   447     if ( error != KErrNone )
   448         {
   448         {
   449         WRITELOG( "CHarvesterExifUtil::ConvertExifDateTimeToSymbianTimeL() - couldn't get year" );
   449         WRITELOG( "CHarvesterImagePluginAO::ConvertExifDateTimeToSymbianTimeL() - couldn't get year" );
   450         OstTrace0( TRACE_NORMAL, DUP1_CHARVESTEREXIFUTIL_CONVERTEXIFDATETIMETOSYMBIANTIMEL, "CHarvesterExifUtil::ConvertExifDateTimeToSymbianTimeL - couldn't get year" );
   450         OstTrace0( TRACE_NORMAL, DUP1_CHARVESTEREXIFUTIL_CONVERTEXIFDATETIMETOSYMBIANTIMEL, "CHarvesterExifUtil::ConvertExifDateTimeToSymbianTimeL - couldn't get year" );
   451         
   451         
   452         User::Leave( error );
   452         User::Leave( error );
   453         }
   453         }
   454     datetime.SetYear( number );
   454     datetime.SetYear( number );
   457     TPtrC8 textPart2 = aDateTime.Mid( 5,2 );
   457     TPtrC8 textPart2 = aDateTime.Mid( 5,2 );
   458     lex.Assign( textPart2 );
   458     lex.Assign( textPart2 );
   459     error = lex.Val( number );
   459     error = lex.Val( number );
   460     if ( error != KErrNone )
   460     if ( error != KErrNone )
   461         {
   461         {
   462         WRITELOG( "CHarvesterExifUtil::ConvertExifDateTimeToSymbianTimeL() - couldn't get month" );
   462         WRITELOG( "CHarvesterImagePluginAO::ConvertExifDateTimeToSymbianTimeL() - couldn't get month" );
   463         OstTrace0( TRACE_NORMAL, DUP2_CHARVESTEREXIFUTIL_CONVERTEXIFDATETIMETOSYMBIANTIMEL, "CHarvesterExifUtil::ConvertExifDateTimeToSymbianTimeL - couldn't get month" );
   463         OstTrace0( TRACE_NORMAL, DUP2_CHARVESTEREXIFUTIL_CONVERTEXIFDATETIMETOSYMBIANTIMEL, "CHarvesterExifUtil::ConvertExifDateTimeToSymbianTimeL - couldn't get month" );
   464         
   464         
   465         User::Leave( error );
   465         User::Leave( error );
   466         }        
   466         }        
   467     number--;
   467     number--;
   472     TPtrC8 textPart3 = aDateTime.Mid( 8,2 );
   472     TPtrC8 textPart3 = aDateTime.Mid( 8,2 );
   473     lex.Assign( textPart3 );
   473     lex.Assign( textPart3 );
   474     error = lex.Val( number );
   474     error = lex.Val( number );
   475     if ( error != KErrNone )
   475     if ( error != KErrNone )
   476         {
   476         {
   477         WRITELOG( "CHarvesterExifUtil::ConvertExifDateTimeToSymbianTimeL() - couldn't get date" );
   477         WRITELOG( "CHarvesterImagePluginAO::ConvertExifDateTimeToSymbianTimeL() - couldn't get date" );
   478         OstTrace0( TRACE_NORMAL, DUP3_CHARVESTEREXIFUTIL_CONVERTEXIFDATETIMETOSYMBIANTIMEL, "CHarvesterExifUtil::ConvertExifDateTimeToSymbianTimeL - couldn't get date" );
   478         OstTrace0( TRACE_NORMAL, DUP3_CHARVESTEREXIFUTIL_CONVERTEXIFDATETIMETOSYMBIANTIMEL, "CHarvesterExifUtil::ConvertExifDateTimeToSymbianTimeL - couldn't get date" );
   479         
   479         
   480         User::Leave( error );
   480         User::Leave( error );
   481         }
   481         }
   482     datetime.SetDay( number - 1 );
   482     datetime.SetDay( number - 1 );
   485     TPtrC8 textPart4 = aDateTime.Mid( 11,2 );
   485     TPtrC8 textPart4 = aDateTime.Mid( 11,2 );
   486     lex.Assign( textPart4 );
   486     lex.Assign( textPart4 );
   487     error = lex.Val( number );
   487     error = lex.Val( number );
   488     if ( error != KErrNone )
   488     if ( error != KErrNone )
   489         {
   489         {
   490         WRITELOG( "CHarvesterExifUtil::ConvertExifDateTimeToSymbianTimeL() - couldn't get hours" );
   490         WRITELOG( "CHarvesterImagePluginAO::ConvertExifDateTimeToSymbianTimeL() - couldn't get hours" );
   491         OstTrace0( TRACE_NORMAL, DUP4_CHARVESTEREXIFUTIL_CONVERTEXIFDATETIMETOSYMBIANTIMEL, "CHarvesterExifUtil::ConvertExifDateTimeToSymbianTimeL - couldn't get hours" );
   491         OstTrace0( TRACE_NORMAL, DUP4_CHARVESTEREXIFUTIL_CONVERTEXIFDATETIMETOSYMBIANTIMEL, "CHarvesterExifUtil::ConvertExifDateTimeToSymbianTimeL - couldn't get hours" );
   492         
   492         
   493         User::Leave( error );
   493         User::Leave( error );
   494         }    
   494         }    
   495     datetime.SetHour( number );
   495     datetime.SetHour( number );
   498     TPtrC8 textPart5 = aDateTime.Mid( 14,2 );
   498     TPtrC8 textPart5 = aDateTime.Mid( 14,2 );
   499     lex.Assign( textPart5 );
   499     lex.Assign( textPart5 );
   500     error = lex.Val( number );
   500     error = lex.Val( number );
   501     if ( error != KErrNone )
   501     if ( error != KErrNone )
   502         {
   502         {
   503         WRITELOG( "CHarvesterExifUtil::ConvertExifDateTimeToSymbianTimeL() - couldn't get minutes" );
   503         WRITELOG( "CHarvesterImagePluginAO::ConvertExifDateTimeToSymbianTimeL() - couldn't get minutes" );
   504         OstTrace0( TRACE_NORMAL, DUP5_CHARVESTEREXIFUTIL_CONVERTEXIFDATETIMETOSYMBIANTIMEL, "CHarvesterExifUtil::ConvertExifDateTimeToSymbianTimeL - couldn't get minutes" );
   504         OstTrace0( TRACE_NORMAL, DUP5_CHARVESTEREXIFUTIL_CONVERTEXIFDATETIMETOSYMBIANTIMEL, "CHarvesterExifUtil::ConvertExifDateTimeToSymbianTimeL - couldn't get minutes" );
   505         
   505         
   506         User::Leave( error );
   506         User::Leave( error );
   507         }
   507         }
   508     datetime.SetMinute( number );
   508     datetime.SetMinute( number );
   511     TPtrC8 textPart6 = aDateTime.Mid( 17,2 );
   511     TPtrC8 textPart6 = aDateTime.Mid( 17,2 );
   512     lex.Assign( textPart6 );
   512     lex.Assign( textPart6 );
   513     error = lex.Val( number );
   513     error = lex.Val( number );
   514     if ( error != KErrNone )
   514     if ( error != KErrNone )
   515         {
   515         {
   516         WRITELOG( "CHarvesterExifUtil::ConvertExifDateTimeToSymbianTimeL() - couldn't get seconds" );
   516         WRITELOG( "CHarvesterImagePluginAO::ConvertExifDateTimeToSymbianTimeL() - couldn't get seconds" );
   517         OstTrace0( TRACE_NORMAL, DUP6_CHARVESTEREXIFUTIL_CONVERTEXIFDATETIMETOSYMBIANTIMEL, "CHarvesterExifUtil::ConvertExifDateTimeToSymbianTimeL - couldn't get seconds" );
   517         OstTrace0( TRACE_NORMAL, DUP6_CHARVESTEREXIFUTIL_CONVERTEXIFDATETIMETOSYMBIANTIMEL, "CHarvesterExifUtil::ConvertExifDateTimeToSymbianTimeL - couldn't get seconds" );
   518         
   518         
   519         User::Leave( error );
   519         User::Leave( error );
   520         }
   520         }
   521     datetime.SetSecond( number );
   521     datetime.SetSecond( number );
   827     if ( exifError != KErrNone )
   827     if ( exifError != KErrNone )
   828         {
   828         {
   829         WRITELOG( "CHarvesterExifUtil::ComposeExifData() - Image doesn't contain EXIF data" );
   829         WRITELOG( "CHarvesterExifUtil::ComposeExifData() - Image doesn't contain EXIF data" );
   830         modifyExif = CExifModify::NewL( aImagePtr, 
   830         modifyExif = CExifModify::NewL( aImagePtr, 
   831         		CExifModify::ECreate, CExifModify::ENoJpegParsing );
   831         		CExifModify::ECreate, CExifModify::ENoJpegParsing );
   832         CleanupStack::PushL( modifyExif );
       
   833         SetExifDefaultsL( aMdeObject, *modifyExif );
   832         SetExifDefaultsL( aMdeObject, *modifyExif );
   834         CleanupStack::Pop( modifyExif );
       
   835         exifChanged = ETrue;
   833         exifChanged = ETrue;
   836         }
   834         }
   837     CleanupStack::PushL( modifyExif );
   835     CleanupStack::PushL( modifyExif );
   838     const CExifRead* readExif = modifyExif->Reader();
   836     const CExifRead* readExif = modifyExif->Reader();
   839     CMdEObjectDef& imageDef = iDefaultNamespace->GetObjectDefL( Image::KImageObject );
   837     CMdEObjectDef& imageDef = iDefaultNamespace->GetObjectDefL( Image::KImageObject );