16 */ |
16 */ |
17 |
17 |
18 // <qmail> |
18 // <qmail> |
19 |
19 |
20 // INCLUDE FILES |
20 // INCLUDE FILES |
21 |
|
22 #include "emailtrace.h" |
21 #include "emailtrace.h" |
23 #include "ipsplgheaders.h" |
22 #include "ipsplgheaders.h" |
24 |
23 |
25 // LOCAL CONSTANTS AND MACROS |
24 //<qmail> removed |
26 |
25 |
27 // ================= MEMBER FUNCTIONS ======================= |
26 // ================= MEMBER FUNCTIONS ======================= |
28 |
27 |
29 // ---------------------------------------------------------------------------- |
28 // ---------------------------------------------------------------------------- |
30 // CIpsPlgCreateMessageOperation::CIpsPlgCreateMessageOperation |
29 // CIpsPlgCreateMessageOperation::CIpsPlgCreateMessageOperation |
31 // ---------------------------------------------------------------------------- |
30 // ---------------------------------------------------------------------------- |
32 // |
31 // |
33 // <qmail> priority parameter has been removed |
32 // <qmail> priority parameter has been removed |
|
33 //<qmail> iBlank removed |
|
34 //<qmail> aSmtpServiceId removed |
34 CIpsPlgCreateMessageOperation::CIpsPlgCreateMessageOperation( |
35 CIpsPlgCreateMessageOperation::CIpsPlgCreateMessageOperation( |
35 CIpsPlgSmtpService* aSmtpService, |
36 CIpsPlgSmtpService& aSmtpService, |
36 CMsvSession& aMsvSession, |
37 CMsvSession& aMsvSession, |
37 TRequestStatus& aObserverRequestStatus, |
38 TRequestStatus& aObserverRequestStatus, |
38 TMsvId aSmtpServiceId, |
|
39 TMsvPartList aPartList, |
39 TMsvPartList aPartList, |
40 TFSMailMsgId aMailBoxId, |
40 TFSMailMsgId aMailBoxId, |
41 MFSMailRequestObserver& aOperationObserver, |
41 MFSMailRequestObserver& aOperationObserver, |
42 TInt aRequestId ) |
42 TInt aRequestId ) |
43 : |
43 : |
45 aMsvSession, |
45 aMsvSession, |
46 aObserverRequestStatus, |
46 aObserverRequestStatus, |
47 aRequestId, |
47 aRequestId, |
48 aMailBoxId), |
48 aMailBoxId), |
49 iSmtpService(aSmtpService), |
49 iSmtpService(aSmtpService), |
50 iSmtpServiceId(aSmtpServiceId), |
|
51 iPartList(aPartList), |
50 iPartList(aPartList), |
52 iOperationObserver(aOperationObserver) |
51 iOperationObserver(aOperationObserver) |
53 { |
52 { |
54 FUNC_LOG; |
53 FUNC_LOG; |
55 CActiveScheduler::Add( this ); |
54 CActiveScheduler::Add( this ); |
56 } |
55 } |
57 |
56 //</qmail> |
58 // ---------------------------------------------------------------------------- |
57 // ---------------------------------------------------------------------------- |
59 // CIpsPlgCreateMessageOperation::ConstructL |
58 // CIpsPlgCreateMessageOperation::ConstructL |
60 // ---------------------------------------------------------------------------- |
59 // ---------------------------------------------------------------------------- |
61 // |
60 // |
62 void CIpsPlgCreateMessageOperation::ConstructL() |
61 void CIpsPlgCreateMessageOperation::ConstructL() |
68 |
67 |
69 // ---------------------------------------------------------------------------- |
68 // ---------------------------------------------------------------------------- |
70 // CIpsPlgCreateMessageOperation::NewL |
69 // CIpsPlgCreateMessageOperation::NewL |
71 // ---------------------------------------------------------------------------- |
70 // ---------------------------------------------------------------------------- |
72 // |
71 // |
|
72 //<qmail> aSmtpServiceId removed |
|
73 //<qmail> aSmtpService changed to reference |
73 CIpsPlgCreateMessageOperation* CIpsPlgCreateMessageOperation::NewL( |
74 CIpsPlgCreateMessageOperation* CIpsPlgCreateMessageOperation::NewL( |
74 CIpsPlgSmtpService* aSmtpService, |
75 CIpsPlgSmtpService& aSmtpService, |
75 CMsvSession& aMsvSession, |
76 CMsvSession& aMsvSession, |
76 TRequestStatus& aObserverRequestStatus, |
77 TRequestStatus& aObserverRequestStatus, |
77 TMsvId aSmtpServiceId, |
|
78 TMsvPartList aPartList, |
78 TMsvPartList aPartList, |
79 TFSMailMsgId aMailBoxId, |
79 TFSMailMsgId aMailBoxId, |
80 MFSMailRequestObserver& aOperationObserver, |
80 MFSMailRequestObserver& aOperationObserver, |
81 TInt aRequestId ) |
81 TInt aRequestId ) |
82 { |
82 { |
83 FUNC_LOG; |
83 FUNC_LOG; |
84 CIpsPlgCreateMessageOperation* self = |
84 CIpsPlgCreateMessageOperation* self = |
85 new (ELeave) CIpsPlgCreateMessageOperation( |
85 new (ELeave) CIpsPlgCreateMessageOperation( |
86 aSmtpService, aMsvSession, aObserverRequestStatus, aSmtpServiceId, |
86 aSmtpService, aMsvSession, aObserverRequestStatus, |
87 aPartList, aMailBoxId, aOperationObserver, aRequestId ); |
87 aPartList, aMailBoxId, aOperationObserver, aRequestId ); |
88 CleanupStack::PushL( self ); |
88 CleanupStack::PushL( self ); |
89 self->ConstructL(); |
89 self->ConstructL(); |
90 CleanupStack::Pop( self ); |
90 CleanupStack::Pop( self ); |
91 return self; |
91 return self; |
92 } |
92 } |
93 |
93 //</qmail> |
94 // ---------------------------------------------------------------------------- |
94 // ---------------------------------------------------------------------------- |
95 // CIpsPlgCreateMessageOperation::~CIpsPlgCreateMessageOperation |
95 // CIpsPlgCreateMessageOperation::~CIpsPlgCreateMessageOperation |
96 // ---------------------------------------------------------------------------- |
96 // ---------------------------------------------------------------------------- |
97 // |
97 // |
98 CIpsPlgCreateMessageOperation::~CIpsPlgCreateMessageOperation() |
98 CIpsPlgCreateMessageOperation::~CIpsPlgCreateMessageOperation() |
132 |
132 |
133 if( iStatus.Int() == KErrNone ) |
133 if( iStatus.Int() == KErrNone ) |
134 { |
134 { |
135 // new message creation has finished so make an FS type message |
135 // new message creation has finished so make an FS type message |
136 CFSMailMessage* newMessage = NULL; |
136 CFSMailMessage* newMessage = NULL; |
|
137 //<qmail> removed trap, handled in RunError |
|
138 TMsvId msgId; |
137 |
139 |
138 TMsvId msgId = TMsvId(); |
140 msgId = GetIdFromProgressL( iOperation->FinalProgress() ); |
139 TRAPD( err, msgId = GetIdFromProgressL( iOperation->FinalProgress() ) ); |
|
140 |
141 |
141 if( err == KErrNone ) |
142 newMessage = iSmtpService.CreateFSMessageAndSetFlagsL( |
142 { |
143 msgId, KErrNotFound, iFSMailboxId.Id() ); |
143 newMessage = iSmtpService->CreateFSMessageAndSetFlagsL( |
144 //</qmail> |
144 msgId, KErrNotFound, iFSMailboxId.Id() ); |
|
145 } |
|
146 |
|
147 // relay the created message (observer takes ownership) |
145 // relay the created message (observer takes ownership) |
148 SignalFSObserver( iStatus.Int(), newMessage ); |
146 SignalFSObserver( iStatus.Int(), newMessage ); |
149 } |
147 } |
150 |
148 |
151 // nothing left to process, so complete the observer |
149 // nothing left to process, so complete the observer |
152 TRequestStatus* status = &iObserverRequestStatus; |
150 TRequestStatus* status = &iObserverRequestStatus; |
153 User::RequestComplete( status, iStatus.Int() ); |
151 User::RequestComplete( status, iStatus.Int() ); |
154 } |
152 } |
155 |
153 //<qmail> |
156 // ---------------------------------------------------------------------------- |
154 // ---------------------------------------------------------------------------- |
157 // CIpsPlgCreateMessageOperation::RunError() |
155 // CIpsPlgCreateMessageOperation::RunError() |
158 // ---------------------------------------------------------------------------- |
156 // ---------------------------------------------------------------------------- |
159 // |
157 // |
160 TInt CIpsPlgCreateMessageOperation::RunError( TInt aError ) |
158 TInt CIpsPlgCreateMessageOperation::RunError( TInt aError ) |
164 |
162 |
165 TRequestStatus* status = &iObserverRequestStatus; |
163 TRequestStatus* status = &iObserverRequestStatus; |
166 User::RequestComplete( status, aError ); |
164 User::RequestComplete( status, aError ); |
167 return KErrNone; // RunError must return KErrNone to active sheduler. |
165 return KErrNone; // RunError must return KErrNone to active sheduler. |
168 } |
166 } |
169 |
167 //</qmail> |
|
168 //<qmail> function description updated |
170 // ---------------------------------------------------------------------------- |
169 // ---------------------------------------------------------------------------- |
171 // CIpsPlgCreateMessageOperation::GetIdFromProgressL |
170 // CIpsPlgCreateMessageOperation::GetIdFromProgressL |
172 // ---------------------------------------------------------------------------- |
171 // ---------------------------------------------------------------------------- |
173 // |
172 // |
174 TMsvId CIpsPlgCreateMessageOperation::GetIdFromProgressL( const TDesC8& aProg ) |
173 TMsvId CIpsPlgCreateMessageOperation::GetIdFromProgressL( const TDesC8& aProg ) |
175 { |
174 { |
176 FUNC_LOG; |
175 FUNC_LOG; |
177 // Taken from symbian os help example code |
176 //<qmail> comment removed |
178 // Create and initialise a temporary TPckg object that |
177 // Create and initialise a temporary TPckg object that |
179 // can hold a message Id. |
178 // can hold a message Id. |
180 TMsvId msgId; |
179 TMsvId msgId; |
181 TPckg<TMsvId> param(msgId); |
180 TPckg<TMsvId> param(msgId); |
182 |
181 |
190 // Email is not correctly created, so leave |
189 // Email is not correctly created, so leave |
191 User::Leave( KErrNotFound ); |
190 User::Leave( KErrNotFound ); |
192 } |
191 } |
193 return msgId; |
192 return msgId; |
194 } |
193 } |
195 |
194 //<qmail> function description updated |
196 // ---------------------------------------------------------------------------- |
195 // ---------------------------------------------------------------------------- |
197 // CIpsPlgCreateMessageOperation::ProgressL |
196 // CIpsPlgCreateMessageOperation::SignalFSObserver |
198 // ---------------------------------------------------------------------------- |
197 // ---------------------------------------------------------------------------- |
199 // |
198 // |
200 void CIpsPlgCreateMessageOperation::SignalFSObserver( |
199 void CIpsPlgCreateMessageOperation::SignalFSObserver( |
201 TInt aStatus, CFSMailMessage* aMessage ) |
200 TInt aStatus, CFSMailMessage* aMessage ) |
202 { |
201 { |
282 // ---------------------------------------------------------------------------- |
282 // ---------------------------------------------------------------------------- |
283 // |
283 // |
284 void CIpsPlgCreateMessageOperation::StartMessageCreationL() |
284 void CIpsPlgCreateMessageOperation::StartMessageCreationL() |
285 { |
285 { |
286 FUNC_LOG; |
286 FUNC_LOG; |
|
287 //<qmail> |
|
288 TMsvId service; |
|
289 TMsvEntry mboxEntry; |
|
290 |
287 delete iOperation; |
291 delete iOperation; |
288 iOperation = NULL; |
292 iOperation = NULL; |
289 |
293 |
|
294 User::LeaveIfError( |
|
295 iMsvSession.GetEntry( iFSMailboxId.Id(), service, mboxEntry ) ); |
|
296 //</qmail> |
|
297 //<qmail> removed useless parameter |
290 // Start a new operation, execution continues in RunL |
298 // Start a new operation, execution continues in RunL |
291 // once the operation has finished. |
299 // once the operation has finished. |
292 iOperation = CImEmailOperation::CreateNewL( |
300 iOperation = CImEmailOperation::CreateNewL( |
293 iStatus, |
301 iStatus, |
294 iMsvSession, |
302 iMsvSession, |
295 KMsvDraftEntryId, |
303 KMsvDraftEntryId, |
296 iSmtpServiceId, |
304 mboxEntry.iRelatedId, // SMTP service id |
297 iPartList, |
305 iPartList, |
298 KMsvEmailTypeListMHTMLMessage, |
306 KMsvEmailTypeListMHTMLMessage, |
299 //0, |
|
300 KUidMsgTypeSMTP); |
307 KUidMsgTypeSMTP); |
|
308 //</qmail> |
301 } |
309 } |
302 |
310 |
303 |
311 |
304 // ---------------------------------------------------------------------------- |
312 // ---------------------------------------------------------------------------- |
305 // CIpsPlgCreateMessageOperation::IpsOpType |
313 // CIpsPlgCreateMessageOperation::IpsOpType |