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