|
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: Implements the definition of CICalJournal. It deals with Journal property of calendar event. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // Class include. |
|
21 #include "ICalJournal.h" // CICalJournal |
|
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 CICalJournal |
|
32 @internalTechnology |
|
33 */ |
|
34 CICalJournal* CICalJournal::NewLC(TICalMethod aMethod) |
|
35 { |
|
36 TRACE_ENTRY_POINT; |
|
37 |
|
38 CICalJournal* self = new (ELeave) CICalJournal; |
|
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 CICalJournal::~CICalJournal() |
|
51 { |
|
52 TRACE_ENTRY_POINT; |
|
53 } |
|
54 |
|
55 /** |
|
56 Constructor |
|
57 @internalTechnology |
|
58 */ |
|
59 CICalJournal::CICalJournal() |
|
60 { |
|
61 TRACE_ENTRY_POINT; |
|
62 |
|
63 iComponentType = EICalJournal; |
|
64 |
|
65 TRACE_EXIT_POINT; |
|
66 } |
|
67 |
|
68 /** |
|
69 Internal construction |
|
70 @internalTechnology |
|
71 */ |
|
72 void CICalJournal::ConstructL(TICalMethod aMethod) |
|
73 { |
|
74 TRACE_ENTRY_POINT; |
|
75 |
|
76 iMethod = aMethod; |
|
77 switch(iMethod) |
|
78 { |
|
79 case EMethodNone: |
|
80 iComponentMethodBitMask = EMaskJournalNone; |
|
81 break; |
|
82 case EMethodPublish: |
|
83 iComponentMethodBitMask = EMaskJournalPublish; |
|
84 break; |
|
85 case EMethodAdd: |
|
86 iComponentMethodBitMask = EMaskJournalAdd; |
|
87 break; |
|
88 case EMethodCancel: |
|
89 iComponentMethodBitMask = EMaskJournalCancel; |
|
90 break; |
|
91 default: |
|
92 // This is invalid should we leave? |
|
93 iComponentMethodBitMask = 0; |
|
94 break; |
|
95 } |
|
96 TRACE_EXIT_POINT; |
|
97 } |
|
98 |
|
99 /** |
|
100 Checks that the iCalendar specification allows this calendar component to |
|
101 contain the property aName |
|
102 @param aName the name of the property to validate |
|
103 @return ETrue if the property is valid for this component, otherwise EFalse |
|
104 @internalTechnology |
|
105 */ |
|
106 TBool CICalJournal::ValidatePropertyImpl(const TDesC& aName) const |
|
107 { |
|
108 TRACE_ENTRY_POINT; |
|
109 |
|
110 if ((aName.CompareF(KICalClass) == 0) || (aName.CompareF(KICalCreated) == 0) || |
|
111 (aName.CompareF(KICalDescription) == 0) || (aName.CompareF(KICalDtstart) == 0) || |
|
112 (aName.CompareF(KICalDtstamp) == 0) || (aName.CompareF(KICalLastmodified) == 0) || |
|
113 (aName.CompareF(KICalOrganizer) == 0) || (aName.CompareF(KICalRecurrenceId) == 0) || |
|
114 (aName.CompareF(KICalSequence) == 0) || (aName.CompareF(KICalStatus) == 0) || |
|
115 (aName.CompareF(KICalSummary) == 0) || (aName.CompareF(KICalUid) == 0) || |
|
116 (aName.CompareF(KICalUrl) == 0)) |
|
117 { |
|
118 // 0..1 CLASS |
|
119 // 0..1 CREATED |
|
120 // 0..1 DESCRIPTION |
|
121 // 0..1 DTSTART |
|
122 // 0..1 DTSTAMP |
|
123 // 0..1 LAST-MOD |
|
124 // 0..1 ORGANIZER |
|
125 // 0..1 RECURRENCE-ID |
|
126 // 0..1 SEQUENCE |
|
127 // 0..1 STATUS |
|
128 // 0..1 SUMMARY |
|
129 // 0..1 UID |
|
130 // 0..1 URL |
|
131 TRACE_EXIT_POINT; |
|
132 return (FindProperty(aName) == NULL); |
|
133 } |
|
134 else if ((aName.CompareF(KICalAttach) == 0) || (aName.CompareF(KICalAttendee) == 0) || |
|
135 (aName.CompareF(KICalCategories) == 0) || (aName.CompareF(KICalComment) == 0) || |
|
136 (aName.CompareF(KICalContact) == 0) || (aName.CompareF(KICalExdate) == 0) || |
|
137 (aName.CompareF(KICalExrule) == 0) || (aName.CompareF(KICalRelatedto) == 0) || |
|
138 (aName.CompareF(KICalRdate) == 0) || (aName.CompareF(KICalRRule) == 0) || |
|
139 (aName.CompareF(KICalRequeststatus) == 0)) |
|
140 { |
|
141 // 0..* ATTACH |
|
142 // 0..* ATTENDEE |
|
143 // 0..* CATEGORIES |
|
144 // 0..* COMMENT |
|
145 // 0..* CONTACT |
|
146 // 0..* EXDATE |
|
147 // 0..* EXRULE |
|
148 // 0..* RELATED-TO |
|
149 // 0..* RDATE |
|
150 // 0..* RRULE |
|
151 // 0..* REQUEST-STATUS |
|
152 TRACE_EXIT_POINT; |
|
153 return ETrue; |
|
154 } |
|
155 |
|
156 if ((aName.Length() >= 2) && (aName.Left(2).CompareF(KICalXProperty) == 0)) |
|
157 { |
|
158 // 0..* X-[anything] |
|
159 TRACE_EXIT_POINT; |
|
160 return ETrue; |
|
161 } |
|
162 |
|
163 // If we got this far we didn't match any of the possible property names |
|
164 TRACE_EXIT_POINT; |
|
165 return EFalse; |
|
166 } |
|
167 |
|
168 /** |
|
169 Checks that the iCalendar specification allows this calendar component to |
|
170 contain a nested component of type aType. |
|
171 @param aType the type of component to validate. |
|
172 @return ETrue if the component is a valid child for this component, otherwise |
|
173 EFalse. |
|
174 @internalTechnology |
|
175 */ |
|
176 TBool CICalJournal::ValidateComponent(TICalComponentType /*aType*/) const |
|
177 { |
|
178 TRACE_ENTRY_POINT; |
|
179 TRACE_EXIT_POINT; |
|
180 // VJOURNAL cannot contain other components. |
|
181 return EFalse; |
|
182 } |
|
183 |
|
184 // End of File |