diff -r a1caeb42b3a3 -r fcdfafb36fe7 commonuis/CommonUi/src/DocDefaultHandler.cpp --- a/commonuis/CommonUi/src/DocDefaultHandler.cpp Thu Jul 15 18:56:19 2010 +0300 +++ b/commonuis/CommonUi/src/DocDefaultHandler.cpp Thu Aug 19 10:11:06 2010 +0300 @@ -106,7 +106,8 @@ iStatus( KErrNone ), iUid( aUid ), iOpenService( NULL ), - iMMCSaveAllowed ( ETrue ) + iMMCSaveAllowed ( ETrue ), + iFileHandleSet( EFalse ) { } @@ -550,6 +551,13 @@ return SetAndReturnStatus( KErrNone ); } +TInt CDocDefaultHandler::SetSrcFile( const RFile& aFile ) + { + TInt err = iFile.Duplicate( aFile ); + iFileHandleSet = ( err == KErrNone ) ? ETrue : EFalse; + return SetAndReturnStatus( KErrNone ); + } + // --------------------------------------------------------- // CDocDefaultHandler::SetDestName() // Check the name and set iDestFile. @@ -1657,43 +1665,49 @@ TBuf<6> ext; CContent* content = NULL; - TRAPD(err,content = CContent::NewL( iSourceFile )); - - if(err == KErrNone) - { - CleanupStack::PushL(content); - content->GetAttribute( ContentAccess::EIsProtected, ret ); - if ( ret ) + if( iFileHandleSet ) + { + content = CContent::NewL( iFile ); + iFile.Close(); + iFileHandleSet = EFalse; + } + else + { + content = CContent::NewL( iSourceFile ); + } + + CleanupStack::PushL(content); + content->GetAttribute( ContentAccess::EIsProtected, ret ); + if ( ret ) + { + content->GetAttribute( EFileType, ret ); + + #ifdef _DEBUG + RDebug::Print( _L("DocumentHandler: CDocDefaultHandler::CheckFileNameExtensionL: GetAttribute called, ret =%d"), ret); + #endif + + if ( ret == EOma1Dcf ) { - content->GetAttribute( EFileType, ret ); - - #ifdef _DEBUG - RDebug::Print( _L("DocumentHandler: CDocDefaultHandler::CheckFileNameExtensionL: GetAttribute called, ret =%d"), ret); - #endif - - if ( ret == EOma1Dcf ) + // change extension to .dcf + ext.Copy( KOma1DcfExtension ); + ReplaceExtension( aFileName, ext ); + CleanupStack::PopAndDestroy(); // content + return; + } + else if ( ret == EOma2Dcf ) + { + // change extension to .odf if not already .o4a, .o4v or .odf + ext.Copy( KOma2DcfExtension ); + if ( NeedsToReplaceDcf2Extension( aFileName ) ) { - // change extension to .dcf - ext.Copy( KOma1DcfExtension ); - ReplaceExtension( aFileName, ext ); - CleanupStack::PopAndDestroy(); // content - return; - } - else if ( ret == EOma2Dcf ) - { - // change extension to .odf if not already .o4a, .o4v or .odf - ext.Copy( KOma2DcfExtension ); - if ( NeedsToReplaceDcf2Extension( aFileName ) ) - { - ReplaceExtension( aFileName, ext ); - } - CleanupStack::PopAndDestroy(); // content - return; - } + ReplaceExtension( aFileName, ext ); + } + CleanupStack::PopAndDestroy(); // content + return; } - CleanupStack::PopAndDestroy(); // content } - } + CleanupStack::PopAndDestroy(); // content + } //if mime type=oma 2 dcf check extension separately if ( aDataType.Des8().FindF( KOma2DcfContentType ) != KErrNotFound )