ipsservices/ipssosaoplugin/src/IpsSosAOImapAgent.cpp
changeset 18 578830873419
parent 0 8466d47a6819
child 20 ecc8def7944a
equal deleted inserted replaced
4:e7aa27f58ae1 18:578830873419
     1 /*
     1 /*
     2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    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>
    27 //<cmail>
    28 #include "CFSMailCommon.h"
    28 #include "cfsmailcommon.h"
    29 //</cmail>
    29 //</cmail>
    30 
    30 
    31 
    31 
    32 #include "IpsSosAOImapAgent.h"
    32 #include "IpsSosAOImapAgent.h"
    33 #include "IpsSosAOImapPopLogic.h"
    33 #include "IpsSosAOImapPopLogic.h"
    34 
    34 
    35 
    35 
    36 // from settings
    36 // from settings
    37 #include "ipssetdataapi.h"
    37 //<QMail>
    38 #include "ipssetutilsconsts.h"
    38 
       
    39 //</QMail>
    39 
    40 
    40 // from ipsplugin
    41 // from ipsplugin
    41 #include "ipsplgimap4populateop.h"
    42 #include "ipsplgimap4populateop.h"
    42 #include "ipsplgcommon.h"
    43 #include "ipsplgcommon.h"
    43 
    44 
    65     ClearSignaledFlags();
    66     ClearSignaledFlags();
    66     delete iImapSettings;
    67     delete iImapSettings;
    67     delete iOngoingOp;
    68     delete iOngoingOp;
    68     delete iImapClientMtm;
    69     delete iImapClientMtm;
    69     delete iMtmReg;
    70     delete iMtmReg;
    70     delete iDataApi;
    71 	//<QMail>
       
    72 
       
    73 	//</QMail>
    71     iFoldersArray.Close();
    74     iFoldersArray.Close();
    72 
    75 
    73     }
    76     }
    74 
    77 
    75 // ----------------------------------------------------------------------------
    78 // ----------------------------------------------------------------------------
    96     CActiveScheduler::Add(this);
    99     CActiveScheduler::Add(this);
    97     
   100     
    98     iMtmReg = CClientMtmRegistry::NewL( iSession );
   101     iMtmReg = CClientMtmRegistry::NewL( iSession );
    99     CBaseMtm* bmtm = iMtmReg->NewMtmL( KUidMsgTypeIMAP4 );
   102     CBaseMtm* bmtm = iMtmReg->NewMtmL( KUidMsgTypeIMAP4 );
   100     iImapClientMtm = static_cast<CImap4ClientMtm*>(bmtm);
   103     iImapClientMtm = static_cast<CImap4ClientMtm*>(bmtm);
   101     iDataApi = CIpsSetDataApi::NewL( iSession );
   104 	//<QMail>
       
   105     
       
   106 	//</QMail>
   102     iState = EStateIdle; 
   107     iState = EStateIdle; 
   103     }
   108     }
   104  
   109  
   105 // ----------------------------------------------------------------------------
   110 // ----------------------------------------------------------------------------
   106 // ----------------------------------------------------------------------------
   111 // ----------------------------------------------------------------------------
   179              break;
   184              break;
   180          case EStateConnectAndSyncOnHold:
   185          case EStateConnectAndSyncOnHold:
   181              StartSyncL();
   186              StartSyncL();
   182              break;
   187              break;
   183          case EStateRefreshFolderArray:
   188          case EStateRefreshFolderArray:
   184              iDataApi->GetSubscribedImapFoldersL( iServiceId , iFoldersArray );
   189 			 //<QMail>
       
   190              //iDataApi->GetSubscribedImapFoldersL( iServiceId , iFoldersArray );
       
   191 			 //</QMail>
   185              iState = EStatePopulateAll;
   192              iState = EStatePopulateAll;
   186              SetActiveAndCompleteThis();
   193              SetActiveAndCompleteThis();
   187              break;
   194              break;
   188          case EStatePopulateAll:
   195          case EStatePopulateAll:
   189              PopulateAllL();
   196              PopulateAllL();
   466 // ----------------------------------------------------------------------------
   473 // ----------------------------------------------------------------------------
   467 void CIpsSosAOImapAgent::PopulateAllL()
   474 void CIpsSosAOImapAgent::PopulateAllL()
   468     {
   475     {
   469     FUNC_LOG;
   476     FUNC_LOG;
   470     TImImap4GetPartialMailInfo info;
   477     TImImap4GetPartialMailInfo info;
   471     CIpsSetDataApi::ConstructImapPartialFetchInfo( info, *iImapSettings );
   478 	//<QMail>
       
   479     //CIpsSetDataApi::ConstructImapPartialFetchInfo( info, *iImapSettings );
       
   480 	//</QMail>
   472     
   481     
   473     if ( !IsConnected() )
   482     if ( !IsConnected() )
   474         {
   483         {
   475         SignalSyncCompleted( iServiceId, iError );
   484         SignalSyncCompleted( iServiceId, iError );
   476         CancelAllAndDisconnectL();
   485         CancelAllAndDisconnectL();
   477         }
   486         }
   478     else if ( iFoldersArray.Count() > 0 && info.iTotalSizeLimit 
   487 	//<QMail>
   479             != KIpsSetDataHeadersOnly )
   488     else if ( iFoldersArray.Count())// > 0 && info.iTotalSizeLimit 
       
   489             //!= KIpsSetDataHeadersOnly )
       
   490 	//</QMail>
   480          {
   491          {
   481 
   492 
   482          // only inbox is set, do we have to populate other folders also
   493          // only inbox is set, do we have to populate other folders also
   483          TMsvId id = iFoldersArray[0];
   494          TMsvId id = iFoldersArray[0];
   484          CMsvEntry* cEntry = iSession.GetEntryL( id );
   495          CMsvEntry* cEntry = iSession.GetEntryL( id );