1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
16 #ifndef __CALSESSION_H__
17 #define __CALSESSION_H__
21 #include <calchangecallback.h>
22 #include <calnotification.h>
24 class CCalSessionImpl;
25 class MCalChangeCallBack2;
27 class CCalCalendarInfo;
28 class MCalFileChangeObserver;
30 /** A handle to the calendar file.
32 When the client instantiates a CCalSession, it will connect to the calendar server.
33 In turn, the client can use its APIs, for instance to create or open a calendar file.
35 The agenda data in the file can be accessed as entries. To access the entries, clients should
36 use class CCalEntryView or CCalInstanceView to process the entry data. However, both view classes
37 require the handle to the file which is represented by this class.
39 A calendar file can be opened on any writable drive. Note that if the file is opened
40 on a removable media and that media is removed, operations will leave with KErrNotReady.
41 This error can also happen when trying to access file attachments on removed media.
42 When this error occurs, the user should close the CCalSession and re-open it once the media
44 It is recommended that when using a calendar file on removable media, the user should watch for when
45 the media is removed / replaced using the RFs::NotifyChange API.
47 The session object must not be destroyed until all the objects which where created by referencing it
53 NONSHARABLE_CLASS(CCalSession) : public CBase
56 IMPORT_C static CCalSession* NewL();
57 IMPORT_C static CCalSession* NewL(CCalSession& aCalSession);
58 IMPORT_C ~CCalSession();
60 IMPORT_C void CreateCalFileL(const TDesC& aFileName) const;
61 IMPORT_C void CreateCalFileL(const TDesC& aFileName, const CCalCalendarInfo& aCalendarInfo) const;
62 IMPORT_C void SetCalendarInfoL(const CCalCalendarInfo& aCalendarInfo) const;
63 IMPORT_C CCalCalendarInfo* CalendarInfoL() const;
65 IMPORT_C void OpenL(const TDesC& aFileName) const;
66 IMPORT_C void OpenL(const TDesC& aFileName, CalCommon::TCalFileVersionSupport& aFileSupportStatus) const;
67 IMPORT_C const TDesC& DefaultFileNameL() const;
68 IMPORT_C void DeleteCalFileL(const TDesC& aFileName) const;
69 IMPORT_C CDesCArray* ListCalFilesL() const;
70 IMPORT_C void StartChangeNotification(MCalChangeCallBack2& aCallBack, const CCalChangeNotificationFilter& aFilter);
71 IMPORT_C void StartFileChangeNotificationL(MCalFileChangeObserver& aCallBack);
72 IMPORT_C void StopChangeNotification();
73 IMPORT_C void StopFileChangeNotification();
74 IMPORT_C void DisableChangeBroadcast();
75 IMPORT_C void EnableChangeBroadcast();
77 IMPORT_C void EnablePubSubNotificationsL();
78 IMPORT_C void DisablePubSubNotificationsL();
80 IMPORT_C void FileIdL(TCalFileId& aCalFileId) const;
81 IMPORT_C void GetFileNameL(TCalPubSubData aPubSubData, TDes& aFileName) const;
82 IMPORT_C TBool IsFileNameL(TCalPubSubData aPubSubData, const TDesC& aFileName) const;
83 IMPORT_C TBool IsOpenedFileL(TCalPubSubData aPubSubData) const;
84 IMPORT_C TCalCollectionId CollectionIdL() const;
91 IMPORT_C void _DebugSetHeapFailL(RAllocator::TAllocFail aFail, TInt aRate);
97 IMPORT_C TInt _DebugRequestAllocatedCellsL();
100 IMPORT_C void StartChangeNotification(MCalChangeCallBack* aCallBack, MCalChangeCallBack::TChangeEntryType aChangeEntryType, TBool aIncludeUndatedTodos, TTime aFilterStartTime, TTime aFilterEndTime);
102 IMPORT_C void __dbgClearTzClientCacheL(TBool aRestartCaching);
104 IMPORT_C TInt _DebugRequestAllocatedHeapSizeL();
107 CCalSessionImpl& Impl() const;
112 void ConstructL(CCalSession& aCalSession);
114 CCalSessionImpl* iImpl;
117 #endif // __CALSESSION_H__