|
1 /* |
|
2 * Copyright (c) 2002-2004 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: Holds the definition of CICalTodo.It deals with calendar entry of type ToDO. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // Class includes. |
|
21 #include "ICalTodo.h" // CICalTodo |
|
22 |
|
23 //debug |
|
24 #include "calendarengines_debug.h" |
|
25 |
|
26 // User includes. |
|
27 #include "ICalKeyWords.h" // Literals |
|
28 |
|
29 /** |
|
30 Static factory construction |
|
31 @return A new CICalTodo |
|
32 @internalTechnology |
|
33 */ |
|
34 CICalTodo* CICalTodo::NewLC(TICalMethod aMethod) |
|
35 { |
|
36 TRACE_ENTRY_POINT; |
|
37 |
|
38 CICalTodo* self = new (ELeave) CICalTodo; |
|
39 CleanupStack::PushL(self); |
|
40 self->ConstructL(aMethod); |
|
41 |
|
42 TRACE_EXIT_POINT; |
|
43 return self; |
|
44 } |
|
45 |
|
46 /** |
|
47 Destructor |
|
48 @internalTechnology |
|
49 */ |
|
50 CICalTodo::~CICalTodo() |
|
51 { |
|
52 TRACE_ENTRY_POINT; |
|
53 TRACE_EXIT_POINT; |
|
54 } |
|
55 |
|
56 /** |
|
57 Constructor |
|
58 @internalTechnology |
|
59 */ |
|
60 CICalTodo::CICalTodo() |
|
61 { |
|
62 TRACE_ENTRY_POINT; |
|
63 |
|
64 iComponentType = EICalTodo; |
|
65 |
|
66 TRACE_EXIT_POINT; |
|
67 } |
|
68 |
|
69 /** |
|
70 Internal construction |
|
71 @internalTechnology |
|
72 */ |
|
73 void CICalTodo::ConstructL(TICalMethod aMethod) |
|
74 { |
|
75 TRACE_ENTRY_POINT; |
|
76 |
|
77 iMethod = aMethod; |
|
78 switch(iMethod) |
|
79 { |
|
80 case EMethodNone: |
|
81 iComponentMethodBitMask = EMaskTodoNone; |
|
82 break; |
|
83 case EMethodPublish: |
|
84 iComponentMethodBitMask = EMaskTodoPublish; |
|
85 break; |
|
86 case EMethodRequest: |
|
87 iComponentMethodBitMask = EMaskTodoRequest; |
|
88 break; |
|
89 case EMethodReply: |
|
90 iComponentMethodBitMask = EMaskTodoReply; |
|
91 break; |
|
92 case EMethodAdd: |
|
93 iComponentMethodBitMask = EMaskTodoAdd; |
|
94 break; |
|
95 case EMethodCancel: |
|
96 iComponentMethodBitMask = EMaskTodoCancel; |
|
97 break; |
|
98 case EMethodRefresh: |
|
99 iComponentMethodBitMask = EMaskTodoRefresh; |
|
100 break; |
|
101 case EMethodCounter: |
|
102 iComponentMethodBitMask = EMaskTodoCounter; |
|
103 break; |
|
104 case EMethodDeclineCounter: |
|
105 iComponentMethodBitMask = EMaskTodoDeclineCounter; |
|
106 break; |
|
107 } |
|
108 TRACE_EXIT_POINT; |
|
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 CICalTodo::ValidatePropertyImpl(const TDesC& aName) const |
|
119 { |
|
120 TRACE_ENTRY_POINT; |
|
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 TRACE_EXIT_POINT; |
|
152 return (FindProperty(aName) == NULL); |
|
153 } |
|
154 // Either DUE or DURATION may exist but *not* both |
|
155 else if (aName.CompareF(KICalDue) == 0) |
|
156 { |
|
157 // 0..1 DUE |
|
158 if (FindProperty(aName) == NULL) |
|
159 { |
|
160 TRACE_EXIT_POINT; |
|
161 return (FindProperty(KICalDuration) == NULL); |
|
162 } |
|
163 } |
|
164 else if (aName.CompareF(KICalDuration) == 0) |
|
165 { |
|
166 // 0..1 DURATION |
|
167 if (FindProperty(aName) == NULL) |
|
168 { |
|
169 TRACE_EXIT_POINT; |
|
170 return (FindProperty(KICalDue) == NULL); |
|
171 } |
|
172 } |
|
173 else if ((aName.CompareF(KICalAttach) == 0) || (aName.CompareF(KICalAttendee) == 0) || |
|
174 (aName.CompareF(KICalCategories) == 0) || (aName.CompareF(KICalComment) == 0) || |
|
175 (aName.CompareF(KICalContact) == 0) || (aName.CompareF(KICalExdate) == 0) || |
|
176 (aName.CompareF(KICalExrule) == 0) || (aName.CompareF(KICalRequeststatus) == 0) || |
|
177 (aName.CompareF(KICalRelatedto) == 0) || (aName.CompareF(KICalResources) == 0) || |
|
178 (aName.CompareF(KICalRdate) == 0) || (aName.CompareF(KICalRRule) == 0)) |
|
179 { |
|
180 // 0..* ATTACH |
|
181 // 0..* ATTENDEE |
|
182 // 0..* CATEGORIES |
|
183 // 0..* COMMENT |
|
184 // 0..* CONTACT |
|
185 // 0..* EXDATE |
|
186 // 0..* EXRULE |
|
187 // 0..* REQUEST-STATUS |
|
188 // 0..* RELATED-TO |
|
189 // 0..* RESOURCES |
|
190 // 0..* RDATE |
|
191 // 0..* RRULE |
|
192 TRACE_EXIT_POINT; |
|
193 return ETrue; |
|
194 } |
|
195 |
|
196 if ((aName.Length() >= 2) && (aName.Left(2).CompareF(KICalXProperty) == 0)) |
|
197 { |
|
198 // 0..* X-[anything] |
|
199 TRACE_EXIT_POINT; |
|
200 return ETrue; |
|
201 } |
|
202 |
|
203 // If we got this far we didn't match any of the possible property names |
|
204 TRACE_EXIT_POINT; |
|
205 return EFalse; |
|
206 } |
|
207 |
|
208 /** |
|
209 Checks that the iCalendar specification allows this calendar component to |
|
210 contain a nested component of type aType. |
|
211 @param aType the type of component to validate. |
|
212 @return ETrue if the component is a valid child for this component, otherwise |
|
213 EFalse. |
|
214 @internalTechnology |
|
215 */ |
|
216 TBool CICalTodo::ValidateComponent(TICalComponentType aType) const |
|
217 { |
|
218 TRACE_ENTRY_POINT; |
|
219 TRACE_EXIT_POINT; |
|
220 // VTODO can only contain VALARMs. |
|
221 return (aType == EICalAlarm); |
|
222 } |
|
223 |
|
224 // End of File |
|
225 |