diff -r 96907930389d -r 12af337248b1 calendarui/controller/inc/calencontroller.h --- a/calendarui/controller/inc/calencontroller.h Thu Aug 19 09:53:43 2010 +0300 +++ b/calendarui/controller/inc/calencontroller.h Tue Aug 31 15:13:43 2010 +0300 @@ -11,48 +11,49 @@ * * Contributors: * -* Description: Calendar controller +* Description: Calendar controller * */ - #ifndef CALENCONTROLLER_H #define CALENCONTROLLER_H -// INCLUDES -#include // CAsyncCallBack -#include // TVwsViewId -#include // TApaCommand -#include // Calendar commands -#include // TCalenInstanceId -#include // TCalenNotification -#include -class MCalenPreview; -#include "calenglobaldata.h" // TCalenContext +// System includes +#include // CAsyncCallBack +#include // TVwsViewId +#include // TApaCommand +#include // Q_DECL_EXPORT macro +#include +#include + +// User includes +#include "hb_calencommands.hrh"// Calendar commands +#include "calennotificationhandler.h"// TCalenNotification +#include "calenservices.h" #include "calenservicesfactory.h" // MCalenServicesFactory + +#ifdef CALENCONTROLLER_DLL +#define CALENCONTROLLER_EXPORT Q_DECL_EXPORT +#else +#define CALENCONTROLLER_EXPORT Q_DECL_IMPORT +#endif + // FORWARD DECLARATIONS +class CalenViewManager; +class CalenView; +class CalenServicesImpl; +class HbMainWindow; +class CalenNotifier; +class CCalenStateMachine; +class MCalenCommandHandler; class CCalenActionUi; -class CCalenNotifier; -class CCalenViewManager; -class CCalenAlarmManager; -class CCalenView; -class CAknViewAppUi; -class CCalenStateMachine; -class CCalenCmdLineLauncher; +class HbWidget; class CCalenCustomisationManager; -class CEikMenuPane; -class CCoeControl; -class CCalenViewInfo; -class CCalenSetting; -class CCalenServicesImpl; -class MCalenCommandHandler; -class TCalenCommand; -class CMissedAlarmStore; -class CCalenMultipleDbManager; -class CCalenInfo; -class CCalenAttachmentModel; +class CalenContextImpl; // context implementation +class QString; +class HbMenu; // CLASS DEFINITIONS @@ -60,32 +61,51 @@ * The controller handles events from the rest of Calendar and delegates * them to the appropriate place (i.e. the action ui classes). */ -class CCalenController : public CBase, - public MCalenServicesFactory +class CALENCONTROLLER_EXPORT CCalenController : public QObject, public MCalenServicesFactory { + Q_OBJECT + public: // Construction and destruction - /** - * Symbian 1st phase constructor - * @param aAppUi A reference to the CAknViewAppUi - * @return self pointer to CCalenController - */ - IMPORT_C static CCalenController* NewL( CAknViewAppUi& aAppUi ); - - /** - * Constructs CCalenController with existing CAknViewAppUi. If the - * controller has been previously initialized with the same CAknViewAppUi, - * the existing instance will be returned. - * @param aAppUi Reference to CAknViewAppUi - * @return CCalenController pointer - */ - IMPORT_C static CCalenController* InstanceL(); + /** + * C++ constructor + */ + CCalenController(); + + /** + * Second phase contruction for controller + */ + void constructController(); + + /** + * Constructs CCalenController with existing CAknViewAppUi. If the + * controller has been previously initialized with the same CAknViewAppUi, + * the existing instance will be returned. + * @param aAppUi Reference to CAknViewAppUi + * @return CCalenController pointer + */ + static CCalenController* InstanceL(); - /** - * CCalenController is a reference counting singleton. Call Release() - * when you are done with it, it will clean itself when it needs to - */ - IMPORT_C void Release(); + + /** + * Releases all plugins, should only be called when + * the application is exiting. + */ + void ReleaseCustomisations(); + /** + * CCalenController is a reference counting singleton. Call Release() + * when you are done with it, it will clean itself when it needs to + */ + void Release(); + + /** + * destructor + */ + ~CCalenController(); + + signals: + void appReady(); + public: // New functions /** * Adds the passed command to the command queue. Command are handled @@ -94,21 +114,20 @@ * @return EFalse if the passed command is not in the issuers command range * ETrue otherwise */ - IMPORT_C TBool IssueCommandL( TInt aCommand ); - - /** + TBool IssueCommandL( TInt aCommand ); + /** * Passes the notification to the calendar notifier. The notification will be * broadcast to all observers * @param aNotification Notification to be broadcast */ - IMPORT_C void BroadcastNotification( TCalenNotification aNotification ); + void BroadcastNotification( TCalenNotification aNotification ); /** * Register the passed notification handler with the calendar notifier * @param aHandler Notification handler * @param aNotification Notification that handler wants to be notified */ - IMPORT_C void RegisterForNotificationsL( MCalenNotificationHandler* aHandler, + void RegisterForNotificationsL( MCalenNotificationHandler* aHandler, TCalenNotification aNotification ); @@ -117,323 +136,136 @@ * @param aHandler Notification handler * @param aNotifications Array of Notifications that handler wants to be notified */ - IMPORT_C void RegisterForNotificationsL( MCalenNotificationHandler* aHandler, + void RegisterForNotificationsL( MCalenNotificationHandler* aHandler, RArray& aNotifications ); /** * Unregister the passed handler with the notifier * @param aHandler Notification handler */ - IMPORT_C void CancelNotifications( MCalenNotificationHandler* aHandler ); - - /** - * Process comamndline parameters - * @param aCommand Not in use in this case - * @param aDocumentName Not in use in this case - * @param aTail Descriptor contains the command + void CancelNotifications( MCalenNotificationHandler* aHandler ); + + /** + * From MCalenServicesFactory */ - IMPORT_C void ProcessCommandParametersL( TApaCommand aCommand, - TFileName& aDocumentName, - const TDesC8& aTail ); - /** - * Offer the menu pane to Plugins to customisation - * @param aMenuPane Where the customisation apply to - */ - IMPORT_C void OfferMenuPaneL( TInt aResourceId, - CEikMenuPane* aMenuPane ); - - /** - * Get infobar based on the available area for infobar - * @param aRect The available area for Infobar - * @return pointer to a Infobar control - */ - IMPORT_C CCoeControl* Infobar( const TRect& aRect ); - + MCalenServices* NewServicesL(); + /** * Get infobar based on the available area for infobar * @param aRect The available area for Infobar * @return pointer to a Infobar control */ - IMPORT_C const TDesC& Infobar(); - - /** - * Get preview pane based on the available area - * @param aRect The available area for preview pane - * @return pointer to a preview pane control + HbWidget* Infobar( ); + + /** + * Returns info bar text */ - IMPORT_C CCoeControl* PreviewPane( TRect& aRect ); + QString* InfobarTextL(); - /** - * Releases all plugins, should only be called when - * the application is exiting. - */ - IMPORT_C void ReleaseCustomisations(); /** - * From MCalenServicesFactory + * Offer the menu to Plugins to customisation + * @param aMenu Where the customisation apply to + */ + void OfferMenu(HbMenu* aHbMenu); + /** + * returns the interface to the agenda database + * @return reference to agendainterface */ - IMPORT_C MCalenServices* NewServicesL(); - - /* - * Get custom preview pane to replace the native one. - * @param aRect TRect of preview pane area. - * @return MCalenPreview* pointer to MCalenPreview class + AgendaUtil* agendaInterface(); + /** + * returns the calendar context + * @return reference to the calendar context */ - IMPORT_C MCalenPreview* CustomPreviewPaneL( TRect& aRect ); + MCalenContext& context(); + /** + * Launches the requested view + */ + void handleServiceManagerSlot(int view, const QDateTime& dateTime); + /** + * returns the first view with which calendar has been launched + * @return view Id + */ + int getFirstView(); public: // public but not exported - /** - * Get reference to the CCalenNotiffier - */ - CCalenNotifier& Notifier(); + + /** + * Get reference to the CCalenNotiffier + */ + CalenNotifier& Notifier(); /** * Get a command handler for a specific command * @param aCommand Command to find a command handler for */ - MCalenCommandHandler* GetCommandHandlerL( TInt aCommand ); - + MCalenCommandHandler* GetCommandHandlerL( TInt aCommand ); + /** - * Request activation of a specific view - * @param aViewId View id + * Get viewmanager + * @return reference to CalenViewManager */ - void RequestActivationL( const TVwsViewId& aViewId ); + CalenViewManager& ViewManager(); /** - * Get customisationmanager - * @return reference to CCalenCustomisationManager + * Get MainWindow + * @return reference to HbMainWindow */ - CCalenCustomisationManager& CustomisationManager(); - - /** - * Get viewmanager - * @return reference to CCalenViewManager - */ - CCalenViewManager& ViewManager(); + HbMainWindow& MainWindow(); /** * Get services * @return reference to controller's services object */ MCalenServices& Services(); - /** - * Checks to see if the system time was changed while Calendar was - * not running, potentially causing alarms to be missed + * Get customisationmanager + * @return reference to CCalenCustomisationManager */ - void HandleSystemTimeChangeL(); + CCalenCustomisationManager& CustomisationManager(); - /** - * Check for faster app flag + /** + * Filters the events eg. Locale/language change events + * @param event */ - TBool IsFasterAppFlagEnabled(); - - /** - * Set faster app flag - */ - void SetFasterAppFlag( TBool aFlag ); + bool eventFilter(QObject *object, QEvent *event); /** - * Get Missed alarm store - * @return reference to Missed alarm store - */ - CMissedAlarmStore* MissedAlarmStore(); - - /** - * Get missed alarms list - * @return list of missed alarms - */ - void GetMissedAlarmsList(RArray& aMissedAlarmList); - - /** - * returns a reference to the calendar settings - */ - CCalenSetting& Settings(); - - /** - * Get calendar icon of specific type - * @return CGulIcon* - */ - CGulIcon* GetIconL(MCalenServices::TCalenIcons aIndex, const TInt aViewId = 0 ); - - /* Get multipledb manager - * @return reference to CCalenMultipleDbManager - */ - CCalenMultipleDbManager& MultipleDbManager(); - - /* - * Get all active collection id - * @param aCollectionIds array for collection on return - * @return void - */ - void GetActiveCollectionidsL(RArray& aCollectionIds); - - /* - * Form calendar name based dbid for eg:for - * c:Calendar append dbid 1 as c:Calendar1 - * @return HBufC* calendar name ownership return to caller. - * @param TInt aDbId db id for which calendar name should be formed. + * Emits appReady signal. */ - HBufC* GetCalendarNameFromDbIdL(const TInt aDbId); - - - /** - * Get State Machine - * @return reference to CCalenStateMachine - */ - CCalenStateMachine& StateMachine(); + void emitAppReady(); - /** - * Get action ui - * - * @return reference to CCalenActionUi - */ - CCalenAttachmentModel& AttachmentData(); - - /** - * Function to tell whether editor is active or not - * @return ETrue if editor is active else EFalse - */ - TBool IsEditorActive(); - - /** - * @brief adds a new calendar info to the calendar file - * - * @param aCalendarInfo meatadata to be set to calendar file - */ - void AddCalendarL(CCalCalendarInfo* aCalendarInfo); - - /** - * @brief removes a calendar - * - * @param aCalendarFileName name of the calendar file to be deleted - */ - void RemoveCalendarL(const TDesC& aCalendarFileName); - - /** - * @brief removes all dead calendars from the file system. - */ - void RemoveDeadCalendarsL(); - - /** - * @brief updates a calendar file with new metadata - * - * @param aCalendarInfo updated metadata to be set to calendar file - */ - void UpdateCalendarL(CCalCalendarInfo* aCalendarInfo); + private: // Construction and destruction /** - * @brief get all available calendar info - * - * @param aCalendarInfoList reference to the calendar info list - */ - void GetAllCalendarInfoL( - RPointerArray& aCalendarInfoList ); - - /** - * @brief sets the flag if the calendar application is launched - * from external application. - * - * @param aFlag The flag to be set. - */ - void SetLaunchFromExternalApp( TBool aFlag ); - - /** - * @brief Checks whether the calendar application is launched - * from external application. - * - * @return ETrue If the calendar application is launched from - * external application else EFalse. - */ - TBool IsLaunchFromExternalApp(); - - private: // Construction and destruction - /** - * C++ constructor - */ - CCalenController( CAknViewAppUi& aAppUi ); - - /** - * Symbian 2nd phase constructor - */ - void ConstructL(); - - /** - * destructor - */ - ~CCalenController(); - - private: // New functions - /** - * Leaving form of HandleCommandL - * @param aCommand Command to be handled - */ - void HandleCommandL( TCalenCommand& aCommand ); - + * Sets the default context for today + */ + void SetDefaultContext(); /** - * Displays an information note if the system time changed - * while Calendar was inactive - * @param aResourceId resource id for information note - */ - void ShowSystemChangeInfoNoteL( TInt aResourceId ); - - /** - * This function is called when a System time is changed. - * only at the startup - * @param aThisPtr Specified to be TCallBack() - * @return EFalse - */ - static TInt SystemTimeChangeCallback(TAny* aThisPtr); - - public: - /** - * Check system time change at startup - */ - void CheckSystemTimeAtStartUpL(); - - /** - * Returns a reference to the appui - */ - CAknViewAppUi& AppUi(); + * Stores the controller object in TLS + */ + void checkMultipleCreation(); - /** - * Set the iIsExitOnDialogClose flag status from command line launcher. - * @param aFlag , Sets the status - */ - void SetExitOnDialogFlag( TBool aFlag ); //updateflag - - /** - * Get the iIsExitOnDialogClose flag status from command line launcher. - * @return TBool, Status of the flag. - */ - TBool GetExitOnDialogFlag(); // getflagstatus - +private slots: + void raiseWindow(); + private: // Data - CAknViewAppUi& iAppUi; // Calendar AppUi + CalenViewManager* iViewManager;// Activate / deactivate views + CalenContextImpl* mContext; + AgendaUtil *mAgendaUtil; // Agenda interface provider + CalenServicesImpl* iServices; // Services. + CalenNotifier* iNotifier; // Broadcasts calendar events + CCalenStateMachine* iStateMachine; CCalenActionUi* iActionUi; // Default internal command handling - CCalenNotifier* iNotifier; // Broadcasts calendar events - CCalenViewManager* iViewManager;// Activate / deactivate views - CCalenGlobalData* iGlobalData; // Calendar Global Data - CCalenSetting* iSetting; // Calendar settings - CCalenServicesImpl* iServices; // Services. - CCalenAlarmManager* iAlarmManager; //Alarm Manager. - CCalenMultipleDbManager* iMultipleDbmanager; //Multiple calendar - CCalenAttachmentModel* iAttachmentData; - TInt iRefCount; // Reference counting singleton - - // Handles the cmd line launching of calendar - CCalenCmdLineLauncher* iCmdLineLauncher; // Manages any customisation plugins - CCalenCustomisationManager* iCustomisationManager; - CCalenStateMachine* iStateMachine; - + CCalenCustomisationManager* iCustomisationManager; + + TInt iRefCount; // Reference counting singleton // Start point of the next command range // to be assigned to a services instance. - TInt iNextServicesCommandBase; - TInt iResourceFileOffset; - CAsyncCallBack* iSystemTimeChangedMsgDelayer; - TBool iFasterApp; - TBool iLaunchFromExternalApp; + TInt iNextServicesCommandBase; + bool iIsFromServiceFrmWrk; + }; #endif // CALENCONTROLLER_H