serviceproviders/sapi_calendar/calendarservice/inc/calendargetlist.h
changeset 22 fc9cf246af83
child 24 f4292e0e20df
equal deleted inserted replaced
19:989d2f495d90 22:fc9cf246af83
       
     1 /*
       
     2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Interface to GetListing the contents to a Calender
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CALENDARGETLIST_H_
       
    20 #define CALENDARGETLIST_H_
       
    21 
       
    22 
       
    23 //System Includes
       
    24 #include <e32base.h>
       
    25 
       
    26 
       
    27 //Forward Declarations
       
    28 class CCalSession;
       
    29 class CCalEntryView;
       
    30 class CCalendarSessionInfo;
       
    31 class MCalCallbackBase;
       
    32 class CCalendarFilter;
       
    33 class CCalEntry;
       
    34 class CCalInstance;
       
    35 
       
    36 /**
       
    37  *  This class provides functionality for Calendar GetList
       
    38  *  provides four versions of GetList Functionality Sync and Async 
       
    39  *  @since S60_3_2_200726
       
    40  */
       
    41 class CCalendarGetList : public CCalendarASyncRequest/*, public CActive*/
       
    42 	{
       
    43 	
       
    44     enum TGetListOption
       
    45         {
       
    46         EGetListAll = 0,
       
    47         EGetListGUid,
       
    48         EGetListLocalUid,
       
    49         EGetListTimeRange,
       
    50         };
       
    51 	
       
    52 	public: //*********************Public Members(Behaviours)******************************************/
       
    53 	
       
    54 		/**
       
    55 		 * Static Method which either returns the Two Phase constructed Object or Leave 
       
    56 		 *
       
    57 		 * @param CCalendarSessionInfo  to set the iCalenderSessionInfo which is used to access various resources
       
    58 		 *										like CCalSession, CCalEntryView etc
       
    59 		 * @param aFormat used to set the iFormat it can be either ICAL or VCAL, two popular Calendar formats
       
    60 		 *
       
    61 		 * @param aInputBuffer contains the data to be GetListed to the specified calendar
       
    62 		 * 
       
    63 		 * @param CAsyncRequestObserver For ASyncronous usage of this Object this paramater is set / Default is NULL
       
    64 		 *											Set in case of Asynchronous call only
       
    65 		 * @param MCalCallbackBase      For Asyncronous usage of this Object this paramater is set
       
    66 		 *				
       
    67 		 * NOTE: Ownership of any of the parameters is not taken through this function call
       
    68 		 * NOTE: Therefore the User of this function needs to take care of neccessary cleanup of passed parameters		
       
    69 		 * @return CCalendarExport
       
    70 		 */
       
    71 		static CCalendarGetList* NewL ( CCalendarSessionInfo* aCalSessionInfo,  
       
    72                                         const TDesC8& aGuid, 
       
    73 										CAsyncRequestObserver* aAsyncRequestObserver = NULL,
       
    74 										MCalCallbackBase* aCallBack = NULL );
       
    75 
       
    76 			static CCalendarGetList* NewL ( CCalendarSessionInfo* aCalSessionInfo,  
       
    77                                         const TCalLocalUid aLocalUid, 
       
    78 										CAsyncRequestObserver* aAsyncRequestObserver = NULL,
       
    79 										MCalCallbackBase* aCallBack = NULL );
       
    80 		
       
    81 		static CCalendarGetList* NewL ( CCalendarSessionInfo* aCalSessionInfo,  
       
    82                                         CCalendarFilter* aFilter, 
       
    83 		                                CAsyncRequestObserver* aAsyncRequestObserver = NULL,
       
    84 		                                MCalCallbackBase* aCallBack = NULL );								
       
    85 		/**
       
    86 		 * Destructor.
       
    87 		 */
       
    88 		~CCalendarGetList();
       
    89 
       
    90         /**
       
    91          * Inherited from MAsyncRequest class 
       
    92          */ 
       
    93         void CancelRequest();
       
    94 
       
    95         /**
       
    96            * Inherited from MAsyncRequest class.
       
    97         */
       
    98       //  TInt32 GetTransactionID();
       
    99 		
       
   100 		/**
       
   101      	  * Synchronous Version of GetList which takes InputBuffer set at the time of Construction of this object through NewL
       
   102      	  * and GetLists them to the Calender opened in CalSession of CalendarSessionInfoL object passed to this object
       
   103           * It sets the LUids and GUids in the aOutputLocalUidArray, this object is not the owner of aOutputLocalUidArray
       
   104           * @since S60_3_2_200726
       
   105           *
       
   106           * @param aOutputLocalUidArray 	Output which is the array of LocalUIDs after StoreL on the Calender file
       
   107           *
       
   108           * @return void
       
   109           */
       
   110 		void GetListL(const TDesC8& aGuid, RPointerArray<CCalEntry>& aEntryList );
       
   111 		
       
   112 		void GetListL(const TCalLocalUid aLocalUid, RPointerArray<CCalEntry>& aEntryList );
       
   113 		
       
   114 		void GetListL( RPointerArray<CCalInstance>& aInstanceList );
       
   115 	
       
   116 		/**
       
   117      	  * ASynchronous Version of GetList which takes InputBuffer set at the time of Construction of this object through NewL
       
   118      	  *                     and GetLists to the Calender(outputis passed through callback)
       
   119           *
       
   120           * @since S60_3_2_200726
       
   121           *
       
   122           * @return void
       
   123           */
       
   124 		void GetListL();
       
   125 		
       
   126 	private: //*********************Private Member(Behaviours)******************************************/
       
   127 	
       
   128 	   /** 
       
   129           * Constructor.
       
   130       	  * @param CCalendarSessionInfo  to set the iCalenderSessionInfo which is used to access various resources
       
   131 		  *										like CCalSession, CCalEntryView etc
       
   132 		  * @param CAsyncRequestObserver For Asyncronous usage of this Object this paramater is set / Default is NULL
       
   133 		  * @param MCalCallbackBase      For Asyncronous usage of this Object this paramater is set
       
   134      	  */
       
   135 	    CCalendarGetList( CCalendarSessionInfo* aCalSessionInfo,
       
   136 						 CAsyncRequestObserver* aAsyncRequestObserver = NULL,
       
   137 						 MCalCallbackBase* aCallBack = NULL );
       
   138 		
       
   139 		/** 
       
   140           * 2nd Phase of Two Phase Construction
       
   141  		  * @param aFormat used to set the iFormat it can be either ICAL or VCAL, two popular Calendar formats
       
   142 		  *
       
   143 		  * @param aInputBuffer contains the data to be GetListed to the specified calendar
       
   144 		  * @return void
       
   145      	  */
       
   146 		void ConstructL( const TDesC8& aGuid );
       
   147 		void ConstructL( const TCalLocalUid aLocalUid );
       
   148 		void ConstructL( CCalendarFilter* aFilter );
       
   149         /** 
       
   150           * Service Functions to Enable Proper Completion of Asynchronous Request called at the end of RUNL to send output
       
   151           * @param aReason  Give the reason it can be KErrNone or any error
       
   152           *
       
   153           * @return void
       
   154           */
       
   155         void NotifyRequestResult( TInt aReason );
       
   156         /**
       
   157           * Inherited from CActive class...Active Object for Aynchronous Support 
       
   158           */ 
       
   159         virtual void DoCancel();
       
   160        
       
   161 
       
   162         /** 
       
   163          * Initializes delete option based in input filter
       
   164         */
       
   165         void InitializeGetListOption();
       
   166 
       
   167         /**
       
   168         * Start Fetching Entries
       
   169         */
       
   170         void StartFetchingL();
       
   171 
       
   172         /**
       
   173         * Gets Entries based on GUid
       
   174         */
       
   175         void GetGUidL();
       
   176         /**
       
   177         * Gets Entries based on LocalUid
       
   178         */
       
   179         void GetLocalUidL();
       
   180 
       
   181         /**
       
   182         * Delete Instances based on Time Range
       
   183         */
       
   184         void GetTimeRangeL();
       
   185 
       
   186 		/**
       
   187 		 * Inherited from CActive class...Active Object for Aynchronous Support
       
   188 		 */ 
       
   189 		virtual void RunL();
       
   190 		
       
   191 		/** 
       
   192           * Service Functions to activate the Asynchronous Request by activating the Active Object using SetActive()
       
   193       	  * @param aReason  Give the reason it can be KErrNone or any error
       
   194 		  *
       
   195 		  * @return void
       
   196      	  */
       
   197 		void ActivateRequest( TInt aReason );
       
   198 				
       
   199 	private: //*********************Private Member(Properties)******************************************/
       
   200 			
       
   201 		/**
       
   202           * This is the handle to CCalendarSessionInfo Service class which is used to access various resources
       
   203 		  *										like CCalSession, CCalEntryView etc
       
   204 		  * Pure USES A Relalationship...This class doesnot own this and So, it wont delete it
       
   205           */	
       
   206 		CCalendarSessionInfo* iSessionInfo ; 
       
   207 		
       
   208 		/**
       
   209      	  * For Syncronous usage of this Object this paramater is set / Default is NULL
       
   210      	  * Own. This class is responsible for deleting it. HAS A Relationship
       
   211      	  */
       
   212 		MCalCallbackBase* iCallBack;
       
   213 		
       
   214 		
       
   215 		/**
       
   216      	  * For Syncronous usage of this Object this paramater is set / Default is NULL
       
   217      	  * Own. This class is responsible for deleting it. HAS A Relationship
       
   218      	  */
       
   219 		
       
   220 		CAsyncRequestObserver* iAsyncRequestObserver;
       
   221 
       
   222         /**
       
   223          * Filter Object
       
   224         */ 
       
   225         CCalendarFilter* iFilter;
       
   226         HBufC8* iGuid;
       
   227         TUint32 iLocalUid;
       
   228 		
       
   229         TGetListOption iGetListOption;
       
   230 	
       
   231         RPointerArray<CCalEntry> iEntryList;
       
   232         
       
   233         RPointerArray<CCalInstance> iInstanceList;
       
   234 	};
       
   235 	
       
   236 
       
   237 #endif CALENDARGETLIST_H_