18 |
18 |
19 |
19 |
20 #include "emailtrace.h" |
20 #include "emailtrace.h" |
21 #include "ipsplgheaders.h" |
21 #include "ipsplgheaders.h" |
22 |
22 |
23 // <qmail> priority const has been removed, interval changed to 0.2 sec |
23 // Constants and defines |
24 const TInt KIpsAttaFetchProgressReportInterval = 200000; // 0.2 sec |
24 const TInt KFetchOpPriority = CActive::EPriorityStandard; |
|
25 const TInt KIpsAttaFetchProgressReportInterval = 1000000; // 1 sec |
25 const TInt KIpsAttaFetchRetryInterval = 1000000; // 1 sec |
26 const TInt KIpsAttaFetchRetryInterval = 1000000; // 1 sec |
26 const TInt KIpsAttaFetchRetryCount = 30; |
27 const TInt KIpsAttaFetchRetryCount = 30; |
27 |
28 |
28 // ---------------------------------------------------------------------------- |
29 // ---------------------------------------------------------------------------- |
29 // ---------------------------------------------------------------------------- |
30 // ---------------------------------------------------------------------------- |
96 iAttaOp.ReportProgressL(); |
97 iAttaOp.ReportProgressL(); |
97 AdjustTimer(); |
98 AdjustTimer(); |
98 } |
99 } |
99 |
100 |
100 // ---------------------------------------------------------------------------- |
101 // ---------------------------------------------------------------------------- |
101 // CIpsPlgImap4FetchAttachmentOp |
102 // ---------------------------------------------------------------------------- |
102 // ---------------------------------------------------------------------------- |
|
103 // <qmail> aFunctionId removed, CMsvEntrySelection& changed to pointer |
|
104 // <qmail> MFSMailRequestObserver& changed to pointer |
|
105 CIpsPlgImap4FetchAttachmentOp* CIpsPlgImap4FetchAttachmentOp::NewL( |
103 CIpsPlgImap4FetchAttachmentOp* CIpsPlgImap4FetchAttachmentOp::NewL( |
106 CMsvSession& aMsvSession, |
104 CMsvSession& aMsvSession, |
107 TRequestStatus& aObserverRequestStatus, |
105 TRequestStatus& aObserverRequestStatus, |
|
106 TInt aFunctionId, |
108 TMsvId aService, |
107 TMsvId aService, |
109 CIpsPlgTimerOperation& aActivityTimer, |
108 CIpsPlgTimerOperation& aActivityTimer, |
110 const CMsvEntrySelection* aSelection, |
109 const TImImap4GetMailInfo& aGetMailInfo, |
|
110 const CMsvEntrySelection& aSel, |
111 TFSMailMsgId aFSMailBoxId, |
111 TFSMailMsgId aFSMailBoxId, |
112 MFSMailRequestObserver* aFSOperationObserver, |
112 MFSMailRequestObserver& aFSOperationObserver, |
113 TInt aFSRequestId ) |
113 TInt aFSRequestId ) |
114 { |
114 { |
115 FUNC_LOG; |
115 FUNC_LOG; |
116 CIpsPlgImap4FetchAttachmentOp* op = new ( |
116 CIpsPlgImap4FetchAttachmentOp* op = new ( |
117 ELeave) CIpsPlgImap4FetchAttachmentOp( |
117 ELeave) CIpsPlgImap4FetchAttachmentOp( |
118 aMsvSession, |
118 aMsvSession, |
119 aObserverRequestStatus, |
119 aObserverRequestStatus, |
|
120 aFunctionId, |
120 aService, |
121 aService, |
121 aActivityTimer, |
122 aActivityTimer, |
122 aSelection, |
123 aGetMailInfo, |
123 aFSMailBoxId, |
124 aFSMailBoxId, |
124 aFSOperationObserver, |
125 aFSOperationObserver, |
125 aFSRequestId ); |
126 aFSRequestId ); |
126 |
127 |
127 CleanupStack::PushL( op ); |
128 CleanupStack::PushL( op ); |
128 op->ConstructL(); |
129 op->ConstructL( aSel ); |
129 CleanupStack::Pop( op ); |
130 CleanupStack::Pop( op ); |
130 return op; |
131 return op; |
131 } |
132 } |
132 |
133 |
133 // ---------------------------------------------------------------------------- |
134 // ---------------------------------------------------------------------------- |
134 // ---------------------------------------------------------------------------- |
135 // ---------------------------------------------------------------------------- |
135 // <qmail> priority parameter has been removed |
|
136 // <qmail> MFSMailRequestObserver& changed to pointer |
|
137 CIpsPlgImap4FetchAttachmentOp::CIpsPlgImap4FetchAttachmentOp( |
136 CIpsPlgImap4FetchAttachmentOp::CIpsPlgImap4FetchAttachmentOp( |
138 CMsvSession& aMsvSession, |
137 CMsvSession& aMsvSession, |
139 TRequestStatus& aObserverRequestStatus, |
138 TRequestStatus& aObserverRequestStatus, |
|
139 TInt aFunctionId, |
140 TMsvId aService, |
140 TMsvId aService, |
141 CIpsPlgTimerOperation& aActivityTimer, |
141 CIpsPlgTimerOperation& aActivityTimer, |
142 const CMsvEntrySelection* aSelection, |
142 const TImImap4GetMailInfo& aGetMailInfo, |
143 TFSMailMsgId aFSMailBoxId, |
143 TFSMailMsgId aFSMailBoxId, |
144 MFSMailRequestObserver* aFSOperationObserver, |
144 MFSMailRequestObserver& aFSOperationObserver, |
145 TInt aFSRequestId ) |
145 TInt aFSRequestId ) |
146 : |
146 : |
147 CIpsPlgOnlineOperation( |
147 CIpsPlgOnlineOperation( |
148 aMsvSession, |
148 aMsvSession, |
149 aObserverRequestStatus, |
149 KFetchOpPriority, |
150 aActivityTimer, |
150 aObserverRequestStatus, |
151 aFSMailBoxId, |
151 aActivityTimer, |
152 aFSOperationObserver, |
152 aFSMailBoxId, |
153 aFSRequestId ), |
153 aFSOperationObserver, |
154 iSelection( aSelection ), |
154 aFSRequestId), |
155 iRetryCount( 0 ) |
155 iSelection( NULL ), |
|
156 iGetMailInfo(aGetMailInfo), |
|
157 iFunctionId(aFunctionId), |
|
158 iRetryCount( 0 ) |
156 { |
159 { |
157 FUNC_LOG; |
160 FUNC_LOG; |
158 iService = aService; |
161 iService = aService; |
159 iRetryTimer.CreateLocal(); |
162 iRetryTimer.CreateLocal(); |
160 } |
163 } |
185 { |
188 { |
186 FUNC_LOG; |
189 FUNC_LOG; |
187 iState = EStateConnecting; |
190 iState = EStateConnecting; |
188 iStatus = KRequestPending; |
191 iStatus = KRequestPending; |
189 |
192 |
190 // <qmail> priority parameter has been removed |
|
191 CIpsPlgImap4ConnectOp* connOp = CIpsPlgImap4ConnectOp::NewL( |
193 CIpsPlgImap4ConnectOp* connOp = CIpsPlgImap4ConnectOp::NewL( |
192 iMsvSession, |
194 iMsvSession, |
|
195 KFetchOpPriority, |
193 iStatus, |
196 iStatus, |
194 iService, |
197 iService, |
195 *iActivityTimer, |
198 *iActivityTimer, |
196 iFSMailboxId, |
199 iFSMailboxId, |
197 NULL, // no observer for subopertaion |
200 iFSOperationObserver, |
198 0, // no requestId needed |
201 iFSRequestId, |
199 NULL, // event handler not needed whin plain connect |
202 NULL, // event handler not needed whin plain connect |
200 ETrue ); |
203 ETrue, |
|
204 EFalse ); |
201 |
205 |
202 delete iSubOperation; |
206 delete iOperation; |
203 iSubOperation = connOp; |
207 iOperation = connOp; |
204 |
208 |
205 SetActive(); |
209 SetActive(); |
206 } |
210 } |
207 |
211 |
208 // ---------------------------------------------------------------------------- |
212 // ---------------------------------------------------------------------------- |
308 void CIpsPlgImap4FetchAttachmentOp::ReportProgressL() |
314 void CIpsPlgImap4FetchAttachmentOp::ReportProgressL() |
309 { |
315 { |
310 FUNC_LOG; |
316 FUNC_LOG; |
311 TInt error = KErrNone; |
317 TInt error = KErrNone; |
312 TFSProgress fsProgress = { TFSProgress::EFSStatus_Waiting, 0, 0, KErrNone }; |
318 TFSProgress fsProgress = { TFSProgress::EFSStatus_Waiting, 0, 0, KErrNone }; |
313 if ( iSubOperation && iState == EStateFetching ) |
319 if ( iOperation && iState == EStateFetching ) |
314 { |
320 { |
315 TRAP(error, iProgress.Copy( iSubOperation->ProgressL() ) ); |
321 TRAP(error, iProgress.Copy( iOperation->ProgressL() ) ); |
316 } |
322 } |
317 |
323 |
318 if ( error == KErrNone ) |
324 if ( error == KErrNone ) |
319 { |
325 { |
320 const TImap4GenericProgress& progg = iProgress().iGenericProgress; |
326 const TImap4GenericProgress& progg = iProgress().iGenericProgress; |
397 { |
397 { |
398 FUNC_LOG; |
398 FUNC_LOG; |
399 iState = EStateFetching; |
399 iState = EStateFetching; |
400 |
400 |
401 // Switch operations. |
401 // Switch operations. |
402 delete iSubOperation; |
402 delete iOperation; |
403 iSubOperation = NULL; |
403 iOperation = NULL; |
404 iStatus = KRequestPending; |
404 iStatus = KRequestPending; |
405 |
405 |
406 iProgReport = CIpsFetchProgReport::NewL( *this ); |
406 iProgReport = CIpsFetchProgReport::NewL( *this ); |
407 |
407 |
408 // Filters are not used when performing 'fetch' operation, |
408 // Filters are not used when performing 'fetch' operation, |
409 // use normal getmail info instead |
409 // use normal getmail info instead |
410 // <qmail> |
410 TPckg<TImImap4GetMailInfo> param(iGetMailInfo); |
411 TPckgBuf<TImImap4GetMailInfo> param; |
411 InvokeClientMtmAsyncFunctionL( iFunctionId, *iSelection, iService, param ); |
412 TImImap4GetMailInfo& options = param(); |
|
413 options.iMaxEmailSize = KMaxTInt32; |
|
414 options.iGetMailBodyParts = EGetImap4EmailAttachments; |
|
415 options.iDestinationFolder = 0; // not used |
|
416 |
|
417 InvokeClientMtmAsyncFunctionL( KIMAP4MTMPopulate, *iSelection, param ); // <qmail> 1 param removed |
|
418 // </qmail> |
|
419 SetActive(); |
412 SetActive(); |
420 } |
413 } |
421 |
414 |
422 // <qmail> GetEngineProgress function removed |
|
423 |
|
424 // <qmail> new func to this op |
|
425 // ---------------------------------------------------------------------------- |
415 // ---------------------------------------------------------------------------- |
426 // ---------------------------------------------------------------------------- |
416 // ---------------------------------------------------------------------------- |
427 TIpsOpType CIpsPlgImap4FetchAttachmentOp::IpsOpType() const |
417 TInt CIpsPlgImap4FetchAttachmentOp::GetEngineProgress( const TDesC8& aProgress ) |
428 { |
418 { |
429 FUNC_LOG; |
419 FUNC_LOG; |
430 return EIpsOpTypeFetchAttachmentOp; |
420 if( !aProgress.Length() ) |
431 } |
421 { |
432 // </qmail> |
422 return KErrNone; |
|
423 } |
|
424 else |
|
425 { |
|
426 TPckgBuf<TImap4CompoundProgress> paramPack; |
|
427 paramPack.Copy( aProgress ); |
|
428 const TImap4GenericProgress& progress = paramPack().iGenericProgress; |
|
429 |
|
430 return progress.iErrorCode; |
|
431 } |
|
432 } |
433 |
433 |
434 |
434 |
435 // End of File |
435 // End of File |
436 |
436 |