ipsservices/ipssosplugin/src/ipsplgonlineoperation.cpp
changeset 18 578830873419
parent 3 a4d6f1ea0416
child 20 ecc8def7944a
--- a/ipsservices/ipssosplugin/src/ipsplgonlineoperation.cpp	Tue Feb 02 00:02:40 2010 +0200
+++ b/ipsservices/ipssosplugin/src/ipsplgonlineoperation.cpp	Fri Apr 16 14:51:52 2010 +0300
@@ -15,12 +15,9 @@
 *
 */
 
-
-
 #include "emailtrace.h"
 #include "ipsplgheaders.h"
 
-
 // ----------------------------------------------------------------------------
 // CIpsPlgOnlineOperation::~CIpsPlgOnlineOperation()
 // ----------------------------------------------------------------------------
@@ -50,7 +47,7 @@
     :
     CIpsPlgBaseOperation( aMsvSession, aPriority, aObserverRequestStatus,
         aFSRequestId, aFSMailBoxId ), 
-        iActivityTimer( &aActivityTimer ),
+        iActivityTimer( aActivityTimer ),
         iBaseMtm( NULL ),
         iMtmReg( NULL ), 
         iOperation( NULL ),
@@ -70,9 +67,9 @@
     FUNC_LOG;
     // reset timer, if operation not completed after timer fires causes
     // disconnection
-    if( iActivityTimer )
+    if( &iActivityTimer )
         {
-        iActivityTimer->ResetTimerOperation();
+        iActivityTimer.ResetTimerOperation();
         }
 
     iMtmReg = CClientMtmRegistry::NewL( iMsvSession );
@@ -140,14 +137,22 @@
     TRequestStatus* status = &iObserverRequestStatus;
     if (status && status->Int() == KRequestPending)
         {
-    
         SignalFSObserver( aStatus );
+        // <qmail>
         // removed checks to prevent unwanted disconnections
         //if we're connected, reset activitytimer. if not, there is no reason to.
-        if( iActivityTimer )
+        if( &iActivityTimer )
             {
-            iActivityTimer->ResetTimerOperation();
+            if ( Connected() )
+                {
+                iActivityTimer.ResetTimerOperation();
+                }
+            else
+                {
+                iActivityTimer.Cancel();
+                }
             }
+        // </qmail>
         User::RequestComplete(status, aStatus);
         }
     }
@@ -232,12 +237,12 @@
     FUNC_LOG;
     if( iSignallingAllowed )
         {        
-        TFSProgress prog;
+        TFSProgress prog = TFSProgress();
         prog.iError = aStatus;
         // Initialize the progress data
         // it would be better to get fs progress from inherited class
         // by calling FSProgressL method??
-        if ( prog.iError == KErrCancel || prog.iError == KErrImapBadLogon )
+        if ( prog.iError == KErrCancel )
             {
             prog.iProgressStatus = TFSProgress::EFSStatus_RequestCancelled;
             }
@@ -267,3 +272,15 @@
     return EIpsOpTypeOnlineOp;
     }
 
+// <qmail> makes more sence to have this method here in "base" online op than in every derived class
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+TBool CIpsPlgOnlineOperation::Connected() const
+    {
+    FUNC_LOG;
+    TMsvEntry tentry;
+    TMsvId service;
+    iMsvSession.GetEntry(iService, service, tentry );
+    return tentry.Connected();
+    }
+// </qmail>