diff -r 12af337248b1 -r bd7edf625bdd calendarui/controller/inc/calennotifier.h --- a/calendarui/controller/inc/calennotifier.h Tue Aug 31 15:13:43 2010 +0300 +++ b/calendarui/controller/inc/calennotifier.h Wed Sep 01 12:32:31 2010 +0100 @@ -11,37 +11,54 @@ * * Contributors: * -* Description: Calendar notifier +* Description: Calendar notifier * */ + #ifndef CALENNOTIFIER_H #define CALENNOTIFIER_H // INCLUDES -#include //RHashSet -#include "calennotificationhandler.h" // MCalenNotificationHandler +#include // RHashSet +#include // MCenRepNotifyHandlerCallback +#include // MCalenNotificationHandler +#include // MCalProgressCallBack +#include // MCalFileChangeObserver + +#include "calendbchangenotifier.h" // MCalenDBChangeObserver #include "calencontextchangeobserver.h" // MCalenContextChangeObserver +#include "calenecomchangeobserver.h" // MCalenEComChangeObserver // FORWARD DECLARATIONS +class CCalenGlobalData; // Calendar global data singleton class CEnvironmentChangeNotifier; // Receive system event notifications -class CCalenStateMachine; +class CCalenEComWatcher; // Receives Ecom registry change notifications +class CCalenSetting; // Calendar settings +class CCalenController; +class CCalFileChangeInfo; /** - * CalenNotifier observes various system events relevent to Calendar + * CCalenNotifier observes various system events relevent to Calendar * MCalenNotificationHandlers can register for notifications of specific * events. This minimises the number of event observers required * throughout the Calendar application. */ -class CalenNotifier : public CBase, - public MCalenContextChangeObserver +class CCalenNotifier : public CBase, + public MCenRepNotifyHandlerCallback, + public MCalenDBChangeObserver, + public MCalProgressCallBack, + public MCalenContextChangeObserver, + public MCalenEComChangeObserver, + public MCalFileChangeObserver + { public: /** * C++ default Constructor */ - CalenNotifier( CCalenStateMachine& aStateMachine ); + CCalenNotifier( CCalenController& aController ); /** * 2nd phase of construction. @@ -51,7 +68,7 @@ /** * Destructor */ - virtual ~CalenNotifier(); + virtual ~CCalenNotifier(); public: /** @@ -90,8 +107,55 @@ * @param aNotification Notification to broadcast */ void BroadcastApprovedNotification( TCalenNotification aNotification ); + + /** + * Check if the system time changed since Calendar was + * last launched + */ + TInt SystemTimeChangedL(); + + /** + * After calling this function, any settings changed notifications + * will not be broadcast until after ResumeSettingsNotifications + * has been called. + */ + void DeferSettingsNotifications(); + + /** + * Resumes settings notifications after they have been paused + * with DeferSettingsNotifications. + */ + void ResumeSettingsNotifications(); - public: + /** + * Update the cenrep with latest system time change information + */ + void UpdateSytemTimeChangeInfoL(); + + public: + /** + * From MCenRepNotifyHandlerCallback. + * Notification of any change to the Calendar central repository + * where the main Calendar settings are stored + * @param aId Id of the cenrep key that changed + */ + void HandleNotifyGeneric( TUint32 aId ); + + /** + * From MCenRepNotifyHandlerCallback. + * Notification of central repository observer failure. + */ + void HandleNotifyError( TUint32 aId, + TInt aError, + CCenRepNotifyHandler* aHandler ); + + /** + * From MCalenDBChangeObserver. + * Notification of any change to the Calendar database through an + * external CCalSession. + * Notifications are limited to a maximum of one per second + */ + void HandleDBChangeL(); /** * From MCalenContextChangeObserver. @@ -99,8 +163,43 @@ */ void ContextChanged(); + /** + * From MCalenEComChangeObserver + * Called by when the ecom registry gets changed. + */ + void EComChanged(); + + /** + * @brief From MCalFileChangeObserver + * The callback that will recieve 1 or more file change notifications + * + * @param aCalendarInfoChangeEntries Holds the information about the + * calendar info changes + */ + void CalendarInfoChangeNotificationL( + RPointerArray& aCalendarInfoChangeEntries); + + public: + /** + * From MCallProgressCallBack + * Called when CCalEntryView creation is complete. + * @param aStatus completion status + */ + void Completed( TInt aStatus ); + + /** + * From MCallProgressCallBack + * Not used by this class + */ + void Progress( TInt aPercentageCompleted ); + + /** + * From MCallProgressCallBack + * Returns EFalse to disable progress notifications + */ + TBool NotifyProgress(); + private: // Callback functions from observers - /** * Called from CEnvironmentChangeNotifier when the * system environment changes @@ -108,15 +207,15 @@ * @return EFalse */ static TInt EnvChangeCallbackL( TAny* aThisPtr ); - + /** * Broadcasts the given notification. * @param aNotification Notification id to be broadcasted */ - void DoBroadcast( TCalenNotification aNotification ); + void DoBroadcast( TCalenNotification aNotification ); TInt DoEnvChange(); - + private: // Data // Array of handlers to notify @@ -131,16 +230,34 @@ RArray iHandlers; + // Notifications about locale and time changes + CEnvironmentChangeNotifier* iEnvChangeNotifier; + + // Notifications about Calendar settings changes + CRepository* iRepository; + CCenRepNotifyHandler* iCenRepChangeNotifier; + + // Calendar Global Data singleton + CCalenGlobalData* iGlobalData; + + // Notifications about changes to the ECom registry + CCalenEComWatcher* iEComWatcher; + // CCalenEComWatcher* iEComWatcher1; + RArray iBroadcastQueue; TBool iBroadcastActive; - - CCalenStateMachine& iStateMachine; + + CCalenSetting* iSetting; + TBool iIsSettingsBroadcastDeferred; + TBool iSettingsNeedsBroadcast; + TBool iLocaleNeedsBroadcast; + CCalenController& iController; + TBool iIgnoreFirstLocaleChange; - // Notifications about locale and time changes - CEnvironmentChangeNotifier* iEnvChangeNotifier; + // latest time change from agenda server + TReal iTimeOfChangeUtcReal; - bool iIgnoreFirstLocaleChange; - + HBufC* iFilnameDeleted; }; #endif // CALENNOTIFIER_H