|
1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #include "calcommonimpl.h" |
|
17 #include <calcommon.h> |
|
18 |
|
19 void CalUtils::Panic(TCalInterimApiPanicCode aPanic) |
|
20 { |
|
21 _LIT(KPanicString, "CalInterimAPI"); |
|
22 User::Panic(KPanicString(), aPanic); |
|
23 } |
|
24 |
|
25 TAgnRpt::TWeekInMonth CalUtils::WeekNumberToAgnWeekInMonthL(TInt8 aWeek) |
|
26 { |
|
27 TAgnRpt::TWeekInMonth weekInMonth(TAgnRpt::EFirst); |
|
28 switch (aWeek) |
|
29 { |
|
30 case -1: |
|
31 weekInMonth = TAgnRpt::ELast; |
|
32 break; |
|
33 case 1: |
|
34 weekInMonth = TAgnRpt::EFirst; |
|
35 break; |
|
36 case 2: |
|
37 weekInMonth = TAgnRpt::ESecond; |
|
38 break; |
|
39 case 3: |
|
40 weekInMonth = TAgnRpt::EThird; |
|
41 break; |
|
42 case 4: |
|
43 weekInMonth = TAgnRpt::EFourth; |
|
44 break; |
|
45 default: |
|
46 User::Leave(KErrArgument); |
|
47 } |
|
48 return weekInMonth; |
|
49 } |
|
50 |
|
51 TInt8 CalUtils::AgnWeekInMonthToWeekNumberL(TAgnRpt::TWeekInMonth aWeek) |
|
52 { |
|
53 TInt8 week(1); |
|
54 switch (aWeek) |
|
55 { |
|
56 case TAgnRpt::ELast: |
|
57 week = -1; |
|
58 break; |
|
59 case TAgnRpt::EFirst: |
|
60 week = 1; |
|
61 break; |
|
62 case TAgnRpt::ESecond: |
|
63 week = 2; |
|
64 break; |
|
65 case TAgnRpt::EThird: |
|
66 week = 3; |
|
67 break; |
|
68 case TAgnRpt::EFourth: |
|
69 week = 4; |
|
70 break; |
|
71 default: |
|
72 User::Leave(KErrArgument); |
|
73 } |
|
74 return week; |
|
75 } |
|
76 |
|
77 TAgnCalendarTime CalUtils::TCalTimeToTAgnCalendarTimeL(const TCalTime& aCalTime) |
|
78 { |
|
79 TAgnCalendarTime agnTime; |
|
80 if (aCalTime.TimeMode() == TCalTime::EFloating) |
|
81 { |
|
82 agnTime.SetFloatingL(aCalTime.TimeLocalL()); |
|
83 } |
|
84 else |
|
85 { |
|
86 agnTime.SetUtcL(aCalTime.TimeUtcL()); |
|
87 } |
|
88 return agnTime; |
|
89 } |
|
90 |
|
91 TCalTime CalUtils::TAgnCalendarTimeToTCalTimeL(const TAgnCalendarTime& aAgnTime) |
|
92 { |
|
93 TCalTime calTime; |
|
94 if (aAgnTime.TimeMode() == TCalTime::EFloating) |
|
95 { |
|
96 calTime.SetTimeLocalFloatingL(aAgnTime.LocalL()); |
|
97 } |
|
98 else |
|
99 { |
|
100 calTime.SetTimeUtcL(aAgnTime.UtcL()); |
|
101 } |
|
102 return calTime; |
|
103 } |
|
104 |
|
105 /** Constructs a TCalTimeRange. |
|
106 @param aStartTime Start time of time range |
|
107 @param aEndTime End time of time range |
|
108 @publishedAll |
|
109 @released |
|
110 @capability None |
|
111 */ |
|
112 EXPORT_C CalCommon::TCalTimeRange::TCalTimeRange(TCalTime aStartTime, TCalTime aEndTime) |
|
113 :iStartTime(aStartTime),iEndTime(aEndTime) |
|
114 { |
|
115 }; |
|
116 |
|
117 /** Returns the start time of the range. |
|
118 @return The start time of the range. |
|
119 @publishedAll |
|
120 @released |
|
121 @capability None |
|
122 */ |
|
123 EXPORT_C TCalTime CalCommon::TCalTimeRange::StartTime() const |
|
124 { |
|
125 return iStartTime; |
|
126 } |
|
127 |
|
128 /** Returns the end time of the range. |
|
129 @return The end time of the range. |
|
130 @publishedAll |
|
131 @capability None |
|
132 @released |
|
133 */ |
|
134 EXPORT_C TCalTime CalCommon::TCalTimeRange::EndTime() const |
|
135 { |
|
136 return iEndTime; |
|
137 } |
|
138 |
|
139 /** Constructs a TCalPriorityRange that includes all priorities. |
|
140 |
|
141 @publishedAll |
|
142 @released |
|
143 */ |
|
144 EXPORT_C CalCommon::TCalPriorityRange::TCalPriorityRange() |
|
145 : iHighestPriority(0), iLowestPriority(KMaxTUint) |
|
146 { |
|
147 } |
|
148 |
|
149 /** Constructs a TCalPriorityRange. |
|
150 |
|
151 Lower numerical values have higher priority. So to filter on entries between priority 1 and 3 |
|
152 included aHighestPriority should be 1 and aLowestPriority should be 3. |
|
153 |
|
154 @param aHighestPriority The highest priority in the range. |
|
155 @param aLowestPriority The lowest priority in the range. |
|
156 @publishedAll |
|
157 @prototype |
|
158 @capability None |
|
159 */ |
|
160 EXPORT_C CalCommon::TCalPriorityRange::TCalPriorityRange(TUint aHighestPriority, TUint aLowestPriority) |
|
161 : iHighestPriority(aHighestPriority), iLowestPriority(aLowestPriority) |
|
162 { |
|
163 } |
|
164 |
|
165 /** Returns the lowest priority of the range. |
|
166 |
|
167 @return The lowest priority of the range. |
|
168 @publishedAll |
|
169 @prototype |
|
170 @capability None |
|
171 */ |
|
172 EXPORT_C TUint CalCommon::TCalPriorityRange::LowestPriority() const |
|
173 { |
|
174 return iLowestPriority; |
|
175 } |
|
176 |
|
177 /** Returns the highest priority of the range. |
|
178 |
|
179 @return The highest priority of the range. |
|
180 @publishedAll |
|
181 @prototype |
|
182 @capability None |
|
183 */ |
|
184 EXPORT_C TUint CalCommon::TCalPriorityRange::HighestPriority() const |
|
185 { |
|
186 return iHighestPriority; |
|
187 } |