pimappservices/calendar/client/src/calattachment.cpp
changeset 45 b6db4fd4947b
parent 0 f979ecb2b13e
--- a/pimappservices/calendar/client/src/calattachment.cpp	Mon May 03 12:30:32 2010 +0300
+++ b/pimappservices/calendar/client/src/calattachment.cpp	Mon Jun 28 15:22:02 2010 +0530
@@ -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.