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 |
|
24 #include <vwsdef.h> |
23 #include <vwsdef.h> |
25 #include <QDate> |
24 #include <coeview.h> // MCoeViewActivationObserver |
26 |
25 #include <calencommandhandler.h> |
27 #include "calennotificationhandler.h" // MCalenNotificationHandler |
26 #include <calennotificationhandler.h> // MCalenNotificationHandler |
28 #include "hb_calencommands.hrh" |
27 |
29 #include "calencommandhandler.h" |
28 // FORWARD DECLARATIONS |
30 |
29 class CAknViewAppUi; |
31 class CalenNativeView; |
30 class CCalenGlobalData; |
|
31 class CCalenViewPopulator; |
32 class CCalenController; |
32 class CCalenController; |
33 class CalenMonthView; |
33 class CCalenView; |
34 class CalenAgendaView; |
34 class CEikMenuPane; |
35 class AgendaEventViewer; |
35 class CCalenToolbarImpl; |
36 class CalenLandscapeDayView; |
36 class MCalenToolbar; |
37 class CalenSettingsView; |
37 class CCalenSetting; |
38 class CalenDocLoader; |
38 class CCalenViewInfo; |
39 class CalenDayView; |
39 class CCalenCustomisationManager; |
|
40 class MCalenServices; |
|
41 class CCalenIcons; |
|
42 class CCalenToolbarImpl; |
|
43 |
|
44 typedef CCalenView* (*NativeView)(MCalenServices&); |
40 |
45 |
41 /** |
46 /** |
42 * The action ui handles events passed from the controller and delegates |
47 * The action ui handles events passed from the controller and delegates |
43 * them to the appropriate place (i.e. the specific action ui classes). |
48 * them to the appropriate place (i.e. the specific action ui classes). |
44 */ |
49 */ |
45 class CalenViewManager : public QObject, |
50 class CCalenViewManager : public CBase, |
46 public MCalenNotificationHandler, |
51 public MCoeViewActivationObserver, |
47 public MCalenCommandHandler |
52 public MCalenNotificationHandler, |
48 { |
53 public MCalenCommandHandler |
49 |
54 { |
50 Q_OBJECT |
|
51 |
|
52 public: // Construction and destruction |
55 public: // Construction and destruction |
53 /** |
56 /** |
54 * Constructor |
57 * Symbian 1st phase constructor |
55 */ |
58 * @param aAppUi Reference to the CAknViewAppUi |
56 CalenViewManager ( CCalenController& aController); |
59 * @param aController Reference to the CCalenController |
57 |
60 * @return Pointer to CCalenViewManager |
58 /** |
61 */ |
59 * Second Phase Constructor |
62 static CCalenViewManager* NewL( CAknViewAppUi& aAppUi, |
60 */ |
63 CCalenController& aController ); |
61 void SecondPhaseConstruction(); |
|
62 |
|
63 /** |
64 /** |
64 * Destructor |
65 * Destructor |
65 */ |
66 */ |
66 virtual ~CalenViewManager(); |
67 virtual ~CCalenViewManager(); |
67 |
68 |
68 public: |
69 public: // New functions |
69 /** |
70 /** |
70 * Handles view manager commands. |
71 * Constructs the custom views |
71 * @return ETrue if command is handled, EFalse otherwise |
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. |
72 */ |
88 */ |
73 TBool HandleCommandL( const TCalenCommand& aCommand ); |
89 TBool HandleCommandL( const TCalenCommand& aCommand ); |
74 |
90 |
75 /** |
91 /** |
76 * Refresh current view. |
92 * From MCalenCommandHandler. |
77 */ |
93 * Allows extending this API without breaking BC. |
78 void refreshCurrentViewL(); |
94 * |
79 |
95 * @param aExtensionUid specifies |
80 /** |
96 * @return extension of the requested type |
81 * Returns the settings view |
97 */ |
82 */ |
98 TAny* CalenCommandHandlerExtensionL( TUid aExtensionUid ); |
83 CalenSettingsView* settingsView(); |
99 |
84 /* |
100 /** |
85 * @brief Returns CCalenController |
101 * Returns the current view. |
86 */ |
102 * @return TUid of current view |
87 CCalenController& calenController(); |
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 |
88 /** |
187 /** |
89 * Constructs and activates the requested view |
188 * Gets the view Id of previous view. |
90 */ |
189 * @return TUid, Uid of previous view. |
91 void constructAndActivateView(int view); |
190 */ |
92 /** |
191 TUid GetPreviousViewUid(); |
93 * Returns the first view |
|
94 */ |
|
95 int getFirstView(); |
|
96 |
192 |
97 void showNextDay(); |
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 /** |
|
209 * Activate the local view if application already in back ground |
|
210 * @param aDefView current default view which needs to be activated. |
|
211 */ |
|
212 void ActivateLocalViewL(TUid aDefView); |
98 |
213 |
99 void showPrevDay(); |
214 /** |
100 |
215 * set the view Id of previous view. |
101 void removePreviousView(); |
216 * @param TUid, aPreviousUid of previous view. |
102 |
217 */ |
103 void constructOtherViews(); |
218 void SetPreviousViewUid(TUid aPreviousUid); |
104 |
219 |
105 void launchSettingsView(); |
220 private: // New functions |
106 |
221 |
107 /** |
222 /** |
108 * @brief check if Agenda Event Viewer is active |
223 * From MCoeViewActivationObserver |
109 */ |
224 * Called just before a view in this application is activated by the view server |
110 bool isEventViewerActive(); |
225 * @param aNewlyActivatedViewId View id to be activated |
111 |
226 * @param aViewIdToBeDeactivated View id to be deactivated |
112 /** |
227 */ |
113 * save the entry and close the editor |
228 void HandleViewActivation( const TVwsViewId& aNewlyActivatedViewId, |
114 */ |
229 const TVwsViewId& aViewIdToBeDeactivated ); |
115 void saveAndCloseEditor(); |
230 |
116 |
231 /** |
117 |
232 * Requests activation for the next view in the view cycle |
118 /** |
233 */ |
119 * close agenda event view |
234 void CycleNextViewL(); |
120 * should be call if agenda eevent view is open |
235 |
121 */ |
236 /** |
122 void closeAgendaEventView(); |
237 * Requests activation for the previous view in the view cycle |
123 |
238 */ |
124 /** |
239 void CyclePrevViewL(); |
125 * remove the setting view |
240 |
126 */ |
241 /** |
127 void removeSettingsView(); |
242 * Constructs the s60 native views and registers them with the view server |
128 |
243 */ |
129 public: // from MCalenNotificationHandler |
244 void ConstructNativeViewsL(); |
|
245 |
|
246 /** |
|
247 * Constructs any custom views from plugins and registers them with the view server |
|
248 */ |
|
249 void ConstructCustomViewsL(); |
|
250 |
|
251 /** |
|
252 * Constructs any custom views from a plugin and registers them with the view server |
|
253 */ |
|
254 void ConstructCustomViewL( TUid aPluginUid ); |
|
255 |
|
256 /** |
|
257 * Prompts the user to choose a view to switch to. If cancelled returns |
|
258 * KErrCancel, otherwise one of the ECalenView* |
|
259 */ |
|
260 void ShowSwitchViewQueryL(); |
|
261 |
|
262 /** |
|
263 * Adds a view to the array |
|
264 * @param aView Pointer to the view that is going to be added |
|
265 */ |
|
266 void AddNativeViewL( CCalenView* aView ); |
|
267 |
|
268 /** |
|
269 * Removes a native view from the view manager |
|
270 * @param aViewUid view uid of view that is going to be removed |
|
271 */ |
|
272 void RemoveNativeViewL( TUid aViewUid ); |
|
273 |
|
274 /** |
|
275 * Creates native view |
|
276 */ |
|
277 TBool CreateNativeViewL( TUid aViewUid ); |
|
278 |
|
279 /** |
|
280 * Return reference to the customisation manager |
|
281 * @return Reference to CCalenCustomisationManager |
|
282 */ |
|
283 CCalenCustomisationManager& CustomisationManager(); |
|
284 |
|
285 /** |
|
286 * Compares the list of active plugins and plugins the view manager |
|
287 * knows about, to discover which plugins have been enabled or |
|
288 * disabled |
|
289 */ |
|
290 void UpdatePluginListL(); |
|
291 |
|
292 /** |
|
293 * Removes the custom views supplied by the plugin list from the view |
|
294 * server. |
|
295 * @param uids |
|
296 */ |
|
297 void RemoveDisabledPluginsViewsL( RArray<TUid>& aDisabledPlugins ); |
|
298 |
|
299 /** |
|
300 * Asyncronous callback function to remove the current view after |
|
301 * it has been disabled. |
|
302 */ |
|
303 static TInt RemoveDeActivatedView( TAny* aObject ); |
|
304 |
|
305 /** |
|
306 * Asyncronous callback function to remove the current view after |
|
307 * it has been disabled. Leaving version |
|
308 */ |
|
309 void RemoveDeActivatedViewL(); |
|
310 |
|
311 /** |
|
312 * Handles notifications (Leaving) |
|
313 */ |
|
314 void HandleNotificationL( TCalenNotification aNotification ); |
|
315 |
|
316 /** |
|
317 * Updates the nextview icon on the toolbar when default view is not month view |
|
318 */ |
|
319 void UpdateToolbarNextViewIconL(TUid defViewUid); |
|
320 |
|
321 /** |
|
322 * Handles Faster app exit |
|
323 */ |
|
324 void HandleFasterAppExitCommandL(); |
|
325 |
|
326 /** |
|
327 * Handles ECalenNotifySettingsChanged notification |
|
328 */ |
|
329 void HandleSettingsChangeNotificationL(); |
|
330 |
|
331 /** |
|
332 * Handles ECalenNotifyEntryDeleted and ECalenNotifyInstanceDeleted |
|
333 * notifications |
|
334 */ |
|
335 void HandleEntryDeleteNotificationL(); |
|
336 |
|
337 /** |
|
338 * Handles ECalenNotifyEntryClosed notification |
|
339 */ |
|
340 void HandleEntryClosedNotificationL(); |
|
341 |
|
342 /** |
|
343 * Handles ECalenNotifySystemTimeChanged notification |
|
344 */ |
|
345 void HandleSystemTimeChangeNotificationL(); |
|
346 |
|
347 /** |
|
348 * Changes day when swipped |
|
349 */ |
|
350 void ChangeDayL( TBool aNextDay ); |
|
351 |
|
352 private: // from MCalenNotificationHandler |
130 |
353 |
131 /** |
354 /** |
132 * Handles notifications |
355 * Handles notifications |
133 */ |
356 */ |
134 void HandleNotification( const TCalenNotification aNotification ); |
357 void HandleNotification( const TCalenNotification aNotification ); |
135 |
358 |
136 private: |
359 private: // Construction and destruction |
137 /** |
360 /** |
138 * Loads month view frm the docml |
361 * C++ constructor |
139 */ |
362 * @param aAppUi Reference to CAknViewAppUi |
140 void loadMonthView(); |
363 * @param aController Reference to CCalenController |
141 /** |
364 */ |
142 * Loads agenda view from the docml |
365 CCalenViewManager( CAknViewAppUi& aAppUi, |
143 */ |
366 CCalenController& aController ); |
144 void loadAgendaView(); |
367 |
145 |
368 /** |
146 /** |
369 * Symbian 2nd phase constructor |
147 * Loads day view from the docml |
370 */ |
148 */ |
371 void ConstructL(); |
149 void loadDayView(); |
372 |
150 |
373 private: // Data |
151 /** |
374 TVwsViewId iCurrentViewId; |
152 * Activates the default view, as retrieved from settings. |
375 CCalenGlobalData* iGlobalData; |
153 */ |
376 CAknViewAppUi& iAppUi; |
154 void ActivateDefaultViewL( int defaultView ); |
377 TInt iViewCycleIndex; |
155 |
378 CCalenViewPopulator* iPopulator; |
156 /** |
379 CCalenSetting* iSetting; |
157 * Activate current view. |
380 CCalenToolbarImpl* iToolbar; |
158 */ |
381 CCalenCustomisationManager* iCustomisationManager; |
159 void activateCurrentView(); |
382 RPointerArray<CCalenViewInfo> iViewInfoArray; |
160 |
383 CCalenController& iController; |
161 /** |
384 |
162 * Launch event view. |
385 // Stores the uids of the plugins, the view manager is |
163 */ |
386 // aware of. |
164 void launchEventView(); |
387 RArray<TUid> iKnownPlugins; |
165 |
388 // Pointer to CCalenViewInfo for an active view which has |
166 /** |
389 // been disabled. |
167 * @brief Constructs the auxilliary view used |
390 CCalenViewInfo* iRemovedActiveView; |
168 * to provide illusion of swiping to next or prev |
391 // Remove the current view asynchronously |
169 * day |
392 CAsyncCallBack* iViewRemovalCallback; |
170 */ |
393 CCalenIcons* iIcons; |
171 void loadAlternateAgendaView(); |
394 |
172 |
395 // The first view on start-up has been activated. |
173 private slots: |
396 TBool iViewsActivated; |
174 void handleMainViewReady(); |
397 TVwsViewId iPreviousViewId; |
175 void handleViewingCompleted(const QDate date); |
398 TVwsViewId iPreviousToDayView; |
176 void handleEditingStarted(); |
399 TVwsViewId iPreviousToWeekView; |
177 void handleEditingCompleted(); |
400 TBool iAvoidRepopulation; |
178 void handleDeletingStarted(); |
401 TBool iStartupComplete; |
179 void handleDeletingCompleted(); |
402 TBool iFakeExit; |
180 void handleInstanceViewCreation(int status); |
403 }; |
181 void handleEntryViewCreation(int status); |
|
182 void handleEntriesChanged(QList<ulong>); |
|
183 void handleEntryUpdation(ulong id); |
|
184 |
|
185 private: // Data |
|
186 |
|
187 CCalenController &mController; |
|
188 CalenMonthView *mCalenMonthView; |
|
189 CalenAgendaView *mCalenAgendaView; |
|
190 AgendaEventViewer *mCalenEventViewer; |
|
191 CalenLandscapeDayView *mCalenLandscapeDayView; |
|
192 CalenSettingsView *mSettingsView; |
|
193 CalenDocLoader *mAgendaViewDocLoader; |
|
194 CalenDocLoader *mMonthViewDocLoader; |
|
195 CalenAgendaView *mCalenAgendaViewAlt; |
|
196 CalenDocLoader *mAgendaViewAltDocLoader; |
|
197 CalenDayView *mCalenDayView; |
|
198 |
|
199 int mCurrentViewId; |
|
200 int mPreviousViewsId; |
|
201 int mFirstView; |
|
202 bool mInstanceViewCreated; |
|
203 }; |
|
204 |
404 |
205 #endif // CALENVIEWMANAGER_H |
405 #endif // CALENVIEWMANAGER_H |
206 |
406 |
207 // End of file |
407 // End of file |