26 // --------------------------------------------------------------------------- |
26 // --------------------------------------------------------------------------- |
27 // --------------------------------------------------------------------------- |
27 // --------------------------------------------------------------------------- |
28 // |
28 // |
29 EXPORT_C CIpsPlgSmtpOperation* CIpsPlgSmtpOperation::NewL( |
29 EXPORT_C CIpsPlgSmtpOperation* CIpsPlgSmtpOperation::NewL( |
30 CMsvSession& aMsvSession, |
30 CMsvSession& aMsvSession, |
31 TInt aPriority, TRequestStatus& |
31 TInt aPriority, |
32 aObserverRequestStatus, |
32 TRequestStatus& aObserverRequestStatus, |
33 TBool /*aUsePublishSubscribe*/ ) |
33 MFSMailRequestObserver* aOperationObserver, |
|
34 TInt aRequestId ) |
34 { |
35 { |
35 FUNC_LOG; |
36 FUNC_LOG; |
36 CIpsPlgSmtpOperation* self = CIpsPlgSmtpOperation::NewLC( |
37 CIpsPlgSmtpOperation* self = CIpsPlgSmtpOperation::NewLC( |
37 aMsvSession, aPriority, aObserverRequestStatus, ETrue ); |
38 aMsvSession, |
|
39 aPriority, |
|
40 aObserverRequestStatus, |
|
41 aOperationObserver, |
|
42 aRequestId ); |
38 CleanupStack::Pop( self ); |
43 CleanupStack::Pop( self ); |
39 return self; |
44 return self; |
40 } |
45 } |
41 |
46 |
42 // --------------------------------------------------------------------------- |
47 // --------------------------------------------------------------------------- |
44 // |
49 // |
45 EXPORT_C CIpsPlgSmtpOperation* CIpsPlgSmtpOperation::NewLC( |
50 EXPORT_C CIpsPlgSmtpOperation* CIpsPlgSmtpOperation::NewLC( |
46 CMsvSession& aMsvSession, |
51 CMsvSession& aMsvSession, |
47 TInt aPriority, |
52 TInt aPriority, |
48 TRequestStatus& aObserverRequestStatus, |
53 TRequestStatus& aObserverRequestStatus, |
49 TBool /*aUsePublishSubscribe*/ ) |
54 MFSMailRequestObserver* aOperationObserver, |
|
55 TInt aRequestId ) |
50 { |
56 { |
51 FUNC_LOG; |
57 FUNC_LOG; |
52 CIpsPlgSmtpOperation* self = new( ELeave ) CIpsPlgSmtpOperation( |
58 CIpsPlgSmtpOperation* self = new( ELeave ) CIpsPlgSmtpOperation( |
53 aMsvSession, aPriority, aObserverRequestStatus ); |
59 aMsvSession, |
|
60 aPriority, |
|
61 aObserverRequestStatus, |
|
62 aOperationObserver, |
|
63 aRequestId ); |
54 CleanupStack::PushL( self ); |
64 CleanupStack::PushL( self ); |
55 self->ConstructL(); |
65 self->ConstructL(); |
56 return self; |
66 return self; |
57 } |
67 } |
58 |
68 |
60 // --------------------------------------------------------------------------- |
70 // --------------------------------------------------------------------------- |
61 // |
71 // |
62 CIpsPlgSmtpOperation::CIpsPlgSmtpOperation( |
72 CIpsPlgSmtpOperation::CIpsPlgSmtpOperation( |
63 CMsvSession& aMsvSession, |
73 CMsvSession& aMsvSession, |
64 TInt aPriority, |
74 TInt aPriority, |
65 TRequestStatus& aObserverRequestStatus ) : |
75 TRequestStatus& aObserverRequestStatus, |
66 CMsvOperation( aMsvSession, aPriority, aObserverRequestStatus ), |
76 MFSMailRequestObserver* aFSOperationObserver, |
|
77 TInt aFSRequestId ) : |
|
78 CIpsPlgBaseOperation( aMsvSession, aPriority, aObserverRequestStatus, |
|
79 aFSRequestId, TFSMailMsgId() ), |
67 iSmtpMtm( NULL ), |
80 iSmtpMtm( NULL ), |
68 iOperation( NULL ), |
81 iOperation( NULL ), |
69 iSelection( NULL ), |
82 iSelection( NULL ), |
70 iMtmRegistry( NULL ) |
83 iMtmRegistry( NULL ), |
|
84 iFSOperationObserver( aFSOperationObserver ) |
71 { |
85 { |
72 FUNC_LOG; |
86 FUNC_LOG; |
73 } |
87 } |
74 |
88 |
75 // --------------------------------------------------------------------------- |
89 // --------------------------------------------------------------------------- |
92 { |
106 { |
93 FUNC_LOG; |
107 FUNC_LOG; |
94 iSelection = new (ELeave) CMsvEntrySelection(); |
108 iSelection = new (ELeave) CMsvEntrySelection(); |
95 CActiveScheduler::Add( this ); |
109 CActiveScheduler::Add( this ); |
96 } |
110 } |
97 |
111 |
98 // --------------------------------------------------------------------------- |
|
99 // --------------------------------------------------------------------------- |
|
100 // |
|
101 void CIpsPlgSmtpOperation::CompleteObserver( TInt aStatus /*= KErrNone*/ ) |
|
102 { |
|
103 FUNC_LOG; |
|
104 |
|
105 TRequestStatus* status = &iObserverRequestStatus; |
|
106 if ( status && status->Int() == KRequestPending ) |
|
107 { |
|
108 User::RequestComplete( status, aStatus ); |
|
109 } |
|
110 } |
|
111 |
|
112 // --------------------------------------------------------------------------- |
|
113 // --------------------------------------------------------------------------- |
|
114 // |
|
115 void CIpsPlgSmtpOperation::CompleteThis() |
|
116 { |
|
117 FUNC_LOG; |
|
118 |
|
119 TRequestStatus* status = &iStatus; |
|
120 User::RequestComplete( status, KErrNone ); |
|
121 } |
|
122 |
|
123 // --------------------------------------------------------------------------- |
112 // --------------------------------------------------------------------------- |
124 // --------------------------------------------------------------------------- |
113 // --------------------------------------------------------------------------- |
125 // |
114 // |
126 void CIpsPlgSmtpOperation::RunL() |
115 void CIpsPlgSmtpOperation::RunL() |
127 { |
116 { |
138 else if ( iState == ESending ) |
127 else if ( iState == ESending ) |
139 { |
128 { |
140 TImSmtpProgress prog; |
129 TImSmtpProgress prog; |
141 TPckg<TImSmtpProgress> param(prog); |
130 TPckg<TImSmtpProgress> param(prog); |
142 param.Copy( iOperation->FinalProgress() ); |
131 param.Copy( iOperation->FinalProgress() ); |
143 |
132 |
144 CompleteObserver( prog.Error() ); |
133 if ( iFSOperationObserver ) |
145 } |
134 { |
146 } |
135 iFSProgress.iProgressStatus = |
147 |
136 TFSProgress::EFSStatus_RequestComplete; |
|
137 iFSProgress.iError = prog.Error(); |
|
138 |
|
139 TRAP_IGNORE( iFSOperationObserver->RequestResponseL( |
|
140 iFSProgress, iFSRequestId ) ); |
|
141 } |
|
142 TRequestStatus* status = &iObserverRequestStatus; |
|
143 User::RequestComplete( status, prog.Error() ); |
|
144 } |
|
145 } |
|
146 |
|
147 // --------------------------------------------------------------------------- |
|
148 // --------------------------------------------------------------------------- |
|
149 // |
|
150 TInt CIpsPlgSmtpOperation::RunError( TInt aError ) |
|
151 { |
|
152 FUNC_LOG; |
|
153 |
|
154 if ( iFSOperationObserver ) |
|
155 { |
|
156 iFSProgress.iProgressStatus = TFSProgress::EFSStatus_RequestComplete; |
|
157 iFSProgress.iError = aError; |
|
158 |
|
159 TRAP_IGNORE( iFSOperationObserver->RequestResponseL( |
|
160 iFSProgress, iFSRequestId ) ); |
|
161 } |
|
162 |
|
163 TRequestStatus* status = &iObserverRequestStatus; |
|
164 User::RequestComplete( status, aError ); |
|
165 |
|
166 return KErrNone; |
|
167 } |
|
168 |
|
169 |
148 // --------------------------------------------------------------------------- |
170 // --------------------------------------------------------------------------- |
149 // --------------------------------------------------------------------------- |
171 // --------------------------------------------------------------------------- |
150 // |
172 // |
151 void CIpsPlgSmtpOperation::DoCancel() |
173 void CIpsPlgSmtpOperation::DoCancel() |
152 { |
174 { |
155 if ( iOperation ) |
177 if ( iOperation ) |
156 { |
178 { |
157 iOperation->Cancel(); |
179 iOperation->Cancel(); |
158 } |
180 } |
159 |
181 |
160 CompleteObserver( KErrCancel ); |
182 // It is not relevant to inform FS observer. Cancelling is initiated |
|
183 // either by the observer or the engine destructor when the application |
|
184 // exits. |
|
185 |
|
186 TRequestStatus* status = &iObserverRequestStatus; |
|
187 User::RequestComplete( status, KErrCancel ); |
161 } |
188 } |
162 |
189 |
163 // --------------------------------------------------------------------------- |
190 // --------------------------------------------------------------------------- |
164 // --------------------------------------------------------------------------- |
191 // --------------------------------------------------------------------------- |
165 // |
192 // |
170 if( iOperation && iState == ESending ) |
197 if( iOperation && iState == ESending ) |
171 { |
198 { |
172 return iOperation->ProgressL(); |
199 return iOperation->ProgressL(); |
173 } |
200 } |
174 return KNullDesC8; |
201 return KNullDesC8; |
|
202 } |
|
203 |
|
204 // --------------------------------------------------------------------------- |
|
205 // CIpsPlgSmtpOperation::GetErrorProgressL |
|
206 // --------------------------------------------------------------------------- |
|
207 // |
|
208 const TDesC8& CIpsPlgSmtpOperation::GetErrorProgressL( TInt /*aError*/ ) |
|
209 { |
|
210 FUNC_LOG; |
|
211 |
|
212 return KNullDesC8; // error progress info not supported |
|
213 } |
|
214 |
|
215 // --------------------------------------------------------------------------- |
|
216 // CIpsPlgSmtpOperation::GetFSProgressL |
|
217 // --------------------------------------------------------------------------- |
|
218 // |
|
219 TFSProgress CIpsPlgSmtpOperation::GetFSProgressL() const |
|
220 { |
|
221 FUNC_LOG; |
|
222 |
|
223 return iFSProgress; |
|
224 } |
|
225 |
|
226 // --------------------------------------------------------------------------- |
|
227 // CIpsPlgSmtpOperation::IpsOpType |
|
228 // --------------------------------------------------------------------------- |
|
229 // |
|
230 TInt CIpsPlgSmtpOperation::IpsOpType() const |
|
231 { |
|
232 FUNC_LOG; |
|
233 return EIpsOpTypeSmtp; |
175 } |
234 } |
176 |
235 |
177 // --------------------------------------------------------------------------- |
236 // --------------------------------------------------------------------------- |
178 // --------------------------------------------------------------------------- |
237 // --------------------------------------------------------------------------- |
179 // |
238 // |