ipsservices/ipssosplugin/src/ipsplgpop3fetchoperation.cpp
changeset 20 ecc8def7944a
parent 18 578830873419
child 23 2dc6caa42ec3
equal deleted inserted replaced
18:578830873419 20:ecc8def7944a
    13 *
    13 *
    14 * Description:  POP3 fetch message operation class
    14 * Description:  POP3 fetch message operation class
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 
       
    19 #include "emailtrace.h"
    18 #include "emailtrace.h"
    20 #include "ipsplgheaders.h"
    19 #include "ipsplgheaders.h"
    21 
       
    22 // Constants and defines
       
    23 const TInt KFetchOpPriority = CActive::EPriorityStandard;
       
    24 
    20 
    25 // ----------------------------------------------------------------------------
    21 // ----------------------------------------------------------------------------
    26 // ----------------------------------------------------------------------------
    22 // ----------------------------------------------------------------------------
    27 CIpsPlgPop3FetchOperation* CIpsPlgPop3FetchOperation::NewL(
    23 CIpsPlgPop3FetchOperation* CIpsPlgPop3FetchOperation::NewL(
    28     CMsvSession& aMsvSession,
    24     CMsvSession& aMsvSession,
    31     TMsvId aService,
    27     TMsvId aService,
    32     CIpsPlgTimerOperation& aActivityTimer,
    28     CIpsPlgTimerOperation& aActivityTimer,
    33     const TImPop3GetMailInfo& aGetMailInfo,
    29     const TImPop3GetMailInfo& aGetMailInfo,
    34     const CMsvEntrySelection& aSel,
    30     const CMsvEntrySelection& aSel,
    35     TFSMailMsgId aFSMailBoxId,
    31     TFSMailMsgId aFSMailBoxId,
    36     MFSMailRequestObserver& aFSOperationObserver,
    32     MFSMailRequestObserver* aFSOperationObserver,
    37     TInt aFSRequestId,
    33     TInt aFSRequestId,
    38     CIpsPlgEventHandler* aEventHandler )
    34     CIpsPlgEventHandler* aEventHandler )
    39     {
    35     {
    40     FUNC_LOG;
    36     FUNC_LOG;
    41     CIpsPlgPop3FetchOperation* op = new(ELeave) CIpsPlgPop3FetchOperation(
    37     CIpsPlgPop3FetchOperation* op = new(ELeave) CIpsPlgPop3FetchOperation(
   106     iStatus = KRequestPending;
   102     iStatus = KRequestPending;
   107     
   103     
   108     // when connecting for the fetch operation, don't let connect operation to do fetch,
   104     // when connecting for the fetch operation, don't let connect operation to do fetch,
   109     // because we do it by ourself. That's why give 0 to connect operation.    
   105     // because we do it by ourself. That's why give 0 to connect operation.    
   110     CIpsPlgPop3ConnectOp* connOp = CIpsPlgPop3ConnectOp::NewL(
   106     CIpsPlgPop3ConnectOp* connOp = CIpsPlgPop3ConnectOp::NewL(
   111         iMsvSession, iStatus, iService, EFalse, iActivityTimer,
   107         iMsvSession,
   112         iFSMailboxId, iFSOperationObserver, iFSRequestId, NULL,EFalse );
   108         iStatus, 
       
   109         iService, 
       
   110         EFalse, 
       
   111         iActivityTimer,
       
   112         iFSMailboxId, 
       
   113         iFSOperationObserver, 
       
   114         iFSRequestId, 
       
   115         NULL );
   113         
   116         
   114     delete iOperation;
   117     delete iSubOperation;
   115     iOperation = connOp;
   118     iSubOperation = connOp;
   116 
   119 
   117     SetActive();
   120     SetActive();
   118     }
   121     }
   119 
   122 
   120 // ----------------------------------------------------------------------------
   123 // ----------------------------------------------------------------------------
   125     FUNC_LOG;
   128     FUNC_LOG;
   126 
   129 
   127     iState = EStateFetching;
   130     iState = EStateFetching;
   128 
   131 
   129     // Switch operations.
   132     // Switch operations.
   130     delete iOperation;
   133     delete iSubOperation;
   131     iOperation = NULL;
   134     iSubOperation = NULL;
   132     iStatus = KRequestPending;
       
   133 
   135 
   134     // Filters are not used when performing 'fetch' operation, use normal 
   136     // Filters are not used when performing 'fetch' operation, use normal 
   135     // getmail info instead
   137     // getmail info instead
   136     TPckg<TImPop3GetMailInfo> param( iGetMailInfo );
   138     TPckg<TImPop3GetMailInfo> param( iGetMailInfo );
   137     InvokeClientMtmAsyncFunctionL( iFunctionId, *iSelection, iService, param );
   139     InvokeClientMtmAsyncFunctionL( iFunctionId, *iSelection, param );
   138     SetActive();
   140     SetActive();
   139     }
   141     }
   140 
   142 
   141 
   143 // ----------------------------------------------------------------------------
   142 
   144 // ----------------------------------------------------------------------------
   143 // ----------------------------------------------------------------------------
   145 // <qmail> priority parameter has been removed
   144 // ----------------------------------------------------------------------------
       
   145 CIpsPlgPop3FetchOperation::CIpsPlgPop3FetchOperation(
   146 CIpsPlgPop3FetchOperation::CIpsPlgPop3FetchOperation(
   146     CMsvSession& aMsvSession,
   147     CMsvSession& aMsvSession,
   147     TRequestStatus& aObserverRequestStatus,
   148     TRequestStatus& aObserverRequestStatus,
   148     TInt aFunctionId,
   149     TInt aFunctionId,
   149     TMsvId aService,
   150     TMsvId aService,
   150     CIpsPlgTimerOperation& aActivityTimer,
   151     CIpsPlgTimerOperation& aActivityTimer,
   151     const TImPop3GetMailInfo& aGetMailInfo,
   152     const TImPop3GetMailInfo& aGetMailInfo,
   152     TFSMailMsgId aFSMailBoxId,
   153     TFSMailMsgId aFSMailBoxId,
   153     MFSMailRequestObserver& aFSOperationObserver,
   154     MFSMailRequestObserver* aFSOperationObserver,
   154     TInt aFSRequestId,
   155     TInt aFSRequestId,
   155     CIpsPlgEventHandler* aEventHandler )
   156     CIpsPlgEventHandler* aEventHandler )
   156     : 
   157     : 
   157     CIpsPlgOnlineOperation( aMsvSession, KFetchOpPriority,
   158     CIpsPlgOnlineOperation(
   158         aObserverRequestStatus, aActivityTimer, aFSMailBoxId,
   159         aMsvSession,
   159         aFSOperationObserver, aFSRequestId), iFunctionId( aFunctionId ),
   160         aObserverRequestStatus, 
   160         iGetMailInfo( aGetMailInfo ), iEventHandler( aEventHandler )
   161         aActivityTimer, 
       
   162         aFSMailBoxId,
       
   163         aFSOperationObserver, 
       
   164         aFSRequestId ),
       
   165     iFunctionId( aFunctionId ),
       
   166     iGetMailInfo( aGetMailInfo ), 
       
   167     iEventHandler( aEventHandler )
   161     {
   168     {
   162     FUNC_LOG;
   169     FUNC_LOG;
   163     iService = aService;
   170     iService = aService;
   164     }
   171     }
   165 
   172 
   169     {
   176     {
   170     FUNC_LOG;
   177     FUNC_LOG;
   171 
   178 
   172     TRAP( iError, DoRunL() );
   179     TRAP( iError, DoRunL() );
   173     
   180     
   174     if(iError != KErrNone)
   181     if( iError )
   175         {        
   182         {        
   176         // Notify observer we have finished.
   183         // Notify observer we have finished.
   177         CompleteObserver();
   184         CompleteObserver();
   178         }    
   185         }    
   179     }
   186     }
   224             TInt err = iStatus.Int();
   231             TInt err = iStatus.Int();
   225 
   232 
   226             if( KErrNone != err )
   233             if( KErrNone != err )
   227                 {
   234                 {
   228                 TPckgBuf<TPop3Progress> paramPack;
   235                 TPckgBuf<TPop3Progress> paramPack;
   229                 if ( iOperation )
   236                 if ( iSubOperation )
   230                     {
   237                     {
   231                 paramPack.Copy( iOperation->ProgressL() );
   238                 paramPack.Copy( iSubOperation->ProgressL() );
   232                     }
   239                     }
   233                 TPop3Progress& progress = paramPack();
   240                 TPop3Progress& progress = paramPack();
   234                 progress.iErrorCode = err;
   241                 progress.iErrorCode = err;
   235                 iFetchErrorProgress = paramPack.AllocL();
   242                 iFetchErrorProgress = paramPack.AllocL();
   236                 }
   243                 }
   286         }
   293         }
   287     
   294     
   288     return result;
   295     return result;
   289     }
   296     }
   290 
   297 
   291 // EOF
   298 // <qmail> new func to this op
   292 
   299 // ----------------------------------------------------------------------------
       
   300 // ----------------------------------------------------------------------------    
       
   301 TIpsOpType CIpsPlgPop3FetchOperation::IpsOpType() const
       
   302     {
       
   303     FUNC_LOG;
       
   304     return EIpsOpTypePop3FetchOp;
       
   305     }