williamr@2: // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). williamr@2: // All rights reserved. williamr@2: // This component and the accompanying materials are made available williamr@4: // under the terms of "Eclipse Public License v1.0" williamr@2: // which accompanies this distribution, and is available williamr@4: // at the URL "http://www.eclipse.org/legal/epl-v10.html". williamr@2: // williamr@2: // Initial Contributors: williamr@2: // Nokia Corporation - initial contribution. williamr@2: // williamr@2: // Contributors: williamr@2: // williamr@2: // Description: williamr@2: // williamr@2: williamr@2: #ifndef __CALCHANGECALLBACK_H__ williamr@2: #define __CALCHANGECALLBACK_H__ williamr@2: williamr@2: #include williamr@2: williamr@2: class TCalChangeEntry; williamr@2: williamr@2: class MCalChangeCallBack williamr@2: /** A call back class for observing changes in the model view. williamr@2: williamr@2: A client will not be notified of a change if it is the source of williamr@2: the change. williamr@2: williamr@2: @publishedAll williamr@2: @deprecated williamr@2: */ williamr@2: { williamr@2: public: williamr@2: /** Instance view change type williamr@2: @publishedAll williamr@2: @deprecated williamr@2: */ williamr@2: enum TChangeType williamr@2: { williamr@2: /** Entries are added */ williamr@2: EChangeAdd, williamr@2: /** Entries are deleted */ williamr@2: EChangeDelete, williamr@2: /** Entries are modified */ williamr@2: EChangeModify, williamr@2: /** Undefined entries */ williamr@2: EChangeUndefined, williamr@2: /** Entries cause overflow error */ williamr@2: EChangeOverflowError williamr@2: }; williamr@2: williamr@2: /** Instance view entry type williamr@2: @publishedAll williamr@2: @deprecated williamr@2: */ williamr@2: enum TChangeEntryType williamr@2: { williamr@2: /** Entry type is todo */ williamr@2: EChangeEntryTodo, williamr@2: /** Entry type is event */ williamr@2: EChangeEntryEvent, williamr@2: /** All entry types */ williamr@2: EChangeEntryAll williamr@2: }; williamr@2: /** A call back function for change notification williamr@2: @param aChangeEntryType Filters notifications to only notify about entries of this type (event/todo/all). williamr@2: williamr@2: */ williamr@2: virtual void CalChangeNotification(TChangeEntryType aChangeEntryType) = 0; williamr@2: }; williamr@2: williamr@2: /** A call back class for observing changes in the model view. williamr@2: williamr@2: The call back returns an array containing information about at least williamr@2: one change to the database. The information includes the type of change williamr@2: and the identity of the item being changed. williamr@2: williamr@2: A client will not be notified of a change if it is the source of williamr@2: the change. williamr@2: williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: class MCalChangeCallBack2 williamr@2: { williamr@2: public: williamr@4: /** williamr@4: Type of change to the entry. williamr@2: */ williamr@2: enum TChangeType williamr@2: { williamr@4: /** Calendar entry added. */ williamr@2: EChangeAdd, williamr@4: /** Calendar entry deleted. */ williamr@2: EChangeDelete, williamr@4: /** Calendar entry modified. */ williamr@2: EChangeModify, williamr@4: /** Undefined Calendar entry change. */ williamr@4: EChangeUndefined, williamr@4: /** The time zone rules for one or more Calendar entries have changed. */ williamr@4: EChangeTzRules, williamr@4: /** Backup Starts williamr@4: * When the backup event is in process, the Calendar file is locked. williamr@4: * Most of operations are not permitted when it happens. However, few williamr@4: * operations, such as notification request, enabling broadcast williamr@4: * and closing Calendar is still permitted. williamr@4: * */ williamr@4: EBackupStart, williamr@4: /** Restore Starts williamr@4: * When the restore event is in process, the Calendar file is locked. williamr@4: * Most of operations are not permitted when it happens. However, few williamr@4: * operations, such as notification request, enabling broadcast williamr@4: * and closing Calendar is still permitted. williamr@4: */ williamr@4: ERestoreStart, williamr@4: /** Backup Ends williamr@4: * When the backup event is completed, the Calendar file is unlocked. williamr@4: * The application can continue to operate on the current Calendar file. williamr@4: */ williamr@4: EBackupEnd, williamr@4: /** Restore Ends williamr@4: * When the restore event is completed, the Calendar file is unlocked. williamr@4: * The application can operate on the restored Calendar file after the application williamr@4: * is notified with the message. However, if the application has cached any williamr@4: * Calendar objects, such as Calendar file ID, Calendar entries, Calendar instances, williamr@4: * they are not necessarily synched with the data in the newly restored Calendar file. williamr@4: */ williamr@4: ERestoreEnd, williamr@4: /** The restored Calendar file can not be opened williamr@4: * When the restore event is completed, the newly restored Calendar file can not williamr@4: * be opened. It is because either the file version is not supported or the data is corrupted. williamr@4: * Apart from closing the session and delete the file, no any other operation is permitted williamr@4: * when it happens. williamr@4: */ williamr@4: ERestoredFileCanNotBeOpened williamr@2: }; williamr@2: williamr@4: /** williamr@4: Type of entry. williamr@2: */ williamr@2: enum TChangeEntryType williamr@2: { williamr@4: /** Entry type is todo. */ williamr@2: EChangeEntryTodo, williamr@4: /** Entry type is event. */ williamr@2: EChangeEntryEvent, williamr@4: /** All entry types. */ williamr@2: EChangeEntryAll williamr@2: }; williamr@2: williamr@4: /** williamr@4: A call back function for change notification. williamr@4: williamr@4: @param aChangeItems List of changes since the last notification. williamr@2: */ williamr@2: virtual void CalChangeNotification(RArray& aChangeItems) = 0; williamr@2: }; williamr@2: williamr@4: /** williamr@4: A structure for storing Calendar change notification data. This contains the williamr@4: Calendar entry local UID, the type of change and the entry type. williamr@2: williamr@4: The iChangeEntryType member may be set to MCalChangeCallBack2::EChangeEntryTodo williamr@4: or MCalChangeCallBack2::EChangeEntryEvent. MCalChangeCallBack2::EChangeEntryAll williamr@4: is provided for call back registration only. williamr@2: williamr@4: If the iChangeType member is MCalChangeCallBack2::EChangeUndefined or williamr@4: MCalChangeCallBack2::EChangeTzRules, iEntryId and iEntryType are undefined and williamr@4: should not be used by clients. williamr@4: williamr@4: When the iChangeType member is MCalChangeCallBack2::EChangeTzRules a change in williamr@4: time zone rules has been detected and processed by the Calendar server. The williamr@4: client should refresh any instance data they own as a result of this change. williamr@2: williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: struct TCalChangeEntry williamr@2: { williamr@4: /** Local UID of the entry. */ williamr@2: TCalLocalUid iEntryId; williamr@4: /** Type of change to the entry. */ williamr@2: MCalChangeCallBack2::TChangeType iChangeType; williamr@4: /** Type of entry. */ williamr@2: MCalChangeCallBack2::TChangeEntryType iEntryType; williamr@2: }; williamr@2: williamr@2: /** Class to encapsulate call back registration parameters. williamr@2: williamr@2: The type of entries, the date range and whether undated todos are included williamr@2: can be specified. williamr@2: williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: class CCalChangeNotificationFilter williamr@2: { williamr@2: public: williamr@2: IMPORT_C static CCalChangeNotificationFilter* NewL(MCalChangeCallBack2::TChangeEntryType aChangeEntryType, TBool aIncludeUndatedTodos, const CalCommon::TCalTimeRange& aTimeRange); williamr@2: IMPORT_C ~CCalChangeNotificationFilter(); williamr@2: williamr@2: MCalChangeCallBack2::TChangeEntryType ChangeEntryType() const; williamr@2: TCalTime StartTime() const; williamr@2: TCalTime EndTime() const; williamr@2: TBool IncludeUndatedTodos() const; williamr@2: williamr@2: private: williamr@2: CCalChangeNotificationFilter(MCalChangeCallBack2::TChangeEntryType aChangeEntryType, TBool aIncludeUndatedTodos, const CalCommon::TCalTimeRange& aTimeRange); williamr@2: williamr@2: MCalChangeCallBack2::TChangeEntryType iChangeEntryType; williamr@2: CalCommon::TCalTimeRange iTimeRange; williamr@2: TBool iIncludeUndatedTodos; williamr@2: }; williamr@2: williamr@2: #endif // __CALCHANGECALLBACK_H__