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