|
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: Class implementing the definition of CICalAlarm. This class deals with alarm property of calendar events. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // Class include. |
|
21 #include "ICalAlarm.h" // CICalAlarm |
|
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 CICalAlarm |
|
32 @internalTechnology |
|
33 */ |
|
34 CICalAlarm* CICalAlarm::NewLC(TICalMethod aMethod) |
|
35 { |
|
36 TRACE_ENTRY_POINT; |
|
37 |
|
38 CICalAlarm* self = new (ELeave) CICalAlarm; |
|
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 CICalAlarm::~CICalAlarm() |
|
51 { |
|
52 TRACE_ENTRY_POINT; |
|
53 TRACE_EXIT_POINT; |
|
54 } |
|
55 |
|
56 /** |
|
57 Constructor |
|
58 @internalTechnology |
|
59 */ |
|
60 CICalAlarm::CICalAlarm() |
|
61 { |
|
62 TRACE_ENTRY_POINT; |
|
63 |
|
64 iComponentType = EICalAlarm; |
|
65 |
|
66 TRACE_EXIT_POINT; |
|
67 } |
|
68 |
|
69 /** |
|
70 Internal construction |
|
71 @internalTechnology |
|
72 */ |
|
73 void CICalAlarm::ConstructL(TICalMethod aMethod) |
|
74 { |
|
75 TRACE_ENTRY_POINT; |
|
76 |
|
77 iMethod = aMethod; |
|
78 iComponentMethodBitMask = EMaskAlarmAny; |
|
79 |
|
80 TRACE_EXIT_POINT; |
|
81 } |
|
82 |
|
83 /** |
|
84 Checks that the iCalendar specification allows this calendar component to |
|
85 contain the property aName |
|
86 @param aName the name of the property to validate |
|
87 @return ETrue if the property is valid for this component, otherwise EFalse |
|
88 @internalTechnology |
|
89 */ |
|
90 TBool CICalAlarm::ValidatePropertyImpl(const TDesC& aName) const |
|
91 { |
|
92 TRACE_ENTRY_POINT; |
|
93 |
|
94 if ((aName.CompareF(KICalAction) == 0) || (aName.CompareF(KICalTrigger) == 0) || |
|
95 (aName.CompareF(KICalDuration) == 0) || (aName.CompareF(KICalRepeat) == 0) || |
|
96 (aName.CompareF(KICalDescription) == 0) || (aName.CompareF(KICalSummary) == 0)) |
|
97 { |
|
98 // 1 ACTION |
|
99 // 1 TRIGGER |
|
100 // 0..1 DURATION |
|
101 // 0..1 REPEAT |
|
102 // 0..1 DESCRIPTION |
|
103 // 0..1 SUMMARY |
|
104 TRACE_EXIT_POINT; |
|
105 return (FindProperty(aName) == NULL); |
|
106 } |
|
107 else if(aName.CompareF(KICalAttendee) == 0 || aName.CompareF(KICalAttach) == 0) |
|
108 { |
|
109 // 0..* ATTENDEE |
|
110 // 0..* ATTACH |
|
111 TRACE_EXIT_POINT; |
|
112 return ETrue; |
|
113 } |
|
114 |
|
115 if ((aName.Length() >= 2) && (aName.Left(2).CompareF(KICalXProperty) == 0)) |
|
116 { |
|
117 // 0..* X-[anything] |
|
118 TRACE_EXIT_POINT; |
|
119 return ETrue; |
|
120 } |
|
121 |
|
122 // If we got this far we didn't match any of the possible property names |
|
123 TRACE_EXIT_POINT; |
|
124 return EFalse; |
|
125 } |
|
126 |
|
127 /** |
|
128 Checks that the iCalendar specification allows this calendar component to |
|
129 contain a nested component of type aType. |
|
130 @param aType the type of component to validate. |
|
131 @return ETrue if the component is a valid child for this component, otherwise |
|
132 EFalse. |
|
133 @internalTechnology |
|
134 */ |
|
135 TBool CICalAlarm::ValidateComponent(TICalComponentType /*aType*/) const |
|
136 { |
|
137 TRACE_ENTRY_POINT; |
|
138 TRACE_EXIT_POINT; |
|
139 // VALARM cannot contain other components. |
|
140 return EFalse; |
|
141 } |
|
142 |
|
143 // End of File |
|
144 |