21 #include <caluser.h> |
21 #include <caluser.h> |
22 #include "esmrinternaluid.h" |
22 #include "esmrinternaluid.h" |
23 //<cmail> |
23 //<cmail> |
24 #include "cesmrpolicymanager.h" |
24 #include "cesmrpolicymanager.h" |
25 //</cmail> |
25 //</cmail> |
26 #include "cesmrentryprocessor.h" |
|
27 #include "mesmrmeetingrequestentry.h" |
26 #include "mesmrmeetingrequestentry.h" |
28 #include "cesmrtaskfactory.h" |
27 #include "cesmrtaskfactory.h" |
29 #include "mesmrtask.h" |
28 #include "mesmrtask.h" |
30 |
29 |
31 // ======== MEMBER FUNCTIONS ======== |
30 // ======== MEMBER FUNCTIONS ======== |
32 |
31 |
33 // --------------------------------------------------------------------------- |
32 // --------------------------------------------------------------------------- |
34 // CESMRTaskExtenstionImpl::CESMRTaskExtenstionImpl |
33 // CESMRTaskExtenstionImpl::CESMRTaskExtenstionImpl |
35 // --------------------------------------------------------------------------- |
34 // --------------------------------------------------------------------------- |
36 // |
35 // |
37 CESMRTaskExtenstionImpl::CESMRTaskExtenstionImpl( |
36 CESMRTaskExtenstionImpl::CESMRTaskExtenstionImpl( MESMRTaskFactory& aTaskFactory ) |
38 MESMRCalDbMgr& aCalDBMgr, |
37 : iTaskFactory( aTaskFactory ) |
39 CMRMailboxUtils& aMRMailboxUtils, |
38 { |
40 CESMRPolicyManager& aPolicyManager, |
39 FUNC_LOG; |
41 CESMREntryProcessor& aEntryProcessor, |
40 //do nothing |
|
41 } |
|
42 |
|
43 |
|
44 // --------------------------------------------------------------------------- |
|
45 // CESMRTaskExtenstionImpl::~CESMRTaskExtenstionImpl |
|
46 // --------------------------------------------------------------------------- |
|
47 // |
|
48 EXPORT_C CESMRTaskExtenstionImpl::~CESMRTaskExtenstionImpl() |
|
49 { |
|
50 FUNC_LOG; |
|
51 //do nothing |
|
52 } |
|
53 |
|
54 // --------------------------------------------------------------------------- |
|
55 // CESMRTaskExtenstionImpl::NewL |
|
56 // --------------------------------------------------------------------------- |
|
57 // |
|
58 EXPORT_C CESMRTaskExtenstionImpl* CESMRTaskExtenstionImpl::NewL( |
42 MESMRTaskFactory& aTaskFactory ) |
59 MESMRTaskFactory& aTaskFactory ) |
43 : iCalDBMgr( aCalDBMgr ), |
|
44 iMRMailboxUtils( aMRMailboxUtils), |
|
45 iPolicyManager( aPolicyManager ), |
|
46 iEntryProcessor( aEntryProcessor), |
|
47 iTaskFactory( aTaskFactory ) |
|
48 { |
|
49 FUNC_LOG; |
|
50 //do nothing |
|
51 } |
|
52 |
|
53 |
|
54 // --------------------------------------------------------------------------- |
|
55 // CESMRTaskExtenstionImpl::~CESMRTaskExtenstionImpl |
|
56 // --------------------------------------------------------------------------- |
|
57 // |
|
58 EXPORT_C CESMRTaskExtenstionImpl::~CESMRTaskExtenstionImpl() |
|
59 { |
|
60 FUNC_LOG; |
|
61 //do nothing |
|
62 } |
|
63 |
|
64 // --------------------------------------------------------------------------- |
|
65 // CESMRTaskExtenstionImpl::NewL |
|
66 // --------------------------------------------------------------------------- |
|
67 // |
|
68 EXPORT_C CESMRTaskExtenstionImpl* CESMRTaskExtenstionImpl::NewL( |
|
69 MESMRCalDbMgr& aCalDBMgr, |
|
70 CMRMailboxUtils& aMRMailboxUtils, |
|
71 CESMRPolicyManager& aPolicyManager, |
|
72 CESMREntryProcessor& aEntryProcessor, |
|
73 MESMRTaskFactory& aTaskFactory ) |
|
74 { |
60 { |
75 FUNC_LOG; |
61 FUNC_LOG; |
76 CESMRTaskExtenstionImpl* self = |
62 CESMRTaskExtenstionImpl* self = |
77 new (ELeave) CESMRTaskExtenstionImpl( |
63 new (ELeave) CESMRTaskExtenstionImpl( aTaskFactory ); |
78 aCalDBMgr, |
|
79 aMRMailboxUtils, |
|
80 aPolicyManager, |
|
81 aEntryProcessor, |
|
82 aTaskFactory ); |
|
83 CleanupStack::PushL( self ); |
64 CleanupStack::PushL( self ); |
84 self->ConstructL(); |
65 self->ConstructL(); |
85 CleanupStack::Pop( self ); |
66 CleanupStack::Pop( self ); |
86 return self; |
67 return self; |
87 } |
68 } |
100 // CESMRTaskExtenstionImpl::SendAndStoreResponseL |
81 // CESMRTaskExtenstionImpl::SendAndStoreResponseL |
101 // --------------------------------------------------------------------------- |
82 // --------------------------------------------------------------------------- |
102 // |
83 // |
103 void CESMRTaskExtenstionImpl::SendAndStoreResponseL( |
84 void CESMRTaskExtenstionImpl::SendAndStoreResponseL( |
104 TESMRCommand aCommand, |
85 TESMRCommand aCommand, |
105 MESMRMeetingRequestEntry& aEntry ) |
86 MESMRCalEntry& aEntry ) |
106 { |
87 { |
107 FUNC_LOG; |
88 FUNC_LOG; |
|
89 |
108 // First do possible command conversion |
90 // First do possible command conversion |
109 if ( EESMRAcceptWithoutAttachmentCheck == aCommand ) |
91 |
|
92 switch ( aCommand ) |
110 { |
93 { |
111 aCommand = EESMRCmdAcceptMR; |
94 case EESMRAcceptWithoutAttachmentCheck: |
|
95 { |
|
96 aCommand = EESMRCmdAcceptMR; |
|
97 break; |
|
98 } |
|
99 case EESMRTentativeWithoutAttachmentCheck: |
|
100 { |
|
101 aCommand = EESMRCmdTentativeMR; |
|
102 break; |
|
103 } |
|
104 case EESMRDeclineWithoutAttachmentCheck: |
|
105 { |
|
106 aCommand = EESMRCmdDeclineMR; |
|
107 break; |
|
108 } |
|
109 default: |
|
110 { |
|
111 break; |
|
112 } |
112 } |
113 } |
113 else if ( EESMRTentativeWithoutAttachmentCheck == aCommand ) |
114 |
114 { |
|
115 aCommand = EESMRCmdTentativeMR; |
|
116 } |
|
117 else if ( EESMRDeclineWithoutAttachmentCheck == aCommand ) |
|
118 { |
|
119 aCommand = EESMRCmdDeclineMR; |
|
120 } |
|
121 |
|
122 // Check that command is valid |
|
123 if ( !( EESMRCmdAcceptMR == aCommand || |
|
124 EESMRCmdTentativeMR == aCommand || |
|
125 EESMRCmdDeclineMR == aCommand ) ) |
|
126 { |
|
127 // Invalid command --> Leave |
|
128 User::Leave( KErrArgument ); |
|
129 } |
|
130 |
|
131 CreateAndExecuteTaskL( aCommand, aEntry ); |
115 CreateAndExecuteTaskL( aCommand, aEntry ); |
132 } |
116 } |
133 |
117 |
134 // --------------------------------------------------------------------------- |
118 // --------------------------------------------------------------------------- |
135 // CESMRTaskExtenstionImpl::SendAndStoreMRL |
119 // CESMRTaskExtenstionImpl::SendAndStoreMRL |
136 // --------------------------------------------------------------------------- |
120 // --------------------------------------------------------------------------- |
137 // |
121 // |
138 void CESMRTaskExtenstionImpl::SendAndStoreMRL( |
122 void CESMRTaskExtenstionImpl::SendAndStoreMRL( |
139 TESMRCommand aCommand, |
123 TESMRCommand aCommand, |
140 MESMRMeetingRequestEntry& aEntry ) |
124 MESMRCalEntry& aEntry ) |
141 { |
125 { |
142 FUNC_LOG; |
126 FUNC_LOG; |
143 // Check that command is valid |
127 |
144 if ( !( EESMRCmdSendMR == aCommand || |
|
145 EESMRCmdSendMRUpdate == aCommand) ) |
|
146 { |
|
147 // Invalid command --> Leave |
|
148 User::Leave( KErrArgument ); |
|
149 } |
|
150 |
|
151 CreateAndExecuteTaskL( aCommand, aEntry ); |
|
152 } |
|
153 |
|
154 // --------------------------------------------------------------------------- |
|
155 // CESMRTaskExtenstionImpl::SendAndStoreMRL |
|
156 // --------------------------------------------------------------------------- |
|
157 // |
|
158 void CESMRTaskExtenstionImpl::DeleteMRFromLocalDBL( |
|
159 TESMRCommand aCommand, |
|
160 MESMRMeetingRequestEntry& aEntry ) |
|
161 { |
|
162 FUNC_LOG; |
|
163 // Check that command is valid |
|
164 if ( EESMRCmdDeleteMR != aCommand ) |
|
165 { |
|
166 // Invalid command --> Leave |
|
167 User::Leave( KErrArgument ); |
|
168 } |
|
169 |
|
170 // Create and execute task |
|
171 CreateAndExecuteTaskL( aCommand, aEntry ); |
128 CreateAndExecuteTaskL( aCommand, aEntry ); |
172 } |
129 } |
173 |
130 |
174 // --------------------------------------------------------------------------- |
131 // --------------------------------------------------------------------------- |
175 // CESMRTaskExtenstionImpl::SendAndStoreMRL |
132 // CESMRTaskExtenstionImpl::SendAndStoreMRL |
176 // --------------------------------------------------------------------------- |
133 // --------------------------------------------------------------------------- |
177 // |
134 // |
178 void CESMRTaskExtenstionImpl::DeleteAndSendMRL( |
135 void CESMRTaskExtenstionImpl::DeleteAndSendMRL( |
179 TESMRCommand aCommand, |
136 TESMRCommand aCommand, |
180 MESMRMeetingRequestEntry& aEntry ) |
137 MESMRCalEntry& aEntry ) |
181 { |
138 { |
182 FUNC_LOG; |
139 FUNC_LOG; |
183 // Check that command is valid |
140 |
184 if ( EESMRCmdDeleteMR == aCommand || |
141 // Create And execute task |
185 EESMRCmdRemoveFromCalendar == aCommand || |
142 CreateAndExecuteTaskL( aCommand, aEntry ); |
186 EESMRCmdMailDelete == aCommand ) |
143 } |
187 { |
144 |
188 // Create And execute task |
145 // --------------------------------------------------------------------------- |
189 CreateAndExecuteTaskL( aCommand, aEntry ); |
146 // CESMRTaskExtenstionImpl::StoreEntryToLocalDBL |
190 } |
147 // --------------------------------------------------------------------------- |
191 else |
148 // |
192 { |
149 void CESMRTaskExtenstionImpl::StoreEntryToLocalDBL( |
193 // Invalid command --> Leave |
150 TESMRCommand aCommand, |
194 User::Leave( KErrArgument ); |
151 MESMRCalEntry& aEntry ) |
195 } |
152 { |
196 } |
153 FUNC_LOG; |
197 |
154 |
198 // --------------------------------------------------------------------------- |
155 // Create And exexute task |
199 // CESMRTaskExtenstionImpl::StoreMRToLocalDBL |
156 CreateAndExecuteTaskL( aCommand, aEntry ); |
200 // --------------------------------------------------------------------------- |
157 } |
201 // |
158 |
202 void CESMRTaskExtenstionImpl::StoreMRToLocalDBL( |
|
203 TESMRCommand aCommand, |
|
204 MESMRMeetingRequestEntry& aEntry ) |
|
205 { |
|
206 FUNC_LOG; |
|
207 if ( EESMRCmdSaveMR != aCommand ) |
|
208 { |
|
209 // Invalid command --> Leave |
|
210 User::Leave( KErrArgument ); |
|
211 } |
|
212 CreateAndExecuteTaskL( aCommand, aEntry ); |
|
213 } |
|
214 |
159 |
215 // --------------------------------------------------------------------------- |
160 // --------------------------------------------------------------------------- |
216 // CESMRTaskExtenstionImpl::ForwardMRAsEmailL |
161 // CESMRTaskExtenstionImpl::ForwardMRAsEmailL |
217 // --------------------------------------------------------------------------- |
162 // --------------------------------------------------------------------------- |
218 // |
163 // |
219 void CESMRTaskExtenstionImpl::ForwardMRAsEmailL( |
164 void CESMRTaskExtenstionImpl::ForwardMRAsEmailL( |
220 TESMRCommand aCommand, |
165 TESMRCommand aCommand, |
221 MESMRMeetingRequestEntry& aEntry ) |
166 MESMRCalEntry& aEntry ) |
222 { |
167 { |
223 FUNC_LOG; |
168 FUNC_LOG; |
224 // Check that command is valid |
169 |
225 if ( EESMRCmdForwardAsMail != aCommand ) |
|
226 { |
|
227 // Invalid command --> Leave |
|
228 User::Leave( KErrArgument ); |
|
229 } |
|
230 |
|
231 // Create And exexute task |
170 // Create And exexute task |
232 CreateAndExecuteTaskL( aCommand, aEntry ); |
171 CreateAndExecuteTaskL( aCommand, aEntry ); |
233 } |
172 } |
234 |
173 |
235 // --------------------------------------------------------------------------- |
174 // --------------------------------------------------------------------------- |
236 // CESMRTaskExtenstionImpl::ReplyAsEmailL |
175 // CESMRTaskExtenstionImpl::ReplyAsEmailL |
237 // --------------------------------------------------------------------------- |
176 // --------------------------------------------------------------------------- |
238 // |
177 // |
239 void CESMRTaskExtenstionImpl::ReplyAsEmailL( |
178 void CESMRTaskExtenstionImpl::ReplyAsEmailL( |
240 TESMRCommand aCommand, |
179 TESMRCommand aCommand, |
241 MESMRMeetingRequestEntry& aEntry ) |
180 MESMRCalEntry& aEntry ) |
242 { |
181 { |
243 FUNC_LOG; |
182 FUNC_LOG; |
244 // Check that command is valid |
183 |
245 if ( EESMRCmdReply != aCommand && EESMRCmdReplyAll != aCommand) |
184 // Create And exexute task |
246 { |
185 CreateAndExecuteTaskL( aCommand, aEntry ); |
247 // Invalid command --> Leave |
186 } |
248 User::Leave( KErrArgument ); |
187 |
249 } |
188 // --------------------------------------------------------------------------- |
250 |
189 // CESMRTaskExtenstionImpl::DeleteEntryFromLocalDBL |
251 // Create And exexute task |
190 // --------------------------------------------------------------------------- |
252 CreateAndExecuteTaskL( aCommand, aEntry ); |
191 // |
|
192 void CESMRTaskExtenstionImpl::DeleteEntryFromLocalDBL( |
|
193 TESMRCommand aCommand, |
|
194 MESMRCalEntry& aEntry ) |
|
195 { |
|
196 FUNC_LOG; |
|
197 |
|
198 // Create And exexute task |
|
199 CreateAndExecuteTaskL( aCommand, aEntry ); |
|
200 } |
|
201 |
|
202 // --------------------------------------------------------------------------- |
|
203 // CESMRTaskExtenstionImpl::MarkTodoAsDoneL |
|
204 // --------------------------------------------------------------------------- |
|
205 // |
|
206 void CESMRTaskExtenstionImpl::MarkTodoAsDoneL( |
|
207 TESMRCommand aCommand, |
|
208 MESMRCalEntry& aEntry ) |
|
209 { |
|
210 FUNC_LOG; |
|
211 |
|
212 // Create And execute task |
|
213 CreateAndExecuteTaskL( aCommand, aEntry ); |
|
214 } |
|
215 |
|
216 // --------------------------------------------------------------------------- |
|
217 // CESMRTaskExtenstionImpl::MarkTodoAsNotDoneL |
|
218 // --------------------------------------------------------------------------- |
|
219 // |
|
220 void CESMRTaskExtenstionImpl::MarkTodoAsNotDoneL( |
|
221 TESMRCommand aCommand, |
|
222 MESMRCalEntry& aEntry ) |
|
223 { |
|
224 FUNC_LOG; |
|
225 |
|
226 // Create And exexute task |
|
227 CreateAndExecuteTaskL( aCommand, aEntry ); |
|
228 } |
|
229 |
|
230 // --------------------------------------------------------------------------- |
|
231 // CESMRTaskExtenstionImpl::MoveEntryToCurrentDBL |
|
232 // --------------------------------------------------------------------------- |
|
233 // |
|
234 void CESMRTaskExtenstionImpl::MoveEntryToCurrentDBL( |
|
235 TESMRCommand /*aCommand*/, |
|
236 MESMRCalEntry& aEntry ) |
|
237 { |
|
238 FUNC_LOG; |
|
239 |
|
240 // Create And exexute task |
|
241 CreateAndExecuteTaskL( EESMRCmdCalendarChange, aEntry ); |
253 } |
242 } |
254 |
243 |
255 // --------------------------------------------------------------------------- |
244 // --------------------------------------------------------------------------- |
256 // CESMRTaskExtenstionImpl::CreateAndExecuteTaskL |
245 // CESMRTaskExtenstionImpl::CreateAndExecuteTaskL |
257 // --------------------------------------------------------------------------- |
246 // --------------------------------------------------------------------------- |
258 // |
247 // |
259 void CESMRTaskExtenstionImpl::CreateAndExecuteTaskL( |
248 void CESMRTaskExtenstionImpl::CreateAndExecuteTaskL( |
260 TESMRCommand aCommand, |
249 TESMRCommand aCommand, |
261 MESMRMeetingRequestEntry& aEntry ) |
250 MESMRCalEntry& aEntry ) |
262 { |
251 { |
263 FUNC_LOG; |
252 FUNC_LOG; |
264 MESMRTask* task = iTaskFactory.CreateTaskL( aCommand, aEntry ); |
253 MESMRTask* task = iTaskFactory.CreateTaskL( aCommand, aEntry ); |
265 |
254 |
266 if (task ) |
255 if (task ) |
267 { |
256 { |
268 CleanupDeletePushL( task ); |
257 CleanupDeletePushL( task ); |
269 task->ExecuteTaskL(); |
258 task->ExecuteTaskL(); |
270 CleanupStack::PopAndDestroy(); // task; |
259 CleanupStack::PopAndDestroy( task ); // task; |
271 } |
260 } |
272 else |
261 else |
273 { |
262 { |
274 // Task cannot be constructed --> Leave |
263 // Task cannot be constructed --> Leave |
275 |
264 |