ipsservices/ipssosaoplugin/src/IpsSosAOPopAgent.cpp
changeset 59 16ed8d08d0b1
parent 54 997a02608b3a
equal deleted inserted replaced
54:997a02608b3a 59:16ed8d08d0b1
    14 * Description: 
    14 * Description: 
    15 *     Contains pop specified sync logic
    15 *     Contains pop specified sync logic
    16 *
    16 *
    17 */
    17 */
    18 
    18 
    19 
    19 #include "ipssosaopluginheaders.h"
    20 
       
    21 #include "emailtrace.h"
       
    22 #include <cemailaccounts.h>
       
    23 #include <pop3cmds.h>
       
    24 #include <miutset.h>
       
    25 #include <popcmtm.h>
       
    26 #include <AlwaysOnlineManagerCommon.h>
       
    27 
       
    28 #include "IpsSosAOPopAgent.h"
       
    29 #include "IpsSosAOImapPopLogic.h"
       
    30 
       
    31 
    20 
    32 // from settings
    21 // from settings
    33 //<QMail>
    22 //<QMail>
    34 
    23 
    35 //</QMail>
    24 //</QMail>
   145          case EStateFetchOngoing:
   134          case EStateFetchOngoing:
   146              break;
   135              break;
   147          case EStateFetchOnHold:
   136          case EStateFetchOnHold:
   148              break;
   137              break;
   149          case EStateDisconnect:
   138          case EStateDisconnect:
       
   139              NM_COMMENT("CIpsSosAOPopAgent: disconnecting");
   150              if ( !iDoNotDisconnect )
   140              if ( !iDoNotDisconnect )
   151                  {
   141                  {
   152                  CancelAllAndDisconnectL();
   142                  CancelAllAndDisconnectL();
   153                  }
   143                  }
   154              else
   144              else
   156                  iState = EStateCompleted;
   146                  iState = EStateCompleted;
   157                  SetActiveAndCompleteThis();
   147                  SetActiveAndCompleteThis();
   158                  }
   148                  }
   159              break;
   149              break;
   160          case EStateCompleted:
   150          case EStateCompleted:
       
   151              NM_COMMENT("CIpsSosAOImapAgent: completed");
   161              TRAP_IGNORE( iOpResponse.OperationCompletedL( iError ) );
   152              TRAP_IGNORE( iOpResponse.OperationCompletedL( iError ) );
   162              SignalSyncCompleted( iServiceId, iError );
   153              SignalSyncCompleted( iServiceId, iError );
   163              ClearSignaledFlags();
   154              ClearSignaledFlags();
   164              iError = KErrNone;
   155              iError = KErrNone;
   165              iState = EStateIdle;
   156              iState = EStateIdle;
   268         User::Leave( KErrNotReady );
   259         User::Leave( KErrNotReady );
   269         }
   260         }
   270     LoadSettingsL( );
   261     LoadSettingsL( );
   271     if ( !IsConnected() )
   262     if ( !IsConnected() )
   272         {
   263         {
       
   264         NM_COMMENT("CIpsSosAOPopAgent: starting sync");
   273         TBuf8<1> dummy;
   265         TBuf8<1> dummy;
   274         // connect and synchronise starts background sync or idle
   266         // connect and synchronise starts background sync or idle
   275         iSelection->ResizeL(0);
   267         iSelection->ResizeL(0);
   276         iSelection->AppendL( iServiceId );
   268         iSelection->AppendL( iServiceId );
   277         iPopClientMtm->SwitchCurrentEntryL( iServiceId );
   269         iPopClientMtm->SwitchCurrentEntryL( iServiceId );
   280         SetActive();
   272         SetActive();
   281         iState = EStateConnectAndSync;
   273         iState = EStateConnectAndSync;
   282         }
   274         }
   283     else
   275     else
   284         {
   276         {
       
   277         NM_COMMENT("CIpsSosAOPopAgent: already connected do not sync");
   285         iState = EStateCompleted;
   278         iState = EStateCompleted;
   286         iError = KErrCancel;
   279         iError = KErrCancel;
   287         SetActiveAndCompleteThis();
   280         SetActiveAndCompleteThis();
   288         }
   281         }
   289     }
   282     }