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: Container base class of Calendar application.
|
|
15 |
* This class is the derivation origin of Calendar container.
|
|
16 |
*
|
|
17 |
*/
|
|
18 |
|
|
19 |
|
|
20 |
#ifndef CALENCONTAINER_H
|
|
21 |
#define CALENCONTAINER_H
|
|
22 |
|
|
23 |
// INCLUDES
|
|
24 |
#include <babitflags.h>
|
|
25 |
#include <coecntrl.h>
|
|
26 |
#include <coemain.h>
|
|
27 |
#include <caltime.h>
|
|
28 |
|
|
29 |
#include <aknlongtapdetector.h>
|
|
30 |
#include <AknNaviDecoratorObserver.h>
|
|
31 |
#include <calennavilabel.h>
|
|
32 |
|
|
33 |
#include <calenservices.h>
|
|
34 |
#include "CalendarVariant.hrh"
|
|
35 |
|
|
36 |
// FORWARD DECLARATIONS
|
|
37 |
class CCalInstance;
|
|
38 |
class CCalEntry;
|
|
39 |
class CCalenNativeView;
|
|
40 |
class CAknIconArray;
|
|
41 |
class CAknsBasicBackgroundControlContext;
|
|
42 |
class CAknsFrameBackgroundControlContext;
|
|
43 |
class MCalenViewUiExtension;
|
|
44 |
class CEikLabel;
|
|
45 |
class MCalenContext;
|
|
46 |
class CCalenContainerLayoutManager;
|
|
47 |
class MCalenPreview;
|
|
48 |
|
|
49 |
|
|
50 |
class MAknNaviDecoratorObserver;
|
|
51 |
class MCCalenNaviLabelObserver;
|
|
52 |
|
|
53 |
class MTouchFeedback;
|
|
54 |
|
|
55 |
class CCalenPreview;
|
|
56 |
|
|
57 |
// CLASS DEFINITIONS
|
|
58 |
|
|
59 |
/**
|
|
60 |
* Container base class of calendar application.
|
|
61 |
*/
|
|
62 |
NONSHARABLE_CLASS( CCalenContainer ) : public CCoeControl,
|
|
63 |
public MAknNaviDecoratorObserver,
|
|
64 |
public MCCalenNaviLabelObserver,
|
|
65 |
public MAknLongTapDetectorCallBack
|
|
66 |
|
|
67 |
{
|
|
68 |
public: // Constructors and destructor
|
|
69 |
/**
|
|
70 |
* C++ constructor.
|
|
71 |
*/
|
|
72 |
CCalenContainer( CCalenNativeView* aView, MCalenServices& aServices );
|
|
73 |
|
|
74 |
/**
|
|
75 |
* By default Symbian OS constructor is private.
|
|
76 |
*/
|
|
77 |
void ConstructL();
|
|
78 |
|
|
79 |
/**
|
|
80 |
* Destructor.
|
|
81 |
*/
|
|
82 |
virtual ~CCalenContainer();
|
|
83 |
|
|
84 |
public: // New function
|
|
85 |
/**
|
|
86 |
* Retrieves the date from the context. If the context is a todo in the past,
|
|
87 |
* today is returned.
|
|
88 |
*/
|
|
89 |
static TTime DateFromContextL( const MCalenContext& aContext );
|
|
90 |
|
|
91 |
/**
|
|
92 |
* Ignore Agenda server notifier.
|
|
93 |
* iIgnoreDocChange is setted ETrue this function.
|
|
94 |
* Then, iIgnoreDocChange is setted EFalse by last code of DoStepL()
|
|
95 |
*/
|
|
96 |
void SetIgnoreDocuChange();
|
|
97 |
|
|
98 |
|
|
99 |
|
|
100 |
/**
|
|
101 |
* Called when an item is changed.
|
|
102 |
* @param aId It is changed item's ID
|
|
103 |
*/
|
|
104 |
//void DoItemChangedL(const CCalEntry& aEntry,const TCalTime& aInstanceTime,TBool aForceRefresh);
|
|
105 |
|
|
106 |
/**
|
|
107 |
* Third phase constructor.
|
|
108 |
* Called from CCalendarView::ConstructL().
|
|
109 |
*/
|
|
110 |
virtual void ConstructImplL() = 0;
|
|
111 |
|
|
112 |
/**
|
|
113 |
* Notify that Active date is changed. Each contianer will redraw.
|
|
114 |
*/
|
|
115 |
virtual void NotifyChangeDateL();
|
|
116 |
|
|
117 |
|
|
118 |
/**
|
|
119 |
* Get the available info bar rect for this container
|
|
120 |
* Default implementation returns empty rect
|
|
121 |
*/
|
|
122 |
virtual TRect InfoBarRectL( TBool aToolbarAvailable );
|
|
123 |
|
|
124 |
/**
|
|
125 |
* Get the available preview pane rect for this container
|
|
126 |
*/
|
|
127 |
virtual TRect PreviewRectL();
|
|
128 |
|
|
129 |
/**
|
|
130 |
* Get the view for this container
|
|
131 |
*/
|
|
132 |
CCalenNativeView* View() { return iView; }
|
|
133 |
|
|
134 |
TBool UseToolbar() const;
|
|
135 |
TBool UseInfobar() const;
|
|
136 |
TBool UsePreview() const;
|
|
137 |
|
|
138 |
|
|
139 |
// From MAknLongTapDetectorCallBack
|
|
140 |
virtual void HandleLongTapEventL( const TPoint& aPenEventLocation,
|
|
141 |
const TPoint& aPenEventScreenLocation ) = 0;
|
|
142 |
|
|
143 |
|
|
144 |
/**
|
|
145 |
* Remove from Control stack and Make in-visible
|
|
146 |
* @param aMakeInvisible if ETrue is set, container becomes invisible
|
|
147 |
*/
|
|
148 |
void RemoveFromStackAndMakeInvisible(TBool aMakeInvisible = ETrue);
|
|
149 |
|
|
150 |
/**
|
|
151 |
* Add to Control stack and Make visible
|
|
152 |
*/
|
|
153 |
void AddToStackAndMakeVisibleL();
|
|
154 |
|
|
155 |
/**
|
|
156 |
* Is this control exist on stack?
|
|
157 |
* @return If value is ETrue, this control is exist on stack
|
|
158 |
*/
|
|
159 |
TBool IsOnStack();
|
|
160 |
|
|
161 |
/**
|
|
162 |
* This methods is called after calendar settings have changed.
|
|
163 |
* See day, week and month container for implementation.
|
|
164 |
*/
|
|
165 |
virtual void UpdateSize() = 0;
|
|
166 |
|
|
167 |
/**
|
|
168 |
* Creates icon array according to icon index array passed in
|
|
169 |
*/
|
|
170 |
CAknIconArray* CreateIconsL( const RArray<MCalenServices::TCalenIcons>& aIndexArray, const TInt aViewId = 0 );
|
|
171 |
|
|
172 |
/**
|
|
173 |
* Creates icon index array
|
|
174 |
*/
|
|
175 |
virtual void CreateIconIndicesL( RArray<MCalenServices::TCalenIcons>& aIndexArray) = 0;
|
|
176 |
|
|
177 |
/**
|
|
178 |
* Get icon index in the icons array
|
|
179 |
*/
|
|
180 |
TInt IconIndex( MCalenServices::TCalenIcons aType ) const;
|
|
181 |
|
|
182 |
/**
|
|
183 |
* Get icon index according to entry type
|
|
184 |
* aAllDayEvent - allday will havew seprate icon,
|
|
185 |
* by defalut value is EFalse if not passed
|
|
186 |
*
|
|
187 |
*/
|
|
188 |
TInt IconIndexFromEntryL( CCalEntry& aEntry, TBool aAllDayEvent = EFalse ) const;
|
|
189 |
|
|
190 |
|
|
191 |
|
|
192 |
/**
|
|
193 |
* Determines if aEntry requires (P)riority, (A)larm, (R)ecurrence or (E)xception icons.
|
|
194 |
* If so, it returns aDes, containing those icons indexes, as created by CalenIcon.
|
|
195 |
* @param aEntry: A Calendar entry
|
|
196 |
* @param aIconFormatDes: i.e. " \t%d" for ToDo view, "%d\t" for Day view
|
|
197 |
* @param aTargetDes: A descriptor, holding icons indexes. Untouched if no Priority, Alarm,
|
|
198 |
* Recurrence or Exception icons needed.
|
|
199 |
* @param aPushSingleIconToRight: When ETrue, (aIconFormatDes - "%d") is appended to
|
|
200 |
* aTargetDes, when there is only one icon to display (i.e. alarm)
|
|
201 |
*
|
|
202 |
* example: init value of aIconFormatDes = "%d\t" (Day view)
|
|
203 |
* init value of aTargetDes: "3\t\t\t\ToDoWithAlarm\t"
|
|
204 |
* example: final value of aTargetDes: "3\t\t\t\ToDoWithAlarm\t\t4\t"
|
|
205 |
* (aPushSingleIconToRight = ETrue)
|
|
206 |
* example: final value of aTargetDes: "3\t\t\t\ToDoWithAlarm\t4\t"
|
|
207 |
* (aPushSingleIconToRight = EFalse)
|
|
208 |
*
|
|
209 |
* @param aRevertOrder: When ETrue, A,R,P/E appended to aTargetDes.
|
|
210 |
* When EFalse, P/E,R,A appended to aTargetDes.
|
|
211 |
*
|
|
212 |
* @leave with KErrArgument if aIconFormatDes does not have "%d" in it
|
|
213 |
* @leave with KErrArgument if aIconFormatDes length is greater than 50
|
|
214 |
* @leave with KErrBadDescriptor if there is not enough free space in aTargetDes
|
|
215 |
* to hold 2 icon strings with aIconFormatDes
|
|
216 |
*/
|
|
217 |
void InsertAdditionalIconsL( const CCalEntry& aEntry,
|
|
218 |
const TDesC& aIconFormatDes,
|
|
219 |
TPtr& aTargetDes,
|
|
220 |
TBool aPushSingleIconToRight = ETrue,
|
|
221 |
TBool aRevertOrder = EFalse ) const;
|
|
222 |
|
|
223 |
/**
|
|
224 |
* Returns the reduced size of the main pane if the
|
|
225 |
* preview pane is displayed.
|
|
226 |
*/
|
|
227 |
TRect ReducePreview(TRect aRect) const;
|
|
228 |
|
|
229 |
// Methods for view ui extensions
|
|
230 |
/**
|
|
231 |
* When focus has changed, UI container should call
|
|
232 |
* this method.
|
|
233 |
*/
|
|
234 |
void UpdateStatusPaneAndExtensionsL();
|
|
235 |
|
|
236 |
/*
|
|
237 |
* Clean instances
|
|
238 |
*/
|
|
239 |
virtual void CleanupInstances(){ };
|
|
240 |
|
|
241 |
/**
|
|
242 |
* Hide/Unhide "today" toolbar item based on the focused day
|
|
243 |
*/
|
|
244 |
void UpdateTodayToolbarItemL();
|
|
245 |
|
|
246 |
/**
|
|
247 |
* returns previewpane pointer
|
|
248 |
*/
|
|
249 |
virtual const MCalenPreview* PreviewPane(){return NULL; };
|
|
250 |
|
|
251 |
/**
|
|
252 |
* Generates tactile feedback on user touch action
|
|
253 |
*/
|
|
254 |
virtual void GenerateTactileFeedback();
|
|
255 |
|
|
256 |
private: // New functions
|
|
257 |
/**
|
|
258 |
* Return number of icons needed to be displayed
|
|
259 |
* @return number of icons (between 0 and 3)
|
|
260 |
*/
|
|
261 |
TInt NumberOfIcons( const TBool aException,
|
|
262 |
const TBool aRepeat,
|
|
263 |
const TBool aAlarm,
|
|
264 |
const TBool aHasPriority ) const;
|
|
265 |
/**
|
|
266 |
* Check if the entry has priority (only ToDos)
|
|
267 |
* @param aEntry : A Calendar Entry
|
|
268 |
* @param aPriHigh : Set aPriHigh ETrue, if aEntry is high priority ToDo
|
|
269 |
* @param aPriLow : Set aPriLow ETrue, if aEntry is low priority ToDo
|
|
270 |
* @return ETrue if high or low priority
|
|
271 |
* @return EFalse otherwise
|
|
272 |
*/
|
|
273 |
TBool NeedsPriorityIconL( const CCalEntry& aEntry,
|
|
274 |
TBool& aPriHigh,
|
|
275 |
TBool& aPriLow ) const;
|
|
276 |
|
|
277 |
protected: // New function
|
|
278 |
|
|
279 |
|
|
280 |
/**
|
|
281 |
* Long tap animation is handled by calling this method
|
|
282 |
*/
|
|
283 |
void NotifyLongTapDetectorL(const TPointerEvent& aPointerEvent);
|
|
284 |
|
|
285 |
|
|
286 |
protected: // Functions from base classes
|
|
287 |
/**
|
|
288 |
* From CCoeControl Handle key event
|
|
289 |
*/
|
|
290 |
TKeyResponse OfferKeyEventL(
|
|
291 |
const TKeyEvent& aKeyEvent, TEventCode aType);
|
|
292 |
|
|
293 |
/**
|
|
294 |
* Called when control size is changed
|
|
295 |
*/
|
|
296 |
void SizeChanged(const TRect& aParent);
|
|
297 |
|
|
298 |
|
|
299 |
// From MAknNaviDecoratorObserver
|
|
300 |
virtual void HandleNaviDecoratorEventL( TInt aEventID ) = 0;
|
|
301 |
// From MCCalenNaviLabelObserver
|
|
302 |
void HandleNaviLabelEventL( TInt aEventID );
|
|
303 |
|
|
304 |
|
|
305 |
protected: // CCoeControl
|
|
306 |
/**
|
|
307 |
* Handler of changing focus
|
|
308 |
* @param aDrawNow ENoDrawNow | EDrawNow
|
|
309 |
*/
|
|
310 |
void FocusChanged(TDrawNow aDrawNow);
|
|
311 |
|
|
312 |
public: // CCoeControl
|
|
313 |
/**
|
|
314 |
* Handles resource changes.
|
|
315 |
* @param aType Resource change type.
|
|
316 |
**/
|
|
317 |
virtual void HandleResourceChange(TInt aType);
|
|
318 |
|
|
319 |
/**
|
|
320 |
* Handles command to stop the alarm ,in case of autosnooze for MSK case.
|
|
321 |
**/
|
|
322 |
virtual void HandleStopCommandL(){};
|
|
323 |
|
|
324 |
protected: // Data
|
|
325 |
CCalenNativeView* iView;
|
|
326 |
|
|
327 |
// main area background skin for all views
|
|
328 |
CAknsBasicBackgroundControlContext* iBgContext;
|
|
329 |
// week and month view heading pane skin
|
|
330 |
CAknsFrameBackgroundControlContext* iHeadingBgContext;
|
|
331 |
// week and month view side pane skin
|
|
332 |
CAknsFrameBackgroundControlContext* iSideBgContext;
|
|
333 |
|
|
334 |
// flag for touch ui long tap functionality
|
|
335 |
TBool iFirstTap;
|
|
336 |
CAknLongTapDetector* iLongTapDetector;
|
|
337 |
|
|
338 |
|
|
339 |
|
|
340 |
protected:
|
|
341 |
// Control to show UI extension data. May be either a preview pane or an info bar, or NULL
|
|
342 |
CCoeControl* iUiExtension;
|
|
343 |
|
|
344 |
MCalenServices& iServices;
|
|
345 |
RArray<MCalenServices::TCalenIcons> iIconIndices;
|
|
346 |
CCalenContainerLayoutManager* iLayoutManager;
|
|
347 |
|
|
348 |
private:
|
|
349 |
MTouchFeedback* iFeedBack;
|
|
350 |
};
|
|
351 |
|
|
352 |
#endif // CALENCONTAINER_H
|
|
353 |
|
|
354 |
|
|
355 |
// End of File
|