|
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 CESMRICalTodo. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // Class includes. |
|
20 #include "emailtrace.h" |
|
21 #include "cesmricaltodo.h" // CESMRICalTodo |
|
22 |
|
23 //debug |
|
24 |
|
25 // User includes. |
|
26 #include "esmricalkeywords.h" // Literals |
|
27 |
|
28 // ======== MEMBER FUNCTIONS ======== |
|
29 |
|
30 // --------------------------------------------------------------------------- |
|
31 // CESMRICalTodo::NewLC |
|
32 // --------------------------------------------------------------------------- |
|
33 // |
|
34 CESMRICalTodo* CESMRICalTodo::NewLC(TICalMethod aMethod) |
|
35 { |
|
36 FUNC_LOG; |
|
37 |
|
38 CESMRICalTodo* self = new (ELeave) CESMRICalTodo; |
|
39 CleanupStack::PushL(self); |
|
40 self->ConstructL(aMethod); |
|
41 |
|
42 return self; |
|
43 } |
|
44 |
|
45 // --------------------------------------------------------------------------- |
|
46 // CESMRICalTodo::~CESMRICalTodo |
|
47 // --------------------------------------------------------------------------- |
|
48 // |
|
49 CESMRICalTodo::~CESMRICalTodo() |
|
50 { |
|
51 FUNC_LOG; |
|
52 } |
|
53 |
|
54 // --------------------------------------------------------------------------- |
|
55 // CESMRICalTodo::CESMRICalTodo |
|
56 // --------------------------------------------------------------------------- |
|
57 // |
|
58 CESMRICalTodo::CESMRICalTodo() |
|
59 { |
|
60 FUNC_LOG; |
|
61 |
|
62 iComponentType = EICalTodo; |
|
63 |
|
64 } |
|
65 |
|
66 // --------------------------------------------------------------------------- |
|
67 // CESMRICalTodo::ConstructL |
|
68 // --------------------------------------------------------------------------- |
|
69 // |
|
70 void CESMRICalTodo::ConstructL(TICalMethod aMethod) |
|
71 { |
|
72 FUNC_LOG; |
|
73 |
|
74 iMethod = aMethod; |
|
75 switch(iMethod) |
|
76 { |
|
77 case EMethodNone: |
|
78 iComponentMethodBitMask = EMaskTodoNone; |
|
79 break; |
|
80 case EMethodPublish: |
|
81 iComponentMethodBitMask = EMaskTodoPublish; |
|
82 break; |
|
83 case EMethodRequest: |
|
84 iComponentMethodBitMask = EMaskTodoRequest; |
|
85 break; |
|
86 case EMethodReply: |
|
87 iComponentMethodBitMask = EMaskTodoReply; |
|
88 break; |
|
89 case EMethodAdd: |
|
90 iComponentMethodBitMask = EMaskTodoAdd; |
|
91 break; |
|
92 case EMethodCancel: |
|
93 iComponentMethodBitMask = EMaskTodoCancel; |
|
94 break; |
|
95 case EMethodRefresh: |
|
96 iComponentMethodBitMask = EMaskTodoRefresh; |
|
97 break; |
|
98 case EMethodCounter: |
|
99 iComponentMethodBitMask = EMaskTodoCounter; |
|
100 break; |
|
101 case EMethodDeclineCounter: |
|
102 iComponentMethodBitMask = EMaskTodoDeclineCounter; |
|
103 break; |
|
104 } |
|
105 } |
|
106 |
|
107 // --------------------------------------------------------------------------- |
|
108 // CESMRICalTodo::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 CESMRICalTodo::ValidatePropertyImpl(const TDesC& aName) const |
|
119 { |
|
120 FUNC_LOG; |
|
121 |
|
122 if ((aName.CompareF(KICalClass) == 0) || (aName.CompareF(KICalCompleted) == 0) || |
|
123 (aName.CompareF(KICalCreated) == 0) || (aName.CompareF(KICalDescription) == 0) || |
|
124 (aName.CompareF(KICalDtstamp) == 0) || (aName.CompareF(KICalDtstart) == 0) || |
|
125 (aName.CompareF(KICalGeo) == 0) || (aName.CompareF(KICalLastmodified) == 0) || |
|
126 (aName.CompareF(KICalLocation) == 0) || (aName.CompareF(KICalOrganizer) == 0) || |
|
127 (aName.CompareF(KICalPercentcomplete) == 0) || (aName.CompareF(KICalPriority) == 0) || |
|
128 (aName.CompareF(KICalRecurrenceId) == 0) || (aName.CompareF(KICalSequence) == 0) || |
|
129 (aName.CompareF(KICalStatus) == 0) || (aName.CompareF(KICalSummary) == 0) || |
|
130 (aName.CompareF(KICalUid) == 0) || (aName.CompareF(KICalUrl) == 0) || |
|
131 (aName.CompareF(KICalDtend) == 0) || (aName.CompareF(KICalDuration) == 0)) |
|
132 { |
|
133 // 0..1 CLASS |
|
134 // 0..1 COMPLETED |
|
135 // 0..1 CREATED |
|
136 // 0..1 DESCRIPTION |
|
137 // 0..1 DTSTAMP |
|
138 // 0..1 DTSTART |
|
139 // 0..1 GEO |
|
140 // 0..1 LAST-MOD |
|
141 // 0..1 LOCATION |
|
142 // 0..1 ORGANIZER |
|
143 // 0..1 PERCENT-COMPLETE |
|
144 // 0..1 PRIORITY |
|
145 // 0..1 RECURRENCE-ID |
|
146 // 0..1 SEQUENCE |
|
147 // 0..1 STATUS |
|
148 // 0..1 SUMMARY |
|
149 // 0..1 UID |
|
150 // 0..1 URL |
|
151 return (FindProperty(aName) == NULL); |
|
152 } |
|
153 // Either DUE or DURATION may exist but *not* both |
|
154 else if (aName.CompareF(KICalDue) == 0) |
|
155 { |
|
156 // 0..1 DUE |
|
157 if (!FindProperty(aName)) |
|
158 { |
|
159 return (FindProperty(KICalDuration) == NULL); |
|
160 } |
|
161 } |
|
162 else if (aName.CompareF(KICalDuration) == 0) |
|
163 { |
|
164 // 0..1 DURATION |
|
165 if (!FindProperty(aName)) |
|
166 { |
|
167 return (FindProperty(KICalDue) == NULL); |
|
168 } |
|
169 } |
|
170 else if ((aName.CompareF(KICalAttach) == 0) || (aName.CompareF(KICalAttendee) == 0) || |
|
171 (aName.CompareF(KICalCategories) == 0) || (aName.CompareF(KICalComment) == 0) || |
|
172 (aName.CompareF(KICalContact) == 0) || (aName.CompareF(KICalExdate) == 0) || |
|
173 (aName.CompareF(KICalExrule) == 0) || (aName.CompareF(KICalRequeststatus) == 0) || |
|
174 (aName.CompareF(KICalRelatedto) == 0) || (aName.CompareF(KICalResources) == 0) || |
|
175 (aName.CompareF(KICalRdate) == 0) || (aName.CompareF(KICalRRule) == 0)) |
|
176 { |
|
177 // 0..* ATTACH |
|
178 // 0..* ATTENDEE |
|
179 // 0..* CATEGORIES |
|
180 // 0..* COMMENT |
|
181 // 0..* CONTACT |
|
182 // 0..* EXDATE |
|
183 // 0..* EXRULE |
|
184 // 0..* REQUEST-STATUS |
|
185 // 0..* RELATED-TO |
|
186 // 0..* RESOURCES |
|
187 // 0..* RDATE |
|
188 // 0..* RRULE |
|
189 return ETrue; |
|
190 } |
|
191 |
|
192 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 // CESMRICalTodo::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 CESMRICalTodo::ValidateComponent(TICalComponentType aType) const |
|
215 { |
|
216 FUNC_LOG; |
|
217 // VTODO can only contain VALARMs. |
|
218 return (aType == EICalAlarm); |
|
219 } |
|
220 |
|
221 // End of File |
|
222 |