|
1 /* |
|
2 * Copyright (c) 2007-2009 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: Calendar view manager |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CALENVIEWMANAGER_H |
|
20 #define CALENVIEWMANAGER_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <vwsdef.h> |
|
24 #include <coeview.h> // MCoeViewActivationObserver |
|
25 #include <calencommandhandler.h> |
|
26 #include <calennotificationhandler.h> // MCalenNotificationHandler |
|
27 |
|
28 // FORWARD DECLARATIONS |
|
29 class CAknViewAppUi; |
|
30 class CCalenGlobalData; |
|
31 class CCalenViewPopulator; |
|
32 class CCalenController; |
|
33 class CCalenView; |
|
34 class CEikMenuPane; |
|
35 class CCalenToolbarImpl; |
|
36 class MCalenToolbar; |
|
37 class CCalenSetting; |
|
38 class CCalenViewInfo; |
|
39 class CCalenCustomisationManager; |
|
40 class MCalenServices; |
|
41 class CCalenIcons; |
|
42 class CCalenToolbarImpl; |
|
43 |
|
44 typedef CCalenView* (*NativeView)(MCalenServices&); |
|
45 |
|
46 /** |
|
47 * The action ui handles events passed from the controller and delegates |
|
48 * them to the appropriate place (i.e. the specific action ui classes). |
|
49 */ |
|
50 class CCalenViewManager : public CBase, |
|
51 public MCoeViewActivationObserver, |
|
52 public MCalenNotificationHandler, |
|
53 public MCalenCommandHandler |
|
54 { |
|
55 public: // Construction and destruction |
|
56 /** |
|
57 * Symbian 1st phase constructor |
|
58 * @param aAppUi Reference to the CAknViewAppUi |
|
59 * @param aController Reference to the CCalenController |
|
60 * @return Pointer to CCalenViewManager |
|
61 */ |
|
62 static CCalenViewManager* NewL( CAknViewAppUi& aAppUi, |
|
63 CCalenController& aController ); |
|
64 /** |
|
65 * Destructor |
|
66 */ |
|
67 virtual ~CCalenViewManager(); |
|
68 |
|
69 public: // New functions |
|
70 /** |
|
71 * Constructs the custom views |
|
72 * @param aCustomisationmManager Reference to CCalenCustomisationManager |
|
73 */ |
|
74 void ConstructCustomViewsL( |
|
75 CCalenCustomisationManager& aCustomisationManager ); |
|
76 |
|
77 /** |
|
78 * Get info array |
|
79 * @return Reference to RPointerArray<CCalenViewInfo> |
|
80 */ |
|
81 RPointerArray<CCalenViewInfo>& ViewInfoArray(); |
|
82 |
|
83 /** |
|
84 * From MCalenCommandHandler. |
|
85 * Handles key presses. |
|
86 * |
|
87 * @param aCommand The command Id of the key. |
|
88 */ |
|
89 TBool HandleCommandL( const TCalenCommand& aCommand ); |
|
90 |
|
91 /** |
|
92 * From MCalenCommandHandler. |
|
93 * Allows extending this API without breaking BC. |
|
94 * |
|
95 * @param aExtensionUid specifies |
|
96 * @return extension of the requested type |
|
97 */ |
|
98 TAny* CalenCommandHandlerExtensionL( TUid aExtensionUid ); |
|
99 |
|
100 /** |
|
101 * Returns the current view. |
|
102 * @return TUid of current view |
|
103 */ |
|
104 TUid CurrentView() const; |
|
105 |
|
106 /** |
|
107 * Removes the current view from the switch menu |
|
108 * @param aMenuPane Where the currenct view should be removed from |
|
109 */ |
|
110 void RemoveCurrentViewFromMenu( CEikMenuPane* aMenuPane ); |
|
111 |
|
112 /** |
|
113 * Request activation of a specific view |
|
114 * @param aViewId Reference to TVwsViewId of the view to be activated |
|
115 */ |
|
116 void RequestActivationL( const TVwsViewId& aViewId ); |
|
117 |
|
118 /** |
|
119 * Get a pointer to the Calendar toolbar, or NULL if none is available. |
|
120 * Ownership is not transferred. |
|
121 * @return Calendar toolbar if available |
|
122 */ |
|
123 MCalenToolbar* ToolbarOrNull(); |
|
124 |
|
125 /** |
|
126 * Activates the default view, as retrieved from settings. |
|
127 */ |
|
128 void ActivateDefaultViewL( TUid aDefaultView ); |
|
129 |
|
130 /** |
|
131 * Returns if the first view activation on start-up has taken place |
|
132 */ |
|
133 TBool ViewsActivated() const; |
|
134 |
|
135 /** |
|
136 * Interupts the population of the current view. |
|
137 */ |
|
138 void InterruptPopulationL(); |
|
139 |
|
140 /** |
|
141 * Try to activate a view |
|
142 * @param aViewUid View id to be activated |
|
143 * @param aMessageId Message id |
|
144 * @param aMessage Message send along activation query |
|
145 */ |
|
146 void RequestActivationL( const TUid& aViewUid, |
|
147 const TUid& aMessageId = KNullUid, |
|
148 const TDesC8& aMessage = KNullDesC8 ); |
|
149 |
|
150 /** |
|
151 * Started population of the current view |
|
152 */ |
|
153 void StartActiveStepL(); |
|
154 |
|
155 /** |
|
156 * Returns a reference to the calendar icon array |
|
157 * @return reference to a CCalenIcons array |
|
158 */ |
|
159 CCalenIcons& IconsL(); |
|
160 |
|
161 /** |
|
162 * Gets next view icon |
|
163 */ |
|
164 CGulIcon* GetNextViewIconL(); |
|
165 |
|
166 /** |
|
167 * Repopulate the view. |
|
168 */ |
|
169 void SetRepopulation(TBool aRePopulate); |
|
170 |
|
171 /** |
|
172 * Returns calendar toolbar |
|
173 */ |
|
174 CCalenToolbarImpl* CalenToolbar(); |
|
175 |
|
176 /** |
|
177 * Unload all plugins on fake exit |
|
178 */ |
|
179 void UnLoadAllPluginsL(); |
|
180 |
|
181 /** |
|
182 * Reload all plugins when application comes to |
|
183 * foreground after fake exit |
|
184 */ |
|
185 void ReloadAllPluginsL(); |
|
186 |
|
187 /** |
|
188 * Gets the view Id of previous view. |
|
189 * @return TUid, Uid of previous view. |
|
190 */ |
|
191 TUid GetPreviousViewUid(); |
|
192 |
|
193 /** |
|
194 * Check for native view. |
|
195 * @param aViewUid Uid of the View |
|
196 * @returns ETrue if aViewUid is any of the native views |
|
197 */ |
|
198 TBool IsNativeView(TUid aViewUid); |
|
199 |
|
200 /** |
|
201 * Activate view depending upon the current default view |
|
202 * If plugin views is default view, then dummy view will be activated |
|
203 * else the native view |
|
204 * @param aDefView current default view frm calendar settings |
|
205 */ |
|
206 void ActivateViewOnFakeExitL(TUid aDefView); |
|
207 |
|
208 private: // New functions |
|
209 |
|
210 /** |
|
211 * From MCoeViewActivationObserver |
|
212 * Called just before a view in this application is activated by the view server |
|
213 * @param aNewlyActivatedViewId View id to be activated |
|
214 * @param aViewIdToBeDeactivated View id to be deactivated |
|
215 */ |
|
216 void HandleViewActivation( const TVwsViewId& aNewlyActivatedViewId, |
|
217 const TVwsViewId& aViewIdToBeDeactivated ); |
|
218 |
|
219 /** |
|
220 * Requests activation for the next view in the view cycle |
|
221 */ |
|
222 void CycleNextViewL(); |
|
223 |
|
224 /** |
|
225 * Requests activation for the previous view in the view cycle |
|
226 */ |
|
227 void CyclePrevViewL(); |
|
228 |
|
229 /** |
|
230 * Constructs the s60 native views and registers them with the view server |
|
231 */ |
|
232 void ConstructNativeViewsL(); |
|
233 |
|
234 /** |
|
235 * Constructs any custom views from plugins and registers them with the view server |
|
236 */ |
|
237 void ConstructCustomViewsL(); |
|
238 |
|
239 /** |
|
240 * Constructs any custom views from a plugin and registers them with the view server |
|
241 */ |
|
242 void ConstructCustomViewL( TUid aPluginUid ); |
|
243 |
|
244 /** |
|
245 * Prompts the user to choose a view to switch to. If cancelled returns |
|
246 * KErrCancel, otherwise one of the ECalenView* |
|
247 */ |
|
248 void ShowSwitchViewQueryL(); |
|
249 |
|
250 /** |
|
251 * Adds a view to the array |
|
252 * @param aView Pointer to the view that is going to be added |
|
253 */ |
|
254 void AddNativeViewL( CCalenView* aView ); |
|
255 |
|
256 /** |
|
257 * Removes a native view from the view manager |
|
258 * @param aViewUid view uid of view that is going to be removed |
|
259 */ |
|
260 void RemoveNativeViewL( TUid aViewUid ); |
|
261 |
|
262 /** |
|
263 * Creates native view |
|
264 */ |
|
265 TBool CreateNativeViewL( TUid aViewUid ); |
|
266 |
|
267 /** |
|
268 * Return reference to the customisation manager |
|
269 * @return Reference to CCalenCustomisationManager |
|
270 */ |
|
271 CCalenCustomisationManager& CustomisationManager(); |
|
272 |
|
273 /** |
|
274 * Compares the list of active plugins and plugins the view manager |
|
275 * knows about, to discover which plugins have been enabled or |
|
276 * disabled |
|
277 */ |
|
278 void UpdatePluginListL(); |
|
279 |
|
280 /** |
|
281 * Removes the custom views supplied by the plugin list from the view |
|
282 * server. |
|
283 * @param uids |
|
284 */ |
|
285 void RemoveDisabledPluginsViewsL( RArray<TUid>& aDisabledPlugins ); |
|
286 |
|
287 /** |
|
288 * Asyncronous callback function to remove the current view after |
|
289 * it has been disabled. |
|
290 */ |
|
291 static TInt RemoveDeActivatedView( TAny* aObject ); |
|
292 |
|
293 /** |
|
294 * Asyncronous callback function to remove the current view after |
|
295 * it has been disabled. Leaving version |
|
296 */ |
|
297 void RemoveDeActivatedViewL(); |
|
298 |
|
299 /** |
|
300 * Handles notifications (Leaving) |
|
301 */ |
|
302 void HandleNotificationL( TCalenNotification aNotification ); |
|
303 |
|
304 /** |
|
305 * Updates the nextview icon on the toolbar when default view is not month view |
|
306 */ |
|
307 void UpdateToolbarNextViewIconL(TUid defViewUid); |
|
308 |
|
309 /** |
|
310 * Handles Faster app exit |
|
311 */ |
|
312 void HandleFasterAppExitCommandL(); |
|
313 |
|
314 /** |
|
315 * Handles ECalenNotifySettingsChanged notification |
|
316 */ |
|
317 void HandleSettingsChangeNotificationL(); |
|
318 |
|
319 /** |
|
320 * Handles ECalenNotifyEntryDeleted and ECalenNotifyInstanceDeleted |
|
321 * notifications |
|
322 */ |
|
323 void HandleEntryDeleteNotificationL(); |
|
324 |
|
325 /** |
|
326 * Handles ECalenNotifyEntryClosed notification |
|
327 */ |
|
328 void HandleEntryClosedNotificationL(); |
|
329 |
|
330 /** |
|
331 * Handles ECalenNotifySystemTimeChanged notification |
|
332 */ |
|
333 void HandleSystemTimeChangeNotificationL(); |
|
334 |
|
335 private: // from MCalenNotificationHandler |
|
336 |
|
337 /** |
|
338 * Handles notifications |
|
339 */ |
|
340 void HandleNotification( const TCalenNotification aNotification ); |
|
341 |
|
342 private: // Construction and destruction |
|
343 /** |
|
344 * C++ constructor |
|
345 * @param aAppUi Reference to CAknViewAppUi |
|
346 * @param aController Reference to CCalenController |
|
347 */ |
|
348 CCalenViewManager( CAknViewAppUi& aAppUi, |
|
349 CCalenController& aController ); |
|
350 |
|
351 /** |
|
352 * Symbian 2nd phase constructor |
|
353 */ |
|
354 void ConstructL(); |
|
355 |
|
356 private: // Data |
|
357 TVwsViewId iCurrentViewId; |
|
358 CCalenGlobalData* iGlobalData; |
|
359 CAknViewAppUi& iAppUi; |
|
360 TInt iViewCycleIndex; |
|
361 CCalenViewPopulator* iPopulator; |
|
362 CCalenSetting* iSetting; |
|
363 CCalenToolbarImpl* iToolbar; |
|
364 CCalenCustomisationManager* iCustomisationManager; |
|
365 RPointerArray<CCalenViewInfo> iViewInfoArray; |
|
366 CCalenController& iController; |
|
367 |
|
368 // Stores the uids of the plugins, the view manager is |
|
369 // aware of. |
|
370 RArray<TUid> iKnownPlugins; |
|
371 // Pointer to CCalenViewInfo for an active view which has |
|
372 // been disabled. |
|
373 CCalenViewInfo* iRemovedActiveView; |
|
374 // Remove the current view asynchronously |
|
375 CAsyncCallBack* iViewRemovalCallback; |
|
376 CCalenIcons* iIcons; |
|
377 |
|
378 // The first view on start-up has been activated. |
|
379 TBool iViewsActivated; |
|
380 TVwsViewId iPreviousViewId; |
|
381 TVwsViewId iPreviousToDayView; |
|
382 TBool iAvoidRepopulation; |
|
383 TBool iStartupComplete; |
|
384 }; |
|
385 |
|
386 #endif // CALENVIEWMANAGER_H |
|
387 |
|
388 // End of file |