ipsservices/ipssosplugin/src/ipsplgimap4fetchattachmentop.cpp
changeset 76 38bf5461e270
parent 23 2dc6caa42ec3
--- a/ipsservices/ipssosplugin/src/ipsplgimap4fetchattachmentop.cpp	Thu Sep 30 11:43:07 2010 +0300
+++ b/ipsservices/ipssosplugin/src/ipsplgimap4fetchattachmentop.cpp	Thu Oct 14 17:33:43 2010 +0300
@@ -308,7 +308,9 @@
 void CIpsPlgImap4FetchAttachmentOp::ReportProgressL()
     {
     FUNC_LOG;
+        
     TInt error = KErrNone;
+
     TFSProgress fsProgress = { TFSProgress::EFSStatus_Waiting, 0, 0, KErrNone };
     if ( iSubOperation && iState == EStateFetching )
         {
@@ -337,6 +339,20 @@
         User::Leave( error );
         }
 
+    TInt fileSize( 0 );
+    
+    if ( fsProgress.iMaxCount - fsProgress.iCounter > 0 )
+        {
+        fileSize = fsProgress.iMaxCount - fsProgress.iCounter;
+        }
+
+    if ( EnoughDiskSpaceOnCurrentDrive( fileSize ) == EFalse )
+        {
+        // Not enough space on the disk for the attachment!
+        error = KErrDiskFull;
+        fsProgress.iError = error;
+        }
+
 // <qmail>
     // signal observer if it exists
     if ( iFSOperationObserver )
@@ -344,6 +360,11 @@
         iFSOperationObserver->RequestResponseL( fsProgress, iFSRequestId );
         }
 // </qmail>
+    
+    if ( error == KErrDiskFull )
+        {
+        Cancel();
+        }
     }
 
 // ----------------------------------------------------------------------------