|
1 /* |
|
2 * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Implementation for ESMR task factory |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "emailtrace.h" |
|
19 #include "cesmrtaskfactory.h" |
|
20 |
|
21 #include "cesmrcombinedtask.h" |
|
22 #include "cesmrstoremrtask.h" |
|
23 #include "cesmrsendmrrespmailtask.h" |
|
24 #include "cesmrdeletefromdbmrtask.h" |
|
25 #include "cesmrsendmrrespfsmailtask.h" |
|
26 #include "cesmrsendmrfsmailtask.h" |
|
27 #include "cesmrforwardasfsmailtask.h" |
|
28 #include "cesmrsendmrfsmailreplytask.h" |
|
29 |
|
30 #include "mesmrmeetingrequestentry.h" |
|
31 #include "cesmrconfirmationquery.h" |
|
32 #include "cesmrlistquery.h" |
|
33 #include "cesmrresponsedialog.h" |
|
34 #include "tesmrinputparams.h" |
|
35 #include "esmrconfig.hrh" |
|
36 |
|
37 //<cmail> |
|
38 #include "CFSMailCommon.h" |
|
39 #include "CFSMailClient.h" |
|
40 #include "CFSMailMessage.h" |
|
41 #include "CFSMailBox.h" |
|
42 //</cmail> |
|
43 |
|
44 namespace { |
|
45 |
|
46 #ifdef _DEBUG |
|
47 |
|
48 // Panic literal for ESMRTaskFactory |
|
49 _LIT( KESMRTaskFactoryPanicTxt, "ESMRTaskFactory" ); |
|
50 |
|
51 /** Panic code definitions */ |
|
52 enum TESMRTaskFactoryPanic |
|
53 { |
|
54 EESMRTaskFactoryInvalidTask // Trying to create invalid task |
|
55 }; |
|
56 |
|
57 |
|
58 // --------------------------------------------------------------------------- |
|
59 // Panic wrapper method |
|
60 // --------------------------------------------------------------------------- |
|
61 // |
|
62 void Panic( TESMRTaskFactoryPanic aPanic ) |
|
63 { |
|
64 |
|
65 User::Panic( KESMRTaskFactoryPanicTxt, aPanic ); |
|
66 } |
|
67 |
|
68 #endif // _DEBUG |
|
69 |
|
70 /** |
|
71 * Checks whether reply mail is required by the plug-in or not. |
|
72 * @param aEntry Regerence to MR entry |
|
73 */ |
|
74 TBool ReplyMailRequiredL( |
|
75 MESMRMeetingRequestEntry& aEntry ) |
|
76 { |
|
77 TBool replyNeeded( EFalse ); |
|
78 |
|
79 TESMRInputParams esmrParams; |
|
80 if ( aEntry.IsOpenedFromMail() && |
|
81 aEntry.StartupParameters(esmrParams) ) |
|
82 { |
|
83 TFSMailMsgId mailboxId( |
|
84 esmrParams.iMailMessage->GetMailBoxId() ); |
|
85 |
|
86 CFSMailBox* mailbox = |
|
87 esmrParams.iMailClient->GetMailBoxByUidL( mailboxId ); |
|
88 CleanupStack::PushL( mailbox ); |
|
89 |
|
90 if ( mailbox->HasCapability(EFSMBoxCapaMRRequiresReplyEmail ) ) |
|
91 { |
|
92 replyNeeded = ETrue; |
|
93 } |
|
94 CleanupStack::PopAndDestroy( mailbox ); |
|
95 mailbox = NULL; |
|
96 } |
|
97 |
|
98 return replyNeeded; |
|
99 } |
|
100 |
|
101 // --------------------------------------------------------------------------- |
|
102 // Queries response query from user. |
|
103 // --------------------------------------------------------------------------- |
|
104 // |
|
105 HBufC* QuerySendResponseQueryFromUserLC( |
|
106 TESMRCommand aCommand, |
|
107 TESMRResponseType& aResponseType, |
|
108 MESMRMeetingRequestEntry& aEntry ) |
|
109 { |
|
110 HBufC* responseMessage = NULL; |
|
111 TInt ret = EESMRResponsePlain; |
|
112 |
|
113 TESMRAttendeeStatus status( |
|
114 EESMRAttendeeStatusDecline ); |
|
115 |
|
116 // convert the command to status: |
|
117 switch ( aCommand ) |
|
118 { |
|
119 case EESMRCmdAcceptMR: |
|
120 { |
|
121 status = EESMRAttendeeStatusAccept; |
|
122 break; |
|
123 } |
|
124 case EESMRCmdTentativeMR: |
|
125 { |
|
126 status = EESMRAttendeeStatusTentative; |
|
127 break; |
|
128 } |
|
129 case EESMRCmdDeclineMR: |
|
130 { |
|
131 status = EESMRAttendeeStatusDecline; |
|
132 break; |
|
133 } |
|
134 default: |
|
135 { |
|
136 // never should come here. |
|
137 User::Leave(KErrGeneral); |
|
138 break; |
|
139 } |
|
140 } |
|
141 |
|
142 TBool replyRequired( ReplyMailRequiredL(aEntry) ); |
|
143 |
|
144 if ( replyRequired ) |
|
145 { |
|
146 ret = CESMRListQuery::ExecuteEditBeforeSendWithSendOptOnlyL( status ); |
|
147 } |
|
148 else |
|
149 { |
|
150 ret = CESMRListQuery::ExecuteEditBeforeSendL( status ); |
|
151 } |
|
152 |
|
153 // User has selected cancel from dialog. Interrupt task execution, |
|
154 // leave will be trapped in cesmecontroller (esmrviewer module) |
|
155 if ( ret == KErrCancel ) |
|
156 { |
|
157 User::Leave( KErrCancel ); |
|
158 } |
|
159 |
|
160 aResponseType = static_cast<TESMRResponseType>(ret); |
|
161 |
|
162 // set the response status to cal entry: |
|
163 aEntry.ConstructReplyL(status); |
|
164 |
|
165 if ( EESMRResponseMessage == aResponseType ) |
|
166 { |
|
167 CESMRResponseDialog* respDlg = |
|
168 CESMRResponseDialog::NewL( responseMessage ); |
|
169 CleanupStack::PushL( respDlg ); |
|
170 |
|
171 TBool dialogRetValue( respDlg->ExecuteDlgLD() ); |
|
172 // Dialog has deleted itself --> Only pop from cleanup stack |
|
173 CleanupStack::Pop( respDlg ); |
|
174 |
|
175 if ( !dialogRetValue ) |
|
176 { |
|
177 User::Leave( KErrCancel ); |
|
178 } |
|
179 } |
|
180 if ( responseMessage ) |
|
181 { |
|
182 CleanupStack::PushL( responseMessage ); |
|
183 } |
|
184 else |
|
185 { |
|
186 responseMessage = KNullDesC().AllocLC(); |
|
187 } |
|
188 return responseMessage; |
|
189 } |
|
190 |
|
191 } // namespace |
|
192 |
|
193 // ======== MEMBER FUNCTIONS ======== |
|
194 |
|
195 // --------------------------------------------------------------------------- |
|
196 // CESMRTaskFactory::CESMRTaskFactory |
|
197 // --------------------------------------------------------------------------- |
|
198 // |
|
199 inline CESMRTaskFactory::CESMRTaskFactory( |
|
200 MESMRCalDbMgr& aCalDbMgr, |
|
201 CMRMailboxUtils& aMRMailboxUtils ) |
|
202 : iCalDbMgr( aCalDbMgr ), |
|
203 iMRMailboxUtils(aMRMailboxUtils) |
|
204 { |
|
205 FUNC_LOG; |
|
206 |
|
207 } |
|
208 |
|
209 // --------------------------------------------------------------------------- |
|
210 // CESMRTaskFactory::~CESMRTaskFactory |
|
211 // --------------------------------------------------------------------------- |
|
212 // |
|
213 CESMRTaskFactory::~CESMRTaskFactory() |
|
214 { |
|
215 FUNC_LOG; |
|
216 } |
|
217 |
|
218 // --------------------------------------------------------------------------- |
|
219 // CESMRTaskFactory::TaskFactory |
|
220 // --------------------------------------------------------------------------- |
|
221 // |
|
222 EXPORT_C CESMRTaskFactory* CESMRTaskFactory::NewL( |
|
223 MESMRCalDbMgr& aCalDbMgr, |
|
224 CMRMailboxUtils& aMRMailboxUtils ) |
|
225 { |
|
226 FUNC_LOG; |
|
227 |
|
228 CESMRTaskFactory* self = |
|
229 new (ELeave) CESMRTaskFactory(aCalDbMgr, aMRMailboxUtils ); |
|
230 |
|
231 |
|
232 return self; |
|
233 } |
|
234 |
|
235 // --------------------------------------------------------------------------- |
|
236 // CESMRTaskFactory::CreateTaskL |
|
237 // --------------------------------------------------------------------------- |
|
238 // |
|
239 MESMRTask* CESMRTaskFactory::CreateTaskL( |
|
240 TESMRCommand aCommand, |
|
241 MESMRMeetingRequestEntry& aEntry ) |
|
242 { |
|
243 FUNC_LOG; |
|
244 |
|
245 MESMRTask* task = NULL; |
|
246 |
|
247 switch (aCommand) |
|
248 { |
|
249 case EESMRCmdAcceptMR: |
|
250 case EESMRCmdTentativeMR: |
|
251 case EESMRCmdDeclineMR: |
|
252 task = CreateSendMRResponseViaMailTaskL( aCommand, aEntry ); |
|
253 break; |
|
254 |
|
255 case EESMRCmdSendMR: |
|
256 case EESMRCmdSendMRUpdate: |
|
257 task = CreateSendMRTaskL( aCommand, aEntry ); |
|
258 break; |
|
259 |
|
260 case EESMRCmdDeleteMR: |
|
261 case EESMRCmdRemoveFromCalendar: |
|
262 case EESMRCmdMailDelete: |
|
263 task = CreateDeleteMRTaskL( aCommand, aEntry ); |
|
264 break; |
|
265 |
|
266 case EESMRCmdSaveMR: |
|
267 task = CreateStoreMRToLocalDBTaskL( aCommand, aEntry ); |
|
268 break; |
|
269 |
|
270 case EESMRCmdForwardAsMeeting: |
|
271 task = CreateForwardAsMeetingTaskL( aCommand, aEntry ); |
|
272 break; |
|
273 |
|
274 case EESMRCmdForwardAsMail: |
|
275 task = CreateForwardAsMailTaskL( aEntry ); |
|
276 break; |
|
277 case EESMRCmdReplyAll: |
|
278 task = CreateReplyAsMailTaskL( aEntry, ETrue ); |
|
279 break; |
|
280 |
|
281 case EESMRCmdReply: |
|
282 task = CreateReplyAsMailTaskL( aEntry, EFalse ); |
|
283 break; |
|
284 |
|
285 default: |
|
286 __ASSERT_DEBUG(EFalse, Panic(EESMRTaskFactoryInvalidTask) ); |
|
287 User::Leave( KErrNotSupported ); |
|
288 break; |
|
289 } |
|
290 |
|
291 |
|
292 return task; |
|
293 } |
|
294 |
|
295 // --------------------------------------------------------------------------- |
|
296 // CESMRTaskFactory::CreateSendMRResponseViaMailTask |
|
297 // --------------------------------------------------------------------------- |
|
298 // |
|
299 MESMRTask* CESMRTaskFactory::CreateSendMRResponseViaMailTaskL( |
|
300 TESMRCommand aCommand, |
|
301 MESMRMeetingRequestEntry& aEntry ) |
|
302 { |
|
303 FUNC_LOG; |
|
304 |
|
305 CESMRCombinedTask* task = NULL; |
|
306 TESMRRole role = aEntry.RoleL(); |
|
307 |
|
308 TBool syncObjectPresent( aEntry.IsSyncObjectPresent() ); |
|
309 TBool isStored( aEntry.IsStoredL() ); |
|
310 |
|
311 if ( EESMRRoleRequiredAttendee == role || |
|
312 EESMRRoleOptionalAttendee == role || |
|
313 EESMRRoleNonParticipant == role ) |
|
314 { |
|
315 task = CESMRCombinedTask::NewL |
|
316 ( iCalDbMgr, |
|
317 aEntry, |
|
318 iMRMailboxUtils, |
|
319 CESMRCombinedTask::EESMRTrap ); |
|
320 |
|
321 CleanupStack::PushL( task ); |
|
322 |
|
323 TESMRResponseType responseType( EESMRResponsePlain ); |
|
324 HBufC* responseMessage = QuerySendResponseQueryFromUserLC( |
|
325 aCommand, |
|
326 responseType, |
|
327 aEntry ); |
|
328 |
|
329 if ( !syncObjectPresent && EESMRCmdDeclineMR != aCommand) |
|
330 { |
|
331 // Entry is stored or deleted from calendar DB if |
|
332 // sync object is not present |
|
333 // Store MR task |
|
334 task->AppendTaskL( |
|
335 CESMRStoreMRTask::NewL( |
|
336 iCalDbMgr, |
|
337 aEntry, |
|
338 iMRMailboxUtils ) ); |
|
339 } |
|
340 |
|
341 if ( EESMRResponseDontSend != responseType || |
|
342 aEntry.IsSyncObjectPresent() ) |
|
343 { |
|
344 // Send MR response via mail freestyle task |
|
345 task->AppendTaskL( |
|
346 CESMRSendMRRespFSMailTask::NewL( |
|
347 aCommand, |
|
348 iCalDbMgr, |
|
349 aEntry, |
|
350 iMRMailboxUtils, |
|
351 responseType, |
|
352 *responseMessage ) ); |
|
353 } |
|
354 CleanupStack::PopAndDestroy( responseMessage ); |
|
355 |
|
356 if ( !syncObjectPresent && EESMRCmdDeclineMR == aCommand && |
|
357 isStored ) |
|
358 { |
|
359 // Entry is deleted from calendar DB if |
|
360 // sync object is not present and entry exits in database |
|
361 // Declined --> Delete MR from cal DB task |
|
362 task->AppendTaskL( |
|
363 CESMRDeleteMRFromDbTask::NewL( |
|
364 iCalDbMgr, |
|
365 aEntry, |
|
366 iMRMailboxUtils ) ); |
|
367 } |
|
368 |
|
369 CleanupStack::Pop( task ); |
|
370 } |
|
371 else |
|
372 { |
|
373 // Only (opt-)attendees and non-participants can send |
|
374 // responses |
|
375 User::Leave( KErrNotSupported ); |
|
376 } |
|
377 |
|
378 |
|
379 return task; |
|
380 } |
|
381 |
|
382 // --------------------------------------------------------------------------- |
|
383 // CESMRTaskFactory::CreateSendMRTask |
|
384 // --------------------------------------------------------------------------- |
|
385 // |
|
386 |
|
387 MESMRTask* CESMRTaskFactory::CreateSendMRTaskL( |
|
388 TESMRCommand aCommand, |
|
389 MESMRMeetingRequestEntry& aEntry ) |
|
390 { |
|
391 FUNC_LOG; |
|
392 |
|
393 CESMRCombinedTask* task = CESMRCombinedTask::NewL |
|
394 ( iCalDbMgr, |
|
395 aEntry, |
|
396 iMRMailboxUtils ); |
|
397 |
|
398 CleanupStack::PushL( task ); |
|
399 |
|
400 if ( !aEntry.IsForwardedL() ) |
|
401 { |
|
402 // Store MR task |
|
403 task->AppendTaskL( |
|
404 CESMRStoreMRTask::NewL( |
|
405 iCalDbMgr, |
|
406 aEntry, |
|
407 iMRMailboxUtils ) ); |
|
408 } |
|
409 |
|
410 // Note: forwarding is allowed also for entries that occurred in past |
|
411 if ( aEntry.IsForwardedL() || !aEntry.OccursInPastL() ) |
|
412 { |
|
413 if ( aCommand == EESMRCmdSendMR || |
|
414 aCommand == EESMRCmdSendMRUpdate ) |
|
415 { |
|
416 // Send MR response via mail task |
|
417 task->AppendTaskL( |
|
418 CESMRSendMRFSMailTask::NewL( |
|
419 iCalDbMgr, |
|
420 aEntry, |
|
421 iMRMailboxUtils, |
|
422 aCommand ) ); |
|
423 } |
|
424 } |
|
425 |
|
426 CleanupStack::Pop( task ); |
|
427 |
|
428 |
|
429 return task; |
|
430 } |
|
431 |
|
432 // --------------------------------------------------------------------------- |
|
433 // CESMRTaskFactory::CreateDeleteMRTask |
|
434 // --------------------------------------------------------------------------- |
|
435 // |
|
436 MESMRTask* CESMRTaskFactory::CreateDeleteMRTaskL( |
|
437 TESMRCommand aCommand, |
|
438 MESMRMeetingRequestEntry& aEntry ) |
|
439 { |
|
440 FUNC_LOG; |
|
441 |
|
442 MESMRTask* task = NULL; |
|
443 |
|
444 if ( EESMRRoleOrganizer == aEntry.RoleL() ) |
|
445 { |
|
446 task = CreateOrganizerDeleteMRTaskL( aCommand, aEntry ); |
|
447 } |
|
448 else |
|
449 { |
|
450 task = CreateAttendeeDeleteMRTaskL( aCommand, aEntry ); |
|
451 } |
|
452 |
|
453 |
|
454 return task; |
|
455 } |
|
456 |
|
457 // --------------------------------------------------------------------------- |
|
458 // CESMRTaskFactory::CreateStoreMRToLocalDBTaskL |
|
459 // --------------------------------------------------------------------------- |
|
460 // |
|
461 MESMRTask* CESMRTaskFactory::CreateStoreMRToLocalDBTaskL( |
|
462 TESMRCommand /*aCommand*/, |
|
463 MESMRMeetingRequestEntry& aEntry ) |
|
464 { |
|
465 FUNC_LOG; |
|
466 return CESMRStoreMRTask::NewL( |
|
467 iCalDbMgr, |
|
468 aEntry, |
|
469 iMRMailboxUtils ); |
|
470 } |
|
471 |
|
472 // --------------------------------------------------------------------------- |
|
473 // CESMRTaskFactory::CreateForwardAsMeetingTaskL |
|
474 // --------------------------------------------------------------------------- |
|
475 // |
|
476 MESMRTask* CESMRTaskFactory::CreateForwardAsMeetingTaskL( |
|
477 TESMRCommand aCommand, |
|
478 MESMRMeetingRequestEntry& aEntry ) |
|
479 { |
|
480 FUNC_LOG; |
|
481 MESMRTask* task = NULL; |
|
482 |
|
483 // Send MR response via mail task is used for forwarding as meeting request |
|
484 |
|
485 if ( aCommand == EESMRCmdForwardAsMeeting ) |
|
486 { |
|
487 task = CESMRSendMRFSMailTask::NewL( |
|
488 iCalDbMgr, |
|
489 aEntry, |
|
490 iMRMailboxUtils, |
|
491 aCommand ); |
|
492 } |
|
493 return task; |
|
494 } |
|
495 |
|
496 |
|
497 |
|
498 // --------------------------------------------------------------------------- |
|
499 // CESMRTaskFactory::CreateForwardAsMeetingTaskL |
|
500 // --------------------------------------------------------------------------- |
|
501 // |
|
502 MESMRTask* CESMRTaskFactory::CreateForwardAsMailTaskL( |
|
503 MESMRMeetingRequestEntry& aEntry ) |
|
504 { |
|
505 FUNC_LOG; |
|
506 // Send MR response via mail task |
|
507 return CESMRForwardAsFSMailTask::NewL( |
|
508 iCalDbMgr, |
|
509 aEntry, |
|
510 iMRMailboxUtils ); |
|
511 } |
|
512 |
|
513 // --------------------------------------------------------------------------- |
|
514 // CESMRTaskFactory::CreateReplyAsMailTaskL |
|
515 // --------------------------------------------------------------------------- |
|
516 // |
|
517 MESMRTask* CESMRTaskFactory::CreateReplyAsMailTaskL( |
|
518 MESMRMeetingRequestEntry& aEntry, TBool aReplyAll ) |
|
519 { |
|
520 FUNC_LOG; |
|
521 // Send MR reply via mail task |
|
522 return CESMRSendMRFSMailReplyTask::NewL( |
|
523 iCalDbMgr, |
|
524 aEntry, |
|
525 iMRMailboxUtils, |
|
526 aReplyAll); |
|
527 |
|
528 } |
|
529 |
|
530 |
|
531 // --------------------------------------------------------------------------- |
|
532 // CESMRTaskFactory::CreateOrganizerDeleteMRTaskL |
|
533 // --------------------------------------------------------------------------- |
|
534 // |
|
535 MESMRTask* CESMRTaskFactory::CreateOrganizerDeleteMRTaskL( |
|
536 TESMRCommand aCommand, |
|
537 MESMRMeetingRequestEntry& aEntry ) |
|
538 { |
|
539 FUNC_LOG; |
|
540 |
|
541 CESMRCombinedTask* task = CESMRCombinedTask::NewL |
|
542 ( iCalDbMgr, |
|
543 aEntry, |
|
544 iMRMailboxUtils, |
|
545 CESMRCombinedTask::EESMRTrap ); |
|
546 |
|
547 CleanupStack::PushL( task ); |
|
548 |
|
549 if ( EESMRCmdDeleteMR == aCommand ) |
|
550 { |
|
551 // SYNC_SOLUTION requires the modified entry to be stored into |
|
552 // calendar db for deletion purposes. |
|
553 task->AppendTaskL( |
|
554 CESMRStoreMRTask::NewL( |
|
555 iCalDbMgr, |
|
556 aEntry, |
|
557 iMRMailboxUtils ) ); |
|
558 |
|
559 TUint attendeeFlags( |
|
560 EESMRRoleRequiredAttendee | EESMRRoleOptionalAttendee); |
|
561 if ( aEntry.AttendeeCountL( attendeeFlags ) && aEntry.IsSentL() |
|
562 && !aEntry.OccursInPastL() ) |
|
563 { |
|
564 // Meeting request contains attendees --> Cancellation message |
|
565 // needs to be sent |
|
566 if ( CESMRConfirmationQuery::ExecuteL( |
|
567 CESMRConfirmationQuery::EESMRSendCancellationInfoToParticipants) ) |
|
568 { |
|
569 task->AppendTaskL( |
|
570 CESMRSendMRFSMailTask::NewL( |
|
571 iCalDbMgr, |
|
572 aEntry, |
|
573 iMRMailboxUtils, |
|
574 aCommand ) ); |
|
575 } |
|
576 } |
|
577 } |
|
578 |
|
579 // Delete MR from cal DB task |
|
580 task->AppendTaskL( |
|
581 CESMRDeleteMRFromDbTask::NewL( |
|
582 iCalDbMgr, |
|
583 aEntry, |
|
584 iMRMailboxUtils ) ); |
|
585 |
|
586 CleanupStack::Pop( task ); |
|
587 |
|
588 |
|
589 return task; |
|
590 } |
|
591 |
|
592 // --------------------------------------------------------------------------- |
|
593 // CESMRTaskFactory::CreateAttendeeDeleteMRTaskL |
|
594 // --------------------------------------------------------------------------- |
|
595 // |
|
596 MESMRTask* CESMRTaskFactory::CreateAttendeeDeleteMRTaskL( |
|
597 TESMRCommand aCommand, |
|
598 MESMRMeetingRequestEntry& aEntry ) |
|
599 { |
|
600 FUNC_LOG; |
|
601 |
|
602 TBool pluginRequiresReplyMail( ReplyMailRequiredL(aEntry) ); |
|
603 |
|
604 TBool deleteTaskCreated(EFalse); |
|
605 |
|
606 CESMRCombinedTask* task = CESMRCombinedTask::NewL |
|
607 ( iCalDbMgr, |
|
608 aEntry, |
|
609 iMRMailboxUtils, |
|
610 CESMRCombinedTask::EESMRTrap ); |
|
611 |
|
612 CleanupStack::PushL( task ); |
|
613 |
|
614 if ( !aEntry.IsOpenedFromMail() && !aEntry.IsSyncObjectPresent() ) |
|
615 { |
|
616 // When deleting from the calendar --> Store first modifying entry |
|
617 // And then delete that from calendar DB. |
|
618 // |
|
619 // When opened from mail --> We do not need to store |
|
620 // modifying entry into calendar database. |
|
621 // |
|
622 task->AppendTaskL( |
|
623 CESMRStoreMRTask::NewL( |
|
624 iCalDbMgr, |
|
625 aEntry, |
|
626 iMRMailboxUtils ) ); |
|
627 } |
|
628 |
|
629 |
|
630 if ( EESMRCmdDeleteMR == aCommand || |
|
631 EESMRCmdMailDelete == aCommand || |
|
632 (pluginRequiresReplyMail && EESMRCmdRemoveFromCalendar == aCommand ) ) |
|
633 { |
|
634 TBool sendDecline(EFalse); |
|
635 |
|
636 if ( pluginRequiresReplyMail ) |
|
637 { |
|
638 sendDecline = ETrue; |
|
639 } |
|
640 else |
|
641 { |
|
642 sendDecline = CESMRConfirmationQuery::ExecuteL( |
|
643 CESMRConfirmationQuery::EESMRSendDecline ); |
|
644 } |
|
645 |
|
646 if( sendDecline ) |
|
647 { |
|
648 // Send MR response via mail task. No response message is appended |
|
649 // to sent email |
|
650 |
|
651 TESMRCommand command( EESMRCmdDeclineMR ); |
|
652 if ( pluginRequiresReplyMail && EESMRCmdRemoveFromCalendar == aCommand ) |
|
653 { |
|
654 command = EESMRCmdRemoveFromCalendar; |
|
655 } |
|
656 |
|
657 task->AppendTaskL( |
|
658 CESMRSendMRRespFSMailTask::NewL( |
|
659 command, |
|
660 iCalDbMgr, |
|
661 aEntry, |
|
662 iMRMailboxUtils, |
|
663 EESMRResponsePlain, |
|
664 KNullDesC()) ); |
|
665 } |
|
666 } |
|
667 |
|
668 // Delete MR from cal DB task if plugin does not handle it |
|
669 if ( !pluginRequiresReplyMail && !deleteTaskCreated) |
|
670 { |
|
671 task->AppendTaskL( |
|
672 CESMRDeleteMRFromDbTask::NewL( |
|
673 iCalDbMgr, |
|
674 aEntry, |
|
675 iMRMailboxUtils ) ); |
|
676 } |
|
677 |
|
678 CleanupStack::Pop( task ); |
|
679 |
|
680 |
|
681 return task; |
|
682 } |
|
683 |
|
684 // EOF |
|
685 |