--- a/calendarui/controller/inc/calencontroller.h Tue Aug 31 15:13:43 2010 +0300
+++ b/calendarui/controller/inc/calencontroller.h Wed Sep 01 12:32:31 2010 +0100
@@ -11,49 +11,48 @@
*
* Contributors:
*
-* Description: Calendar controller
+* Description: Calendar controller
*
*/
+
#ifndef CALENCONTROLLER_H
#define CALENCONTROLLER_H
-// System includes
-#include <e32base.h>// CAsyncCallBack
-#include <vwsdef.h>// TVwsViewId
-#include <apadef.h>// TApaCommand
-#include <qglobal.h>// Q_DECL_EXPORT macro
-#include <agendautil.h>
-#include <qobject>
-
-// User includes
-#include "hb_calencommands.hrh"// Calendar commands
-#include "calennotificationhandler.h"// TCalenNotification
-#include "calenservices.h"
+// INCLUDES
+#include <e32base.h> // CAsyncCallBack
+#include <vwsdef.h> // TVwsViewId
+#include <apadef.h> // TApaCommand
+#include <calencommands.hrh> // Calendar commands
+#include <caleninstanceid.h> // TCalenInstanceId
+#include <calennotificationhandler.h> // TCalenNotification
+#include <calenservices.h>
+class MCalenPreview;
+#include "calenglobaldata.h" // TCalenContext
#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 CCalenActionUi;
+class CCalenNotifier;
+class CCalenViewManager;
+class CCalenAlarmManager;
+class CCalenView;
+class CAknViewAppUi;
class CCalenStateMachine;
+class CCalenCmdLineLauncher;
+class CCalenCustomisationManager;
+class CEikMenuPane;
+class CCoeControl;
+class CCalenViewInfo;
+class CCalenSetting;
+class CCalenServicesImpl;
class MCalenCommandHandler;
-class CCalenActionUi;
-class HbWidget;
-class CCalenCustomisationManager;
-class CalenContextImpl; // context implementation
-class QString;
-class HbMenu;
+class TCalenCommand;
+class CMissedAlarmStore;
+class CCalenMultipleDbManager;
+class CCalenInfo;
+class CCalenAttachmentModel;
// CLASS DEFINITIONS
@@ -61,51 +60,32 @@
* The controller handles events from the rest of Calendar and delegates
* them to the appropriate place (i.e. the action ui classes).
*/
-class CALENCONTROLLER_EXPORT CCalenController : public QObject, public MCalenServicesFactory
+class CCalenController : public CBase,
+ public MCalenServicesFactory
{
- Q_OBJECT
-
public: // Construction and destruction
- /**
- * C++ constructor
- */
- CCalenController();
-
- /**
- * Second phase contruction for controller
- */
- void constructController();
+ /**
+ * 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();
- /**
- * 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
@@ -114,20 +94,21 @@
* @return EFalse if the passed command is not in the issuers command range
* ETrue otherwise
*/
- TBool IssueCommandL( TInt aCommand );
- /**
+ IMPORT_C 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
*/
- void BroadcastNotification( TCalenNotification aNotification );
+ IMPORT_C 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
*/
- void RegisterForNotificationsL( MCalenNotificationHandler* aHandler,
+ IMPORT_C void RegisterForNotificationsL( MCalenNotificationHandler* aHandler,
TCalenNotification aNotification );
@@ -136,136 +117,323 @@
* @param aHandler Notification handler
* @param aNotifications Array of Notifications that handler wants to be notified
*/
- void RegisterForNotificationsL( MCalenNotificationHandler* aHandler,
+ IMPORT_C void RegisterForNotificationsL( MCalenNotificationHandler* aHandler,
RArray<TCalenNotification>& aNotifications );
/**
* Unregister the passed handler with the notifier
* @param aHandler Notification handler
*/
- void CancelNotifications( MCalenNotificationHandler* aHandler );
-
- /**
- * From MCalenServicesFactory
+ 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
*/
- MCalenServices* NewServicesL();
-
+ 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 );
+
/**
* Get infobar based on the available area for infobar
* @param aRect The available area for Infobar
* @return pointer to a Infobar control
*/
- HbWidget* Infobar( );
+ 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
+ */
+ IMPORT_C CCoeControl* PreviewPane( TRect& aRect );
- /**
- * Returns info bar text
+ /**
+ * Releases all plugins, should only be called when
+ * the application is exiting.
*/
- QString* InfobarTextL();
-
+ IMPORT_C void ReleaseCustomisations();
/**
- * 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
+ * From MCalenServicesFactory
*/
- AgendaUtil* agendaInterface();
- /**
- * returns the calendar context
- * @return reference to the calendar context
+ 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
*/
- 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();
+ IMPORT_C MCalenPreview* CustomPreviewPaneL( TRect& aRect );
public: // public but not exported
-
- /**
- * Get reference to the CCalenNotiffier
- */
- CalenNotifier& Notifier();
+ /**
+ * Get reference to the CCalenNotiffier
+ */
+ CCalenNotifier& 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
+ */
+ void RequestActivationL( const TVwsViewId& aViewId );
+
+ /**
+ * Get customisationmanager
+ * @return reference to CCalenCustomisationManager
+ */
+ CCalenCustomisationManager& CustomisationManager();
+
/**
* Get viewmanager
- * @return reference to CalenViewManager
+ * @return reference to CCalenViewManager
*/
- CalenViewManager& ViewManager();
-
- /**
- * Get MainWindow
- * @return reference to HbMainWindow
- */
- HbMainWindow& MainWindow();
+ CCalenViewManager& ViewManager();
/**
* Get services
* @return reference to controller's services object
*/
MCalenServices& Services();
+
/**
- * Get customisationmanager
- * @return reference to CCalenCustomisationManager
+ * Checks to see if the system time was changed while Calendar was
+ * not running, potentially causing alarms to be missed
*/
- CCalenCustomisationManager& CustomisationManager();
+ void HandleSystemTimeChangeL();
- /**
- * Filters the events eg. Locale/language change events
- * @param event
+ /**
+ * Check for faster app flag
*/
- bool eventFilter(QObject *object, QEvent *event);
+ TBool IsFasterAppFlagEnabled();
+
+ /**
+ * Set faster app flag
+ */
+ void SetFasterAppFlag( TBool aFlag );
/**
- * Emits appReady signal.
+ * Get Missed alarm store
+ * @return reference to Missed alarm store
+ */
+ CMissedAlarmStore* MissedAlarmStore();
+
+ /**
+ * Get missed alarms list
+ * @return list of missed alarms
+ */
+ void GetMissedAlarmsList(RArray<TCalenInstanceId>& 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<TInt>& 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.
*/
- void emitAppReady();
+ HBufC* GetCalendarNameFromDbIdL(const TInt aDbId);
+
+
+ /**
+ * Get State Machine
+ * @return reference to CCalenStateMachine
+ */
+ CCalenStateMachine& StateMachine();
- private: // Construction and destruction
+ /**
+ * 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);
/**
- * Sets the default context for today
- */
- void SetDefaultContext();
+ * @brief get all available calendar info
+ *
+ * @param aCalendarInfoList reference to the calendar info list
+ */
+ void GetAllCalendarInfoL(
+ RPointerArray<CCalCalendarInfo>& 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
/**
- * Stores the controller object in TLS
- */
- void checkMultipleCreation();
+ * Leaving form of HandleCommandL
+ * @param aCommand Command to be handled
+ */
+ void HandleCommandL( TCalenCommand& aCommand );
+
+ /**
+ * 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();
-private slots:
- void raiseWindow();
-
+ /**
+ * Returns a reference to the appui
+ */
+ CAknViewAppUi& AppUi();
+
+ /**
+ * 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: // Data
- CalenViewManager* iViewManager;// Activate / deactivate views
- CalenContextImpl* mContext;
- AgendaUtil *mAgendaUtil; // Agenda interface provider
- CalenServicesImpl* iServices; // Services.
- CalenNotifier* iNotifier; // Broadcasts calendar events
+ CAknViewAppUi& iAppUi; // Calendar AppUi
+ 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;
- CCalenActionUi* iActionUi; // Default internal command handling
- // Manages any customisation plugins
- CCalenCustomisationManager* iCustomisationManager;
-
- TInt iRefCount; // Reference counting singleton
+
// Start point of the next command range
// to be assigned to a services instance.
- TInt iNextServicesCommandBase;
- bool iIsFromServiceFrmWrk;
-
+ TInt iNextServicesCommandBase;
+ TInt iResourceFileOffset;
+ CAsyncCallBack* iSystemTimeChangedMsgDelayer;
+ TBool iFasterApp;
+ TBool iLaunchFromExternalApp;
};
#endif // CALENCONTROLLER_H