diff -r 360d55486d7f -r 5de72ea7a065 pimappservices/calendar/client/src/calattachment.cpp --- a/pimappservices/calendar/client/src/calattachment.cpp Fri Jun 11 13:37:54 2010 +0300 +++ b/pimappservices/calendar/client/src/calattachment.cpp Wed Jun 23 18:11:28 2010 +0300 @@ -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.