|
1 /* |
|
2 * Copyright (c) 2002-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: This file implements class CESMRICalEvent. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // Class include. |
|
20 #include "emailtrace.h" |
|
21 #include "cesmricalevent.h" // CESMRICalEvent |
|
22 |
|
23 //debug |
|
24 |
|
25 // User includes. |
|
26 #include "esmricalkeywords.h" // Literals |
|
27 |
|
28 // ======== MEMBER FUNCTIONS ======== |
|
29 |
|
30 // --------------------------------------------------------------------------- |
|
31 // CESMRICalEvent::NewLC |
|
32 // --------------------------------------------------------------------------- |
|
33 // |
|
34 CESMRICalEvent* CESMRICalEvent::NewLC(TICalMethod aMethod) |
|
35 { |
|
36 FUNC_LOG; |
|
37 |
|
38 CESMRICalEvent* self = new (ELeave) CESMRICalEvent; |
|
39 CleanupStack::PushL(self); |
|
40 self->ConstructL(aMethod); |
|
41 |
|
42 return self; |
|
43 } |
|
44 |
|
45 // --------------------------------------------------------------------------- |
|
46 // CESMRICalEvent::~CESMRICalEvent |
|
47 // --------------------------------------------------------------------------- |
|
48 // |
|
49 CESMRICalEvent::~CESMRICalEvent() |
|
50 { |
|
51 FUNC_LOG; |
|
52 } |
|
53 |
|
54 // --------------------------------------------------------------------------- |
|
55 // CESMRICalEvent::CESMRICalEvent |
|
56 // --------------------------------------------------------------------------- |
|
57 // |
|
58 CESMRICalEvent::CESMRICalEvent() |
|
59 { |
|
60 FUNC_LOG; |
|
61 |
|
62 iComponentType = EICalEvent; |
|
63 |
|
64 } |
|
65 |
|
66 // --------------------------------------------------------------------------- |
|
67 // CESMRICalEvent::ConstructL |
|
68 // --------------------------------------------------------------------------- |
|
69 // |
|
70 void CESMRICalEvent::ConstructL(TICalMethod aMethod) |
|
71 { |
|
72 FUNC_LOG; |
|
73 |
|
74 iMethod = aMethod; |
|
75 switch(iMethod) |
|
76 { |
|
77 case EMethodNone: |
|
78 iComponentMethodBitMask = EMaskEventNone; |
|
79 break; |
|
80 case EMethodPublish: |
|
81 iComponentMethodBitMask = EMaskEventPublish; |
|
82 break; |
|
83 case EMethodRequest: |
|
84 iComponentMethodBitMask = EMaskEventRequest; |
|
85 break; |
|
86 case EMethodReply: |
|
87 iComponentMethodBitMask = EMaskEventReply; |
|
88 break; |
|
89 case EMethodAdd: |
|
90 iComponentMethodBitMask = EMaskEventAdd; |
|
91 break; |
|
92 case EMethodCancel: |
|
93 iComponentMethodBitMask = EMaskEventCancel; |
|
94 break; |
|
95 case EMethodRefresh: |
|
96 iComponentMethodBitMask = EMaskEventRefresh; |
|
97 break; |
|
98 case EMethodCounter: |
|
99 iComponentMethodBitMask = EMaskEventCounter; |
|
100 break; |
|
101 case EMethodDeclineCounter: |
|
102 iComponentMethodBitMask = EMaskEventDeclineCounter; |
|
103 break; |
|
104 } |
|
105 } |
|
106 |
|
107 // --------------------------------------------------------------------------- |
|
108 // CESMRICalEvent::ValidatePropertyImpl |
|
109 // --------------------------------------------------------------------------- |
|
110 // |
|
111 /** |
|
112 Checks that the iCalendar specification allows this calendar component to |
|
113 contain the property aName |
|
114 @param aName the name of the property to validate |
|
115 @return ETrue if the property is valid for this component, otherwise EFalse |
|
116 @internalTechnology |
|
117 */ |
|
118 TBool CESMRICalEvent::ValidatePropertyImpl(const TDesC& aName) const |
|
119 { |
|
120 FUNC_LOG; |
|
121 |
|
122 if ((aName.CompareF(KICalClass) == 0) || (aName.CompareF(KICalCreated) == 0) || |
|
123 (aName.CompareF(KICalDescription) == 0) || (aName.CompareF(KICalDtstart) == 0) || |
|
124 (aName.CompareF(KICalGeo) == 0) || (aName.CompareF(KICalLastmodified) == 0) || |
|
125 (aName.CompareF(KICalLocation) == 0) || (aName.CompareF(KICalOrganizer) == 0) || |
|
126 (aName.CompareF(KICalPriority) == 0) || (aName.CompareF(KICalDtstamp) == 0) || |
|
127 (aName.CompareF(KICalSequence) == 0) || (aName.CompareF(KICalStatus) == 0) || |
|
128 (aName.CompareF(KICalSummary) == 0) || (aName.CompareF(KICalTransp) == 0) || |
|
129 (aName.CompareF(KICalUid) == 0) || (aName.CompareF(KICalUrl) == 0) || |
|
130 (aName.CompareF(KICalRecurrenceId) == 0)) |
|
131 { |
|
132 // 0..1 CLASS |
|
133 // 0..1 CREATED |
|
134 // 0..1 DESCRIPTION |
|
135 // 0..1 DTSTART |
|
136 // 0..1 GEO |
|
137 // 0..1 LAST-MOD |
|
138 // 0..1 LOCATION |
|
139 // 0..1 ORGANIZER |
|
140 // 0..1 PRIORITY |
|
141 // 0..1 DTSTAMP |
|
142 // 0..1 SEQUENCE |
|
143 // 0..1 STATUS |
|
144 // 0..1 SUMMARY |
|
145 // 0..1 TRANSP |
|
146 // 0..1 UID |
|
147 // 0..1 URL |
|
148 // 0..1 RECURRENCE-ID |
|
149 return (FindProperty(aName) == NULL); |
|
150 } |
|
151 // Either DTEND or DURATION may exist but *not* both |
|
152 else if (aName.CompareF(KICalDtend) == 0) |
|
153 { |
|
154 // 0..1 DTEND |
|
155 if (!FindProperty(aName)) |
|
156 { |
|
157 return (FindProperty(KICalDuration) == NULL); |
|
158 } |
|
159 return EFalse; |
|
160 } |
|
161 else if (aName.CompareF(KICalDuration) == 0) |
|
162 { |
|
163 // 0..1 DURATION |
|
164 if (!FindProperty(aName)) |
|
165 { |
|
166 return (FindProperty(KICalDtend) == NULL); |
|
167 } |
|
168 |
|
169 return EFalse; |
|
170 } |
|
171 else if ((aName.CompareF(KICalAttach) == 0) || (aName.CompareF(KICalAttendee) == 0) || |
|
172 (aName.CompareF(KICalCategories) == 0) || (aName.CompareF(KICalComment) == 0) || |
|
173 (aName.CompareF(KICalContact) == 0) || (aName.CompareF(KICalExdate) == 0) || |
|
174 (aName.CompareF(KICalExrule) == 0) || (aName.CompareF(KICalRequeststatus) == 0) || |
|
175 (aName.CompareF(KICalRelatedto) == 0) || (aName.CompareF(KICalResources) == 0) || |
|
176 (aName.CompareF(KICalRdate) == 0) || (aName.CompareF(KICalRRule) == 0)) |
|
177 { |
|
178 // 0..* ATTACH |
|
179 // 0..* ATTENDEE |
|
180 // 0..* CATEGORIES |
|
181 // 0..* COMMENT |
|
182 // 0..* CONTACT |
|
183 // 0..* EXDATE |
|
184 // 0..* EXRULE |
|
185 // 0..* REQUEST-STATUS |
|
186 // 0..* RELATED-TO |
|
187 // 0..* RESOURCES |
|
188 // 0..* RDATE |
|
189 // 0..* RRULE |
|
190 return ETrue; |
|
191 } |
|
192 else if ((aName.Length() >= 2) && (aName.Left(2).CompareF(KICalXProperty) == 0)) |
|
193 { |
|
194 // 0..* X-[anything] |
|
195 return ETrue; |
|
196 } |
|
197 |
|
198 // If we got this far we didn't match any of the possible property names |
|
199 return EFalse; |
|
200 } |
|
201 |
|
202 // --------------------------------------------------------------------------- |
|
203 // CESMRICalEvent::ValidateComponent |
|
204 // --------------------------------------------------------------------------- |
|
205 // |
|
206 /** |
|
207 Checks that the iCalendar specification allows this calendar component to |
|
208 contain a nested component of type aType. |
|
209 @param aType the type of component to validate. |
|
210 @return ETrue if the component is a valid child for this component, otherwise |
|
211 EFalse. |
|
212 @internalTechnology |
|
213 */ |
|
214 TBool CESMRICalEvent::ValidateComponent(TICalComponentType aType) const |
|
215 { |
|
216 FUNC_LOG; |
|
217 // VEVENTs can only contain VALARMs. |
|
218 return (aType == EICalAlarm); |
|
219 } |
|
220 |
|
221 // End of File |
|
222 |