64
|
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* QuerySendResponseQueryFromUserL(
|
|
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 |
TInt 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 |
else if ( dialogRetValue == EAknCmdExit )
|
|
190 |
{
|
|
191 |
aResponseType = EESMRResponseDontSend;
|
|
192 |
}
|
|
193 |
else if ( !responseMessage
|
|
194 |
&& dialogRetValue == EESMRCmdSendMR )
|
|
195 |
{
|
|
196 |
// Send command is triggered but response is empty
|
|
197 |
aResponseType = EESMRResponsePlain;
|
|
198 |
responseMessage = KNullDesC().AllocL();
|
|
199 |
}
|
|
200 |
}
|
|
201 |
else
|
|
202 |
{
|
|
203 |
responseMessage = KNullDesC().AllocL();
|
|
204 |
}
|
|
205 |
|
|
206 |
return responseMessage;
|
|
207 |
}
|
|
208 |
|
|
209 |
} // namespace
|
|
210 |
|
|
211 |
// ======== MEMBER FUNCTIONS ========
|
|
212 |
|
|
213 |
// ---------------------------------------------------------------------------
|
|
214 |
// CMRTaskPlugin::CMRTaskPlugin
|
|
215 |
// ---------------------------------------------------------------------------
|
|
216 |
//
|
|
217 |
inline CMRTaskPlugin::CMRTaskPlugin( MESMRCalDbMgr& aCalDbMgr )
|
|
218 |
: iCalDbMgr( aCalDbMgr )
|
|
219 |
{
|
|
220 |
FUNC_LOG;
|
|
221 |
}
|
|
222 |
|
|
223 |
// ---------------------------------------------------------------------------
|
|
224 |
// CMRTaskPlugin::~CMRTaskPlugin
|
|
225 |
// ---------------------------------------------------------------------------
|
|
226 |
//
|
|
227 |
CMRTaskPlugin::~CMRTaskPlugin()
|
|
228 |
{
|
|
229 |
FUNC_LOG;
|
|
230 |
}
|
|
231 |
|
|
232 |
// ---------------------------------------------------------------------------
|
|
233 |
// CMRTaskPlugin::TaskFactory
|
|
234 |
// ---------------------------------------------------------------------------
|
|
235 |
//
|
|
236 |
CMRTaskPlugin* CMRTaskPlugin::NewL( TAny* aCalDbMgr )
|
|
237 |
{
|
|
238 |
FUNC_LOG;
|
|
239 |
|
|
240 |
MESMRCalDbMgr* calDbMgr = static_cast< MESMRCalDbMgr* >( aCalDbMgr );
|
|
241 |
CMRTaskPlugin* self = new(ELeave) CMRTaskPlugin( *calDbMgr );
|
|
242 |
|
|
243 |
return self;
|
|
244 |
}
|
|
245 |
|
|
246 |
// ---------------------------------------------------------------------------
|
|
247 |
// CMRTaskPlugin::CreateTaskL
|
|
248 |
// ---------------------------------------------------------------------------
|
|
249 |
//
|
|
250 |
MESMRTask* CMRTaskPlugin::CreateTaskL(
|
|
251 |
TESMRCommand aCommand,
|
|
252 |
MESMRCalEntry& aEntry )
|
|
253 |
{
|
|
254 |
FUNC_LOG;
|
|
255 |
|
|
256 |
MESMRTask* task = NULL;
|
|
257 |
|
|
258 |
MESMRMeetingRequestEntry& mrEntry =
|
|
259 |
static_cast< MESMRMeetingRequestEntry& >( aEntry );
|
|
260 |
|
|
261 |
switch (aCommand)
|
|
262 |
{
|
|
263 |
case EESMRCmdAcceptMR:
|
|
264 |
case EESMRCmdTentativeMR:
|
|
265 |
case EESMRCmdDeclineMR:
|
|
266 |
task = CreateSendMRResponseViaMailTaskL( aCommand, mrEntry );
|
|
267 |
break;
|
|
268 |
|
|
269 |
case EESMRCmdSendMR:
|
|
270 |
case EESMRCmdSendMRUpdate:
|
|
271 |
task = CreateSendMRTaskL( aCommand, mrEntry );
|
|
272 |
break;
|
|
273 |
|
|
274 |
case EESMRCmdDeleteMR:
|
|
275 |
case EESMRCmdRemoveFromCalendar:
|
|
276 |
case EESMRCmdMailDelete:
|
|
277 |
task = CreateDeleteMRTaskL( aCommand, mrEntry );
|
|
278 |
break;
|
|
279 |
|
|
280 |
case EESMRCmdSaveMR:
|
|
281 |
task = CreateStoreMRToLocalDBTaskL( aCommand, mrEntry );
|
|
282 |
break;
|
|
283 |
|
|
284 |
case EESMRCmdForwardAsMeeting:
|
|
285 |
task = CreateForwardAsMeetingTaskL( aCommand, mrEntry );
|
|
286 |
break;
|
|
287 |
|
|
288 |
case EESMRCmdForwardAsMail:
|
|
289 |
task = CreateForwardAsMailTaskL( mrEntry );
|
|
290 |
break;
|
|
291 |
case EESMRCmdReplyAll:
|
|
292 |
task = CreateReplyAsMailTaskL( mrEntry, ETrue );
|
|
293 |
break;
|
|
294 |
|
|
295 |
case EESMRCmdReply:
|
|
296 |
task = CreateReplyAsMailTaskL( mrEntry, EFalse );
|
|
297 |
break;
|
|
298 |
|
|
299 |
case EESMRCmdCalendarChange:
|
|
300 |
task = CreateMoveMRToCurrentDBTaskL( mrEntry );
|
|
301 |
break;
|
|
302 |
|
|
303 |
default:
|
|
304 |
__ASSERT_DEBUG(EFalse, Panic(EESMRTaskFactoryInvalidTask) );
|
|
305 |
User::Leave( KErrNotSupported );
|
|
306 |
break;
|
|
307 |
}
|
|
308 |
|
|
309 |
|
|
310 |
return task;
|
|
311 |
}
|
|
312 |
|
|
313 |
// ---------------------------------------------------------------------------
|
|
314 |
// CMRTaskPlugin::CreateSendMRResponseViaMailTask
|
|
315 |
// ---------------------------------------------------------------------------
|
|
316 |
//
|
|
317 |
MESMRTask* CMRTaskPlugin::CreateSendMRResponseViaMailTaskL(
|
|
318 |
TESMRCommand aCommand,
|
|
319 |
MESMRMeetingRequestEntry& aEntry )
|
|
320 |
{
|
|
321 |
FUNC_LOG;
|
|
322 |
|
|
323 |
CESMRCombinedTask* task = NULL;
|
|
324 |
TESMRRole role = aEntry.RoleL();
|
|
325 |
|
|
326 |
TBool syncObjectPresent( aEntry.IsSyncObjectPresent() );
|
|
327 |
TBool isStored( aEntry.IsStoredL() );
|
|
328 |
|
|
329 |
if ( EESMRRoleRequiredAttendee == role ||
|
|
330 |
EESMRRoleOptionalAttendee == role ||
|
|
331 |
EESMRRoleNonParticipant == role )
|
|
332 |
{
|
|
333 |
task = CESMRCombinedTask::NewL( aEntry,
|
|
334 |
CESMRCombinedTask::EESMRTrap );
|
|
335 |
|
|
336 |
CleanupStack::PushL( task );
|
|
337 |
|
|
338 |
TESMRResponseType responseType( EESMRResponsePlain );
|
|
339 |
HBufC* responseMessage = QuerySendResponseQueryFromUserL(
|
|
340 |
aCommand,
|
|
341 |
responseType,
|
|
342 |
aEntry );
|
|
343 |
|
|
344 |
// If response message is NULL, it means that user
|
|
345 |
// has cancelled response editing and wants to only exit
|
|
346 |
// application
|
|
347 |
if( responseMessage )
|
|
348 |
{
|
|
349 |
CleanupStack::PushL( responseMessage );
|
|
350 |
|
|
351 |
if ( !syncObjectPresent && EESMRCmdDeclineMR != aCommand)
|
|
352 |
{
|
|
353 |
// Entry is stored or deleted from calendar DB if
|
|
354 |
// sync object is not present
|
|
355 |
// Store MR task
|
|
356 |
AppendTaskL( *task,
|
|
357 |
CESMRStoreMRTask::NewL(
|
|
358 |
iCalDbMgr,
|
|
359 |
aEntry,
|
|
360 |
aEntry.MailboxUtils() ) );
|
|
361 |
}
|
|
362 |
|
|
363 |
if ( EESMRResponseDontSend != responseType )
|
|
364 |
{
|
|
365 |
// Send MR response via mail freestyle task
|
|
366 |
AppendTaskL( *task,
|
|
367 |
CESMRSendMRRespFSMailTask::NewL(
|
|
368 |
aCommand,
|
|
369 |
iCalDbMgr,
|
|
370 |
aEntry,
|
|
371 |
aEntry.MailboxUtils(),
|
|
372 |
responseType,
|
|
373 |
*responseMessage ) );
|
|
374 |
}
|
|
375 |
|
|
376 |
CleanupStack::PopAndDestroy( responseMessage );
|
|
377 |
|
|
378 |
if ( !syncObjectPresent && EESMRCmdDeclineMR == aCommand &&
|
|
379 |
isStored )
|
|
380 |
{
|
|
381 |
// Entry is deleted from calendar DB if
|
|
382 |
// sync object is not present and entry exits in database
|
|
383 |
// Declined --> Delete MR from cal DB task
|
|
384 |
AppendTaskL( *task,
|
|
385 |
CESMRDeleteMRFromDbTask::NewL(
|
|
386 |
iCalDbMgr,
|
|
387 |
aEntry,
|
|
388 |
aEntry.MailboxUtils() ) );
|
|
389 |
}
|
|
390 |
}
|
|
391 |
|
|
392 |
CleanupStack::Pop( task );
|
|
393 |
}
|
|
394 |
else
|
|
395 |
{
|
|
396 |
// Only (opt-)attendees and non-participants can send
|
|
397 |
// responses
|
|
398 |
User::Leave( KErrNotSupported );
|
|
399 |
}
|
|
400 |
|
|
401 |
|
|
402 |
return task;
|
|
403 |
}
|
|
404 |
|
|
405 |
// ---------------------------------------------------------------------------
|
|
406 |
// CMRTaskPlugin::CreateSendMRTask
|
|
407 |
// ---------------------------------------------------------------------------
|
|
408 |
//
|
|
409 |
|
|
410 |
MESMRTask* CMRTaskPlugin::CreateSendMRTaskL(
|
|
411 |
TESMRCommand aCommand,
|
|
412 |
MESMRMeetingRequestEntry& aEntry )
|
|
413 |
{
|
|
414 |
FUNC_LOG;
|
|
415 |
|
|
416 |
CESMRCombinedTask* task = CESMRCombinedTask::NewL( aEntry );
|
|
417 |
|
|
418 |
CleanupStack::PushL( task );
|
|
419 |
|
|
420 |
if ( !aEntry.IsForwardedL() )
|
|
421 |
{
|
|
422 |
// Store MR task
|
|
423 |
AppendTaskL( *task,
|
|
424 |
CESMRStoreMRTask::NewL(
|
|
425 |
iCalDbMgr,
|
|
426 |
aEntry,
|
|
427 |
aEntry.MailboxUtils() ) );
|
|
428 |
}
|
|
429 |
|
|
430 |
if ( !aEntry.OccursInPastL() )
|
|
431 |
{
|
|
432 |
if ( aCommand == EESMRCmdSendMR ||
|
|
433 |
aCommand == EESMRCmdSendMRUpdate )
|
|
434 |
{
|
|
435 |
// Send MR response via mail task
|
|
436 |
AppendTaskL( *task,
|
|
437 |
CESMRSendMRFSMailTask::NewL(
|
|
438 |
iCalDbMgr,
|
|
439 |
aEntry,
|
|
440 |
aEntry.MailboxUtils(),
|
|
441 |
aCommand ) );
|
|
442 |
}
|
|
443 |
}
|
|
444 |
|
|
445 |
CleanupStack::Pop( task );
|
|
446 |
|
|
447 |
|
|
448 |
return task;
|
|
449 |
}
|
|
450 |
|
|
451 |
// ---------------------------------------------------------------------------
|
|
452 |
// CMRTaskPlugin::CreateDeleteMRTask
|
|
453 |
// ---------------------------------------------------------------------------
|
|
454 |
//
|
|
455 |
MESMRTask* CMRTaskPlugin::CreateDeleteMRTaskL(
|
|
456 |
TESMRCommand aCommand,
|
|
457 |
MESMRMeetingRequestEntry& aEntry )
|
|
458 |
{
|
|
459 |
FUNC_LOG;
|
|
460 |
|
|
461 |
MESMRTask* task = NULL;
|
|
462 |
|
|
463 |
if ( EESMRRoleOrganizer == aEntry.RoleL() )
|
|
464 |
{
|
|
465 |
task = CreateOrganizerDeleteMRTaskL( aCommand, aEntry );
|
|
466 |
}
|
|
467 |
else
|
|
468 |
{
|
|
469 |
task = CreateAttendeeDeleteMRTaskL( aCommand, aEntry );
|
|
470 |
}
|
|
471 |
|
|
472 |
|
|
473 |
return task;
|
|
474 |
}
|
|
475 |
|
|
476 |
// ---------------------------------------------------------------------------
|
|
477 |
// CMRTaskPlugin::CreateStoreMRToLocalDBTaskL
|
|
478 |
// ---------------------------------------------------------------------------
|
|
479 |
//
|
|
480 |
MESMRTask* CMRTaskPlugin::CreateStoreMRToLocalDBTaskL(
|
|
481 |
TESMRCommand /*aCommand*/,
|
|
482 |
MESMRMeetingRequestEntry& aEntry )
|
|
483 |
{
|
|
484 |
FUNC_LOG;
|
|
485 |
return CESMRStoreMRTask::NewL(
|
|
486 |
iCalDbMgr,
|
|
487 |
aEntry,
|
|
488 |
aEntry.MailboxUtils() );
|
|
489 |
}
|
|
490 |
|
|
491 |
// ---------------------------------------------------------------------------
|
|
492 |
// CMRTaskPlugin::CreateForwardAsMeetingTaskL
|
|
493 |
// ---------------------------------------------------------------------------
|
|
494 |
//
|
|
495 |
MESMRTask* CMRTaskPlugin::CreateForwardAsMeetingTaskL(
|
|
496 |
TESMRCommand aCommand,
|
|
497 |
MESMRMeetingRequestEntry& aEntry )
|
|
498 |
{
|
|
499 |
FUNC_LOG;
|
|
500 |
MESMRTask* task = NULL;
|
|
501 |
|
|
502 |
// Send MR response via mail task is used for forwarding as meeting request
|
|
503 |
|
|
504 |
if ( aCommand == EESMRCmdForwardAsMeeting )
|
|
505 |
{
|
|
506 |
task = CESMRSendMRFSMailTask::NewL(
|
|
507 |
iCalDbMgr,
|
|
508 |
aEntry,
|
|
509 |
aEntry.MailboxUtils(),
|
|
510 |
aCommand );
|
|
511 |
}
|
|
512 |
return task;
|
|
513 |
}
|
|
514 |
|
|
515 |
|
|
516 |
|
|
517 |
// ---------------------------------------------------------------------------
|
|
518 |
// CMRTaskPlugin::CreateForwardAsMeetingTaskL
|
|
519 |
// ---------------------------------------------------------------------------
|
|
520 |
//
|
|
521 |
MESMRTask* CMRTaskPlugin::CreateForwardAsMailTaskL(
|
|
522 |
MESMRMeetingRequestEntry& aEntry )
|
|
523 |
{
|
|
524 |
FUNC_LOG;
|
|
525 |
// Send MR response via mail task
|
|
526 |
return CESMRForwardAsFSMailTask::NewL(
|
|
527 |
iCalDbMgr,
|
|
528 |
aEntry,
|
|
529 |
aEntry.MailboxUtils() );
|
|
530 |
}
|
|
531 |
|
|
532 |
// ---------------------------------------------------------------------------
|
|
533 |
// CMRTaskPlugin::CreateReplyAsMailTaskL
|
|
534 |
// ---------------------------------------------------------------------------
|
|
535 |
//
|
|
536 |
MESMRTask* CMRTaskPlugin::CreateReplyAsMailTaskL(
|
|
537 |
MESMRMeetingRequestEntry& aEntry, TBool aReplyAll )
|
|
538 |
{
|
|
539 |
FUNC_LOG;
|
|
540 |
// Send MR reply via mail task
|
|
541 |
return CESMRSendMRFSMailReplyTask::NewL(
|
|
542 |
iCalDbMgr,
|
|
543 |
aEntry,
|
|
544 |
aEntry.MailboxUtils(),
|
|
545 |
aReplyAll);
|
|
546 |
|
|
547 |
}
|
|
548 |
|
|
549 |
|
|
550 |
// ---------------------------------------------------------------------------
|
|
551 |
// CMRTaskPlugin::CreateOrganizerDeleteMRTaskL
|
|
552 |
// ---------------------------------------------------------------------------
|
|
553 |
//
|
|
554 |
MESMRTask* CMRTaskPlugin::CreateOrganizerDeleteMRTaskL(
|
|
555 |
TESMRCommand aCommand,
|
|
556 |
MESMRMeetingRequestEntry& aEntry )
|
|
557 |
{
|
|
558 |
FUNC_LOG;
|
|
559 |
|
|
560 |
CESMRCombinedTask* task = CESMRCombinedTask::NewL(
|
|
561 |
aEntry,
|
|
562 |
CESMRCombinedTask::EESMRTrap );
|
|
563 |
|
|
564 |
CleanupStack::PushL( task );
|
|
565 |
|
|
566 |
if ( EESMRCmdDeleteMR == aCommand )
|
|
567 |
{
|
|
568 |
// SYNC_SOLUTION requires the modified entry to be stored into
|
|
569 |
// calendar db for deletion purposes.
|
|
570 |
AppendTaskL( *task,
|
|
571 |
CESMRStoreMRTask::NewL(
|
|
572 |
iCalDbMgr,
|
|
573 |
aEntry,
|
|
574 |
aEntry.MailboxUtils() ) );
|
|
575 |
|
|
576 |
TUint attendeeFlags(
|
|
577 |
EESMRRoleRequiredAttendee | EESMRRoleOptionalAttendee);
|
|
578 |
if ( aEntry.AttendeeCountL( attendeeFlags ) && aEntry.IsSentL()
|
|
579 |
&& !aEntry.OccursInPastL() )
|
|
580 |
{
|
|
581 |
// If entry doesn't need to send cancellation, don't query
|
|
582 |
if( aEntry.SendCanellationAvailable())
|
|
583 |
{
|
|
584 |
// Meeting request contains attendees --> Cancellation message
|
|
585 |
// needs to be sent
|
|
586 |
if ( CESMRConfirmationQuery::ExecuteL(
|
|
587 |
CESMRConfirmationQuery::EESMRSendCancellationInfoToParticipants) )
|
|
588 |
{
|
|
589 |
AppendTaskL( *task,
|
|
590 |
CESMRSendMRFSMailTask::NewL(
|
|
591 |
iCalDbMgr,
|
|
592 |
aEntry,
|
|
593 |
aEntry.MailboxUtils(),
|
|
594 |
aCommand ) );
|
|
595 |
}
|
|
596 |
}
|
|
597 |
aEntry.SetSendCanellationAvailable( ETrue );
|
|
598 |
}
|
|
599 |
}
|
|
600 |
|
|
601 |
// Delete MR from cal DB task
|
|
602 |
AppendTaskL( *task,
|
|
603 |
CESMRDeleteMRFromDbTask::NewL(
|
|
604 |
iCalDbMgr,
|
|
605 |
aEntry,
|
|
606 |
aEntry.MailboxUtils() ) );
|
|
607 |
|
|
608 |
CleanupStack::Pop( task );
|
|
609 |
|
|
610 |
|
|
611 |
return task;
|
|
612 |
}
|
|
613 |
|
|
614 |
// ---------------------------------------------------------------------------
|
|
615 |
// CMRTaskPlugin::CreateAttendeeDeleteMRTaskL
|
|
616 |
// ---------------------------------------------------------------------------
|
|
617 |
//
|
|
618 |
MESMRTask* CMRTaskPlugin::CreateAttendeeDeleteMRTaskL(
|
|
619 |
TESMRCommand aCommand,
|
|
620 |
MESMRMeetingRequestEntry& aEntry )
|
|
621 |
{
|
|
622 |
FUNC_LOG;
|
|
623 |
|
|
624 |
TBool pluginRequiresReplyMail( ReplyMailRequiredL(aEntry) );
|
|
625 |
|
|
626 |
CESMRCombinedTask* task = CESMRCombinedTask::NewL(
|
|
627 |
aEntry,
|
|
628 |
CESMRCombinedTask::EESMRTrap );
|
|
629 |
|
|
630 |
CleanupStack::PushL( task );
|
|
631 |
|
|
632 |
if ( !aEntry.IsOpenedFromMail() && !aEntry.IsSyncObjectPresent() )
|
|
633 |
{
|
|
634 |
// When deleting from the calendar --> Store first modifying entry
|
|
635 |
// And then delete that from calendar DB.
|
|
636 |
//
|
|
637 |
// When opened from mail --> We do not need to store
|
|
638 |
// modifying entry into calendar database.
|
|
639 |
//
|
|
640 |
AppendTaskL( *task,
|
|
641 |
CESMRStoreMRTask::NewL(
|
|
642 |
iCalDbMgr,
|
|
643 |
aEntry,
|
|
644 |
aEntry.MailboxUtils() ) );
|
|
645 |
}
|
|
646 |
|
|
647 |
|
|
648 |
if ( EESMRCmdDeleteMR == aCommand ||
|
|
649 |
EESMRCmdMailDelete == aCommand ||
|
|
650 |
(pluginRequiresReplyMail && EESMRCmdRemoveFromCalendar == aCommand ) )
|
|
651 |
{
|
|
652 |
TBool sendDecline(EFalse);
|
|
653 |
|
|
654 |
if ( pluginRequiresReplyMail )
|
|
655 |
{
|
|
656 |
sendDecline = ETrue;
|
|
657 |
}
|
|
658 |
else
|
|
659 |
{
|
|
660 |
sendDecline = CESMRConfirmationQuery::ExecuteL(
|
|
661 |
CESMRConfirmationQuery::EESMRSendDecline );
|
|
662 |
}
|
|
663 |
|
|
664 |
if( sendDecline )
|
|
665 |
{
|
|
666 |
// Send MR response via mail task. No response message is appended
|
|
667 |
// to sent email
|
|
668 |
|
|
669 |
TESMRCommand command( EESMRCmdDeclineMR );
|
|
670 |
|
|
671 |
if ( pluginRequiresReplyMail && EESMRCmdRemoveFromCalendar == aCommand )
|
|
672 |
{
|
|
673 |
command = EESMRCmdRemoveFromCalendar;
|
|
674 |
}
|
|
675 |
|
|
676 |
AppendTaskL( *task,
|
|
677 |
CESMRSendMRRespFSMailTask::NewL(
|
|
678 |
command,
|
|
679 |
iCalDbMgr,
|
|
680 |
aEntry,
|
|
681 |
aEntry.MailboxUtils(),
|
|
682 |
EESMRResponsePlain,
|
|
683 |
KNullDesC() ) );
|
|
684 |
}
|
|
685 |
}
|
|
686 |
|
|
687 |
// Delete MR from cal DB task if plugin does not handle it
|
|
688 |
if ( !pluginRequiresReplyMail )
|
|
689 |
{
|
|
690 |
AppendTaskL( *task,
|
|
691 |
CESMRDeleteMRFromDbTask::NewL(
|
|
692 |
iCalDbMgr,
|
|
693 |
aEntry,
|
|
694 |
aEntry.MailboxUtils() ) );
|
|
695 |
}
|
|
696 |
|
|
697 |
CleanupStack::Pop( task );
|
|
698 |
|
|
699 |
|
|
700 |
return task;
|
|
701 |
}
|
|
702 |
|
|
703 |
// ---------------------------------------------------------------------------
|
|
704 |
// CMRTaskPlugin::CreateMoveMRToCurrentDBTaskL
|
|
705 |
// ---------------------------------------------------------------------------
|
|
706 |
//
|
|
707 |
MESMRTask* CMRTaskPlugin::CreateMoveMRToCurrentDBTaskL(
|
|
708 |
MESMRMeetingRequestEntry& aEntry )
|
|
709 |
{
|
|
710 |
// Check first that entry can be moved
|
|
711 |
if ( aEntry.IsSyncObjectPresent() )
|
|
712 |
{
|
|
713 |
__ASSERT_DEBUG( EFalse, Panic( EESMRTaskFactoryIllegalTask ) );
|
|
714 |
User::Leave( KErrNotSupported );
|
|
715 |
}
|
|
716 |
|
|
717 |
// Create combined task
|
|
718 |
CESMRCombinedTask* task = CESMRCombinedTask::NewL(
|
|
719 |
aEntry,
|
|
720 |
CESMRCombinedTask::EESMRTrap );
|
|
721 |
|
|
722 |
CleanupStack::PushL( task );
|
|
723 |
|
|
724 |
if ( !aEntry.IsOpenedFromMail() )
|
|
725 |
{
|
|
726 |
// When deleting from the calendar --> Store first modifying entry
|
|
727 |
// And then delete that from calendar DB.
|
|
728 |
//
|
|
729 |
// When opened from mail --> We do not need to store
|
|
730 |
// modifying entry into calendar database.
|
|
731 |
//
|
|
732 |
AppendTaskL(
|
|
733 |
*task,
|
|
734 |
CESMRStoreMRTask::NewL(
|
|
735 |
iCalDbMgr,
|
|
736 |
aEntry,
|
|
737 |
aEntry.MailboxUtils() ) );
|
|
738 |
}
|
|
739 |
|
|
740 |
// Delete entry from old db
|
|
741 |
AppendTaskL(
|
|
742 |
*task,
|
|
743 |
CESMRDeleteMRFromDbTask::NewL(
|
|
744 |
iCalDbMgr,
|
|
745 |
aEntry,
|
|
746 |
aEntry.MailboxUtils() ) );
|
|
747 |
|
|
748 |
// Store entry to current db
|
|
749 |
AppendTaskL(
|
|
750 |
*task,
|
|
751 |
CESMRStoreMRTask::NewL(
|
|
752 |
iCalDbMgr,
|
|
753 |
aEntry,
|
|
754 |
aEntry.MailboxUtils() ) );
|
|
755 |
|
|
756 |
CleanupStack::Pop( task );
|
|
757 |
return task;
|
|
758 |
}
|
|
759 |
|
|
760 |
// EOF
|
|
761 |
|