|
1 /* |
|
2 * Copyright (c) 2008 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "creator_traces.h" |
|
20 #include "creator_scriptelementfactory.h" |
|
21 #include "creator_contactelement.h" |
|
22 #include "creator_calendarelement.h" |
|
23 #include "creator_messageelement.h" |
|
24 #include "creator_fileelement.h" |
|
25 #include "creator_browserelement.h" |
|
26 #include "creator_logelement.h" |
|
27 #include "creator_noteelement.h" |
|
28 #include "creator_impselement.h" |
|
29 #include "creator_landmarkelement.h" |
|
30 #include "creator_mailboxelement.h" |
|
31 #include "creator_connectionmethodelement.h" |
|
32 |
|
33 CCreatorScriptElement* TCreatorScriptElementFactory::CreateElementL(CCreatorEngine* aEngine, const TDesC& aElementName, const TDesC& aContext ) |
|
34 { |
|
35 LOGSTRING2("TCreatorScriptElementFactory::CreateElementL: %S", &aElementName); |
|
36 |
|
37 if( aContext.Length() >= KFields().Length() && |
|
38 aContext.Right(KFields().Length()) == KFields) |
|
39 { |
|
40 // This is a field element under 'fields'. |
|
41 return CCreatorScriptElement::NewL(aEngine, aElementName, aContext); |
|
42 } |
|
43 else if( aElementName == creatorcontact::KContact ) |
|
44 { |
|
45 return CCreatorContactElement::NewL(aEngine, aElementName, aContext); |
|
46 } |
|
47 else if( aElementName == creatorcontact::KContactSet) |
|
48 { |
|
49 return CCreatorContactSetElement::NewL(aEngine, aElementName, aContext); |
|
50 } |
|
51 else if( aElementName == creatorcontact::KContactGroup ) |
|
52 { |
|
53 return CCreatorContactGroupElement::NewL(aEngine, aElementName, aContext); |
|
54 } |
|
55 else if( aElementName == KFields) |
|
56 { |
|
57 return CCreatorScriptElement::NewL(aEngine, aElementName, aContext); |
|
58 } |
|
59 else if( aElementName == KScript ) |
|
60 { |
|
61 return CCreatorScriptRoot::NewL(aEngine, aElementName, aContext); |
|
62 } |
|
63 else if( aElementName == creatorcalendar::KCalendar ) |
|
64 { |
|
65 return CCreatorCalendarElement::NewL(aEngine, aElementName, aContext); |
|
66 } |
|
67 else if( aElementName == creatormsg::KMessage ) |
|
68 { |
|
69 return CCreatorMessageElement::NewL(aEngine, aElementName, aContext); |
|
70 } |
|
71 else if( aElementName == creatorfile::KFile ) |
|
72 { |
|
73 return CCreatorFileElement::NewL(aEngine, aElementName, aContext); |
|
74 } |
|
75 else if( aElementName == creatorbrowser::KBookmark || |
|
76 aElementName == creatorbrowser::KBookmarkFolder || |
|
77 aElementName == creatorbrowser::KSavedPage || |
|
78 aElementName == creatorbrowser::KSavedPageFolder ) |
|
79 { |
|
80 return CCreatorBrowserElement::NewL(aEngine, aElementName, aContext); |
|
81 } |
|
82 else if( aElementName == creatorlog::KLog ) |
|
83 { |
|
84 return CCreatorLogElement::NewL(aEngine, aElementName, aContext); |
|
85 } |
|
86 else if( aElementName == creatornote::KNote ) |
|
87 { |
|
88 return CCreatorNoteElement::NewL(aEngine, aElementName, aContext); |
|
89 } |
|
90 #ifdef __PRESENCE |
|
91 else if( aElementName == creatorimps::KImpsServer ) |
|
92 { |
|
93 return CCreatorImpsServerElement::NewL(aEngine, aElementName, aContext); |
|
94 } |
|
95 #endif // __PRESENCE |
|
96 else if( aElementName == creatorlandmark::KLandmark ) |
|
97 { |
|
98 return CCreatorLandmarkElement::NewL(aEngine, aElementName, aContext); |
|
99 } |
|
100 else if( aElementName == creatormailbox::Kmailbox ) |
|
101 { |
|
102 return CCreatorMailboxElement::NewL(aEngine, aElementName, aContext); |
|
103 } |
|
104 else if( aElementName == creatorconnectionmethod::KCm ) |
|
105 { |
|
106 return CCreatorConnectionMethodElement::NewL(aEngine, aElementName, aContext); |
|
107 } |
|
108 else |
|
109 { |
|
110 return CCreatorScriptElement::NewL(aEngine, aElementName, aContext); |
|
111 } |
|
112 } |