18 |
18 |
19 #ifndef CALENVIEWMANAGER_H |
19 #ifndef CALENVIEWMANAGER_H |
20 #define CALENVIEWMANAGER_H |
20 #define CALENVIEWMANAGER_H |
21 |
21 |
22 // INCLUDES |
22 // INCLUDES |
|
23 |
23 #include <vwsdef.h> |
24 #include <vwsdef.h> |
24 #include <coeview.h> // MCoeViewActivationObserver |
|
25 #include <calencommandhandler.h> |
|
26 #include <calennotificationhandler.h> // MCalenNotificationHandler |
|
27 |
25 |
28 // FORWARD DECLARATIONS |
26 #include "calennotificationhandler.h" // MCalenNotificationHandler |
29 class CAknViewAppUi; |
27 #include "hb_calencommands.hrh" |
30 class CCalenGlobalData; |
28 #include "calencommandhandler.h" |
31 class CCalenViewPopulator; |
29 |
|
30 |
32 class CCalenController; |
31 class CCalenController; |
33 class CCalenView; |
32 class CalenMonthView; |
34 class CEikMenuPane; |
33 class CalenDayView; |
35 class CCalenToolbarImpl; |
34 class AgendaEventViewer; |
36 class MCalenToolbar; |
35 class CalenLandscapeDayView; |
37 class CCalenSetting; |
36 class CalenSettingsView; |
38 class CCalenViewInfo; |
37 class CalenDocLoader; |
39 class CCalenCustomisationManager; |
|
40 class MCalenServices; |
|
41 class CCalenIcons; |
|
42 class CCalenToolbarImpl; |
|
43 |
|
44 typedef CCalenView* (*NativeView)(MCalenServices&); |
|
45 |
38 |
46 /** |
39 /** |
47 * The action ui handles events passed from the controller and delegates |
40 * The action ui handles events passed from the controller and delegates |
48 * them to the appropriate place (i.e. the specific action ui classes). |
41 * them to the appropriate place (i.e. the specific action ui classes). |
49 */ |
42 */ |
50 class CCalenViewManager : public CBase, |
43 class CalenViewManager : public QObject, |
51 public MCoeViewActivationObserver, |
44 public MCalenNotificationHandler, |
52 public MCalenNotificationHandler, |
45 public MCalenCommandHandler |
53 public MCalenCommandHandler |
46 { |
54 { |
47 |
|
48 Q_OBJECT |
|
49 |
55 public: // Construction and destruction |
50 public: // Construction and destruction |
56 /** |
51 /** |
57 * Symbian 1st phase constructor |
52 * Constructor |
58 * @param aAppUi Reference to the CAknViewAppUi |
53 */ |
59 * @param aController Reference to the CCalenController |
54 CalenViewManager ( CCalenController& aController, |
60 * @return Pointer to CCalenViewManager |
55 bool isFromServiceFrmwrk); |
61 */ |
56 |
62 static CCalenViewManager* NewL( CAknViewAppUi& aAppUi, |
|
63 CCalenController& aController ); |
|
64 /** |
57 /** |
65 * Destructor |
58 * Destructor |
66 */ |
59 */ |
67 virtual ~CCalenViewManager(); |
60 virtual ~CalenViewManager(); |
68 |
61 |
69 public: // New functions |
62 public: |
70 /** |
63 /** |
71 * Constructs the custom views |
64 * Handles view manager commands. |
72 * @param aCustomisationmManager Reference to CCalenCustomisationManager |
65 * @return ETrue if command is handled, EFalse otherwise |
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 */ |
66 */ |
89 TBool HandleCommandL( const TCalenCommand& aCommand ); |
67 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 |
68 |
118 /** |
69 /** |
119 * Get a pointer to the Calendar toolbar, or NULL if none is available. |
70 * Refresh current view. |
120 * Ownership is not transferred. |
|
121 * @return Calendar toolbar if available |
|
122 */ |
71 */ |
123 MCalenToolbar* ToolbarOrNull(); |
72 void refreshCurrentViewL(); |
124 |
73 |
125 /** |
74 /** |
126 * Activates the default view, as retrieved from settings. |
75 * Returns the settings view |
127 */ |
76 */ |
128 void ActivateDefaultViewL( TUid aDefaultView ); |
77 CalenSettingsView* settingsView(); |
129 |
78 /* |
130 /** |
79 * @brief Returns CCalenController |
131 * Returns if the first view activation on start-up has taken place |
80 */ |
132 */ |
81 CCalenController& calenController(); |
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 /** |
82 /** |
188 * Gets the view Id of previous view. |
83 * Constructs and activates the requested view |
189 * @return TUid, Uid of previous view. |
84 */ |
190 */ |
85 void constructAndActivateView(int view); |
191 TUid GetPreviousViewUid(); |
86 /** |
|
87 * Constructs the other views apart frm firstview and adds |
|
88 * them to main window |
|
89 */ |
|
90 void constructOtherViews(); |
|
91 /** |
|
92 * Returns the first view |
|
93 */ |
|
94 int getFirstView(); |
192 |
95 |
193 /** |
96 void showNextDay(); |
194 * Check for native view. |
97 |
195 * @param aViewUid Uid of the View |
98 void showPrevDay(); |
196 * @returns ETrue if aViewUid is any of the native views |
99 |
197 */ |
100 void removeDayViews(); |
198 TBool IsNativeView(TUid aViewUid); |
101 |
199 |
102 public: // from MCalenNotificationHandler |
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 |
103 |
337 /** |
104 /** |
338 * Handles notifications |
105 * Handles notifications |
339 */ |
106 */ |
340 void HandleNotification( const TCalenNotification aNotification ); |
107 void HandleNotification( const TCalenNotification aNotification ); |
341 |
108 |
342 private: // Construction and destruction |
109 private: |
343 /** |
110 /** |
344 * C++ constructor |
111 * Loads month view frm the docml |
345 * @param aAppUi Reference to CAknViewAppUi |
|
346 * @param aController Reference to CCalenController |
|
347 */ |
112 */ |
348 CCalenViewManager( CAknViewAppUi& aAppUi, |
113 void loadMonthView(); |
349 CCalenController& aController ); |
114 /** |
|
115 * Loads day view frm the docml |
|
116 */ |
|
117 void loadDayView(); |
|
118 /** |
|
119 * Activates the default view, as retrieved from settings. |
|
120 */ |
|
121 void ActivateDefaultViewL( int defaultView ); |
|
122 |
|
123 /** |
|
124 * Activate current view. |
|
125 */ |
|
126 void activateCurrentView(); |
|
127 |
|
128 /** |
|
129 * Launch event view. |
|
130 */ |
|
131 void launchEventView(); |
|
132 |
|
133 /** |
|
134 * @brief Constructs the auxilliary view used |
|
135 * to provide illusion of swiping to next or prev |
|
136 * day |
|
137 */ |
|
138 void loadAlternateDayView(); |
|
139 |
|
140 private slots: |
|
141 |
|
142 void handleViewingCompleted(bool status); |
|
143 void handleEditingStarted(); |
|
144 void handleEditingCompleted(); |
|
145 void handleDeletingStarted(); |
|
146 void handleDeletingCompleted(); |
|
147 |
|
148 private: // Data |
350 |
149 |
351 /** |
150 CCalenController &mController; |
352 * Symbian 2nd phase constructor |
151 CalenMonthView *mCalenMonthView; |
353 */ |
152 CalenDayView *mCalenDayView; |
354 void ConstructL(); |
153 AgendaEventViewer *mCalenEventViewer; |
355 |
154 CalenLandscapeDayView *mCalenLandscapeDayView; |
356 private: // Data |
155 CalenSettingsView *mSettingsView; |
357 TVwsViewId iCurrentViewId; |
156 CalenDocLoader *mDayViewDocLoader; |
358 CCalenGlobalData* iGlobalData; |
157 CalenDocLoader *mMonthViewDocLoader; |
359 CAknViewAppUi& iAppUi; |
158 CalenDayView *mCalenDayViewAlt; |
360 TInt iViewCycleIndex; |
159 CalenDocLoader *mDayViewAltDocLoader; |
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 |
160 |
378 // The first view on start-up has been activated. |
161 int mCurrentViewId; |
379 TBool iViewsActivated; |
162 int mPreviousViewId; |
380 TVwsViewId iPreviousViewId; |
163 int mFirstView; |
381 TVwsViewId iPreviousToDayView; |
164 }; |
382 TBool iAvoidRepopulation; |
|
383 TBool iStartupComplete; |
|
384 }; |
|
385 |
165 |
386 #endif // CALENVIEWMANAGER_H |
166 #endif // CALENVIEWMANAGER_H |
387 |
167 |
388 // End of file |
168 // End of file |