13 * |
13 * |
14 * Description: IMAP4 remote move message operation |
14 * Description: IMAP4 remote move message operation |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 #ifndef __IPSPLGIMAP4MOVEREMOTEOP_H__ |
18 #ifndef IPSPLGIMAP4MOVEREMOTEOP_H |
19 #define __IPSPLGIMAP4MOVEREMOTEOP_H__ |
19 #define IPSPLGIMAP4MOVEREMOTEOP_H |
20 |
|
21 |
20 |
22 #include "ipsplgonlineoperation.h" |
21 #include "ipsplgonlineoperation.h" |
23 #include "mfsmailrequestobserver.h" |
22 // <qmail> mfsmailrequestobserver include removed |
24 |
23 |
25 /** |
24 /** |
26 * Move a selection of messages that may or may not be complete. |
25 * Move a selection of messages that may or may not be complete. |
27 * Always fetches entire messages. |
26 * Always fetches entire messages. |
28 */ |
27 */ |
29 class CIpsPlgImap4MoveRemoteOp : |
28 NONSHARABLE_CLASS ( CIpsPlgImap4MoveRemoteOp ) : |
30 public CIpsPlgOnlineOperation |
29 public CIpsPlgOnlineOperation |
31 { |
30 { |
32 public: |
31 public: |
33 /** |
32 /** |
34 * |
33 * NewL |
35 * @param aSession: Server session. |
34 * @param aMsvSession client/server session to MsvServer |
36 * @param aStatus: Observer completion status. |
35 * @param aObserverRequestStatus client's status |
37 * @param aReporter: Progress reporter. |
36 * @param aService serviceId of the mailbox |
38 * @param aSel: The message ids to get. |
37 * @param aActivityTimer mailbox specific activity timer |
39 * @param aTargetId: Where to fetch the messages to. |
38 * @param aDestinationFolder destination folder id to where the messages are to be moved |
40 * @param aCopy: Copying or moving. |
39 * @param aSelection selection of messages |
41 */ |
40 * @param aFSMailBoxId identifies mailbox |
42 static CIpsPlgImap4MoveRemoteOp* NewL( |
41 * @param aFSOperationObserver observer of this operation |
43 CMsvSession& aMsvSession, |
42 * @param aFSRequestId client assigned request identifier |
44 TRequestStatus& aObserverRequestStatus, |
43 * @return class instance |
45 TInt aFunctionId, |
44 */ |
46 TMsvId aService, |
45 // <qmail> parameters changed: aFunctionId removed, TImImap4GetMailInfo& -> TMsvId& |
47 CIpsPlgTimerOperation& aActivityTimer, |
46 // <qmail> MFSMailRequestObserver* changed to pointer |
48 const TImImap4GetMailInfo& aGetMailInfo, |
47 static CIpsPlgImap4MoveRemoteOp* NewL( |
49 const CMsvEntrySelection& aSel, |
48 CMsvSession& aMsvSession, |
50 TFSMailMsgId aFSMailBoxId, |
49 TRequestStatus& aObserverRequestStatus, |
51 MFSMailRequestObserver& aFSOperationObserver, |
50 TMsvId aService, |
52 TInt aFSRequestId ); |
51 CIpsPlgTimerOperation& aActivityTimer, |
|
52 const TMsvId& aDestinationFolder, |
|
53 const CMsvEntrySelection& aSelection, |
|
54 TFSMailMsgId aFSMailBoxId, |
|
55 MFSMailRequestObserver* aFSOperationObserver, |
|
56 TInt aFSRequestId ); |
53 |
57 |
54 /** |
58 virtual ~CIpsPlgImap4MoveRemoteOp(); |
55 * |
59 |
56 */ |
60 /** |
57 virtual ~CIpsPlgImap4MoveRemoteOp(); |
61 * From MsvOperation |
58 |
62 * Gets information on the progress of the operation |
59 /** |
63 * (see MsvOperation header) |
60 * |
64 */ |
61 */ |
65 const TDesC8& ProgressL(); |
62 const TDesC8& ProgressL(); |
66 |
63 |
67 /** |
64 /** |
68 * From CIpsPlgBaseOperation |
65 * |
69 * For reporting if DoRunL leaves |
66 */ |
70 */ |
67 const TDesC8& GetErrorProgressL( TInt aError ); |
71 const TDesC8& GetErrorProgressL( TInt aError ); |
68 |
72 |
69 /** |
73 TFSProgress GetFSProgressL() const; |
70 * |
74 |
71 */ |
75 // <qmail> new func to this op |
72 TFSProgress GetFSProgressL() const; |
76 /** |
73 |
77 * Returns operation type |
74 private: |
78 */ |
|
79 TIpsOpType IpsOpType() const; |
|
80 |
|
81 private: |
|
82 // <qmail> parameters changed |
|
83 /** |
|
84 * for explanation of parameters, see NewL |
|
85 */ |
|
86 CIpsPlgImap4MoveRemoteOp( |
|
87 CMsvSession& aMsvSession, |
|
88 TRequestStatus& aObserverRequestStatus, |
|
89 TMsvId aService, |
|
90 CIpsPlgTimerOperation& aActivityTimer, |
|
91 const TMsvId& aDestinationFolder, |
|
92 TFSMailMsgId aFSMailBoxId, |
|
93 MFSMailRequestObserver* aFSOperationObserver, |
|
94 TInt aFSRequestId ); |
75 |
95 |
76 /** |
96 void ConstructL( const CMsvEntrySelection& aSelection ); |
77 * for explanation of parameters, see NewL |
97 |
78 */ |
98 void RunL(); |
79 CIpsPlgImap4MoveRemoteOp( |
99 |
80 CMsvSession& aMsvSession, |
100 /** |
81 TRequestStatus& aObserverRequestStatus, |
101 * actual implementation of RunL's functionality |
82 TInt aFunctionId, |
102 * RunL wraps and traps this function |
83 TMsvId aService, |
103 */ |
84 CIpsPlgTimerOperation& aActivityTimer, |
104 void DoRunL(); |
85 const TImImap4GetMailInfo& aGetMailInfo, |
105 |
86 TFSMailMsgId aFSMailBoxId, |
106 void DoConnectL(); |
87 MFSMailRequestObserver& aFSOperationObserver, |
107 |
88 TInt aFSRequestId ); |
108 /** |
|
109 * Sort messages into complete and incomplete. |
|
110 */ |
|
111 void SortMessageSelectionL(const CMsvEntrySelection& aSel); |
|
112 |
|
113 /** |
|
114 * Completes client's status |
|
115 */ |
|
116 void Complete(); |
89 |
117 |
90 /** |
118 /** |
91 * |
119 * handles remote moving |
92 */ |
120 */ |
93 void ConstructL(const CMsvEntrySelection& aSel); |
121 void DoMoveRemoteL(); |
94 |
122 |
95 /** |
123 // <qmail> removed TInt GetEngineProgress( const TDesC8& aProgress ); |
96 * RunL() |
|
97 */ |
|
98 void RunL(); |
|
99 |
|
100 /** |
|
101 * |
|
102 */ |
|
103 void DoRunL(); |
|
104 |
|
105 |
|
106 /** |
|
107 * |
|
108 */ |
|
109 void DoConnectL(); |
|
110 |
|
111 /** |
|
112 * |
|
113 * Sort messages into complete and incomplete. |
|
114 */ |
|
115 void SortMessageSelectionL(const CMsvEntrySelection& aSel); |
|
116 |
|
117 /** |
|
118 * |
|
119 */ |
|
120 |
124 |
121 void Complete(); |
125 private: |
|
126 // internal state of this operation |
|
127 enum TState |
|
128 { |
|
129 EIdle, |
|
130 EConnecting, |
|
131 ELocalMsgs, |
|
132 ERemoteMsgs |
|
133 }; |
|
134 TState iState; |
122 |
135 |
123 /** |
136 // <qmail> iFunctionId removed, TImImap4GetMailInfo -> TMsvId |
124 * |
137 // used in error situations |
125 */ |
138 TDesC8* iMoveErrorProgress; |
126 void DoMoveRemoteL(); |
139 // <qmail> using destination folder Id instead of mailInfo struct |
127 |
140 // specifies folder where to move |
128 protected: |
141 TMsvId iDestinationFolderId; |
129 |
142 // <qmail> removed iSelection; |
130 /** |
143 CMsvEntrySelection* iRemoteSel; // Incomplete messages to be fetched. |
131 * From CIpsPlgOnlineoperation |
144 TPckgBuf<TImap4CompoundProgress> iProgressBuf; |
132 */ |
145 TPckgBuf<TImap4SyncProgress> iSyncProgress; |
133 TInt GetEngineProgress( const TDesC8& aProgress ); |
|
134 |
|
135 private: |
|
136 enum TState { EIdle, EConnecting, ELocalMsgs, ERemoteMsgs }; |
|
137 TState iState; |
|
138 TInt iFunctionId; |
|
139 TDesC8* iMoveErrorProgress; |
|
140 TImImap4GetMailInfo iGetMailInfo; |
|
141 CMsvEntrySelection* iSelection; |
|
142 CMsvEntrySelection* iRemoteSel; // Incomplete messages to be fetched. |
|
143 TPckgBuf<TImap4CompoundProgress> iProgressBuf; |
|
144 TPckgBuf<TImap4SyncProgress> iSyncProgress; |
|
145 }; |
146 }; |
146 |
147 |
147 |
148 |
148 NONSHARABLE_CLASS( CIpsPlgImap4MoveRemoteOpObserver ) : public CBase, |
149 NONSHARABLE_CLASS( CIpsPlgImap4MoveRemoteOpObserver ) : public CBase, |
149 public MFSMailRequestObserver |
150 public MFSMailRequestObserver |