diff -r 42814f902fe6 -r 38571fd2a704 pimappservices/calendar/client/src/calattachment.cpp --- a/pimappservices/calendar/client/src/calattachment.cpp Fri Feb 19 22:49:53 2010 +0200 +++ b/pimappservices/calendar/client/src/calattachment.cpp Fri Mar 12 15:42:35 2010 +0200 @@ -554,12 +554,23 @@ */ EXPORT_C void CCalAttachmentFile::FetchFileHandleL(RFile& aFileHandle) const { - if (iAttachmentImpl->IsFileHandleSet() || ! iCalSessionImpl) - { - User::Leave(KErrArgument); - } - - iCalSessionImpl->Server().FetchFileHandleL(aFileHandle, iAttachmentImpl->Uid(), iCalSessionImpl->FileId()); + if ( iAttachmentImpl->IsFileHandleSet() ) + { + aFileHandle.Close(); + User::LeaveIfError( + aFileHandle.Duplicate( iAttachmentImpl->FileHandle() ) ); + } + else if ( iCalSessionImpl ) + { + iCalSessionImpl->Server().FetchFileHandleL( + aFileHandle, + iAttachmentImpl->Uid(), + iCalSessionImpl->FileId() ); + } + else + { + User::Leave( KErrArgument ); + } } /** Load the binary data into the attachment object to be accessed through the CCalAttachment::Value function.