ipsservices/ipssosplugin/src/ipsplgdisconnectop.cpp
changeset 20 ecc8def7944a
parent 18 578830873419
child 23 2dc6caa42ec3
--- a/ipsservices/ipssosplugin/src/ipsplgdisconnectop.cpp	Fri Apr 16 14:51:52 2010 +0300
+++ b/ipsservices/ipssosplugin/src/ipsplgdisconnectop.cpp	Mon May 03 12:23:15 2010 +0300
@@ -15,13 +15,10 @@
 *
 */
 
-
-
 #include "emailtrace.h"
 #include "ipsplgheaders.h"
 
-// Constants and defines
-const TInt KConnectOpPriority = CActive::EPriorityStandard;
+// <qmail> remove priority const
 
 // ----------------------------------------------------------------------------
 // CIpsPlgDisconnectOp::NewL()
@@ -29,23 +26,23 @@
 //
 CIpsPlgDisconnectOp* CIpsPlgDisconnectOp::NewL(
     CMsvSession& aMsvSession,
-                                           TRequestStatus& aObserverRequestStatus,
-                                           TMsvId aService,
-                                           CIpsPlgTimerOperation& aActivityTimer,
-                                           TFSMailMsgId aFSMailBoxId,
-                                           MFSMailRequestObserver& aFSOperationObserver,
-                                           TInt aFSRequestId,
-                                           TBool aDoRemoveAfterDisconnect )
+    TRequestStatus& aObserverRequestStatus,
+    TMsvId aService,
+    CIpsPlgTimerOperation& aActivityTimer,
+    TFSMailMsgId aFSMailBoxId,
+    MFSMailRequestObserver* aFSOperationObserver,
+    TInt aFSRequestId )
     {
     FUNC_LOG;
-    CIpsPlgDisconnectOp* op = new(ELeave) CIpsPlgDisconnectOp(aMsvSession,
+    // <qmail> aDoRemoveAfterDisconnect removed
+    CIpsPlgDisconnectOp* op = new(ELeave) CIpsPlgDisconnectOp(
+        aMsvSession,
         aObserverRequestStatus,
         aService,
         aActivityTimer,
         aFSMailBoxId,
         aFSOperationObserver,
-        aFSRequestId,
-        aDoRemoveAfterDisconnect );
+        aFSRequestId );
         
     CleanupStack::PushL(op);
     op->ConstructL();
@@ -87,9 +84,9 @@
     {
     FUNC_LOG;
     iError = aError;
-    if ( iOperation && iError == KErrNone )
+    if ( iSubOperation && iError == KErrNone )
         {
-        return iOperation->ProgressL();
+        return iSubOperation->ProgressL();
         }
     
     if ( iTEntry.iMtm == KUidMsgTypePOP3 )
@@ -133,20 +130,13 @@
 void CIpsPlgDisconnectOp::DoRunL()
     {
     FUNC_LOG;
-    if( !iDisconnected )
+    if( Connected() )
         {        
         DoDisconnectL();
-        iDisconnected = ETrue;
         }
     else
         {                
-        if ( iDoRemoveAfterDisconnect )
-            {
-            //CIpsSetDataApi* settings = CIpsSetDataApi::NewL( iMsvSession );
-            //CleanupStack::PushL( settings );
-            //settings->RemoveAccountL( iTEntry, iMsvSession );
-            //CleanupStack::PopAndDestroy( settings );
-            }
+        // <qmail> iDoRemoveAfterDisconnect feature from this op has been removed
         CompleteObserver( KErrNone );
         }
     }
@@ -161,19 +151,16 @@
     TMsvId aServiceId,
     CIpsPlgTimerOperation& aActivityTimer,
     TFSMailMsgId aFSMailBoxId,
-    MFSMailRequestObserver& aFSOperationObserver,
-    TInt aFSRequestId,
-    TBool aDoRemoveAfterDisconnect )
+    MFSMailRequestObserver* aFSOperationObserver,
+    TInt aFSRequestId )
     :
     CIpsPlgOnlineOperation(
-    aMsvSession,
-    KConnectOpPriority,
-    aObserverRequestStatus,
-    aActivityTimer,
-    aFSMailBoxId,
-    aFSOperationObserver, 
-    aFSRequestId),
-    iDoRemoveAfterDisconnect( aDoRemoveAfterDisconnect )
+        aMsvSession,
+        aObserverRequestStatus,
+        aActivityTimer,
+        aFSMailBoxId,
+        aFSOperationObserver, 
+        aFSRequestId )
     {
     iService = aServiceId;
     }
@@ -185,9 +172,7 @@
 void CIpsPlgDisconnectOp::ConstructL()
     {    
     FUNC_LOG;
-    iDisconnected = EFalse;
     TMsvId service;
-    
     iMsvSession.GetEntry( iService, service, iTEntry );
     
     if ( iTEntry.iType.iUid == KUidMsvServiceEntryValue )
@@ -196,11 +181,10 @@
         }
     else
         {
-        //should we panic with own codes?
         User::Leave( KErrNotSupported );
         }
     
-    SetActive();
+    // <qmail> SetActive(); moved inside CompleteThis();
     CompleteThis();
     }
     
@@ -211,11 +195,24 @@
 void CIpsPlgDisconnectOp::DoDisconnectL()
     {
     FUNC_LOG;
-    iStatus = KRequestPending;
-    
     TInt cmd = (iTEntry.iMtm == KUidMsgTypePOP3) ? KPOP3MTMDisconnect : KIMAP4MTMDisconnect;
-    
-    InvokeClientMtmAsyncFunctionL(cmd, iService, iService);
+    InvokeClientMtmAsyncFunctionL( cmd, iService ); // <qmail> 1 param removed
     SetActive();
     }
 
+// <qmail> adding this func
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+//
+TIpsOpType CIpsPlgDisconnectOp::IpsOpType() const
+    {
+    FUNC_LOG;
+    if ( iTEntry.iMtm == KUidMsgTypePOP3 )
+        {
+        return EIpsOpTypePop3Disconnect;
+        }
+    else
+        {
+        return EIpsOpTypeImap4Disconnect;
+        }
+    }