|
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 base task |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "emailtrace.h" |
|
19 #include "cesmrsendmrrespmailtask.h" |
|
20 |
|
21 #include <calentry.h> |
|
22 #include <caluser.h> |
|
23 #include <cmrmailboxutils.h> |
|
24 #include <avkon.hrh> |
|
25 #include "cesmrcalimportexporter.h" |
|
26 #include "mesmrmeetingrequestentry.h" |
|
27 #include "esmrhelper.h" |
|
28 #include "cesmrlistquery.h" |
|
29 #include "cesmrmeetingrequestsender.h" |
|
30 #include "cesmrresponsedialog.h" |
|
31 |
|
32 |
|
33 // ======== MEMBER FUNCTIONS ======== |
|
34 |
|
35 // --------------------------------------------------------------------------- |
|
36 // CESMRSendMRRespMailTask::CESMRSendMRRespMailTask |
|
37 // --------------------------------------------------------------------------- |
|
38 // |
|
39 CESMRSendMRRespMailTask::CESMRSendMRRespMailTask( |
|
40 TESMRCommand aCommand, |
|
41 MESMRCalDbMgr& aCalDbMgr, |
|
42 MESMRMeetingRequestEntry& aEntry, |
|
43 CMRMailboxUtils& aMRMailboxUtils, |
|
44 TESMRResponseType aResponseType ) |
|
45 : CESMRTaskBase( aCalDbMgr, aEntry, aMRMailboxUtils ), |
|
46 iCommand( aCommand ), |
|
47 iResponseType( aResponseType ) |
|
48 { |
|
49 FUNC_LOG; |
|
50 //do nothing |
|
51 } |
|
52 |
|
53 // --------------------------------------------------------------------------- |
|
54 // CESMRSendMRRespMailTask::~CESMRSendMRRespMailTask |
|
55 // --------------------------------------------------------------------------- |
|
56 // |
|
57 CESMRSendMRRespMailTask::~CESMRSendMRRespMailTask() |
|
58 { |
|
59 FUNC_LOG; |
|
60 delete iResponseMessage; |
|
61 delete iResponseEntry; |
|
62 } |
|
63 |
|
64 // --------------------------------------------------------------------------- |
|
65 // CESMRSendMRRespMailTask::NewL |
|
66 // --------------------------------------------------------------------------- |
|
67 // |
|
68 CESMRSendMRRespMailTask* CESMRSendMRRespMailTask::NewL( |
|
69 TESMRCommand aCommand, |
|
70 MESMRCalDbMgr& aCalDbMgr, |
|
71 MESMRMeetingRequestEntry& aEntry, |
|
72 CMRMailboxUtils& aMRMailboxUtils, |
|
73 TESMRResponseType aResponseType, |
|
74 const TDesC& aResponseMessage ) |
|
75 { |
|
76 FUNC_LOG; |
|
77 CESMRSendMRRespMailTask* self = |
|
78 new (ELeave) CESMRSendMRRespMailTask( |
|
79 aCommand, |
|
80 aCalDbMgr, |
|
81 aEntry, |
|
82 aMRMailboxUtils, |
|
83 aResponseType ); |
|
84 |
|
85 CleanupStack::PushL(self); |
|
86 self->ConstructL( aResponseMessage ); |
|
87 CleanupStack::Pop(self); |
|
88 return self; |
|
89 } |
|
90 |
|
91 // --------------------------------------------------------------------------- |
|
92 // CESMRSendMRRespMailTask::ConstructL |
|
93 // --------------------------------------------------------------------------- |
|
94 // |
|
95 void CESMRSendMRRespMailTask::ConstructL( |
|
96 const TDesC& aResponseMessage ) |
|
97 { |
|
98 FUNC_LOG; |
|
99 BaseConstructL(); |
|
100 iResponseMessage = aResponseMessage.AllocL(); |
|
101 } |
|
102 |
|
103 // --------------------------------------------------------------------------- |
|
104 // CESMRSendMRRespMailTask::ExecuteTaskL |
|
105 // --------------------------------------------------------------------------- |
|
106 // |
|
107 void CESMRSendMRRespMailTask::ExecuteTaskL() |
|
108 { |
|
109 FUNC_LOG; |
|
110 // Checking input paramters |
|
111 if ( EESMRResponseMessage == iResponseType && |
|
112 !iResponseMessage->Length() ) |
|
113 { |
|
114 User::Leave( KErrArgument ); |
|
115 } |
|
116 |
|
117 if( CCalEntry::EMethodReply != ESMREntry().Entry().MethodL() ) |
|
118 { |
|
119 User::Leave( KErrArgument ); |
|
120 } |
|
121 |
|
122 if ( EESMRResponseDontSend != iResponseType ) |
|
123 { |
|
124 SendResponseMessageL(); |
|
125 } |
|
126 } |
|
127 |
|
128 // --------------------------------------------------------------------------- |
|
129 // CESMRSendMRRespMailTask::SendResponseMessageL |
|
130 // --------------------------------------------------------------------------- |
|
131 // |
|
132 void CESMRSendMRRespMailTask::SendResponseMessageL() |
|
133 { |
|
134 FUNC_LOG; |
|
135 CESMRMeetingRequestSender* sender = |
|
136 CESMRMeetingRequestSender::NewL( MailboxUtils() ); |
|
137 CleanupStack::PushL( sender ); |
|
138 |
|
139 if ( iResponseMessage ) |
|
140 { |
|
141 sender->CreateAndSendMeetingRequestL( |
|
142 ESMREntry(), |
|
143 *iResponseMessage ); |
|
144 } |
|
145 else |
|
146 { |
|
147 sender->CreateAndSendMeetingRequestL( |
|
148 ESMREntry() ); |
|
149 } |
|
150 |
|
151 CleanupStack::PopAndDestroy( sender ); |
|
152 } |
|
153 |