|
1 /* |
|
2 * Copyright (c) 2005-2006 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_AICALENDARPLUGIN2EVENTITEM_H |
|
20 #define C_AICALENDARPLUGIN2EVENTITEM_H |
|
21 |
|
22 #include <e32base.h> |
|
23 #include <e32std.h> |
|
24 #include <calentry.h> |
|
25 #include "aicalendarplugin2constants.hrh" |
|
26 #include "aicalendarplugin2focusdata.h" |
|
27 |
|
28 class CCalInstance; |
|
29 class CAICalendarPlugin2ConstantData; |
|
30 class CAiCalendarPlugin2EventStrings; |
|
31 |
|
32 /** |
|
33 * Calendar plugin 2 local presentation of a calendar event item. |
|
34 * |
|
35 * @lib aicalendarplugin2 |
|
36 * @since S60 3.1 |
|
37 */ |
|
38 NONSHARABLE_CLASS( CAiCalendarPlugin2EventItem ) : public CBase |
|
39 { |
|
40 public: |
|
41 |
|
42 /** |
|
43 * Static factory method for 2 stage construction. |
|
44 * @since Series 60 3.2 |
|
45 * @param aCalInstance calendar instance object |
|
46 * @param aConstantData constant data container |
|
47 * @return CAiCalendarPlugin2EventItem pointer to contructed object |
|
48 */ |
|
49 static CAiCalendarPlugin2EventItem* NewL( |
|
50 const CCalInstance& aCalInstance, |
|
51 CAICalendarPlugin2ConstantData& aConstantData ); |
|
52 |
|
53 ~CAiCalendarPlugin2EventItem(); |
|
54 |
|
55 // New methods |
|
56 |
|
57 /** |
|
58 * Getter for focus data |
|
59 * @since Series 60 3.2 |
|
60 * @return TAiCalendarFocusData |
|
61 */ |
|
62 TAiCalendarFocusData FocusData(); |
|
63 |
|
64 /** |
|
65 * Getter for first line text |
|
66 * @since Series 60 3.2 |
|
67 * @return TDesC |
|
68 */ |
|
69 const TDesC& FirstLineText(); |
|
70 |
|
71 /** |
|
72 * Getter for second line text |
|
73 * @since Series 60 3.2 |
|
74 * @return TDesC |
|
75 */ |
|
76 const TDesC& SecondLineText(); |
|
77 |
|
78 /** |
|
79 * Getter for start time string |
|
80 * @since Series 60 3.2 |
|
81 * @return TDesC |
|
82 */ |
|
83 const TDesC& StartTimeText(); |
|
84 |
|
85 /** |
|
86 * Getter for end time string |
|
87 * @since Series 60 3.2 |
|
88 * @return TDesC |
|
89 */ |
|
90 const TDesC& EndTimeText(); |
|
91 |
|
92 /** |
|
93 * Getter for subject text |
|
94 * @since Series 60 3.2 |
|
95 * @return TDesC |
|
96 */ |
|
97 const TDesC& SubjectText(); |
|
98 |
|
99 /** |
|
100 * Getter for location text |
|
101 * @since Series 60 3.2 |
|
102 * @return TDesC |
|
103 */ |
|
104 const TDesC& LocationText(); |
|
105 |
|
106 /** |
|
107 * Returns a oneline string with a possible starttime and subject |
|
108 * separated with space. |
|
109 * |
|
110 * @since Series 60 5.0 |
|
111 * @param aAddTime |
|
112 * @return TDesC |
|
113 */ |
|
114 const TDesC& SubjectTimeString( TBool aAddTime = ETrue ); |
|
115 |
|
116 /** |
|
117 * Getter for item type |
|
118 * @since Series 60 3.2 |
|
119 * @return TAICal2PluginItemType |
|
120 */ |
|
121 TAICal2PluginItemType Type() const; |
|
122 |
|
123 /** |
|
124 * Getter for icon id |
|
125 * @since Series 60 3.2 |
|
126 * @return TInt |
|
127 */ |
|
128 TInt IconId(); |
|
129 |
|
130 /** |
|
131 * Is event today. |
|
132 * @since Series 60 3.2 |
|
133 * @return TBool |
|
134 */ |
|
135 TBool IsToday(); |
|
136 |
|
137 /** |
|
138 * Is event tomorrow. |
|
139 * @since Series 60 3.2 |
|
140 * @return TBool |
|
141 */ |
|
142 TBool IsTomorrow(); |
|
143 |
|
144 /** |
|
145 * Is event end time today. |
|
146 * @since Series 60 3.2 |
|
147 * @return TBool |
|
148 */ |
|
149 TBool IsEndTimeToday(); |
|
150 |
|
151 /** |
|
152 * Is event a not today event. Within specified day range EPluginDaysToHandleAsNotToday. |
|
153 * @since Series 60 3.2 |
|
154 * @return TBool |
|
155 */ |
|
156 TBool IsNotTodayEvent(); |
|
157 |
|
158 /** |
|
159 * Is event a future event. The rest of not categorized not today items -> future items. |
|
160 * @since Series 60 3.2 |
|
161 * @return TBool |
|
162 */ |
|
163 TBool IsFutureEvent(); |
|
164 |
|
165 /** |
|
166 * Is date needed. |
|
167 * @since Series 60 3.2 |
|
168 * @return TBool |
|
169 */ |
|
170 TBool DateNeeded(); |
|
171 |
|
172 /** |
|
173 * Is time needed. |
|
174 * @since Series 60 3.2 |
|
175 * @return TBool |
|
176 */ |
|
177 TBool TimeNeeded(); |
|
178 |
|
179 /** |
|
180 * Determine if two time/date's are on the same day |
|
181 * @since Series 60 3.2 |
|
182 * @param aX time one |
|
183 * @param aY time two |
|
184 * @return TBool are they on same day |
|
185 **/ |
|
186 static TBool OnSameDay(const TTime& aX, const TTime& aY); |
|
187 |
|
188 /** |
|
189 * Determine if TTime is tomorrow. |
|
190 * @since Series 60 3.2 |
|
191 * @param aToday current time |
|
192 * @param aY tested time |
|
193 * @return TBool are they on same day |
|
194 **/ |
|
195 static TBool OnNextDay(const TTime& aToday, const TTime& aEventTime); |
|
196 |
|
197 /** |
|
198 * Determine if TTime is tomorrow. |
|
199 * @since Series 60 3.2 |
|
200 * @param aToday current time |
|
201 * @param aEventTime tested time |
|
202 * @param aRange the range within to stay |
|
203 * @return TBool are they on same day |
|
204 **/ |
|
205 static TBool OnDayRange(const TTime& aToday, const TTime& aEventTime, TInt aRange); |
|
206 |
|
207 /** |
|
208 * Return the TTime of the event. |
|
209 */ |
|
210 const TTime Time() const; |
|
211 |
|
212 /** |
|
213 * Return the last modified TTime of the event. |
|
214 */ |
|
215 const TTime LastModifiedTime() const; |
|
216 |
|
217 TInt Checksum() |
|
218 { |
|
219 return iChecksum; |
|
220 }; |
|
221 |
|
222 /** |
|
223 * Calculate checksum for event data. |
|
224 */ |
|
225 TInt CreateChecksumFromString( const TDesC& aString ); |
|
226 |
|
227 private: |
|
228 |
|
229 // Construction |
|
230 |
|
231 CAiCalendarPlugin2EventItem(); |
|
232 |
|
233 void ConstructL( const CCalInstance& aCalInstance, |
|
234 CAICalendarPlugin2ConstantData& aConstantData ); |
|
235 |
|
236 // New methods |
|
237 |
|
238 /** |
|
239 * Extract generic event identifiers from calendar instance |
|
240 * CAiCalendarPlugin2EventStrings object instance |
|
241 * @since Series 60 3.2 |
|
242 * @param aCalInstance calendar instance object |
|
243 **/ |
|
244 void ExtractEventIdentifiersL( const CCalInstance& aCalInstance ); |
|
245 |
|
246 /** |
|
247 * Extract and translate item type from calendar instance object |
|
248 * @since Series 60 3.2 |
|
249 * @param aCalInstance calendar instance object |
|
250 * @return TAICal2PluginItemType translated item type |
|
251 **/ |
|
252 TAICal2PluginItemType ExtractTypeL( const CCalInstance& aCalInstance ); |
|
253 |
|
254 /** |
|
255 * Determine local icon type for item type and status |
|
256 * @since Series 60 3.2 |
|
257 * @param aType item type |
|
258 * @param aStatus item status |
|
259 * @return TInt local icon id |
|
260 **/ |
|
261 TInt IconIdToEvent( TAICal2PluginItemType aType, CCalEntry::TStatus aStatus ); |
|
262 |
|
263 public: // Data members |
|
264 |
|
265 /** |
|
266 * Item uid. |
|
267 */ |
|
268 HBufC8* iUid; |
|
269 |
|
270 private: // Data members |
|
271 |
|
272 /** |
|
273 * Time strings creator and container. |
|
274 * Own. |
|
275 */ |
|
276 CAiCalendarPlugin2EventStrings* iEventStrings; |
|
277 |
|
278 /** |
|
279 * Item type. |
|
280 */ |
|
281 TAICal2PluginItemType iType; |
|
282 |
|
283 /** |
|
284 * Is event today. |
|
285 */ |
|
286 TBool iIsToday; |
|
287 |
|
288 /** |
|
289 * Is event tomorrow. |
|
290 */ |
|
291 TBool iIsTomorrow; |
|
292 |
|
293 /** |
|
294 * Is event not today event. Within specified day range EPluginDaysToHandleAsNotToday. |
|
295 */ |
|
296 TBool iIsNotTodayEvent; |
|
297 |
|
298 /** |
|
299 * Is event future event. |
|
300 */ |
|
301 TBool iIsFutureEvent; |
|
302 |
|
303 /** |
|
304 * Item start time (optional). |
|
305 */ |
|
306 TTime iTime; |
|
307 |
|
308 /** |
|
309 * Item end time (optional). |
|
310 */ |
|
311 TTime iEndTime; |
|
312 |
|
313 /** |
|
314 * Item last modified (optional). |
|
315 */ |
|
316 TTime iLastModifiedTime; |
|
317 |
|
318 /** |
|
319 * Item local UID. |
|
320 */ |
|
321 TCalLocalUid iLocalUid; |
|
322 |
|
323 /** |
|
324 * Item cal entry status (accepted/tentative etc). |
|
325 */ |
|
326 CCalEntry::TStatus iStatus; |
|
327 |
|
328 /** |
|
329 * Icon id. |
|
330 */ |
|
331 TInt iIconId; |
|
332 |
|
333 /** |
|
334 * Flag to store info on date string need |
|
335 */ |
|
336 TBool iDateNeeded; |
|
337 |
|
338 /** |
|
339 * Flag to store info on time string need |
|
340 */ |
|
341 TBool iTimeNeeded; |
|
342 |
|
343 /** |
|
344 * Open in viewer. |
|
345 */ |
|
346 TBool iOpenInViewer; |
|
347 |
|
348 /** |
|
349 * Open first valid entry on index zero. |
|
350 */ |
|
351 TBool iOpenFirstValid; |
|
352 |
|
353 /** |
|
354 * Handle tomorrow item as specially. |
|
355 */ |
|
356 TBool iHandleTomorrowItems; |
|
357 |
|
358 /** |
|
359 * Day range for "not today" category. |
|
360 */ |
|
361 TInt iNotTodayDayRange; |
|
362 |
|
363 /** |
|
364 * String checksums |
|
365 */ |
|
366 TInt iChecksum; |
|
367 |
|
368 /** |
|
369 * String for oneline start time subject |
|
370 */ |
|
371 HBufC *iStartTimeSubject; |
|
372 |
|
373 /** |
|
374 * String for unnamed |
|
375 */ |
|
376 HBufC *iUnnamed; |
|
377 }; |
|
378 |
|
379 #endif // C_AICALENDARPLUGIN2EVENTITEM_H |
|
380 |
|
381 |
|
382 // End of File |