13 * |
13 * |
14 * Description: IMAP4 attachment fetch operation |
14 * Description: IMAP4 attachment fetch operation |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 #ifndef __IPSPLGIMAP4FETCHATTACHMENTOP_H__ |
18 #ifndef IPSPLGIMAP4FETCHATTACHMENTOP_H |
19 #define __IPSPLGIMAP4FETCHATTACHMENTOP_H__ |
19 #define IPSPLGIMAP4FETCHATTACHMENTOP_H |
20 |
|
21 |
20 |
22 class CIpsPlgImap4FetchAttachmentOp; |
21 class CIpsPlgImap4FetchAttachmentOp; |
23 |
22 |
24 /** |
23 /** |
25 * class CIpsPlgImap4FetchAttachmentOp |
24 * CIpsFetchProgReport |
26 * |
25 * helper class for the operation |
|
26 * implements a timer which initiates periodical progress updating |
27 */ |
27 */ |
28 NONSHARABLE_CLASS ( CIpsFetchProgReport ) : public CActive |
28 NONSHARABLE_CLASS ( CIpsFetchProgReport ) : public CActive |
29 { |
29 { |
30 public: |
30 public: |
31 /** |
31 /** |
32 * |
32 * @param aAttaOp (callback) reference to fetch operation that created us |
33 */ |
33 */ |
34 static CIpsFetchProgReport* NewL( |
34 static CIpsFetchProgReport* NewL( CIpsPlgImap4FetchAttachmentOp& aAttaOp ); |
35 CIpsPlgImap4FetchAttachmentOp& aAttaOp ); |
|
36 |
35 |
37 /** |
36 virtual ~CIpsFetchProgReport(); |
38 * |
|
39 */ |
|
40 ~CIpsFetchProgReport(); |
|
41 |
37 |
42 /** |
38 protected: // From CActive |
43 * |
39 virtual void DoCancel(); |
44 */ |
40 virtual void RunL(); |
45 virtual void DoCancel(); |
|
46 |
41 |
47 /** |
42 private: |
48 * |
43 CIpsFetchProgReport( CIpsPlgImap4FetchAttachmentOp& aAttaOp ); |
49 */ |
44 void ConstructL(); |
50 virtual void RunL(); |
45 void AdjustTimer(); |
51 |
|
52 private: |
|
53 |
46 |
54 /** |
47 private: // members |
55 * |
48 RTimer iTimer; |
56 */ |
49 // reference to our "parent" op |
57 CIpsFetchProgReport( |
50 CIpsPlgImap4FetchAttachmentOp& iAttaOp; |
58 CIpsPlgImap4FetchAttachmentOp& aAttaOp ); |
|
59 |
|
60 /** |
|
61 * |
|
62 */ |
|
63 void ConstructL(); |
|
64 |
|
65 /** |
|
66 * |
|
67 */ |
|
68 void AdjustTimer(); |
|
69 |
|
70 private: |
|
71 |
|
72 RTimer iTimer; |
|
73 |
|
74 CIpsPlgImap4FetchAttachmentOp& iAttaOp; |
|
75 |
|
76 }; |
51 }; |
77 |
52 |
78 /** |
53 /** |
79 * class CIpsPlgImap4FetchAttachmentOp |
54 * class CIpsPlgImap4FetchAttachmentOp |
80 * |
55 * fetches messageparts |
81 */ |
56 */ |
82 NONSHARABLE_CLASS ( CIpsPlgImap4FetchAttachmentOp ) : |
57 NONSHARABLE_CLASS ( CIpsPlgImap4FetchAttachmentOp ) : |
83 public CIpsPlgOnlineOperation |
58 public CIpsPlgOnlineOperation |
84 { |
59 { |
85 public: |
60 public: |
86 |
61 |
87 /** |
62 /** |
88 * NewL() |
63 * NewL() |
89 * Basic factory function - creates dialog with standard title resource |
64 * @param CMsvSession& client/server session to MsvServer |
90 * @param CMsvSession& |
65 * @param aObserverRequestStatus operation's observer's status |
91 * |
66 * @param aService serviceId of this mailbox |
92 * |
67 * @param aActivityTimer mailbox specific activity timer |
93 * |
68 * @param aSelection selection of message part ids, ownership moves |
94 * |
69 * @param aFSMailBoxId specifies mailbox |
95 * |
70 * @param aFSOperationObserver observes the progress of this operation |
96 * |
71 * @param aFSRequestId identifier for this instance of operation, assigned by the client |
97 * @return CIpsPlgImap4FetchAttachmentOp* self pointer |
72 * @return CIpsPlgImap4FetchAttachmentOp* self pointer |
98 */ |
73 */ |
|
74 static CIpsPlgImap4FetchAttachmentOp* NewL( |
|
75 CMsvSession& aMsvSession, |
|
76 TRequestStatus& aObserverRequestStatus, |
|
77 TMsvId aService, |
|
78 CIpsPlgTimerOperation& aActivityTimer, |
|
79 const CMsvEntrySelection* aSelection, |
|
80 TFSMailMsgId aFSMailBoxId, |
|
81 MFSMailRequestObserver* aFSOperationObserver, |
|
82 TInt aFSRequestId ); |
99 |
83 |
100 static CIpsPlgImap4FetchAttachmentOp* NewL( |
84 virtual ~CIpsPlgImap4FetchAttachmentOp(); |
101 CMsvSession& aMsvSession, |
|
102 TRequestStatus& aObserverRequestStatus, |
|
103 TInt aFunctionId, |
|
104 TMsvId aService, |
|
105 CIpsPlgTimerOperation& aActivityTimer, |
|
106 const TImImap4GetMailInfo& aGetMailInfo, |
|
107 const CMsvEntrySelection& aSel, |
|
108 TFSMailMsgId aFSMailBoxId, |
|
109 MFSMailRequestObserver& aFSOperationObserver, |
|
110 TInt aFSRequestId ); |
|
111 |
85 |
112 /** |
86 /** |
113 * ~CIpsPlgImap4FetchAttachmentOp() |
87 * From MsvOperation |
114 * destructor |
88 * Gets information on the progress of the operation |
115 */ |
89 * (see MsvOperation header) |
|
90 */ |
|
91 const TDesC8& ProgressL(); |
116 |
92 |
117 virtual ~CIpsPlgImap4FetchAttachmentOp(); |
93 /** |
|
94 * From CIpsPlgBaseOperation |
|
95 * For reporting if DoRunL leaves |
|
96 */ |
|
97 const TDesC8& GetErrorProgressL( TInt aError ); |
|
98 |
|
99 TFSProgress GetFSProgressL() const; |
|
100 |
|
101 private: |
|
102 CIpsPlgImap4FetchAttachmentOp( |
|
103 CMsvSession& aMsvSession, |
|
104 TRequestStatus& aObserverRequestStatus, |
|
105 TMsvId aService, |
|
106 CIpsPlgTimerOperation& aActivityTimer, |
|
107 const CMsvEntrySelection* aSelection, |
|
108 TFSMailMsgId aFSMailBoxId, |
|
109 MFSMailRequestObserver* aFSOperationObserver, |
|
110 TInt aFSRequestId ); |
118 |
111 |
119 /** |
112 void ConstructL(); |
120 * |
|
121 */ |
|
122 const TDesC8& ProgressL(); |
|
123 |
113 |
|
114 void RunL(); |
|
115 |
|
116 void DoRunL(); |
|
117 |
|
118 //virtual void DoCancel(); |
|
119 |
|
120 void Complete(); |
|
121 |
|
122 void DoConnectL(); |
|
123 |
|
124 /** |
|
125 * Called periodically by CIpsFetchProgReport during active fetching |
|
126 * Leads to sending progress report to plugin's client |
|
127 */ |
|
128 void ReportProgressL(); |
|
129 |
|
130 // <qmail> new func to this op |
|
131 /** |
|
132 * Returns operation type |
|
133 */ |
|
134 TIpsOpType IpsOpType() const; |
|
135 |
|
136 protected: |
|
137 |
|
138 void DoFetchAttachmentL( ); |
124 |
139 |
125 /** |
140 private: //Data |
126 * |
141 friend class CIpsFetchProgReport; |
127 */ |
142 |
128 const TDesC8& GetErrorProgressL( TInt aError ); |
143 // internal state of this statemachine |
|
144 enum TFetchState { |
|
145 EStateIdle, |
|
146 EStateConnecting, |
|
147 EStateFetching, |
|
148 EStateDisconnecting }; |
|
149 TFetchState iState; |
129 |
150 |
130 /** |
151 const CMsvEntrySelection* iSelection; |
131 * |
152 TDesC8* iFetchErrorProgress; |
132 */ |
153 TPckgBuf<TImap4CompoundProgress> iProgress; |
133 TFSProgress GetFSProgressL() const; |
154 CIpsFetchProgReport* iProgReport; |
134 |
|
135 |
|
136 private: |
|
137 |
|
138 |
|
139 /** |
|
140 * CIpsPlgImap4PopulateOp() |
|
141 * @param |
|
142 * |
|
143 * |
|
144 * |
|
145 * |
|
146 * |
|
147 * |
|
148 |
|
149 */ |
|
150 |
|
151 CIpsPlgImap4FetchAttachmentOp( |
|
152 CMsvSession& aMsvSession, |
|
153 TRequestStatus& aObserverRequestStatus, |
|
154 TInt aFunctionId, |
|
155 TMsvId aService, |
|
156 CIpsPlgTimerOperation& aActivityTimer, |
|
157 const TImImap4GetMailInfo& aGetMailInfo, |
|
158 TFSMailMsgId aFSMailBoxId, |
|
159 MFSMailRequestObserver& aFSOperationObserver, |
|
160 TInt aFSRequestId ); |
|
161 |
|
162 /** |
|
163 * ConstructL() |
|
164 */ |
|
165 |
|
166 void ConstructL( const CMsvEntrySelection& aSel ); |
|
167 |
|
168 |
|
169 /** |
|
170 * RunL() |
|
171 */ |
|
172 |
|
173 void RunL(); |
|
174 |
|
175 /** |
|
176 * DoRunL() |
|
177 */ |
|
178 |
|
179 void DoRunL(); |
|
180 |
|
181 /** |
|
182 * DoCancel() |
|
183 */ |
|
184 |
|
185 //virtual void DoCancel(); |
|
186 |
|
187 /** |
|
188 * Complete() |
|
189 */ |
|
190 |
|
191 void Complete(); |
|
192 |
|
193 /** |
|
194 * |
|
195 */ |
|
196 void DoConnectL(); |
|
197 |
|
198 /** |
|
199 * |
|
200 */ |
|
201 void ReportProgressL(); |
|
202 |
|
203 protected: |
|
204 |
|
205 /** |
|
206 * From CIpsPlgOnlineoperation |
|
207 */ |
|
208 TInt GetEngineProgress( const TDesC8& aProgress ); |
|
209 |
|
210 /** |
|
211 * |
|
212 */ |
|
213 void DoFetchAttachmentL( ); |
|
214 |
|
215 enum TFetchState { |
|
216 EStateIdle, |
|
217 EStateConnecting, |
|
218 EStateFetching, |
|
219 EStateDisconnecting }; |
|
220 TFetchState iState; |
|
221 |
|
222 private: //Data |
|
223 |
|
224 // because use of ReportProgressL() |
|
225 friend class CIpsFetchProgReport; |
|
226 |
|
227 CMsvEntrySelection* iSelection; |
|
228 TDesC8* iFetchErrorProgress; |
|
229 TImImap4GetMailInfo iGetMailInfo; |
|
230 TInt iFunctionId; |
|
231 TPckgBuf<TImap4CompoundProgress> iProgress; |
|
232 TMsvId iService; |
|
233 TBool iPopulated; |
|
234 CIpsFetchProgReport* iProgReport; |
|
235 }; |
155 }; |
236 |
156 |
237 #endif //__IPSPLGIMAP4FETCHATTACHMENTOP_H__ |
157 #endif // IPSPLGIMAP4FETCHATTACHMENTOP_H |