ipsservices/ipssosaoplugin/src/IpsSosAOImapAgent.cpp
changeset 23 2dc6caa42ec3
parent 20 ecc8def7944a
child 47 f83bd4ae1fe3
equal deleted inserted replaced
20:ecc8def7944a 23:2dc6caa42ec3
    22 #include <imapcmds.h>
    22 #include <imapcmds.h>
    23 #include <miutset.h>
    23 #include <miutset.h>
    24 #include <impcmtm.h>
    24 #include <impcmtm.h>
    25 #include <msvapi.h>
    25 #include <msvapi.h>
    26 #include <AlwaysOnlineManagerCommon.h>
    26 #include <AlwaysOnlineManagerCommon.h>
    27 //<cmail>
       
    28 #include "CFSMailCommon.h"
    27 #include "CFSMailCommon.h"
    29 //</cmail>
       
    30 
       
    31 
    28 
    32 #include "IpsSosAOImapAgent.h"
    29 #include "IpsSosAOImapAgent.h"
    33 #include "IpsSosAOImapPopLogic.h"
    30 #include "IpsSosAOImapPopLogic.h"
    34 
    31 
    35 
    32 
    36 // from settings
       
    37 //<QMail>
    33 //<QMail>
    38 
    34 #include "IpsSosAOSettingsHandler.h"
       
    35 
       
    36 const TInt KIpsSetDataHeadersOnly           = -2;
    39 //</QMail>
    37 //</QMail>
    40 
    38 
    41 // from ipsplugin
    39 // from ipsplugin
    42 #include "ipsplgimap4populateop.h"
    40 #include "ipsplgimap4populateop.h"
    43 #include "ipsplgcommon.h"
    41 #include "ipsplgcommon.h"
   185          case EStateConnectAndSyncOnHold:
   183          case EStateConnectAndSyncOnHold:
   186              StartSyncL();
   184              StartSyncL();
   187              break;
   185              break;
   188          case EStateRefreshFolderArray:
   186          case EStateRefreshFolderArray:
   189 			 //<QMail>
   187 			 //<QMail>
   190              //iDataApi->GetSubscribedImapFoldersL( iServiceId , iFoldersArray );
   188              {
       
   189              CIpsSosAOSettingsHandler* settings = 
       
   190                      CIpsSosAOSettingsHandler::NewL(iSession, iServiceId);
       
   191              CleanupStack::PushL(settings);
       
   192              settings->GetSubscribedImapFoldersL( iServiceId , iFoldersArray );
       
   193              CleanupStack::PopAndDestroy(settings);
       
   194              }             
   191 			 //</QMail>
   195 			 //</QMail>
   192              iState = EStatePopulateAll;
   196              iState = EStatePopulateAll;
   193              SetActiveAndCompleteThis();
   197              SetActiveAndCompleteThis();
   194              break;
   198              break;
   195          case EStatePopulateAll:
   199          case EStatePopulateAll:
   473 // ----------------------------------------------------------------------------
   477 // ----------------------------------------------------------------------------
   474 void CIpsSosAOImapAgent::PopulateAllL()
   478 void CIpsSosAOImapAgent::PopulateAllL()
   475     {
   479     {
   476     FUNC_LOG;
   480     FUNC_LOG;
   477     TImImap4GetPartialMailInfo info;
   481     TImImap4GetPartialMailInfo info;
   478 	//<QMail>
   482     //<QMail>
   479     //CIpsSetDataApi::ConstructImapPartialFetchInfo( info, *iImapSettings );
   483     CIpsSosAOSettingsHandler* settings = 
       
   484              CIpsSosAOSettingsHandler::NewL(iSession, iServiceId);
       
   485      CleanupStack::PushL(settings);
       
   486      settings->ConstructImapPartialFetchInfo( info, *iImapSettings );
       
   487      CleanupStack::PopAndDestroy(settings);	
   480 	//</QMail>
   488 	//</QMail>
   481     
   489     
   482     if ( !IsConnected() )
   490     if ( !IsConnected() )
   483         {
   491         {
   484         SignalSyncCompleted( iServiceId, iError );
   492         SignalSyncCompleted( iServiceId, iError );
   485         CancelAllAndDisconnectL();
   493         CancelAllAndDisconnectL();
   486         }
   494         }
   487 	//<QMail>
   495 	//<QMail>
   488     else if ( iFoldersArray.Count())// > 0 && info.iTotalSizeLimit 
   496     else if ( iFoldersArray.Count() > 0 && info.iTotalSizeLimit 
   489             //!= KIpsSetDataHeadersOnly )
   497             != KIpsSetDataHeadersOnly )
   490 	//</QMail>
   498 	//</QMail>
   491          {
   499          {
   492 
   500 
   493          // only inbox is set, do we have to populate other folders also
   501          // only inbox is set, do we have to populate other folders also
   494          TMsvId id = iFoldersArray[0];
   502          TMsvId id = iFoldersArray[0];
   502          
   510          
   503          CIpsPlgTimerOperation* dummy = NULL;
   511          CIpsPlgTimerOperation* dummy = NULL;
   504          iImapClientMtm->SwitchCurrentEntryL( iServiceId );
   512          iImapClientMtm->SwitchCurrentEntryL( iServiceId );
   505          TFSMailMsgId mbox( KIpsPlgImap4PluginUidValue, iServiceId );
   513          TFSMailMsgId mbox( KIpsPlgImap4PluginUidValue, iServiceId );
   506          iStatus = KRequestPending;
   514          iStatus = KRequestPending;
       
   515 		 //<Qmail>
   507          iOngoingOp = CIpsPlgImap4PopulateOp::NewL(
   516          iOngoingOp = CIpsPlgImap4PopulateOp::NewL(
   508              iSession,
   517                  iSession,
   509              this->iStatus,
   518                  this->iStatus,
   510              iServiceId,
   519                  iServiceId,
   511              *dummy,
   520                  *dummy,
   512              info,
   521                  info,
   513              *sel,
   522                  *sel,
   514              mbox,
   523                  mbox,
   515              this,
   524                  this,
   516              0,
   525                  0,
   517              NULL );
   526                  NULL );
   518          
   527          //</Qmail>
   519          iFoldersArray.Remove( 0 );
   528          iFoldersArray.Remove( 0 );
   520          SetActive();
   529          SetActive();
   521          iState = EStatePopulateAll;
   530          iState = EStatePopulateAll;
   522          CleanupStack::PopAndDestroy( 2, cEntry );
   531          CleanupStack::PopAndDestroy( 2, cEntry );
   523          
   532