pimappservices/calendar/inc/calsession.h
changeset 0 f979ecb2b13e
equal deleted inserted replaced
-1:000000000000 0:f979ecb2b13e
       
     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".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #ifndef __CALSESSION_H__
       
    17 #define __CALSESSION_H__
       
    18 
       
    19 #include <badesca.h>
       
    20 
       
    21 #include <calchangecallback.h>
       
    22 #include <calnotification.h>
       
    23 
       
    24 class CCalSessionImpl;
       
    25 class MCalChangeCallBack2;
       
    26 class CCalSession;
       
    27 class CCalCalendarInfo;
       
    28 class MCalFileChangeObserver;
       
    29 
       
    30 /** A handle to the calendar file.
       
    31 
       
    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.
       
    34 
       
    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.
       
    38 
       
    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 
       
    43 has been replaced. 
       
    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.
       
    46 
       
    47 The session object must not be destroyed until all the objects which where created by referencing it 
       
    48 have been destroyed.
       
    49 
       
    50 @publishedAll
       
    51 @released
       
    52 */
       
    53 NONSHARABLE_CLASS(CCalSession) : public CBase
       
    54     {
       
    55 public:
       
    56 	IMPORT_C static CCalSession* NewL();
       
    57 	IMPORT_C static CCalSession* NewL(CCalSession& aCalSession);
       
    58 	IMPORT_C ~CCalSession();
       
    59 
       
    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;
       
    64 
       
    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();
       
    76 	
       
    77 	IMPORT_C void EnablePubSubNotificationsL();
       
    78 	IMPORT_C void DisablePubSubNotificationsL();
       
    79 	
       
    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;
       
    85 	
       
    86 	// debug only
       
    87 /**
       
    88 @publishedPartner
       
    89 @released
       
    90 */
       
    91 	IMPORT_C void _DebugSetHeapFailL(RAllocator::TAllocFail aFail, TInt aRate);
       
    92 
       
    93 /**
       
    94 @publishedPartner
       
    95 @released
       
    96 */
       
    97 	IMPORT_C TInt _DebugRequestAllocatedCellsL();
       
    98 
       
    99 	// deprecated
       
   100 	IMPORT_C void StartChangeNotification(MCalChangeCallBack* aCallBack, MCalChangeCallBack::TChangeEntryType aChangeEntryType,	TBool aIncludeUndatedTodos,	TTime aFilterStartTime,	TTime aFilterEndTime);
       
   101 	
       
   102 	IMPORT_C void __dbgClearTzClientCacheL(TBool aRestartCaching);
       
   103 
       
   104 	IMPORT_C TInt _DebugRequestAllocatedHeapSizeL();
       
   105 	
       
   106 public:
       
   107 	CCalSessionImpl& Impl() const;
       
   108 	  
       
   109 private:
       
   110 	CCalSession();
       
   111 	void ConstructL();
       
   112 	void ConstructL(CCalSession& aCalSession);
       
   113 private:
       
   114 	CCalSessionImpl* iImpl;
       
   115 	};
       
   116 	
       
   117 #endif // __CALSESSION_H__