|
1 /* |
|
2 * Copyright (c) 2002 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: List Box Model class for Calendar Day view |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef CCALENDAYLISTBOXMODEL_H |
|
21 #define CCALENDAYLISTBOXMODEL_H |
|
22 |
|
23 // INCLUDES |
|
24 #include "calendaycontainer.h" |
|
25 #include "CalendarVariant.hrh" |
|
26 |
|
27 #include <AknLayout2Def.h> |
|
28 #include <AknUtils.h> |
|
29 #include <badesca.h> |
|
30 #include <e32base.h> |
|
31 #include <calenservices.h> |
|
32 |
|
33 // FORWARD DECLARATIONS |
|
34 class CCalInstance; |
|
35 class CCalInstanceView; |
|
36 class CCalEntry; |
|
37 |
|
38 |
|
39 // CLASS DECLARATION |
|
40 |
|
41 /** |
|
42 * UI level model of Calendar day view list box data. |
|
43 * Contains list data formatted to Series 60 list data string representation. |
|
44 * Currently class is first refactoring step to remove data model |
|
45 * code from container class. It is not yet a true list box model class. |
|
46 * It doesn't implement necessary interfaces so that it could be directly |
|
47 * given to list box class. |
|
48 * |
|
49 * @lib Calendar.app |
|
50 * @since 2.0 |
|
51 */ |
|
52 NONSHARABLE_CLASS( CCalenDayListBoxModel ) : public CBase |
|
53 { |
|
54 public: // Constructors and destructor |
|
55 |
|
56 /** |
|
57 * Two-phased constructor. |
|
58 */ |
|
59 static CCalenDayListBoxModel* NewL( const CCalenDayContainer* aDayContainer ); |
|
60 |
|
61 /** |
|
62 * Destructor. |
|
63 */ |
|
64 virtual ~CCalenDayListBoxModel(); |
|
65 |
|
66 public: // New functions |
|
67 |
|
68 /** |
|
69 * ?member_description. |
|
70 * @since ?Series60_version |
|
71 * @param ?arg1 ?description |
|
72 * @return ?description |
|
73 */ |
|
74 CDesCArrayFlat* ItemTextArray(); |
|
75 |
|
76 /** |
|
77 * ?member_description. |
|
78 * @since ?Series60_version |
|
79 * @param ?arg1 ?description |
|
80 * @return ?description |
|
81 */ |
|
82 void CreateListBoxDataL( |
|
83 CArrayFixFlat<CCalenDayContainer::SItemInfo>& aLayoutTable, |
|
84 CArrayFixFlat<TInt>& aCellArray, |
|
85 MCalenServices& aServices, |
|
86 TTime aCurrentDay); |
|
87 |
|
88 void UpdateLayoutValues( TInt aLayoutVariant, TBool aMidnightVisualization = EFalse); |
|
89 |
|
90 private: // private constructors |
|
91 |
|
92 /** |
|
93 * C++ default constructor. |
|
94 */ |
|
95 CCalenDayListBoxModel(); |
|
96 |
|
97 /** |
|
98 * By default Symbian 2nd phase constructor is private. |
|
99 */ |
|
100 void ConstructL( const CCalenDayContainer *aDayContainer ); |
|
101 |
|
102 private: // Helper functions |
|
103 |
|
104 void GetEntryTextDataL(CCalEntry& aEntry, TDes& aBuf) const; |
|
105 |
|
106 #ifndef RD_CALEN_MIDNIGHT_VISUALIZATION |
|
107 void LimitStartAndEndTime(TTime& aCurrentDay, |
|
108 TTime& aStart, |
|
109 TTime& aEnd); |
|
110 void InsertTimeL(TDes& aBuf, const TTime& aTime); |
|
111 |
|
112 #endif // RD_CALEN_MIDNIGHT_VISUALIZATION |
|
113 |
|
114 #ifdef RD_CALEN_MIDNIGHT_VISUALIZATION |
|
115 |
|
116 enum TTimeStringFormat |
|
117 { |
|
118 EInsertTimeGiven, |
|
119 EInsert00, |
|
120 EInsert24 |
|
121 }; |
|
122 |
|
123 void InsertTimeL(TDes& aBuf, const TTime& aTime, const TTimeStringFormat aInsert = EInsertTimeGiven); |
|
124 void InsertHyphenL(TDes& aBuf, const TTime& aStart, const TTime& aEnd); |
|
125 #else |
|
126 void InsertHyphen(TDes& aBuf, const TTime& aStart, const TTime& aEnd); |
|
127 #endif // RD_CALEN_MIDNIGHT_VISUALIZATION |
|
128 |
|
129 TInt LastLineWidthL(TInt aWidth, CCalEntry& aEntry) const; |
|
130 |
|
131 HBufC* WrapTextL( CCalEntry& aEntry, |
|
132 CArrayFixFlat<TPtrC>& aLineArray ) const; |
|
133 |
|
134 #ifdef RD_CALEN_MIDNIGHT_VISUALIZATION |
|
135 |
|
136 /* Returns either ETime12 or ETime24 */ |
|
137 TTimeFormat TimeFormat() const; |
|
138 |
|
139 /** |
|
140 * Forms a descriptor for "start time cell" in meeting's |
|
141 * dialog line |
|
142 * |
|
143 * Format (western UI layouts): |
|
144 * |
|
145 * 12hFmt: "\t\<ArrowIconUnicode><FormattedStartTime>" |
|
146 * 24hFmt: "\t\<ArrowIconUnicode>24 " |
|
147 * |
|
148 * Format (mirrored UI layouts): |
|
149 * |
|
150 * 12hFmt: "\t<FormattedStartTime><ArrowIconUnicode>" |
|
151 * 24hFmt: "\t24 \<ArrowIconUnicode>" |
|
152 * |
|
153 * <ArrowIconUnicode> is appended only if meeting starts |
|
154 * before the focused date in Day View. |
|
155 * |
|
156 * <ArrowIconUnicode> is KUnicodeRightwardsArrow for western layouts |
|
157 * <ArrowIconUnicode> is KUnicodeLeftwardsArrow for arabic/hebrew |
|
158 * |
|
159 * <FormattedStartTime>: start time formatted with R_QTN_TIME_USUAL_WITH_ZERO |
|
160 * and converted into arabic-indic digits/european digits |
|
161 * |
|
162 * @param aBuf: whose contents will hold the output string |
|
163 * @param aStartTime: start time of the meeting |
|
164 * @param aFocusedTime: the date & time the meeting is shown |
|
165 */ |
|
166 void InsertStartTimeL(TDes& aBuf, const TTime& aStartTime, |
|
167 const TTime& aFocusedTime); |
|
168 |
|
169 /** |
|
170 * Forms a descriptor for "end time cell" in meeting's |
|
171 * dialog line |
|
172 * |
|
173 * Format (western UI layouts): |
|
174 * |
|
175 * 12hFmt: "\t<FormattedEndTime><ArrowIconUnicode>" |
|
176 * 24hFmt: "\t24 \<ArrowIconUnicode>" |
|
177 * |
|
178 * Format (mirrored UI layouts): |
|
179 * |
|
180 * 12hFmt: "\t\<ArrowIconUnicode><FormattedEndTime>" |
|
181 * 24hFmt: "\t\<ArrowIconUnicode>24 " |
|
182 * |
|
183 * <ArrowIconUnicode> is appended only if meeting ends |
|
184 * after the focused date in Day View. |
|
185 * |
|
186 * <ArrowIconUnicode> is KUnicodeRightwardsArrow for western layouts |
|
187 * <ArrowIconUnicode> is KUnicodeLeftwardsArrow for arabic/hebrew |
|
188 * |
|
189 * <FormattedEndTime>: end time formatted with R_QTN_TIME_USUAL_WITH_ZERO |
|
190 * and converted into arabic-indic digits/european digits |
|
191 * |
|
192 * @param aBuf: whose contents will hold the output string |
|
193 * @param aEndTime: End Time of the meeting |
|
194 * @param aFocusedTime: the date & time the meeting is shown |
|
195 */ |
|
196 void InsertEndTimeL(TDes& aBuf, const TTime& aEndTime, |
|
197 const TTime& aFocusedTime); |
|
198 |
|
199 /** |
|
200 * Returns the unicode value of arrow |
|
201 * |
|
202 * @param aMirroredLayout: ETrue if arabic/hebrew etc, EFalse otherwise |
|
203 * @return a desc containing "\x2192" if western layout |
|
204 * @return a desc containing "\x2190" if mirrored layout |
|
205 */ |
|
206 const TDesC& GetArrowIndicator(const TBool aMirroredLayout); |
|
207 |
|
208 /** |
|
209 * Returns a formatted descriptor for start time |
|
210 * |
|
211 * @param aFocusedTime: DD/MM/YY @ hh:mm:ss of the day in day view |
|
212 * @return a dec containing " 00" if 24 hr format is used |
|
213 * @return a dec containing 12 hr format of DD/MM/YY @ 00:00:00 |
|
214 */ |
|
215 const TDesC& GetFormattedStartTimeL(const TTime& aFocusedTime); |
|
216 |
|
217 /** |
|
218 * Returns a formatted descriptor for end time |
|
219 * |
|
220 * @param aFocusedTime: DD/MM/YY @ hh:mm:ss of the day in day view |
|
221 * @return a dec containing "24 " if 24 hr format is used |
|
222 * @return a dec containing 12 hr format of DD+1/MM/YY @ 00:00:00 |
|
223 */ |
|
224 const TDesC& GetFormattedEndTimeL(const TTime& aFocusedTime); |
|
225 |
|
226 /** |
|
227 * checks if meeting starts before the day it is shown |
|
228 * |
|
229 * @param aFocusedTime: DD/MM/YY @ hh:mm:ss of the day in day view |
|
230 * @param aStartTime: start time of the meeting |
|
231 * @return ETrue if aStartTime < DD/MM/YY @ 00:00:00 |
|
232 * @return EFalse otherwise |
|
233 */ |
|
234 TBool StartsBeforeFocusedDay(const TTime& aStartTime, const TTime& aFocusedTime); |
|
235 |
|
236 /** |
|
237 * checks if meeting ends after the day it is shown |
|
238 * |
|
239 * @param aFocusedTime: DD/MM/YY @ hh:mm:ss of the day in day view |
|
240 * @param aEndTime: End Time of the meeting |
|
241 * @return ETrue if aEndTime > DD+1/MM/YY @ 00:00:00 |
|
242 * @return EFalse otherwise |
|
243 */ |
|
244 TBool EndsAfterFocusedDay(const TTime& aEndTime, const TTime& aFocusedTime); |
|
245 |
|
246 #endif // RD_CALEN_MIDNIGHT_VISUALIZATION |
|
247 |
|
248 private: |
|
249 |
|
250 /** |
|
251 * @brief Find calendarinfo object based on calendar name |
|
252 * |
|
253 * @param aName calendar filename |
|
254 * @param aCalendarInfo referance for calendarinfo |
|
255 * @return TBool find status |
|
256 */ |
|
257 static TBool CalendarInfoIdentifierL(const HBufC* aName, |
|
258 const CCalCalendarInfo& aCalendarInfo); |
|
259 |
|
260 |
|
261 private: // Data |
|
262 NONSHARABLE_STRUCT( SDayViewLaf ) |
|
263 { |
|
264 TAknLayoutRect iGfxA; |
|
265 TAknLayoutText iTextA; |
|
266 TAknLayoutText iTextB; |
|
267 TAknLayoutText iTextC; |
|
268 TAknLayoutRect iIconA; |
|
269 TAknLayoutRect iIconB; |
|
270 }; |
|
271 |
|
272 // List box data model. |
|
273 CDesCArrayFlat* iItemTextArray; // Own. |
|
274 |
|
275 // Time format strings |
|
276 HBufC* iTimeFormat; |
|
277 #ifdef RD_CALEN_MIDNIGHT_VISUALIZATION |
|
278 // either will contain 12 hr or 24 hr format |
|
279 TBuf<50> iFormattedStartTime; |
|
280 TBuf<50> iFormattedEndTime; |
|
281 #endif // RD_CALEN_MIDNIGHT_VISUALIZATION |
|
282 |
|
283 TLocale iLocale; // System locale |
|
284 |
|
285 // LAF values |
|
286 SDayViewLaf iLaf; |
|
287 |
|
288 // not own. |
|
289 const CCalenDayContainer* iDayContainer; |
|
290 }; |
|
291 |
|
292 #endif // CCALENDAYLISTBOXMODEL_H |
|
293 |
|
294 |
|
295 // End of File |