66
|
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: For Day view container of calendar application.
|
|
15 |
* The class derived from CCalenContainer.
|
|
16 |
*
|
|
17 |
*/
|
|
18 |
|
|
19 |
|
|
20 |
#ifndef CALENDAYCONTAINER_H
|
|
21 |
#define CALENDAYCONTAINER_H
|
|
22 |
|
|
23 |
// INCLUDES
|
|
24 |
#include <eiklbo.h>
|
|
25 |
#include <caleninstanceid.h> // TCalenInstanceId
|
|
26 |
#include <gestureobserver.h>
|
|
27 |
|
|
28 |
#include "calencontainer.h"
|
|
29 |
#include "CalendarVariant.hrh"
|
|
30 |
|
|
31 |
// CONSTANTS
|
|
32 |
const TInt KIndexError = -1;
|
|
33 |
|
|
34 |
// FORWARD DECLARATIONS
|
|
35 |
class CCalenDayListBoxModel;
|
|
36 |
class CCalenDayListBox;
|
|
37 |
class CCalenDayListBoxView;
|
|
38 |
class CCalenDayView;
|
|
39 |
class CCalInstance;
|
|
40 |
class CAknsFrameBackgroundControlContext;
|
|
41 |
class TCalenInstanceId;
|
|
42 |
|
|
43 |
namespace GestureHelper
|
|
44 |
{
|
|
45 |
class CGestureHelper;
|
|
46 |
}
|
|
47 |
|
|
48 |
// CLASS DEFINITIONS
|
|
49 |
/**
|
|
50 |
* CCalenDayContainer container control class for DayView.
|
|
51 |
*/
|
|
52 |
NONSHARABLE_CLASS( CCalenDayContainer ) : public CCalenContainer,
|
|
53 |
public MEikListBoxObserver,
|
|
54 |
public GestureHelper::MGestureObserver
|
|
55 |
{
|
|
56 |
public: // Data
|
|
57 |
|
|
58 |
NONSHARABLE_STRUCT( SItemInfo )
|
|
59 |
{
|
|
60 |
TTimeIntervalMinutes iStartTime;
|
|
61 |
TCalenInstanceId iId;
|
|
62 |
TBool iTimedNote;
|
|
63 |
TInt iTopLine;
|
|
64 |
TInt iBottomLine;
|
|
65 |
|
|
66 |
// Fetched instance is temporarily stored to iTmpInstance
|
|
67 |
// This is destroyed after construction phase is over.
|
|
68 |
CCalInstance* iTmpInstance;
|
|
69 |
TUint32 iColor;
|
|
70 |
};
|
|
71 |
|
|
72 |
public: // Constructors and destructor
|
|
73 |
/**
|
|
74 |
* C++ default constructor.
|
|
75 |
*/
|
|
76 |
CCalenDayContainer( CCalenNativeView* aView,
|
|
77 |
TTime& aDate,
|
|
78 |
TInt& aHighlightedRowNumber,
|
|
79 |
TInt& aFirstEntryOnScreenIndex,
|
|
80 |
MCalenServices& aServices );
|
|
81 |
/**
|
|
82 |
* Destructor.
|
|
83 |
*/
|
|
84 |
virtual ~CCalenDayContainer();
|
|
85 |
|
|
86 |
public: // From CalenContainer
|
|
87 |
/**
|
|
88 |
* Create icon index
|
|
89 |
*/
|
|
90 |
void CreateIconIndicesL( RArray<MCalenServices::TCalenIcons>& aIndexArray );
|
|
91 |
|
|
92 |
/**
|
|
93 |
* Handles list box events.
|
|
94 |
* @param aListBox The originating list box.
|
|
95 |
* @param aEventType A code for the event.
|
|
96 |
*/
|
|
97 |
void HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType);
|
|
98 |
|
|
99 |
public: // New function
|
|
100 |
/**
|
|
101 |
* Refresh Day view data and draws
|
|
102 |
*/
|
|
103 |
void UpdateContainerL();
|
|
104 |
|
|
105 |
/**
|
|
106 |
* Update time format (12/24)
|
|
107 |
*/
|
|
108 |
void UpdateTimeFormat();
|
|
109 |
|
|
110 |
/**
|
|
111 |
* @return ETrue, if day view doesn't have any instances to show.
|
|
112 |
*/
|
|
113 |
TBool IsEmptyView() const;
|
|
114 |
|
|
115 |
/**
|
|
116 |
* Get the available preview pane rect for this container
|
|
117 |
*/
|
|
118 |
TRect PreviewRectL();
|
|
119 |
|
|
120 |
//void SetActiveContextFromHighlightL();
|
|
121 |
|
|
122 |
#ifdef RD_CALEN_MIDNIGHT_VISUALIZATION
|
|
123 |
TBool IsMidnightVisualization() const;
|
|
124 |
#endif // RD_CALEN_MIDNIGHT_VISUALIZATION
|
|
125 |
|
|
126 |
/**
|
|
127 |
* Get instances for day. List of instances is processed during construction
|
|
128 |
* of list box data and destroyed once it's done.
|
|
129 |
* Step 1 of construction of listbox data.
|
|
130 |
*/
|
|
131 |
void GetInstanceListL();
|
|
132 |
|
|
133 |
/**
|
|
134 |
* Setup layout table.
|
|
135 |
* Step 2 of construction of listbox data
|
|
136 |
*/
|
|
137 |
void CreateSlotTableL();
|
|
138 |
|
|
139 |
/**
|
|
140 |
* Completes population.
|
|
141 |
* Step 3 of construction of listbox data.
|
|
142 |
*/
|
|
143 |
void CompletePopulationL();
|
|
144 |
|
|
145 |
/**
|
|
146 |
* Get the available info bar rect for this container
|
|
147 |
*/
|
|
148 |
TRect InfoBarRectL( TBool aToolbarAvailable );
|
|
149 |
|
|
150 |
/**
|
|
151 |
* Sets the context based on the highlighted item.
|
|
152 |
*/
|
|
153 |
void SetContextFromHighlightL();
|
|
154 |
|
|
155 |
/**
|
|
156 |
* Sets the highlighted item based on the context.
|
|
157 |
*/
|
|
158 |
void SetHighlightFromContextL();
|
|
159 |
|
|
160 |
/**
|
|
161 |
* Delete note command notification handler
|
|
162 |
*/
|
|
163 |
void NotifyDeleteItemL();
|
|
164 |
|
|
165 |
/**
|
|
166 |
* Returns ETrue if event has geo coordinates else EFalse
|
|
167 |
*/
|
|
168 |
TBool IsEventHasMapLocationL();
|
|
169 |
|
|
170 |
/**
|
|
171 |
* Returns ETrue if event has location text else EFalse
|
|
172 |
*/
|
|
173 |
TBool IsEventHasNoLocationTextL();
|
|
174 |
|
|
175 |
/**
|
|
176 |
* This method is called after pointer event in Navi
|
|
177 |
* decoration object.
|
|
178 |
* @param aDirection right or left
|
|
179 |
*/
|
|
180 |
void HandleNaviDecoratorEventL(TInt aEventID);
|
|
181 |
|
|
182 |
/**
|
|
183 |
* Handles long tap events
|
|
184 |
*/
|
|
185 |
void HandleLongTapEventL( const TPoint& aPenEventLocation,
|
|
186 |
const TPoint& aPenEventScreenLocation );
|
|
187 |
|
|
188 |
/**From MGestureObserver
|
|
189 |
* Handle the gesture event
|
|
190 |
* @param aEvent event describing the gesture
|
|
191 |
*/
|
|
192 |
virtual void HandleGestureL( const GestureHelper::MGestureEvent& aEvent );
|
|
193 |
|
|
194 |
/**
|
|
195 |
* Check whether entry exists or not
|
|
196 |
*/
|
|
197 |
TBool IsValidEntryL();
|
|
198 |
private: // New function
|
|
199 |
|
|
200 |
#ifdef RD_CALEN_MIDNIGHT_VISUALIZATION
|
|
201 |
void GetMidnightVisualizationL();
|
|
202 |
#endif // RD_CALEN_MIDNIGHT_VISUALIZATION
|
|
203 |
/**
|
|
204 |
* Destroy all CCalInstances. This is called during construction of view data
|
|
205 |
* once we have constructed actual listbox data.
|
|
206 |
*/
|
|
207 |
void DestroyInstanceListL();
|
|
208 |
|
|
209 |
/**
|
|
210 |
* Set Listbox data to ListBox
|
|
211 |
* Part of step 3 of construction of listbox data
|
|
212 |
*/
|
|
213 |
void CreateListBoxDataL();
|
|
214 |
|
|
215 |
/**
|
|
216 |
* Called in the final stage of population. If we've just deleted an entry,
|
|
217 |
* update which row is highlighted
|
|
218 |
*/
|
|
219 |
void UpdateHighlightedRowIfDeletedL();
|
|
220 |
|
|
221 |
// FIXME document these
|
|
222 |
//void SetActiveContextForFreshDayL(TTime& aDay);
|
|
223 |
//void SetActiveContextFromEntryL(const CCalEntry& aEntry,const TCalTime& aInstanceTime);
|
|
224 |
|
|
225 |
/**
|
|
226 |
* Handles pressing left or right.
|
|
227 |
*/
|
|
228 |
void HandleHorizontalScrollL( TTimeIntervalDays aDirection );
|
|
229 |
|
|
230 |
/**
|
|
231 |
* Handles pressing up or down.
|
|
232 |
*/
|
|
233 |
void HandleVerticalScrollL( TInt aNewCursor );
|
|
234 |
|
|
235 |
/**
|
|
236 |
* Sets highlight item in ListBox
|
|
237 |
* @param aIndex Index of ListBox
|
|
238 |
* @param aTopItem Index of top item
|
|
239 |
*/
|
|
240 |
void SetHighlightAndVisibleItem(TInt aIndex, TInt aTopItem = KIndexError);
|
|
241 |
|
|
242 |
TInt FindItemIndex(const TCalenInstanceId& aId) const;
|
|
243 |
|
|
244 |
TInt FindItemIndexForRow(TInt aListIndex) const;
|
|
245 |
|
|
246 |
public:
|
|
247 |
SItemInfo& FindItem(TInt aListIndex) const;
|
|
248 |
|
|
249 |
MCalenServices& Services();
|
|
250 |
|
|
251 |
private:
|
|
252 |
|
|
253 |
|
|
254 |
/**
|
|
255 |
* Searches list item that is nearest to aTime
|
|
256 |
* @param aTime
|
|
257 |
* @return if there is such item, index in ListBox is returned
|
|
258 |
* othwerise returns KIndexError.
|
|
259 |
*/
|
|
260 |
TInt SearchNearestItem(TTimeIntervalMinutes aTime) const;
|
|
261 |
|
|
262 |
void SetVisibleLines(TInt aHighlightFirstLine,
|
|
263 |
TInt aPreferredTopLine);
|
|
264 |
|
|
265 |
|
|
266 |
|
|
267 |
CCalenDayListBoxView* View();
|
|
268 |
|
|
269 |
CCalenDayView& DayView() const;
|
|
270 |
public:
|
|
271 |
|
|
272 |
enum TDayLayoutVariant
|
|
273 |
{
|
|
274 |
ENoLayoutVariantSet = 0,
|
|
275 |
EListScrollCaleDayPane,
|
|
276 |
EPopupToolbarWindowCp02,
|
|
277 |
EScrollPaneCp09,
|
|
278 |
EBgCalePane,
|
|
279 |
EListCalePane,
|
|
280 |
EListScrollCaleDayPaneT1
|
|
281 |
};
|
|
282 |
TInt LayoutVariantIndex(TDayLayoutVariant aLayout) const;
|
|
283 |
|
|
284 |
/**
|
|
285 |
* From CCalenContainer.
|
|
286 |
* (no implementation)
|
|
287 |
* This methods is called after calendar settings have changed.
|
|
288 |
*/
|
|
289 |
void UpdateSize();
|
|
290 |
|
|
291 |
private: // From CCoeControl
|
|
292 |
/**
|
|
293 |
* From CCoeControl Resizes child controls
|
|
294 |
*/
|
|
295 |
void SizeChanged();
|
|
296 |
void FocusChanged( TDrawNow aDrawNow );
|
|
297 |
void HandleResourceChange(TInt aType);
|
|
298 |
|
|
299 |
/**
|
|
300 |
* From CCoeControl Gets child control count
|
|
301 |
* @return Child control count
|
|
302 |
*/
|
|
303 |
TInt CountComponentControls() const;
|
|
304 |
/**
|
|
305 |
* From CCoeControl Gets child control pointer
|
|
306 |
* @param aIndex Child control index
|
|
307 |
* @return child control pointer
|
|
308 |
*/
|
|
309 |
CCoeControl* ComponentControl(TInt aIndex) const;
|
|
310 |
/**
|
|
311 |
* From CCoeControl Process key event
|
|
312 |
* @param aKeyEvent The key event.
|
|
313 |
* @param aType EEventKey | EEventKeyUp | EEventKeyDown.
|
|
314 |
* @return EKeyWasNotConsumed: Key event was not consumed.
|
|
315 |
*/
|
|
316 |
TKeyResponse OfferKeyEventL(
|
|
317 |
const TKeyEvent& aKeyEvent, TEventCode aType);
|
|
318 |
|
|
319 |
/**
|
|
320 |
* From CCoeControl Handle pointer event
|
|
321 |
* @param aPointerEvent Event to be handled.
|
|
322 |
*/
|
|
323 |
void HandlePointerEventL(const TPointerEvent& aPointerEvent);
|
|
324 |
|
|
325 |
/**
|
|
326 |
* From CCoeControl Drawing day name
|
|
327 |
* @param aRect Clipping rectangle
|
|
328 |
*/
|
|
329 |
void Draw(const TRect& aRect) const;
|
|
330 |
|
|
331 |
/**
|
|
332 |
* Pass skin information if needed
|
|
333 |
*/
|
|
334 |
TTypeUid::Ptr MopSupplyObject(TTypeUid aId);
|
|
335 |
|
|
336 |
/**
|
|
337 |
* From CCoeControl Gets help context
|
|
338 |
* @param aContext Help context
|
|
339 |
*/
|
|
340 |
void GetHelpContext(TCoeHelpContext& aContext) const;
|
|
341 |
|
|
342 |
private: // From CCalenContainer
|
|
343 |
/**
|
|
344 |
* From CCalenContainer Third phase constructor.
|
|
345 |
* This function was called CCalenView::ConstructL().
|
|
346 |
*/
|
|
347 |
void ConstructImplL();
|
|
348 |
|
|
349 |
|
|
350 |
|
|
351 |
/**
|
|
352 |
* From CCalenContainer Date cahnge operation notification handler.
|
|
353 |
* (i.e. GotoDate).
|
|
354 |
*/
|
|
355 |
void NotifyChangeDateL();
|
|
356 |
|
|
357 |
/**
|
|
358 |
* Notify that item is added or changed.
|
|
359 |
* @param aEntry is the entry added or modified.
|
|
360 |
* @param aInstanceTime is time of the modified instance.
|
|
361 |
*/
|
|
362 |
//void NotifyEntryChangeL(const CCalEntry& aEntry,const TCalTime& aInstanceTime);
|
|
363 |
|
|
364 |
|
|
365 |
private: // New Functions
|
|
366 |
/**
|
|
367 |
* Updates icons after e.g. skin change
|
|
368 |
*/
|
|
369 |
void UpdateIconsL();
|
|
370 |
|
|
371 |
private: // From MActiveStep
|
|
372 |
/**
|
|
373 |
* From MActiveStep Updates DayView data
|
|
374 |
* @return 0 is DoStepL() exit code
|
|
375 |
*/
|
|
376 |
//TInt DoStepL();
|
|
377 |
|
|
378 |
private: // Data
|
|
379 |
CCalenDayListBox* iListBox;
|
|
380 |
CCalenDayListBoxModel* iListBoxModel;
|
|
381 |
|
|
382 |
RPointerArray<CCalInstance> iInstanceList;
|
|
383 |
CArrayFixFlat<SItemInfo>* iLayoutTable;
|
|
384 |
|
|
385 |
/*enum TStepPopulate
|
|
386 |
{
|
|
387 |
ENothingDone,
|
|
388 |
EPopulationDone,
|
|
389 |
ESlotTableDone,
|
|
390 |
EDone
|
|
391 |
};
|
|
392 |
TStepPopulate iStepsCompleted;*/
|
|
393 |
TInt iDeletedIndex;
|
|
394 |
TBool iMidnight;
|
|
395 |
CAknsFrameBackgroundControlContext* iBackgroundSkinContext;
|
|
396 |
|
|
397 |
TBool iDateWasNull;
|
|
398 |
// View specific data references
|
|
399 |
TTime& iDate; // Current day
|
|
400 |
TInt& iHighlightedRowNumber;
|
|
401 |
TInt& iFirstEntryOnScreenIndex;
|
|
402 |
|
|
403 |
/**
|
|
404 |
* Gesture helper provides functionality to convert a stream of pointer
|
|
405 |
* events into a logical gesture.
|
|
406 |
* Own.
|
|
407 |
*/
|
|
408 |
GestureHelper::CGestureHelper* iGestureHelper;
|
|
409 |
TBool iGestureHandled;
|
|
410 |
};
|
|
411 |
|
|
412 |
#endif // CALENDAYCONTAINER_H
|
|
413 |
|
|
414 |
// End of File
|