14 * Description: |
14 * Description: |
15 * Move a selection of messages that may or may not be complete |
15 * Move a selection of messages that may or may not be complete |
16 * |
16 * |
17 */ |
17 */ |
18 |
18 |
19 |
|
20 #include "emailtrace.h" |
19 #include "emailtrace.h" |
21 #include "ipsplgheaders.h" |
20 #include "ipsplgheaders.h" |
22 |
21 |
23 const TInt KMoveRemoteOpPriority = CActive::EPriorityStandard; |
22 // <qmail> priority parameter has been removed |
24 |
23 |
25 // ---------------------------------------------------------------------------- |
24 // ---------------------------------------------------------------------------- |
26 // ---------------------------------------------------------------------------- |
25 // ---------------------------------------------------------------------------- |
27 CIpsPlgImap4MoveRemoteOp* CIpsPlgImap4MoveRemoteOp::NewL( |
26 CIpsPlgImap4MoveRemoteOp* CIpsPlgImap4MoveRemoteOp::NewL( |
28 CMsvSession& aMsvSession, |
27 CMsvSession& aMsvSession, |
29 TRequestStatus& aObserverRequestStatus, |
28 TRequestStatus& aObserverRequestStatus, |
30 TInt aFunctionId, |
|
31 TMsvId aService, |
29 TMsvId aService, |
32 CIpsPlgTimerOperation& aActivityTimer, |
30 CIpsPlgTimerOperation& aActivityTimer, |
33 const TImImap4GetMailInfo& aGetMailInfo, |
31 const TMsvId& aDestinationFolderId, |
34 const CMsvEntrySelection& aSel, |
32 const CMsvEntrySelection& aSelection, |
35 TFSMailMsgId aFSMailBoxId, |
33 TFSMailMsgId aFSMailBoxId, |
36 MFSMailRequestObserver& aFSOperationObserver, |
34 MFSMailRequestObserver* aFSOperationObserver, |
37 TInt aFSRequestId ) |
35 TInt aFSRequestId ) |
38 { |
36 { |
39 FUNC_LOG; |
37 FUNC_LOG; |
40 CIpsPlgImap4MoveRemoteOp* op = new (ELeave) CIpsPlgImap4MoveRemoteOp( |
38 CIpsPlgImap4MoveRemoteOp* op = new (ELeave) CIpsPlgImap4MoveRemoteOp( |
41 aMsvSession, |
39 aMsvSession, |
42 aObserverRequestStatus, |
40 aObserverRequestStatus, |
43 aFunctionId, |
|
44 aService, |
41 aService, |
45 aActivityTimer, |
42 aActivityTimer, |
46 aGetMailInfo, |
43 aDestinationFolderId, |
47 aFSMailBoxId, |
44 aFSMailBoxId, |
48 aFSOperationObserver, |
45 aFSOperationObserver, |
49 aFSRequestId ); |
46 aFSRequestId ); |
50 |
47 |
51 CleanupStack::PushL( op ); |
48 CleanupStack::PushL( op ); |
52 op->ConstructL( aSel ); |
49 op->ConstructL( aSelection ); |
53 CleanupStack::Pop( op ); |
50 CleanupStack::Pop( op ); |
54 return op; |
51 return op; |
55 } |
52 } |
56 |
53 |
57 // ---------------------------------------------------------------------------- |
54 // ---------------------------------------------------------------------------- |
58 // ---------------------------------------------------------------------------- |
55 // ---------------------------------------------------------------------------- |
|
56 // <qmail> priority parameter has been removed |
59 CIpsPlgImap4MoveRemoteOp::CIpsPlgImap4MoveRemoteOp( |
57 CIpsPlgImap4MoveRemoteOp::CIpsPlgImap4MoveRemoteOp( |
60 CMsvSession& aMsvSession, |
58 CMsvSession& aMsvSession, |
61 TRequestStatus& aObserverRequestStatus, |
59 TRequestStatus& aObserverRequestStatus, |
62 TInt aFunctionId, |
|
63 TMsvId aService, |
60 TMsvId aService, |
64 CIpsPlgTimerOperation& aActivityTimer, |
61 CIpsPlgTimerOperation& aActivityTimer, |
65 const TImImap4GetMailInfo& aGetMailInfo, |
62 const TMsvId& aDestinationFolderId, |
66 TFSMailMsgId aFSMailBoxId, |
63 TFSMailMsgId aFSMailBoxId, |
67 MFSMailRequestObserver& aFSOperationObserver, |
64 MFSMailRequestObserver* aFSOperationObserver, |
68 TInt aFSRequestId ) |
65 TInt aFSRequestId ) |
69 : |
66 : |
70 CIpsPlgOnlineOperation( |
67 CIpsPlgOnlineOperation( |
71 aMsvSession, |
68 aMsvSession, |
72 KMoveRemoteOpPriority, |
69 aObserverRequestStatus, |
73 aObserverRequestStatus, |
70 aActivityTimer, |
74 aActivityTimer, |
71 aFSMailBoxId, |
75 aFSMailBoxId, |
72 aFSOperationObserver, |
76 aFSOperationObserver, |
73 aFSRequestId ), |
77 aFSRequestId ), |
74 iState( EIdle ), |
78 iFunctionId(aFunctionId), |
75 iDestinationFolderId( aDestinationFolderId ) |
79 iGetMailInfo(aGetMailInfo) |
76 { |
80 { |
77 FUNC_LOG; |
81 FUNC_LOG; |
78 iService = aService; |
82 iService = aService; |
|
83 } |
79 } |
84 |
80 |
85 // ---------------------------------------------------------------------------- |
81 // ---------------------------------------------------------------------------- |
86 // ---------------------------------------------------------------------------- |
82 // ---------------------------------------------------------------------------- |
87 CIpsPlgImap4MoveRemoteOp::~CIpsPlgImap4MoveRemoteOp() |
83 CIpsPlgImap4MoveRemoteOp::~CIpsPlgImap4MoveRemoteOp() |
88 { |
84 { |
89 FUNC_LOG; |
85 FUNC_LOG; |
90 delete iLocalSel; |
86 delete iLocalSel; |
91 delete iRemoteSel; |
87 delete iRemoteSel; |
|
88 delete iMoveErrorProgress; |
92 } |
89 } |
93 |
90 |
94 // ---------------------------------------------------------------------------- |
91 // ---------------------------------------------------------------------------- |
95 // ---------------------------------------------------------------------------- |
92 // ---------------------------------------------------------------------------- |
96 void CIpsPlgImap4MoveRemoteOp::ConstructL( const CMsvEntrySelection& aSel ) |
93 void CIpsPlgImap4MoveRemoteOp::ConstructL( const CMsvEntrySelection& aSel ) |
107 { |
104 { |
108 FUNC_LOG; |
105 FUNC_LOG; |
109 iState = EConnecting; |
106 iState = EConnecting; |
110 iStatus = KRequestPending; |
107 iStatus = KRequestPending; |
111 |
108 |
|
109 // <qmail> priority parameter has been removed |
112 CIpsPlgImap4ConnectOp* connOp = CIpsPlgImap4ConnectOp::NewL( |
110 CIpsPlgImap4ConnectOp* connOp = CIpsPlgImap4ConnectOp::NewL( |
113 iMsvSession, |
111 iMsvSession, |
114 KMoveRemoteOpPriority, |
|
115 iStatus, |
112 iStatus, |
116 iService, |
113 iService, |
117 iActivityTimer, |
114 iActivityTimer, |
118 iFSMailboxId, |
115 iFSMailboxId, |
119 iFSOperationObserver, |
116 NULL, // no operationobserver for suboperation |
120 iFSRequestId, |
117 0, // no requestId needed |
121 NULL, // event handler not needed whin plain connect |
118 NULL, // event handler not needed whin plain connect |
122 ETrue, |
119 ETrue ); // do only connect |
123 EFalse ); |
|
124 |
120 |
125 delete iOperation; |
121 delete iSubOperation; |
126 iOperation = connOp; |
122 iSubOperation = connOp; |
127 |
123 |
128 SetActive(); |
124 SetActive(); |
129 } |
125 } |
130 |
126 |
131 // ---------------------------------------------------------------------------- |
127 // ---------------------------------------------------------------------------- |
307 // find the parent of the moved message... |
302 // find the parent of the moved message... |
308 TMsvId parent = cEntry->Entry().Parent(); |
303 TMsvId parent = cEntry->Entry().Parent(); |
309 // and use it as a context |
304 // and use it as a context |
310 cEntry->SetEntryL( parent ); |
305 cEntry->SetEntryL( parent ); |
311 |
306 |
312 delete iOperation; |
307 delete iSubOperation; |
313 iOperation = NULL; |
308 iSubOperation = NULL; |
314 iOperation = cEntry->MoveL( *iLocalSel, |
309 iSubOperation = cEntry->MoveL( *iLocalSel, iDestinationFolderId, iStatus ); |
315 iGetMailInfo.iDestinationFolder, |
|
316 iStatus ); |
|
317 CleanupStack::PopAndDestroy( cEntry ); |
310 CleanupStack::PopAndDestroy( cEntry ); |
318 SetActive(); |
311 SetActive(); |
319 } |
312 } |
320 else |
313 else |
321 { |
314 { |
322 SetActive(); |
315 // <qmail> SetActive(); moved inside CompleteThis(); |
323 CompleteThis(); |
316 CompleteThis(); |
324 } |
317 } |
325 } |
318 } |
326 |
319 |
327 // ---------------------------------------------------------------------------- |
320 // ---------------------------------------------------------------------------- |
328 // ---------------------------------------------------------------------------- |
321 // ---------------------------------------------------------------------------- |
329 void CIpsPlgImap4MoveRemoteOp::DoMoveRemoteL() |
322 void CIpsPlgImap4MoveRemoteOp::DoMoveRemoteL() |
330 { |
323 { |
331 FUNC_LOG; |
324 FUNC_LOG; |
332 iState = ERemoteMsgs; |
325 iState = ERemoteMsgs; |
333 iStatus = KRequestPending; |
|
334 // first element of the CMsvEntrySelection is the service which is then |
326 // first element of the CMsvEntrySelection is the service which is then |
335 // followed by any messages |
327 // followed by any messages |
336 if( iRemoteSel->Count() > 1 ) |
328 if( iRemoteSel->Count() > 1 ) |
337 { |
329 { |
338 // Switch operations. |
330 // <qmail> deletion of iSubOperation is done inside InvokeClientMtmAsyncFunctionL </qmail> |
339 delete iOperation; |
|
340 iOperation = NULL; |
|
341 |
331 |
342 // Filters are not used when performing 'move' operation, use normal |
332 // Filters are not used when performing 'move' operation, use normal |
343 // getmail info instead |
333 // getmail info instead |
344 TPckg<TImImap4GetMailInfo> param( iGetMailInfo ); |
334 TPckgBuf<TImImap4GetMailInfo> paramBuf; |
345 InvokeClientMtmAsyncFunctionL( iFunctionId, *iRemoteSel, iService, param ); |
335 TImImap4GetMailInfo& mailInfo = paramBuf(); |
|
336 mailInfo.iMaxEmailSize = KMaxTInt32; |
|
337 mailInfo.iGetMailBodyParts = EGetImap4EmailBodyTextAndAttachments; |
|
338 mailInfo.iDestinationFolder = iDestinationFolderId; |
|
339 |
|
340 InvokeClientMtmAsyncFunctionL( KIMAP4MTMMoveMailSelectionWhenAlreadyConnected, *iRemoteSel, paramBuf ); |
346 SetActive(); |
341 SetActive(); |
347 } |
342 } |
348 else |
343 else |
349 { |
344 { |
350 SetActive(); |
345 // <qmail> SetActive(); moved inside CompleteThis(); |
351 CompleteThis(); |
346 CompleteThis(); |
352 } |
347 } |
353 } |
348 } |
354 |
349 |
|
350 // <qmail> removed CIpsPlgImap4MoveRemoteOp::GetEngineProgress( const TDesC8& aProgress ) |
|
351 |
|
352 // <qmail> new func to this op |
355 // ---------------------------------------------------------------------------- |
353 // ---------------------------------------------------------------------------- |
356 // ---------------------------------------------------------------------------- |
354 // ---------------------------------------------------------------------------- |
357 TInt CIpsPlgImap4MoveRemoteOp::GetEngineProgress( const TDesC8& aProgress ) |
355 TIpsOpType CIpsPlgImap4MoveRemoteOp::IpsOpType() const |
358 { |
356 { |
359 FUNC_LOG; |
357 FUNC_LOG; |
360 if( !aProgress.Length() ) |
358 return EIpsOpTypeMoveRemoteOp; |
361 { |
359 } |
362 return KErrNone; |
|
363 } |
|
364 else |
|
365 { |
|
366 TPckgBuf<TImap4CompoundProgress> paramPack; |
|
367 paramPack.Copy( aProgress ); |
|
368 const TImap4GenericProgress& progress = paramPack().iGenericProgress; |
|
369 |
|
370 return progress.iErrorCode; |
|
371 } |
|
372 } |
|
373 |
|