|
1 /* |
|
2 * Copyright (c) 2007 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: Implementation of calendar context. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef CALENCONTEXTIMPL_H |
|
21 #define CALENCONTEXTIMPL_H |
|
22 |
|
23 // FORWARD DECLARATIONS |
|
24 class MCalenContextChangeObserver; |
|
25 |
|
26 // INCLUDES |
|
27 #include <calencontext.h> |
|
28 #include <caleninstanceid.h> // TCalenInstanceId |
|
29 #include <calentry.h> |
|
30 #include <vwsdef.h> |
|
31 #include <EPos_CPosLandmark.h> |
|
32 |
|
33 // CLASS DEFINITIONS |
|
34 /** |
|
35 * The controller handles events from the rest of Calendar and delegates |
|
36 * them to the appropriate place (i.e. the action ui classes). |
|
37 */ |
|
38 class CCalenContextImpl : public CBase, public MCalenContext |
|
39 { |
|
40 |
|
41 public: // Construction and destruction |
|
42 |
|
43 /** |
|
44 * The only reason this should be created outside of this dll is for |
|
45 * SCalenCommand, which needs a default constructor. Normal usage is |
|
46 * to use the accessor from the global data. Attempting to call |
|
47 * "setters" on any context not from the global data will panic. |
|
48 */ |
|
49 CCalenContextImpl( MCalenContextChangeObserver* aObserver ); |
|
50 CCalenContextImpl(); |
|
51 CCalenContextImpl( const CCalenContextImpl& aContext ); |
|
52 ~CCalenContextImpl(); |
|
53 |
|
54 public: // from MCalenContext |
|
55 |
|
56 // Utils |
|
57 /** |
|
58 * Returns the default time for views. (Normally 8am.) This would be |
|
59 * used for example by the month view, which sets the focus time to |
|
60 * 8am on a day. Then when opening the week view, a sane time is shown. |
|
61 */ |
|
62 TTimeIntervalMinutes DefaultTimeForViews() const; |
|
63 |
|
64 /** |
|
65 * Returns the default TCalTime for views. (Normally 8am today.) This |
|
66 * would be used for example when a view is the first view loaded in |
|
67 * Calendar. |
|
68 */ |
|
69 TCalTime DefaultCalTimeForViewsL() const; |
|
70 |
|
71 // Setters |
|
72 /** |
|
73 * Sets the date and time currently focused. |
|
74 * @param aFocusTime The new focus date and time. |
|
75 * @param aViewId The view id of the currently active view. |
|
76 */ |
|
77 void SetFocusDateAndTimeL( const TCalTime& aFocusDateTime, |
|
78 const TVwsViewId& aViewId ); |
|
79 |
|
80 /** |
|
81 * Sets the date currently focused. When retrieving the focus |
|
82 * date and time after calling this function, the time component |
|
83 * will be set to the default of view. When retrieving the focus |
|
84 * time only, it will be set to -1. |
|
85 * @param aFocusDate The new focus date and time. |
|
86 * @param aViewId The view id of the currently active view. |
|
87 */ |
|
88 void SetFocusDateL( const TCalTime& aFocusDate, |
|
89 const TVwsViewId& aViewId ); |
|
90 |
|
91 /** |
|
92 * Sets the id of the instance currently focused. |
|
93 * @param aInstanceId the id of the focused instance. |
|
94 * @param aViewId The view id of the currently active view. |
|
95 */ |
|
96 void SetInstanceIdL( const TCalenInstanceId& aInstanceId, |
|
97 const TVwsViewId& aViewId ); |
|
98 |
|
99 /** |
|
100 * Sets the time and instance currently focused. |
|
101 * @param aFocusTime The new focus time. If no time is focused, set |
|
102 * the Utc time of this object to be Time::NullTTime. |
|
103 * @param aInstanceId the id of the focused instance. |
|
104 * @param aViewId The view id of the currently active view. |
|
105 */ |
|
106 void SetFocusDateAndTimeAndInstanceL( const TCalTime& aFocusDateTime, |
|
107 const TCalenInstanceId& aInstanceId, |
|
108 const TVwsViewId& aViewId ); |
|
109 |
|
110 // Getters |
|
111 /** |
|
112 * Gets the date and time currently focused. |
|
113 * @return The currently focused date and time. When no time is |
|
114 * focused, the default time on the current date will be returned. |
|
115 */ |
|
116 TCalTime FocusDateAndTimeL() const; |
|
117 |
|
118 /** |
|
119 * Gets the time currently focused. |
|
120 * @return The currently focused time. When no time is |
|
121 * focused, -1 will be returned. |
|
122 */ |
|
123 TTimeIntervalMinutes FocusTime() const; |
|
124 |
|
125 /** |
|
126 * Gets the id of the instance currently focused. |
|
127 * @return The instance id currently focused. When no instance is focused, |
|
128 * this will be TCalenInstanceId::NullInstanceIdL() |
|
129 */ |
|
130 TCalenInstanceId InstanceId() const; |
|
131 |
|
132 /** |
|
133 * Gets the id of the currently active view. |
|
134 * @return The view id of the currently active view. |
|
135 */ |
|
136 TVwsViewId ViewId() const; |
|
137 |
|
138 public: // Multiple Context support |
|
139 |
|
140 /** |
|
141 * Set multiple context ids |
|
142 * |
|
143 * @param aMutlipleContextIds |
|
144 */ |
|
145 void SetMutlipleContextIds(RArray<TCalenInstanceId>& aMutlipleContextIds); |
|
146 |
|
147 /** |
|
148 * Remove multiple context id |
|
149 * |
|
150 * @param aInstanceId Instance Id for which context to be removed |
|
151 */ |
|
152 void RemoveMultipleContextId(TCalenInstanceId aInstanceId); |
|
153 |
|
154 /** |
|
155 * Resets all the multiple context ids |
|
156 * |
|
157 */ |
|
158 void ResetMultipleContextIds(TInt aDbId=0); |
|
159 |
|
160 /** |
|
161 * Getter for multiple context ids |
|
162 * |
|
163 * @return RArray<TCalenInstanceId>& |
|
164 */ |
|
165 RArray<TCalenInstanceId>& GetMutlipleContextIds(TInt aDbId=0); |
|
166 |
|
167 /** |
|
168 * Returns mutliple context's count |
|
169 * |
|
170 * @return |
|
171 */ |
|
172 TInt MutlipleContextIdsCount(); |
|
173 |
|
174 /** |
|
175 * Sets the user selected landmark |
|
176 * @param aLandMark Landmark object |
|
177 */ |
|
178 void SetLandMark(CPosLandmark* aLandMark); |
|
179 |
|
180 /** |
|
181 * Returns the user selected landmark |
|
182 * @return Landmark object |
|
183 */ |
|
184 CPosLandmark* GetLandMark(); |
|
185 |
|
186 /** |
|
187 * Resets the landmark |
|
188 */ |
|
189 void ResetLandMark(); |
|
190 |
|
191 /** |
|
192 * Allows extending this API without breaking BC. |
|
193 * |
|
194 * @param aExtensionUid specifies |
|
195 * @return extension of the requested type |
|
196 */ |
|
197 TAny* CalenContextExtensionL( TUid aExtensionUid ); |
|
198 |
|
199 /** |
|
200 * @brief Get calendar filename |
|
201 * |
|
202 * @return TDesC& reference to calendar filename |
|
203 */ |
|
204 TDesC& GetCalendarFileNameL() const; |
|
205 |
|
206 /** |
|
207 * @brief Set the calendar filename |
|
208 * |
|
209 * @param aName referance to calendar file name |
|
210 */ |
|
211 void SetCalendarFileNameL(const TDesC& aName); |
|
212 |
|
213 /** |
|
214 * @brief Resets calendar file name in context |
|
215 */ |
|
216 void ResetCalendarFileName(); |
|
217 |
|
218 private: // Data |
|
219 MCalenContextChangeObserver* iObserver; |
|
220 TCalTime iFocusDate; |
|
221 TTimeIntervalMinutes iFocusTime; |
|
222 TCalenInstanceId iInstanceId; |
|
223 TVwsViewId iViewId; |
|
224 CPosLandmark* iLandMark; |
|
225 CCalGeoValue* iGeoValue; |
|
226 HBufC* iLocation; |
|
227 // Multiple context ids |
|
228 RArray<TCalenInstanceId> iMutlipleContextIds; |
|
229 HBufC* iCalenFileName; |
|
230 }; |
|
231 |
|
232 #endif // CALENCONTEXTIMPL_H |
|
233 |
|
234 // End of file |