64
|
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 implementation
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#include "emailtrace.h"
|
|
20 |
#include "cesmrfieldbuilderplugin.h"
|
|
21 |
|
|
22 |
//<cmail>
|
|
23 |
#include "esmrdef.h"
|
|
24 |
//</cmail>
|
|
25 |
#include "mesmrresponseobserver.h"
|
|
26 |
|
|
27 |
// Editor fields
|
|
28 |
#include "cesmrsubjectfield.h"
|
|
29 |
#include "cesmrtimefield.h"
|
|
30 |
#include "cesmrdatefield.h"
|
|
31 |
#include "cesmrlocationfield.h"
|
|
32 |
#include "cesmralarmfield.h"
|
|
33 |
#include "cesmrrecurencefield.h"
|
|
34 |
#include "cesmrdescriptionfield.h"
|
|
35 |
#include "cesmrcheckbox.h"
|
|
36 |
#include "cesmrsingletimefield.h"
|
|
37 |
#include "cmralarmonofffield.h"
|
|
38 |
#include "cesmrsyncfield.h"
|
|
39 |
#include "cesmrpriorityfield.h"
|
|
40 |
#include "cmrattachmentsfield.h"
|
|
41 |
#include "cmrunifiededitorfield.h"
|
|
42 |
#include "cmrmulticalenfield.h"
|
|
43 |
|
|
44 |
// Viewer fields
|
|
45 |
#include "cesmrviewerlocationfield.h"
|
|
46 |
#include "cesmrviewerstartdatefield.h"
|
|
47 |
#include "cesmrviewertimefield.h"
|
|
48 |
#include "cesmrvieweralarmfield.h"
|
|
49 |
#include "cesmrviewerdescriptionfield.h"
|
|
50 |
#include "cesmrviewerstopdatefield.h"
|
|
51 |
#include "cesmrviewerrecurrencefield.h"
|
|
52 |
#include "cesmrviewerrecurrencedatefield.h"
|
|
53 |
#include "cesmrviewersyncfield.h"
|
|
54 |
#include "cesmrviewerpriorityfield.h"
|
|
55 |
#include "cesmrvieweralldayeventfield.h"
|
|
56 |
#include "cesmrvieweralarmdatefield.h"
|
|
57 |
#include "cesmrvieweralarmtimefield.h"
|
|
58 |
#include "cesmrviewerdetailedsubjectfield.h"
|
|
59 |
#include "cesmrrepeatuntil.h"
|
|
60 |
#include "cmrviewerattachmentfield.h"
|
|
61 |
|
|
62 |
|
|
63 |
/// Unnamed namespace for local definitions
|
|
64 |
namespace { // codescanner::namespace
|
|
65 |
|
|
66 |
// Panic literal
|
|
67 |
_LIT( KESMRFieldBuilderPlugin, "ESMRFieldBuilderPlugin" );
|
|
68 |
|
|
69 |
/** Panic codes */
|
|
70 |
enum TESMRFieldBuilderPluginPanic
|
|
71 |
{
|
|
72 |
EInvalidFieldId = 0 // Invalid field id
|
|
73 |
};
|
|
74 |
|
|
75 |
void Panic( TESMRFieldBuilderPluginPanic aPanic )
|
|
76 |
{
|
|
77 |
User::Panic( KESMRFieldBuilderPlugin, aPanic );
|
|
78 |
}
|
|
79 |
|
|
80 |
} // namespace
|
|
81 |
|
|
82 |
// ======== MEMBER FUNCTIONS ========
|
|
83 |
|
|
84 |
// -----------------------------------------------------------------------------
|
|
85 |
// CESMRFieldBuilderPlugin::CESMRFieldBuilderPlugin
|
|
86 |
// -----------------------------------------------------------------------------
|
|
87 |
//
|
|
88 |
CESMRFieldBuilderPlugin::CESMRFieldBuilderPlugin()
|
|
89 |
:iExtension(NULL),
|
|
90 |
iFieldExtension(NULL)
|
|
91 |
{
|
|
92 |
FUNC_LOG;
|
|
93 |
//do nothing
|
|
94 |
}
|
|
95 |
|
|
96 |
// -----------------------------------------------------------------------------
|
|
97 |
// CESMRFieldBuilderPlugin::~CESMRFieldBuilderPlugin
|
|
98 |
// -----------------------------------------------------------------------------
|
|
99 |
//
|
|
100 |
CESMRFieldBuilderPlugin::~CESMRFieldBuilderPlugin()
|
|
101 |
{
|
|
102 |
FUNC_LOG;
|
|
103 |
delete iExtension;
|
|
104 |
}
|
|
105 |
|
|
106 |
// -----------------------------------------------------------------------------
|
|
107 |
// CESMRFieldBuilderPlugin::NewL
|
|
108 |
// -----------------------------------------------------------------------------
|
|
109 |
//
|
|
110 |
CESMRFieldBuilderPlugin* CESMRFieldBuilderPlugin::NewL()
|
|
111 |
{
|
|
112 |
FUNC_LOG;
|
|
113 |
CESMRFieldBuilderPlugin* self = new (ELeave) CESMRFieldBuilderPlugin;
|
|
114 |
return self;
|
|
115 |
}
|
|
116 |
|
|
117 |
// ----------------------------------------------------------------------------
|
|
118 |
// CESMRFieldBuilderPlugin::ExtensionL
|
|
119 |
// ----------------------------------------------------------------------------
|
|
120 |
//
|
|
121 |
TAny* CESMRFieldBuilderPlugin::ExtensionL( TUid aExtensionUid )
|
|
122 |
{
|
|
123 |
FUNC_LOG;
|
|
124 |
if(!iExtension)
|
|
125 |
{
|
|
126 |
LoadExtensionL();
|
|
127 |
}
|
|
128 |
|
|
129 |
TAny* extension = NULL;
|
|
130 |
if ( iExtension )
|
|
131 |
{
|
|
132 |
extension = iExtension->ExtensionL( aExtensionUid );
|
|
133 |
}
|
|
134 |
return extension;
|
|
135 |
}
|
|
136 |
|
|
137 |
// ---------------------------------------------------------------------------
|
|
138 |
// CESMRFieldBuilderPlugin::FieldBuilderL()
|
|
139 |
// ---------------------------------------------------------------------------
|
|
140 |
//
|
|
141 |
MESMRFieldBuilder* CESMRFieldBuilderPlugin::FieldBuilderL()
|
|
142 |
{
|
|
143 |
FUNC_LOG;
|
|
144 |
return this;
|
|
145 |
}
|
|
146 |
|
|
147 |
// ---------------------------------------------------------------------------
|
|
148 |
// CESMRFieldBuilderPlugin::CreateEditorFieldL()
|
|
149 |
// ---------------------------------------------------------------------------
|
|
150 |
//
|
|
151 |
CESMRField* CESMRFieldBuilderPlugin::CreateEditorFieldL(
|
|
152 |
MESMRFieldValidator* aValidator,
|
|
153 |
TESMREntryField aField )
|
|
154 |
{
|
|
155 |
FUNC_LOG;
|
|
156 |
CESMRField* field = NULL;
|
|
157 |
switch ( aField.iFieldId )
|
|
158 |
{
|
|
159 |
case EESMRFieldMeetingTime:
|
|
160 |
field = CESMRTimeField::NewL( aValidator );
|
|
161 |
break;
|
|
162 |
case EESMRFieldStartDate:
|
|
163 |
field = CESMRDateField::NewL( aValidator, aField.iFieldId );
|
|
164 |
break;
|
|
165 |
case EESMRFieldStopDate:
|
|
166 |
field = CESMRDateField::NewL( aValidator, aField.iFieldId );
|
|
167 |
break;
|
|
168 |
case EESMRFieldLocation:
|
|
169 |
field = CESMRLocationField::NewL();
|
|
170 |
break;
|
|
171 |
case EESMRFieldAlarm:
|
|
172 |
field = CESMRAlarmField::NewL( aValidator );
|
|
173 |
break;
|
|
174 |
case EESMRFieldAllDayEvent:
|
|
175 |
field = CESMRCheckBox::NewL( aValidator );
|
|
176 |
break;
|
|
177 |
case EESMRFieldAlarmOnOff:
|
|
178 |
field = CMRAlarmOnOffField::NewL( aValidator );
|
|
179 |
break;
|
|
180 |
case EESMRFieldAlarmTime:
|
|
181 |
field = CESMRSingleTimeField::NewL( aValidator );
|
|
182 |
break;
|
|
183 |
case EESMRFieldAlarmDate:
|
|
184 |
field = CESMRDateField::NewL( aValidator, aField.iFieldId );
|
|
185 |
break;
|
|
186 |
case EESMRFieldSubject:
|
|
187 |
field = CESMRSubjectField::NewL();
|
|
188 |
break;
|
|
189 |
case EESMRFieldDescription:
|
|
190 |
field = CESMRDescriptionField::NewL();
|
|
191 |
break;
|
|
192 |
case EESMRFieldRecurrence:
|
|
193 |
field = CESMRRecurenceField::NewL( aValidator );
|
|
194 |
break;
|
|
195 |
case EESMRFieldRecurrenceDate:
|
|
196 |
field = CESMRRepeatUntilField::NewL( aValidator );
|
|
197 |
break;
|
|
198 |
case EESMRFieldSync:
|
|
199 |
field = CESMRSyncField::NewL();
|
|
200 |
break;
|
|
201 |
case EESMRFieldOccasion:
|
|
202 |
field = CESMRSubjectField::NewL( CESMRSubjectField::ETypeOccasion );
|
|
203 |
break;
|
|
204 |
case EESMRFieldPriority:
|
|
205 |
field = CESMRPriorityField::NewL();
|
|
206 |
break;
|
|
207 |
case EESMRFieldAttachments:
|
|
208 |
field = CMRAttachmentsField::NewL();
|
|
209 |
break;
|
|
210 |
case EESMRFieldUnifiedEditor:
|
|
211 |
field = CMRUnifiedEditorField::NewL();
|
|
212 |
break;
|
|
213 |
case EESMRFieldCalendarName:
|
|
214 |
field = CMRMultiCalenField::NewL();
|
|
215 |
break;
|
|
216 |
default:
|
|
217 |
{
|
|
218 |
field = FieldBuilderExtensionL()->CreateEditorFieldL(
|
|
219 |
aValidator,
|
|
220 |
aField );
|
|
221 |
}
|
|
222 |
break;
|
|
223 |
}
|
|
224 |
|
|
225 |
__ASSERT_ALWAYS( field, Panic(EInvalidFieldId) );
|
|
226 |
// Set field mode
|
|
227 |
field->SetFieldMode( EESMRFieldModeEdit );
|
|
228 |
|
|
229 |
return field;
|
|
230 |
}
|
|
231 |
|
|
232 |
// ---------------------------------------------------------------------------
|
|
233 |
// CESMRFieldBuilderPlugin::CreateViewerFieldL()
|
|
234 |
// ---------------------------------------------------------------------------
|
|
235 |
//
|
|
236 |
CESMRField* CESMRFieldBuilderPlugin::CreateViewerFieldL( MESMRResponseObserver* aResponseObserver,
|
|
237 |
TESMREntryField aField,
|
|
238 |
TBool aResponseReady )
|
|
239 |
{
|
|
240 |
FUNC_LOG;
|
|
241 |
CESMRField* field = NULL;
|
|
242 |
switch ( aField.iFieldId )
|
|
243 |
{
|
|
244 |
case EESMRFieldMeetingTime:
|
|
245 |
{
|
|
246 |
field = CESMRViewerTimeField::NewL();
|
|
247 |
break;
|
|
248 |
}
|
|
249 |
case EESMRFieldStartDate:
|
|
250 |
{
|
|
251 |
field = CESMRViewerStartDateField::NewL();
|
|
252 |
break;
|
|
253 |
}
|
|
254 |
case EESMRFieldStopDate:
|
|
255 |
{
|
|
256 |
field = CESMRViewerStopDateField::NewL();
|
|
257 |
break;
|
|
258 |
}
|
|
259 |
case EESMRFieldLocation:
|
|
260 |
{
|
|
261 |
field = CESMRViewerLocationField::NewL();
|
|
262 |
break;
|
|
263 |
}
|
|
264 |
case EESMRFieldAlarm:
|
|
265 |
{
|
|
266 |
field = CESMRViewerAlarmField::NewL();
|
|
267 |
break;
|
|
268 |
}
|
|
269 |
case EESMRFieldDescription:
|
|
270 |
{
|
|
271 |
field = CESMRViewerDescriptionField::NewL();
|
|
272 |
break;
|
|
273 |
}
|
|
274 |
case EESMRFieldRecurrence:
|
|
275 |
{
|
|
276 |
field = CESMRViewerRecurrenceField::NewL();
|
|
277 |
break;
|
|
278 |
}
|
|
279 |
case EESMRFieldRecurrenceDate:
|
|
280 |
{
|
|
281 |
field = CESMRViewerRecurrenceDateField::NewL();
|
|
282 |
break;
|
|
283 |
}
|
|
284 |
case EESMRFieldSync:
|
|
285 |
{
|
|
286 |
field = CESMRViewerSyncField::NewL();
|
|
287 |
break;
|
|
288 |
}
|
|
289 |
case EESMRFieldPriority:
|
|
290 |
{
|
|
291 |
field = CESMRViewerPriorityField::NewL();
|
|
292 |
break;
|
|
293 |
}
|
|
294 |
case EESMRFieldAllDayEvent:
|
|
295 |
{
|
|
296 |
field = CESMRViewerAllDayEventField::NewL();
|
|
297 |
break;
|
|
298 |
}
|
|
299 |
case EESMRFieldAlarmDate:
|
|
300 |
{
|
|
301 |
field = CESMRViewerAlarmDateField::NewL();
|
|
302 |
break;
|
|
303 |
}
|
|
304 |
case EESMRFieldAlarmTime:
|
|
305 |
{
|
|
306 |
field = CESMRViewerAlarmTimeField::NewL();
|
|
307 |
break;
|
|
308 |
}
|
|
309 |
case EESMRFieldDetailedSubject:
|
|
310 |
{
|
|
311 |
field = CESMRViewerDetailedSubjectField::NewL();
|
|
312 |
break;
|
|
313 |
}
|
|
314 |
case EESMRFieldViewerAttachments:
|
|
315 |
{
|
|
316 |
field = CMRViewerAttachmentsField::NewL();
|
|
317 |
break;
|
|
318 |
}
|
|
319 |
case EESMRFieldCalendarName:
|
|
320 |
{
|
|
321 |
field = CMRMultiCalenField::NewL();
|
|
322 |
break;
|
|
323 |
}
|
|
324 |
|
|
325 |
default:
|
|
326 |
{
|
|
327 |
MESMRFieldBuilder* extension = FieldBuilderExtensionL();
|
|
328 |
if ( extension )
|
|
329 |
{
|
|
330 |
field = extension->CreateViewerFieldL(
|
|
331 |
aResponseObserver,
|
|
332 |
aField,
|
|
333 |
aResponseReady );
|
|
334 |
}
|
|
335 |
}
|
|
336 |
break;
|
|
337 |
}
|
|
338 |
|
|
339 |
__ASSERT_ALWAYS( field, Panic(EInvalidFieldId) );
|
|
340 |
// Set field mode
|
|
341 |
field->SetFieldMode( EESMRFieldModeView );
|
|
342 |
|
|
343 |
return field;
|
|
344 |
}
|
|
345 |
|
|
346 |
// ---------------------------------------------------------------------------
|
|
347 |
// CESMRFieldBuilderPlugin::FieldBuilderExtensionL()
|
|
348 |
// ---------------------------------------------------------------------------
|
|
349 |
//
|
|
350 |
MESMRFieldBuilder* CESMRFieldBuilderPlugin::FieldBuilderExtensionL()
|
|
351 |
{
|
|
352 |
FUNC_LOG;
|
|
353 |
if(!iFieldExtension)
|
|
354 |
{
|
|
355 |
LoadExtensionL();
|
|
356 |
}
|
|
357 |
|
|
358 |
return iFieldExtension;
|
|
359 |
}
|
|
360 |
|
|
361 |
// ---------------------------------------------------------------------------
|
|
362 |
// CESMRFieldBuilderPlugin::LoadExtensionL()
|
|
363 |
// ---------------------------------------------------------------------------
|
|
364 |
//
|
|
365 |
void CESMRFieldBuilderPlugin::LoadExtensionL()
|
|
366 |
{
|
|
367 |
FUNC_LOG;
|
|
368 |
CESMRFieldBuilderInterface* extension = NULL;
|
|
369 |
|
|
370 |
TRAPD(error,
|
|
371 |
extension = CESMRFieldBuilderInterface::CreatePluginL(
|
|
372 |
TUid::Uid(KESMRUIFieldBuilderPluginExtensionImplUId) ) );
|
|
373 |
|
|
374 |
if ( error == KErrNone && extension )
|
|
375 |
{
|
|
376 |
delete iExtension;
|
|
377 |
iExtension = extension;
|
|
378 |
iFieldExtension = iExtension->FieldBuilderL();
|
|
379 |
}
|
|
380 |
|
|
381 |
}
|
|
382 |
//EOF
|
|
383 |
|