diff -r 96907930389d -r 12af337248b1 calendarui/controller/inc/calenviewmanager.h --- a/calendarui/controller/inc/calenviewmanager.h Thu Aug 19 09:53:43 2010 +0300 +++ b/calendarui/controller/inc/calenviewmanager.h Tue Aug 31 15:13:43 2010 +0300 @@ -20,375 +20,187 @@ #define CALENVIEWMANAGER_H // INCLUDES + #include -#include // MCoeViewActivationObserver -#include -#include // MCalenNotificationHandler +#include -// FORWARD DECLARATIONS -class CAknViewAppUi; -class CCalenGlobalData; -class CCalenViewPopulator; +#include "calennotificationhandler.h" // MCalenNotificationHandler +#include "hb_calencommands.hrh" +#include "calencommandhandler.h" + +class CalenNativeView; class CCalenController; -class CCalenView; -class CEikMenuPane; -class CCalenToolbarImpl; -class MCalenToolbar; -class CCalenSetting; -class CCalenViewInfo; -class CCalenCustomisationManager; -class MCalenServices; -class CCalenIcons; -class CCalenToolbarImpl; - -typedef CCalenView* (*NativeView)(MCalenServices&); +class CalenMonthView; +class CalenAgendaView; +class AgendaEventViewer; +class CalenLandscapeDayView; +class CalenSettingsView; +class CalenDocLoader; +class CalenDayView; /** * The action ui handles events passed from the controller and delegates * them to the appropriate place (i.e. the specific action ui classes). */ -class CCalenViewManager : public CBase, - public MCoeViewActivationObserver, - public MCalenNotificationHandler, - public MCalenCommandHandler - { +class CalenViewManager : public QObject, + public MCalenNotificationHandler, + public MCalenCommandHandler + { + + Q_OBJECT + public: // Construction and destruction - /** - * Symbian 1st phase constructor - * @param aAppUi Reference to the CAknViewAppUi - * @param aController Reference to the CCalenController - * @return Pointer to CCalenViewManager - */ - static CCalenViewManager* NewL( CAknViewAppUi& aAppUi, - CCalenController& aController ); + /** + * Constructor + */ + CalenViewManager ( CCalenController& aController); + + /** + * Second Phase Constructor + */ + void SecondPhaseConstruction(); + /** * Destructor */ - virtual ~CCalenViewManager(); - - public: // New functions - /** - * Constructs the custom views - * @param aCustomisationmManager Reference to CCalenCustomisationManager - */ - void ConstructCustomViewsL( - CCalenCustomisationManager& aCustomisationManager ); - - /** - * Get info array - * @return Reference to RPointerArray - */ - RPointerArray& ViewInfoArray(); - - /** - * From MCalenCommandHandler. - * Handles key presses. - * - * @param aCommand The command Id of the key. + virtual ~CalenViewManager(); + + public: + /** + * Handles view manager commands. + * @return ETrue if command is handled, EFalse otherwise */ TBool HandleCommandL( const TCalenCommand& aCommand ); - - /** - * From MCalenCommandHandler. - * Allows extending this API without breaking BC. - * - * @param aExtensionUid specifies - * @return extension of the requested type - */ - TAny* CalenCommandHandlerExtensionL( TUid aExtensionUid ); - - /** - * Returns the current view. - * @return TUid of current view - */ - TUid CurrentView() const; - - /** - * Removes the current view from the switch menu - * @param aMenuPane Where the currenct view should be removed from - */ - void RemoveCurrentViewFromMenu( CEikMenuPane* aMenuPane ); - - /** - * Request activation of a specific view - * @param aViewId Reference to TVwsViewId of the view to be activated - */ - void RequestActivationL( const TVwsViewId& aViewId ); - - /** - * Get a pointer to the Calendar toolbar, or NULL if none is available. - * Ownership is not transferred. - * @return Calendar toolbar if available - */ - MCalenToolbar* ToolbarOrNull(); - - /** - * Activates the default view, as retrieved from settings. - */ - void ActivateDefaultViewL( TUid aDefaultView ); /** - * Returns if the first view activation on start-up has taken place - */ - TBool ViewsActivated() const; - - /** - * Interupts the population of the current view. - */ - void InterruptPopulationL(); - - /** - * Try to activate a view - * @param aViewUid View id to be activated - * @param aMessageId Message id - * @param aMessage Message send along activation query - */ - void RequestActivationL( const TUid& aViewUid, - const TUid& aMessageId = KNullUid, - const TDesC8& aMessage = KNullDesC8 ); - - /** - * Started population of the current view - */ - void StartActiveStepL(); - - /** - * Returns a reference to the calendar icon array - * @return reference to a CCalenIcons array - */ - CCalenIcons& IconsL(); - - /** - * Gets next view icon + * Refresh current view. */ - CGulIcon* GetNextViewIconL(); - - /** - * Repopulate the view. - */ - void SetRepopulation(TBool aRePopulate); - - /** - * Returns calendar toolbar - */ - CCalenToolbarImpl* CalenToolbar(); - - /** - * Unload all plugins on fake exit - */ - void UnLoadAllPluginsL(); - - /** - * Reload all plugins when application comes to - * foreground after fake exit - */ - void ReloadAllPluginsL(); - - /** - * Gets the view Id of previous view. - * @return TUid, Uid of previous view. - */ - TUid GetPreviousViewUid(); - - /** - * Check for native view. - * @param aViewUid Uid of the View - * @returns ETrue if aViewUid is any of the native views - */ - TBool IsNativeView(TUid aViewUid); + void refreshCurrentViewL(); /** - * Activate view depending upon the current default view - * If plugin views is default view, then dummy view will be activated - * else the native view - * @param aDefView current default view frm calendar settings + * Returns the settings view */ - void ActivateViewOnFakeExitL(TUid aDefView); - - /** - * Activate the local view if application already in back ground - * @param aDefView current default view which needs to be activated. - */ - void ActivateLocalViewL(TUid aDefView); - - private: // New functions + CalenSettingsView* settingsView(); + /* + * @brief Returns CCalenController + */ + CCalenController& calenController(); + /** + * Constructs and activates the requested view + */ + void constructAndActivateView(int view); + /** + * Returns the first view + */ + int getFirstView(); + + void showNextDay(); + + void showPrevDay(); + + void removePreviousView(); + + void constructOtherViews(); + + void launchSettingsView(); + + /** + * @brief check if Agenda Event Viewer is active + */ + bool isEventViewerActive(); + + /** + * save the entry and close the editor + */ + void saveAndCloseEditor(); + /** - * From MCoeViewActivationObserver - * Called just before a view in this application is activated by the view server - * @param aNewlyActivatedViewId View id to be activated - * @param aViewIdToBeDeactivated View id to be deactivated - */ - void HandleViewActivation( const TVwsViewId& aNewlyActivatedViewId, - const TVwsViewId& aViewIdToBeDeactivated ); - - /** - * Requests activation for the next view in the view cycle - */ - void CycleNextViewL(); - - /** - * Requests activation for the previous view in the view cycle - */ - void CyclePrevViewL(); - - /** - * Constructs the s60 native views and registers them with the view server - */ - void ConstructNativeViewsL(); - - /** - * Constructs any custom views from plugins and registers them with the view server - */ - void ConstructCustomViewsL(); - - /** - * Constructs any custom views from a plugin and registers them with the view server - */ - void ConstructCustomViewL( TUid aPluginUid ); - - /** - * Prompts the user to choose a view to switch to. If cancelled returns - * KErrCancel, otherwise one of the ECalenView* - */ - void ShowSwitchViewQueryL(); - - /** - * Adds a view to the array - * @param aView Pointer to the view that is going to be added - */ - void AddNativeViewL( CCalenView* aView ); - - /** - * Removes a native view from the view manager - * @param aViewUid view uid of view that is going to be removed - */ - void RemoveNativeViewL( TUid aViewUid ); - - /** - * Creates native view - */ - TBool CreateNativeViewL( TUid aViewUid ); - - /** - * Return reference to the customisation manager - * @return Reference to CCalenCustomisationManager + * close agenda event view + * should be call if agenda eevent view is open */ - CCalenCustomisationManager& CustomisationManager(); - - /** - * Compares the list of active plugins and plugins the view manager - * knows about, to discover which plugins have been enabled or - * disabled - */ - void UpdatePluginListL(); - - /** - * Removes the custom views supplied by the plugin list from the view - * server. - * @param uids - */ - void RemoveDisabledPluginsViewsL( RArray& aDisabledPlugins ); - - /** - * Asyncronous callback function to remove the current view after - * it has been disabled. - */ - static TInt RemoveDeActivatedView( TAny* aObject ); - - /** - * Asyncronous callback function to remove the current view after - * it has been disabled. Leaving version - */ - void RemoveDeActivatedViewL(); - - /** - * Handles notifications (Leaving) - */ - void HandleNotificationL( TCalenNotification aNotification ); + void closeAgendaEventView(); - /** - * Updates the nextview icon on the toolbar when default view is not month view - */ - void UpdateToolbarNextViewIconL(TUid defViewUid); - - /** - * Handles Faster app exit - */ - void HandleFasterAppExitCommandL(); - - /** - * Handles ECalenNotifySettingsChanged notification + /** + * remove the setting view */ - void HandleSettingsChangeNotificationL(); - - /** - * Handles ECalenNotifyEntryDeleted and ECalenNotifyInstanceDeleted - * notifications - */ - void HandleEntryDeleteNotificationL(); - - /** - * Handles ECalenNotifyEntryClosed notification - */ - void HandleEntryClosedNotificationL(); - - /** - * Handles ECalenNotifySystemTimeChanged notification - */ - void HandleSystemTimeChangeNotificationL(); - - private: // from MCalenNotificationHandler + void removeSettingsView(); + + public: // from MCalenNotificationHandler /** * Handles notifications */ void HandleNotification( const TCalenNotification aNotification ); - private: // Construction and destruction + private: /** - * C++ constructor - * @param aAppUi Reference to CAknViewAppUi - * @param aController Reference to CCalenController + * Loads month view frm the docml */ - CCalenViewManager( CAknViewAppUi& aAppUi, - CCalenController& aController ); + void loadMonthView(); + /** + * Loads agenda view from the docml + */ + void loadAgendaView(); /** - * Symbian 2nd phase constructor + * Loads day view from the docml */ - void ConstructL(); - - private: // Data - TVwsViewId iCurrentViewId; - CCalenGlobalData* iGlobalData; - CAknViewAppUi& iAppUi; - TInt iViewCycleIndex; - CCalenViewPopulator* iPopulator; - CCalenSetting* iSetting; - CCalenToolbarImpl* iToolbar; - CCalenCustomisationManager* iCustomisationManager; - RPointerArray iViewInfoArray; - CCalenController& iController; + void loadDayView(); + + /** + * Activates the default view, as retrieved from settings. + */ + void ActivateDefaultViewL( int defaultView ); + + /** + * Activate current view. + */ + void activateCurrentView(); + + /** + * Launch event view. + */ + void launchEventView(); + + /** + * @brief Constructs the auxilliary view used + * to provide illusion of swiping to next or prev + * day + */ + void loadAlternateAgendaView(); + + private slots: + void handleMainViewReady(); + void handleViewingCompleted(const QDate date); + void handleEditingStarted(); + void handleEditingCompleted(); + void handleDeletingStarted(); + void handleDeletingCompleted(); + void handleInstanceViewCreation(int status); + void handleEntryViewCreation(int status); + void handleEntriesChanged(QList); + void handleEntryUpdation(ulong id); + + private: // Data - // Stores the uids of the plugins, the view manager is - // aware of. - RArray iKnownPlugins; - // Pointer to CCalenViewInfo for an active view which has - // been disabled. - CCalenViewInfo* iRemovedActiveView; - // Remove the current view asynchronously - CAsyncCallBack* iViewRemovalCallback; - CCalenIcons* iIcons; + CCalenController &mController; + CalenMonthView *mCalenMonthView; + CalenAgendaView *mCalenAgendaView; + AgendaEventViewer *mCalenEventViewer; + CalenLandscapeDayView *mCalenLandscapeDayView; + CalenSettingsView *mSettingsView; + CalenDocLoader *mAgendaViewDocLoader; + CalenDocLoader *mMonthViewDocLoader; + CalenAgendaView *mCalenAgendaViewAlt; + CalenDocLoader *mAgendaViewAltDocLoader; + CalenDayView *mCalenDayView; - // The first view on start-up has been activated. - TBool iViewsActivated; - TVwsViewId iPreviousViewId; - TVwsViewId iPreviousToDayView; - TVwsViewId iPreviousToWeekView; - TBool iAvoidRepopulation; - TBool iStartupComplete; - }; + int mCurrentViewId; + int mPreviousViewsId; + int mFirstView; + bool mInstanceViewCreated; + }; #endif // CALENVIEWMANAGER_H