|
1 /* |
|
2 * Copyright (c) 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: MRUI field build plugin extension implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "CESMRFieldBuilderPluginExtension.h" |
|
19 |
|
20 //<cmail> |
|
21 #include "esmrdef.h" |
|
22 //</cmail> |
|
23 #include "tesmrentryfield.h" |
|
24 #include "mesmrresponseobserver.h" |
|
25 #include "cesmrattendeefield.h" |
|
26 #include "cesmrtrackingfieldlabel.h" |
|
27 #include "cesmrtrackstatus.h" |
|
28 #include "cesmrviewerattendeesfield.h" |
|
29 #include "cesmrresponsefield.h" |
|
30 #include "cesmrviewerfromfield.h" |
|
31 #include "cesmrfieldbuilderinterface.h" |
|
32 #include "cfsmailcommon.h" |
|
33 |
|
34 #include <CalenInterimUtils2.h> |
|
35 #include <featdiscovery.h> |
|
36 #include <bldvariant.hrh> |
|
37 |
|
38 // DEBUG |
|
39 #include "emailtrace.h" |
|
40 |
|
41 // ======== MEMBER FUNCTIONS ======== |
|
42 |
|
43 // ----------------------------------------------------------------------------- |
|
44 // CESMRFieldBuilderPluginExtension::CESMRFieldBuilderPluginExtension |
|
45 // ----------------------------------------------------------------------------- |
|
46 // |
|
47 CESMRFieldBuilderPluginExtension::CESMRFieldBuilderPluginExtension() : |
|
48 iESMRStaticAccessed(EFalse) |
|
49 { |
|
50 FUNC_LOG; |
|
51 //do nothing |
|
52 } |
|
53 |
|
54 // ----------------------------------------------------------------------------- |
|
55 // CESMRFieldBuilderPluginExtension::~CESMRFieldBuilderPluginExtension |
|
56 // ----------------------------------------------------------------------------- |
|
57 // |
|
58 CESMRFieldBuilderPluginExtension::~CESMRFieldBuilderPluginExtension() |
|
59 { |
|
60 FUNC_LOG; |
|
61 if(iESMRStaticAccessed) |
|
62 { |
|
63 iESMRStatic.Close(); |
|
64 } |
|
65 } |
|
66 |
|
67 // ---------------------------------------------------------------------------- |
|
68 // CESMRFieldBuilderPluginExtension::ExtensionL |
|
69 // ---------------------------------------------------------------------------- |
|
70 // |
|
71 TAny* CESMRFieldBuilderPluginExtension::ExtensionL( TUid /*aExtensionUid*/ ) |
|
72 { |
|
73 FUNC_LOG; |
|
74 MESMRBuilderExtension* capa = static_cast<MESMRBuilderExtension*>( this ); |
|
75 return capa; |
|
76 } |
|
77 |
|
78 // ---------------------------------------------------------------------------- |
|
79 // CESMRFieldBuilderPluginExtension::CFSMailBoxCapabilityL |
|
80 // ---------------------------------------------------------------------------- |
|
81 // |
|
82 TBool CESMRFieldBuilderPluginExtension::CFSMailBoxCapabilityL( |
|
83 TMRCFSMailBoxCapability aCapa ) |
|
84 { |
|
85 FUNC_LOG; |
|
86 |
|
87 iESMRStatic.ConnectL(); |
|
88 iESMRStaticAccessed = ETrue; |
|
89 |
|
90 return HasCapability( iESMRStatic.DefaultFSMailBoxL(), aCapa ); |
|
91 } |
|
92 |
|
93 // ---------------------------------------------------------------------------- |
|
94 // CESMRFieldBuilderPluginExtension::CFSMailBoxCapabilityL |
|
95 // ---------------------------------------------------------------------------- |
|
96 // |
|
97 TBool CESMRFieldBuilderPluginExtension::CFSMailBoxCapabilityL( |
|
98 const TDesC& aEmailAddress, |
|
99 TMRCFSMailBoxCapability aCapa ) |
|
100 { |
|
101 FUNC_LOG; |
|
102 |
|
103 iESMRStatic.ConnectL(); |
|
104 iESMRStaticAccessed = ETrue; |
|
105 |
|
106 CFSMailBox* mailBox = iESMRStatic.MailBoxL( aEmailAddress ); |
|
107 TBool result = HasCapability( *mailBox, aCapa ); |
|
108 delete mailBox; |
|
109 |
|
110 return result; |
|
111 } |
|
112 |
|
113 // ---------------------------------------------------------------------------- |
|
114 // CESMRFieldBuilderPluginExtension::MRCanBeOriginateedL |
|
115 // ---------------------------------------------------------------------------- |
|
116 // |
|
117 TBool CESMRFieldBuilderPluginExtension::MRCanBeOriginateedL() |
|
118 { |
|
119 FUNC_LOG; |
|
120 TBool retValue( EFalse ); |
|
121 |
|
122 if ( CFeatureDiscovery::IsFeatureSupportedL( |
|
123 TUid::Uid( KFeatureIdFfCalMeetingRequestUi ) ) ) |
|
124 { |
|
125 iESMRStatic.ConnectL(); |
|
126 iESMRStaticAccessed = ETrue; |
|
127 |
|
128 CCalenInterimUtils2* calUtils2 = CCalenInterimUtils2::NewL(); |
|
129 CleanupStack::PushL( calUtils2 ); |
|
130 if ( calUtils2->MRViewersEnabledL() ) |
|
131 { |
|
132 TRAPD( err, iESMRStatic.DefaultFSMailBoxL() ); |
|
133 |
|
134 if ( KErrNone == err ) |
|
135 { |
|
136 // If can fetch the default FS mailbox --> |
|
137 // We are able to originate MR as well. |
|
138 retValue = ETrue; |
|
139 } |
|
140 } |
|
141 |
|
142 CleanupStack::PopAndDestroy( calUtils2 ); |
|
143 calUtils2 = NULL; |
|
144 } |
|
145 return retValue; |
|
146 } |
|
147 |
|
148 // ----------------------------------------------------------------------------- |
|
149 // CESMRFieldBuilderPluginExtension::NewL |
|
150 // ----------------------------------------------------------------------------- |
|
151 // |
|
152 CESMRFieldBuilderPluginExtension* CESMRFieldBuilderPluginExtension::NewL() |
|
153 { |
|
154 FUNC_LOG; |
|
155 CESMRFieldBuilderPluginExtension* self = |
|
156 new (ELeave) CESMRFieldBuilderPluginExtension; |
|
157 CleanupStack::PushL(self); |
|
158 self->ConstructL(); |
|
159 CleanupStack::Pop(self); |
|
160 return self; |
|
161 } |
|
162 |
|
163 // ----------------------------------------------------------------------------- |
|
164 // CESMRFieldBuilderPluginExtension::ConstructL |
|
165 // ----------------------------------------------------------------------------- |
|
166 // |
|
167 void CESMRFieldBuilderPluginExtension::ConstructL() |
|
168 { |
|
169 FUNC_LOG; |
|
170 //do nothing |
|
171 } |
|
172 |
|
173 // ----------------------------------------------------------------------------- |
|
174 // CESMRFieldBuilderPluginExtension::FieldBuilderL |
|
175 // ----------------------------------------------------------------------------- |
|
176 // |
|
177 MESMRFieldBuilder* CESMRFieldBuilderPluginExtension::FieldBuilderL() |
|
178 { |
|
179 FUNC_LOG; |
|
180 return this; |
|
181 } |
|
182 |
|
183 // ----------------------------------------------------------------------------- |
|
184 // CESMRFieldBuilderPluginExtension::CreateEditorFieldL |
|
185 // ----------------------------------------------------------------------------- |
|
186 // |
|
187 CESMRField* CESMRFieldBuilderPluginExtension::CreateEditorFieldL( |
|
188 MESMRFieldValidator* /*aValidator*/, |
|
189 TESMREntryField aField ) |
|
190 { |
|
191 FUNC_LOG; |
|
192 CESMRField* field = NULL; |
|
193 switch ( aField.iFieldId ) |
|
194 { |
|
195 case EESMRFieldAttendee: |
|
196 { |
|
197 field = CESMRAttendeeField::NewL( CCalAttendee::EReqParticipant ); |
|
198 break; |
|
199 } |
|
200 case EESMRFieldOptAttendee: |
|
201 { |
|
202 field = CESMRAttendeeField::NewL( CCalAttendee::EOptParticipant ); |
|
203 break; |
|
204 } |
|
205 default: |
|
206 { |
|
207 User::Leave( KErrArgument ); |
|
208 } |
|
209 } |
|
210 // Set field mode |
|
211 field->SetFieldMode( EESMRFieldModeEdit ); |
|
212 |
|
213 return field; |
|
214 } |
|
215 |
|
216 // ----------------------------------------------------------------------------- |
|
217 // CESMRFieldBuilderPluginExtension::CreateViewerFieldL |
|
218 // ----------------------------------------------------------------------------- |
|
219 // |
|
220 CESMRField* CESMRFieldBuilderPluginExtension::CreateViewerFieldL( |
|
221 MESMRResponseObserver* aResponseObserver, |
|
222 TESMREntryField aField, |
|
223 TBool /*aResponseReady*/ ) |
|
224 { |
|
225 FUNC_LOG; |
|
226 CESMRField* field = NULL; |
|
227 switch ( aField.iFieldId ) |
|
228 { |
|
229 case EESMRFieldAttendee: |
|
230 { |
|
231 field = CESMRViewerAttendeesField::NewL( CCalAttendee::EReqParticipant ); |
|
232 break; |
|
233 } |
|
234 case EESMRFieldOptAttendee: |
|
235 { |
|
236 field = CESMRViewerAttendeesField::NewL( CCalAttendee::EOptParticipant ); |
|
237 break; |
|
238 } |
|
239 case EESMRFieldResponseArea: |
|
240 { |
|
241 field = CESMRResponseField::NewL( aResponseObserver ); |
|
242 break; |
|
243 } |
|
244 case EESMRFieldOrganizer: |
|
245 { |
|
246 field = CESMRViewerFromField::NewL(); |
|
247 break; |
|
248 } |
|
249 case EESMRFieldReqTrack: |
|
250 { |
|
251 field = CESMRTrackingFieldLabel::NewL(CCalAttendee::EReqParticipant ); |
|
252 break; |
|
253 } |
|
254 case EESMRFieldOptTrack: |
|
255 { |
|
256 field = CESMRTrackingFieldLabel::NewL(CCalAttendee::EOptParticipant ); |
|
257 break; |
|
258 } |
|
259 case EESMRTrackStatus: |
|
260 { |
|
261 field = CESMRTrackStatus::NewL(); |
|
262 break; |
|
263 } |
|
264 default: |
|
265 { |
|
266 User::Leave( KErrArgument ); |
|
267 } |
|
268 } |
|
269 // Set field mode |
|
270 field->SetFieldMode( EESMRFieldModeView ); |
|
271 |
|
272 return field; |
|
273 } |
|
274 |
|
275 // ----------------------------------------------------------------------------- |
|
276 // CESMRFieldBuilderPluginExtension::HasCapability |
|
277 // ----------------------------------------------------------------------------- |
|
278 // |
|
279 TBool CESMRFieldBuilderPluginExtension::HasCapability( |
|
280 const CFSMailBox& aMailBox, |
|
281 MESMRBuilderExtension::TMRCFSMailBoxCapability aCapability ) const |
|
282 { |
|
283 TBool response(EFalse); |
|
284 |
|
285 switch ( aCapability ) |
|
286 { |
|
287 case EMRCFSAttendeeStatus: |
|
288 { |
|
289 response = aMailBox.HasCapability( |
|
290 EFSMBoxCapaMeetingRequestAttendeeStatus ); |
|
291 break; |
|
292 } |
|
293 |
|
294 case EMRCFSRemoveFromCalendar: |
|
295 { |
|
296 response = aMailBox.HasCapability( EFSMBoxCapaRemoveFromCalendar ); |
|
297 break; |
|
298 } |
|
299 |
|
300 case EMRCFSSupportsAttachmentsInMR: |
|
301 { |
|
302 response = aMailBox.HasCapability( EFSMboxCapaSupportsAttahmentsInMR ); |
|
303 } |
|
304 break; |
|
305 |
|
306 default: |
|
307 { |
|
308 break; |
|
309 } |
|
310 } |
|
311 |
|
312 return response; |
|
313 } |
|
314 |
|
315 //EOF |
|
316 |