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