30
|
1 |
/*
|
|
2 |
* Copyright (c) 2002-2008 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: Container control for Week View .
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#ifndef CALENWEEKCONT_H
|
|
20 |
#define CALENWEEKCONT_H
|
|
21 |
|
|
22 |
|
|
23 |
#include <calsession.h>
|
|
24 |
#include <calenconstants.h>
|
|
25 |
#include <AknUtils.h>
|
|
26 |
#include <calcommon.h> // CalCommon::TCalViewFilter
|
|
27 |
#include <caleninstanceid.h> // TCalenInstanceId
|
|
28 |
#include <gestureobserver.h> //MGestureObserver
|
|
29 |
|
|
30 |
// INCLUDES
|
|
31 |
#include "calencontainer.h"
|
|
32 |
#include "calenweekcallback.h"
|
|
33 |
#include "calenweekdata.h"
|
|
34 |
#include "calenglobaldata.h"
|
|
35 |
|
|
36 |
// FORWARD DECLARATIONS
|
|
37 |
class CAknsFrameBackgroundControlContext;
|
|
38 |
class CCalenWeekListbox;
|
|
39 |
class CCalenWeekView;
|
|
40 |
class CCalInstance;
|
|
41 |
class CCalHourItem;
|
|
42 |
class CGulIcon;
|
|
43 |
class TAknWindowLineLayout;
|
|
44 |
class TCalenInstanceId;
|
|
45 |
class CCalInstanceView;
|
|
46 |
class MCalenPreview;
|
|
47 |
|
|
48 |
namespace GestureHelper
|
|
49 |
{
|
|
50 |
class CGestureHelper;
|
|
51 |
}
|
|
52 |
|
|
53 |
typedef CArrayFixFlat<CCalHourItem*>* CWeekSlotArrayPtr;
|
|
54 |
|
|
55 |
NONSHARABLE_CLASS (CCalHourItem):public CBase
|
|
56 |
{
|
|
57 |
public:
|
|
58 |
~CCalHourItem();
|
|
59 |
static CCalHourItem* NewL();
|
|
60 |
static CCalHourItem* NewL(CCalInstance& aInstance);
|
|
61 |
|
|
62 |
// FIXME: can be removed:
|
|
63 |
void SetDataL( CCalInstance& aInstance,
|
|
64 |
TTimeIntervalMinutes aStartTime,
|
|
65 |
TBool aTimedNote,
|
|
66 |
TCalenWeekHour aHourData);
|
|
67 |
|
|
68 |
TBool HasInstance() const;
|
|
69 |
TBool IsTimed() const;
|
|
70 |
private:
|
|
71 |
CCalHourItem();
|
|
72 |
void ConstructL(CCalInstance& aInstance);
|
|
73 |
void ConstructL();
|
|
74 |
|
|
75 |
public:
|
|
76 |
TTimeIntervalMinutes iStartTime;
|
|
77 |
CCalInstance* iInstance;
|
|
78 |
TBool iTimedNote;
|
|
79 |
TCalenWeekHour iHourData;
|
|
80 |
|
|
81 |
|
|
82 |
};
|
|
83 |
|
|
84 |
|
|
85 |
/**
|
|
86 |
* Container control for Week View.
|
|
87 |
*/
|
|
88 |
NONSHARABLE_CLASS( CCalenWeekContainer ) : public CCalenContainer,
|
|
89 |
public MCalenWeekCursorObserver,
|
|
90 |
public GestureHelper::MGestureObserver
|
|
91 |
{
|
|
92 |
public:
|
|
93 |
enum TLocaleChangeRedraw
|
|
94 |
{
|
|
95 |
ERedrawAll,
|
|
96 |
ERedrawWeek
|
|
97 |
};
|
|
98 |
|
|
99 |
public: // Constructors and destructor
|
|
100 |
/**
|
|
101 |
* C++ constructor.
|
|
102 |
*/
|
|
103 |
CCalenWeekContainer( CCalenNativeView* aView,
|
|
104 |
TTime& aTime,
|
|
105 |
TInt& aSelectedRowNumber,
|
|
106 |
TTimeIntervalMinutes& aFirstRowTime,
|
|
107 |
MCalenServices& aServices );
|
|
108 |
|
|
109 |
/**
|
|
110 |
* Destructor.
|
|
111 |
*/
|
|
112 |
virtual ~CCalenWeekContainer();
|
|
113 |
|
|
114 |
public:
|
|
115 |
/**
|
|
116 |
* Create icon indices
|
|
117 |
*/
|
|
118 |
void CreateIconIndicesL( RArray<MCalenServices::TCalenIcons>& aIndexArray );
|
|
119 |
|
|
120 |
public: // New Function
|
|
121 |
/**
|
|
122 |
* Check with the layoutmanager for any layout chnanges
|
|
123 |
*/
|
|
124 |
void CheckLayoutAndExtensionL();
|
|
125 |
|
|
126 |
/**
|
|
127 |
* Sets cursor in Active day
|
|
128 |
*/
|
|
129 |
void SetCursorToActiveDayL();
|
|
130 |
|
|
131 |
/**
|
|
132 |
* Redrawing when locale change
|
|
133 |
* @param aFlag Redraw flag: ERedrawAll | ERedrawWeek
|
|
134 |
*/
|
|
135 |
void RedrawLocaleChangeL(TLocaleChangeRedraw aFlag);
|
|
136 |
|
|
137 |
/**
|
|
138 |
* Set Active context based on currently focused cell.
|
|
139 |
* @param aInstAvailable Flag to find instance available
|
|
140 |
*/
|
|
141 |
void SetActiveContextFromHighlightL(TBool aInstAvailable = ETrue);
|
|
142 |
|
|
143 |
/**
|
|
144 |
* Step 1 of construction of grid data.
|
|
145 |
*/
|
|
146 |
void BeginPopulationWithInstanceViewL();
|
|
147 |
|
|
148 |
/**
|
|
149 |
* Step 2 of construction of grid data.
|
|
150 |
*/
|
|
151 |
void FirstPopulateOfSlotTableL();
|
|
152 |
|
|
153 |
/**
|
|
154 |
* Step 3 of construction of grid data.
|
|
155 |
*/
|
|
156 |
void SecondPopulateOfSlotTableL();
|
|
157 |
|
|
158 |
/**
|
|
159 |
* Step 4 of construction of grid data.
|
|
160 |
*/
|
|
161 |
void CompletePopulationL();
|
|
162 |
|
|
163 |
/**
|
|
164 |
* Hides preview popup/preview pane
|
|
165 |
*/
|
|
166 |
void HidePopup();
|
|
167 |
/**
|
|
168 |
* Search for top row.
|
|
169 |
*/
|
|
170 |
TInt SearchTopIndexL(TInt aColumn);
|
|
171 |
|
|
172 |
/**
|
|
173 |
* Updates preview popup/preview pane
|
|
174 |
*/
|
|
175 |
void UpdatePreviewPaneL();
|
|
176 |
|
|
177 |
/*
|
|
178 |
* @brief Find calendarinfo object based on calendar name
|
|
179 |
*
|
|
180 |
* @param aName calendar filename
|
|
181 |
* @param aCalendarInfo referance for calendarinfo
|
|
182 |
* @return TBool find status
|
|
183 |
*/
|
|
184 |
static TBool CalendarInfoIdentifierL(const HBufC* aName,
|
|
185 |
const CCalCalendarInfo& aCalendarInfo);
|
|
186 |
|
|
187 |
/*
|
|
188 |
* Cleanup instances
|
|
189 |
*/
|
|
190 |
void CleanupInstances();
|
|
191 |
|
|
192 |
/**
|
|
193 |
* returns previewpane pointer
|
|
194 |
*/
|
|
195 |
const MCalenPreview* PreviewPane();
|
|
196 |
|
|
197 |
public:
|
|
198 |
/**
|
|
199 |
* Handles navi decorator event in week view
|
|
200 |
* @param aDirection left or right
|
|
201 |
*/
|
|
202 |
void HandleNaviDecoratorEventL(TInt aDirection);
|
|
203 |
void HandleLongTapEventL( const TPoint& aPenEventLocation,
|
|
204 |
const TPoint& aPenEventScreenLocation );
|
|
205 |
|
|
206 |
/**
|
|
207 |
* Handle the gesture event
|
|
208 |
* @param aEvent event describing the gesture
|
|
209 |
*/
|
|
210 |
virtual void HandleGestureL( const GestureHelper::MGestureEvent& aEvent );
|
|
211 |
|
|
212 |
private: // New Function
|
|
213 |
TInt HighlightRowFromActiveContextL(TInt aColumn);
|
|
214 |
|
|
215 |
/**
|
|
216 |
* Sets highlight item in ListBox at active time
|
|
217 |
*/
|
|
218 |
void SelectHighlightedCellAndVisibleRangeL();
|
|
219 |
|
|
220 |
/**
|
|
221 |
* Get the available info bar rect for this container
|
|
222 |
*/
|
|
223 |
TRect InfoBarRectL( TBool aToolbarAvailable );
|
|
224 |
|
|
225 |
/**
|
|
226 |
* Calculates and Sets day from ListBox column
|
|
227 |
*/
|
|
228 |
void CalcDayFromColumn();
|
|
229 |
|
|
230 |
/**
|
|
231 |
* Populate whole week daylist from Agenda server
|
|
232 |
*/
|
|
233 |
void PopulatesDayListsL();
|
|
234 |
|
|
235 |
/**
|
|
236 |
* Fills slot table with timed notes.
|
|
237 |
*/
|
|
238 |
void InsertTimedNotesToSlotTableL();
|
|
239 |
|
|
240 |
/**
|
|
241 |
* Fills slot table with non-timed notes
|
|
242 |
*/
|
|
243 |
void InsertNonTimedNotesToSlotTableL();
|
|
244 |
|
|
245 |
/**
|
|
246 |
* Sets Week data to ListBox
|
|
247 |
*/
|
|
248 |
void SetListBoxDataL();
|
|
249 |
|
|
250 |
/**
|
|
251 |
* The note contained in within a time is searched.
|
|
252 |
* ex)
|
|
253 |
* aDayList (Note A 9:00-, Note B 9:30-, Note C 10:00)
|
|
254 |
* aTime 9:00
|
|
255 |
* Return list (Note A 9:00-, Note B 9:30-)
|
|
256 |
* @param aDayList Data list of one day
|
|
257 |
* @param aTime within a time
|
|
258 |
*/
|
|
259 |
void SearchMatchedNoteL(RPointerArray <CCalInstance>& aDayList, TTime aTime);
|
|
260 |
|
|
261 |
/**
|
|
262 |
* Check specified entry whether Timed Note.
|
|
263 |
* @param entry Check a note
|
|
264 |
* @return ETrue : Timed note
|
|
265 |
*/
|
|
266 |
TBool IsTimedNoteL(CCalEntry& aEntry);
|
|
267 |
|
|
268 |
/**
|
|
269 |
* Reset slot time table.
|
|
270 |
*/
|
|
271 |
void ResetSlotTable();
|
|
272 |
|
|
273 |
/**
|
|
274 |
* Create slot table
|
|
275 |
*/
|
|
276 |
void InitSlotTableL();
|
|
277 |
|
|
278 |
TInt FindFirstItemOfColumn(TInt aColumn);
|
|
279 |
TInt FindItemFromColumnL(const TCalenInstanceId& aId, TInt aColumn);
|
|
280 |
//TInt FindFirstRowOfInstanceL(const TCalenInstanceId& aId, TInt aColumn);
|
|
281 |
TInt FindRowForTime(TTimeIntervalMinutes aTime);
|
|
282 |
|
|
283 |
/**
|
|
284 |
* Sets highlight item in ListBox
|
|
285 |
*/
|
|
286 |
void SetHighlightAndVisibleRange(TInt aRow, TInt aColumn, TInt aTopLine);
|
|
287 |
|
|
288 |
/**
|
|
289 |
* Adjust active time when item is updated
|
|
290 |
* @param aId Note Id
|
|
291 |
*/
|
|
292 |
//void AdjustActivetimeL(const CCalEntry& aEntry,const TCalTime& aInstanceTime);
|
|
293 |
|
|
294 |
|
|
295 |
/**
|
|
296 |
* Clear entry of array for cash
|
|
297 |
*/
|
|
298 |
void ClearOneDayEntryCache();
|
|
299 |
|
|
300 |
//TInt SearchTopIndexL( TInt aColumn );
|
|
301 |
|
|
302 |
/**
|
|
303 |
* Gets time of top item in ListBox
|
|
304 |
* @return time of top item in ListBox
|
|
305 |
*/
|
|
306 |
TTimeIntervalMinutes TopTime() const;
|
|
307 |
|
|
308 |
/**
|
|
309 |
* Arrow key pressed
|
|
310 |
*/
|
|
311 |
TKeyResponse HorizontalMoveL(TInt aDir);
|
|
312 |
|
|
313 |
|
|
314 |
void PointerMovedL(TInt aNewColumn);
|
|
315 |
void HorizontalWeekMoveL(TInt aDir);
|
|
316 |
|
|
317 |
|
|
318 |
void FocusChangeForPopupL();
|
|
319 |
|
|
320 |
/**
|
|
321 |
* Draw day names
|
|
322 |
* @param aGc Graphic context
|
|
323 |
*/
|
|
324 |
void DrawDayNamesL(CWindowGc& aGc) const;
|
|
325 |
void DrawBackground(CWindowGc& aGc) const;
|
|
326 |
void DrawGridLines(CWindowGc& aGc) const;
|
|
327 |
|
|
328 |
CCalenWeekView& WeekView() const;
|
|
329 |
|
|
330 |
|
|
331 |
private: // From CCalenContainer
|
|
332 |
/**
|
|
333 |
* From CCalenContainer.
|
|
334 |
* (no implementation)
|
|
335 |
* This methods is called after calendar settings have changed.
|
|
336 |
*/
|
|
337 |
void UpdateSize();
|
|
338 |
|
|
339 |
/**
|
|
340 |
* From CCalenContainer Third phase constructor.
|
|
341 |
* This function was called CCalenView::ConstructL().
|
|
342 |
*/
|
|
343 |
void ConstructImplL();
|
|
344 |
|
|
345 |
/*
|
|
346 |
Constructs heading/side/background skin context if enabled
|
|
347 |
*/
|
|
348 |
void ConstructBackgroundContextL();
|
|
349 |
/**
|
|
350 |
* From CCalenContainer Date cahnge operation notification handler.
|
|
351 |
*/
|
|
352 |
void NotifyChangeDateL();
|
|
353 |
|
|
354 |
/**
|
|
355 |
* Notify that item is added or changed.
|
|
356 |
* @param aEntry is the entry added or modified.
|
|
357 |
* @param aInstanceTime is time of the modified instance.
|
|
358 |
*/
|
|
359 |
//void NotifyEntryChangeL(const CCalEntry& aEntry,const TCalTime& aInstanceTime);
|
|
360 |
|
|
361 |
/**
|
|
362 |
* Calling this will force to resource change to happen
|
|
363 |
* We will use the last requested resource change type.
|
|
364 |
*/
|
|
365 |
void ForceResourceChange();
|
|
366 |
|
|
367 |
private: // From CCoeControl
|
|
368 |
/**
|
|
369 |
* From CCoeControl Resizes child controls
|
|
370 |
*/
|
|
371 |
void SizeChanged();
|
|
372 |
void FocusChanged( TDrawNow aDrawNow );
|
|
373 |
|
|
374 |
/**
|
|
375 |
* React to skin, dynamic layout and other resource changes
|
|
376 |
*/
|
|
377 |
void HandleResourceChange(TInt aType);
|
|
378 |
|
|
379 |
/**
|
|
380 |
* From CCoeControl Return components count
|
|
381 |
*/
|
|
382 |
TInt CountComponentControls() const;
|
|
383 |
|
|
384 |
/**
|
|
385 |
* From CCoeControl Retrun the component specified by aIndex
|
|
386 |
*/
|
|
387 |
CCoeControl* ComponentControl(TInt aIndex) const;
|
|
388 |
|
|
389 |
/**
|
|
390 |
* From CCoeControl processing of a key event
|
|
391 |
*/
|
|
392 |
TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType);
|
|
393 |
|
|
394 |
|
|
395 |
/**
|
|
396 |
* From CCoeControl Handle pointer event
|
|
397 |
*/
|
|
398 |
void HandlePointerEventL(const TPointerEvent& aPointerEvent);
|
|
399 |
|
|
400 |
|
|
401 |
/**
|
|
402 |
* From CCoeControl Drawing day name
|
|
403 |
*/
|
|
404 |
void Draw(const TRect& aRect) const;
|
|
405 |
|
|
406 |
/**
|
|
407 |
* Pass skin information if needed.
|
|
408 |
*/
|
|
409 |
TTypeUid::Ptr MopSupplyObject(TTypeUid aId);
|
|
410 |
|
|
411 |
/**
|
|
412 |
* From CCoeControl Gets help context
|
|
413 |
* @param aContext Help context
|
|
414 |
*/
|
|
415 |
void GetHelpContext(TCoeHelpContext& aContext) const;
|
|
416 |
|
|
417 |
|
|
418 |
private: // From MActiveStep
|
|
419 |
/**
|
|
420 |
* From MActiveStep. Updates WeekView data
|
|
421 |
*/
|
|
422 |
//TInt DoStepL();
|
|
423 |
|
|
424 |
private: // From MCalenWeekCursorCallBack
|
|
425 |
TKeyResponse CursorMovedL(MCalenWeekCursorObserver::TCursorMove aDir);
|
|
426 |
|
|
427 |
private: // New variables
|
|
428 |
CCalenWeekListbox* iListBox;
|
|
429 |
CDesCArrayFlat* iDesArray; // ListBox data
|
|
430 |
RPointerArray<CCalInstance> iIdList[KCalenDaysInWeek];
|
|
431 |
CWeekSlotArrayPtr iSlotTable[KCalenDaysInWeek];
|
|
432 |
RPointerArray<CCalInstance> iEntryCache;
|
|
433 |
RPointerArray<CCalInstance> iOneDayEntryCache;
|
|
434 |
MCalenPreview* iPreview;
|
|
435 |
|
|
436 |
|
|
437 |
TTime iStartDay; // first day of week of iCurrentDay
|
|
438 |
TInt iColumn;
|
|
439 |
|
|
440 |
// In current week view, number of rows reserved for non-timed
|
|
441 |
// notes
|
|
442 |
TInt iNonTimedAreaRowCount;
|
|
443 |
|
|
444 |
CAknsFrameBackgroundControlContext* iBackgroundSkinContext;
|
|
445 |
|
|
446 |
// Cached layout values (used in many places)
|
|
447 |
TAknLayoutRect i_listscroll_cale_week_pane;
|
|
448 |
TBool iViewPopulationComplete;
|
|
449 |
|
|
450 |
// View specific data, references to the view
|
|
451 |
TTime& iTime;
|
|
452 |
TInt& iSelectedRowNumber; // The row number of the highlighted cell.
|
|
453 |
TTimeIntervalMinutes& iFirstRowTime; // The offset of the topmost row on screen to the first row.
|
|
454 |
|
|
455 |
TBool iTopRowDefault;
|
|
456 |
TBool iRow;
|
|
457 |
TBool iValidDay;
|
|
458 |
TBool iHourChange;
|
|
459 |
|
|
460 |
/**
|
|
461 |
* Gesture helper provides functionality to convert a stream of pointer
|
|
462 |
* events into a logical gesture.
|
|
463 |
* Own.
|
|
464 |
*/
|
|
465 |
// Own: Gesture helper
|
|
466 |
GestureHelper::CGestureHelper* iGestureControl;
|
|
467 |
TBool iGestureHandled;
|
|
468 |
};
|
|
469 |
|
|
470 |
#endif //CALENWEEKCONT_H
|
|
471 |
|
|
472 |
|
|
473 |
// End of File
|