ipsservices/ipssosplugin/src/ipsplgpop3plugin.cpp
branchRCL_3
changeset 25 3533d4323edc
parent 24 d189ee25cf9d
equal deleted inserted replaced
24:d189ee25cf9d 25:3533d4323edc
    17 
    17 
    18 
    18 
    19 #include "emailtrace.h"
    19 #include "emailtrace.h"
    20 #include "ipsplgheaders.h"
    20 #include "ipsplgheaders.h"
    21 
    21 
    22 //<qmail> removed
       
    23 
    22 
    24 // ---------------------------------------------------------------------------
    23 // ---------------------------------------------------------------------------
    25 // CIpsPlgPop3Plugin::CIpsPlgPop3Plugin
    24 // CIpsPlgPop3Plugin::CIpsPlgPop3Plugin
    26 // ---------------------------------------------------------------------------
    25 // ---------------------------------------------------------------------------
    27 //
    26 //
   137 // CIpsPlgPop3Plugin::RefreshNowL
   136 // CIpsPlgPop3Plugin::RefreshNowL
   138 // ---------------------------------------------------------------------------- 
   137 // ---------------------------------------------------------------------------- 
   139 void CIpsPlgPop3Plugin::RefreshNowL(
   138 void CIpsPlgPop3Plugin::RefreshNowL(
   140     const TFSMailMsgId& aMailBoxId,
   139     const TFSMailMsgId& aMailBoxId,
   141     MFSMailRequestObserver& aOperationObserver,
   140     MFSMailRequestObserver& aOperationObserver,
   142     TInt aRequestId,
   141     TInt aRequestId )
   143     const TBool /*aSilentConnection*/ )
       
   144     {
   142     {
   145     FUNC_LOG;
   143     FUNC_LOG;
   146     TMsvId service = aMailBoxId.Id();
   144     TMsvId service = aMailBoxId.Id();
   147     CIpsPlgSingleOpWatcher* watcher = CIpsPlgSingleOpWatcher::NewL(*this);
   145     CIpsPlgSingleOpWatcher* watcher = CIpsPlgSingleOpWatcher::NewL(*this);
   148     CleanupStack::PushL( watcher ); // << watcher
   146     CleanupStack::PushL( watcher ); // << watcher
   163     accounts->GetPopAccountL( service , popAccountId );
   161     accounts->GetPopAccountL( service , popAccountId );
   164     accounts->LoadPopSettingsL( popAccountId, *settings );
   162     accounts->LoadPopSettingsL( popAccountId, *settings );
   165     TInt populationLimit( settings->PopulationLimit() );
   163     TInt populationLimit( settings->PopulationLimit() );
   166     CleanupStack::PopAndDestroy( 2, settings );   // >>> settings, accounts
   164     CleanupStack::PopAndDestroy( 2, settings );   // >>> settings, accounts
   167     TBool forcePopulate( EFalse );
   165     TBool forcePopulate( EFalse );
   168 // <qmail> back to use
       
   169     if( populationLimit != KIpsSetDataHeadersOnly )
   166     if( populationLimit != KIpsSetDataHeadersOnly )
   170         {
   167         {
   171         forcePopulate = ETrue;
   168         forcePopulate = ETrue;
   172         }
   169         }
   173 // </qmail>
       
   174     
   170     
   175     CIpsPlgBaseOperation* op = CIpsPlgPop3ConnectOp::NewL( 
   171     CIpsPlgBaseOperation* op = CIpsPlgPop3ConnectOp::NewL( 
   176         *iSession, 
   172         *iSession, 
   177         watcher->iStatus, 
   173         watcher->iStatus, 
   178         service, 
   174         service, 
   179         forcePopulate,
   175         forcePopulate,
   180         ActivityTimerL( aMailBoxId ),
   176         ActivityTimerL( aMailBoxId ),
   181         aMailBoxId, 
   177         aMailBoxId, 
   182         &aOperationObserver,
   178         aOperationObserver,
   183         aRequestId,
   179         aRequestId,
   184         iEventHandler );
   180         iEventHandler );
   185     
   181     
   186     watcher->SetOperation( op );
   182     watcher->SetOperation( op );
   187     CleanupStack::PopAndDestroy( sel ); // >>> sel
   183     CleanupStack::PopAndDestroy( sel ); // >>> sel
   188     
   184     
   189     iOperations.AppendL( watcher );
   185     iOperations.AppendL( watcher );
   190     CleanupStack::Pop( watcher );   // >> watcher
   186     CleanupStack::Pop( watcher );   // >> watcher
   191     	
   187     
   192     // send part of refresh
   188     // send part
   193     EmptyOutboxL( aMailBoxId );
   189     EmptyOutboxL( aMailBoxId );
   194     }
   190     }
   195 
   191 
   196 // ---------------------------------------------------------------------------
   192 // ---------------------------------------------------------------------------
   197 // CIpsPlgPop3Plugin::ListFoldersL
   193 // CIpsPlgPop3Plugin::ListFoldersL
   198 // ---------------------------------------------------------------------------
   194 // ---------------------------------------------------------------------------
   199 //  
   195 //  
   200 void CIpsPlgPop3Plugin::ListFoldersL(
   196 void CIpsPlgPop3Plugin::ListFoldersL(
   201     const TFSMailMsgId& aMailBoxId,
   197     const TFSMailMsgId& aMailBoxId,
   202     const TFSMailMsgId& /*aFolderId*/,
   198     const TFSMailMsgId& aFolderId,
   203     RPointerArray<CFSMailFolder>& aFolderList)
   199     RPointerArray<CFSMailFolder>& aFolderList)
   204 	{
   200     {
   205     FUNC_LOG;
   201     FUNC_LOG;
   206 	// Pop3 returns always the root level, so ignore folder id even
   202     // Pop3 can return only folders on the root level, so folders are not
   207 	// it is given.
   203     // listed when the given folder ID is not null ID.
   208 	ListFoldersL( aMailBoxId, aFolderList );
   204     if ( aFolderId.IsNullId() )
   209 	}
   205         {
       
   206         ListFoldersL( aMailBoxId, aFolderList );
       
   207         }
       
   208     }
   210 
   209 
   211 // ---------------------------------------------------------------------------
   210 // ---------------------------------------------------------------------------
   212 // CIpsPlgPop3Plugin::ListFoldersL
   211 // CIpsPlgPop3Plugin::ListFoldersL
   213 // ---------------------------------------------------------------------------
   212 // ---------------------------------------------------------------------------
   214 //  
   213 //  
   270     FUNC_LOG;
   269     FUNC_LOG;
   271  	TFSMailMsgId result;
   270  	TFSMailMsgId result;
   272  	
   271  	
   273  	if( aFolderType==EFSInbox )
   272  	if( aFolderType==EFSInbox )
   274         {
   273         {
   275         //<qmail> removed CMsvEntry conversion 
   274         //in case of pop3, mailbox id == service id == inbox id
   276  	
   275         CMsvEntry* cEntry = iSession->GetEntryL( aMailBoxId.Id() );
   277         // In case of pop3, mailbox id == service id == inbox id,
   276         CleanupStack::PushL( cEntry );
   278         // so no need to create CMsvEntry from mailbox id to
   277         if ( cEntry->Count() != 0 )
   279         // dig if any children exists.
   278             {
   280         result.SetId( aMailBoxId.Id() );
   279             result.SetId( aMailBoxId.Id() );
   281         //</qmail>
   280             }
       
   281         CleanupStack::PopAndDestroy( cEntry );
   282         }
   282         }
   283     else if( aFolderType==EFSOutbox )
   283     else if( aFolderType==EFSOutbox )
   284         {
   284         {
   285         result.SetId( KMsvGlobalOutBoxIndexEntryId );
   285         result.SetId( KMsvGlobalOutBoxIndexEntryId );
   286         }
   286         }
   334         }
   334         }
   335     
   335     
   336     TImPop3GetMailInfo info;
   336     TImPop3GetMailInfo info;
   337     info.iMaxEmailSize = KMaxTInt32;
   337     info.iMaxEmailSize = KMaxTInt32;
   338     info.iDestinationFolder = aMailBoxId.Id();
   338     info.iDestinationFolder = aMailBoxId.Id();
   339     // <qmail> ownership of selection is moved to the operation
   339     
   340     CIpsPlgBaseOperation* op = CIpsPlgPop3FetchOperation::NewL( 
   340     CIpsPlgBaseOperation* op = CIpsPlgPop3FetchOperation::NewL( 
   341         *iSession, 
   341         *iSession, 
   342         watcher->iStatus,
   342         watcher->iStatus,
       
   343         KPOP3MTMCopyMailSelectionWhenAlreadyConnected,
   343         aMailBoxId.Id(), 
   344         aMailBoxId.Id(), 
   344         ActivityTimerL( aMailBoxId ), 
   345         ActivityTimerL( aMailBoxId ), 
   345         info, 
   346         info, 
   346         sel, 
   347         *sel, 
   347         aMailBoxId, 
   348         aMailBoxId, 
   348         &aObserver, 
   349         aObserver, 
   349         aRequestId,
   350         aRequestId,
   350         iEventHandler );
   351         iEventHandler );
   351     
   352     
   352     watcher->SetOperation( op );
   353     watcher->SetOperation( op );
   353 	// <qmail> change PopAndDestroy to Pop
   354     CleanupStack::PopAndDestroy( sel );
   354     CleanupStack::Pop( sel );
       
   355     CleanupStack::Pop( watcher );
   355     CleanupStack::Pop( watcher );
   356     
   356     
   357     iOperations.AppendL( watcher );	
   357     iOperations.AppendL( watcher );	
   358  	}
   358  	}
   359 
   359