serviceproviders/sapi_calendar/calendarservice/inc/calendarexport.h
changeset 19 989d2f495d90
equal deleted inserted replaced
14:a36b1e19a461 19:989d2f495d90
       
     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 Exporting the contents of a Calender
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CALENDAREXPORTEXPORT_H_
       
    21 #define CALENDAREXPORTEXPORT_H_
       
    22 
       
    23 //System Includes
       
    24 #include <e32base.h>
       
    25 
       
    26 
       
    27 //Forward Declarations
       
    28 class CCalSession;
       
    29 class CCalEntryView;
       
    30 class CCalenExporter;
       
    31 class CCalendarSessionInfo;
       
    32 class MCalCallbackBase;
       
    33 
       
    34 class CAsyncRequestObserver;
       
    35 class CCalendarExportParams;
       
    36 
       
    37 /**
       
    38  *  This class provides functionality for Calendar Export
       
    39  *  provides Six versions of Export Functionality Sync and Async (3 versions for each)
       
    40  *  @since S60_3_2_200726
       
    41  */
       
    42 class CCalendarExport : public CCalendarASyncRequest/*, public CActive*/
       
    43 	{
       
    44 
       
    45 	public: //*********************Public Members(Behaviours)******************************************/
       
    46 	
       
    47 		/**
       
    48 		 * Static Method which either returns the Two Phase constructed Object or Leave 
       
    49 		 *
       
    50 		 * @param CCalendarSessionInfo  to set the iCalenderSessionInfo which is used to access various resources
       
    51 		 *										like CCalSession, CCalEntryView etc
       
    52 		 * @param aFormat used to set the iFormat it can be either ICAL or VCAL, two popular Calendar formats
       
    53 		 * 
       
    54 		 * @param MAsyncRequestObserver For ASyncronous usage of this Object this paramater is set / Default is NULL
       
    55 		 *											Set in case of Asynchronous call only
       
    56 		 * @param MCalCallbackBase      For Asyncronous usage of this Object this paramater is set
       
    57 		 *				
       
    58 		 * @return CCalendarExport
       
    59 		 */
       
    60 		static CCalendarExport* NewL ( CCalendarSessionInfo* aCalSessionInfo, 
       
    61 											const TDesC8& aFormat, 
       
    62 											CCalendarExportParams* aParams,
       
    63 											CAsyncRequestObserver* aAsyncRequestObserver = NULL,
       
    64 											MCalCallbackBase* aCallBack = NULL );
       
    65 
       
    66 		/**
       
    67 		 * Destructor.
       
    68 		 */
       
    69 		~CCalendarExport();
       
    70 		
       
    71 		/**
       
    72      	  * Synchronous Version of Export which decides the flow basing on the inputs set at the time of Construction 
       
    73 		  *					    of this object through NewL and generates corresponding entries in an Ouput Buffer
       
    74           * @since S60_3_2_200726
       
    75           * @param aOutputBuffer    This Buffer contains the Output (Exported from the calender)
       
    76           *
       
    77           * @return void
       
    78           */
       
    79 		void ExportL( HBufC8*& aOutputBuffer );
       
    80 
       
    81 		/**
       
    82      	  * ASynchronous Version of Export Exports entries basing on the input set at the time of construction of this object througn NewL
       
    83      	  *				all the entries of the Calender(outputis passed through callback)
       
    84      	  *	
       
    85      	  * @since S60_3_2_200726
       
    86      	  *
       
    87           * @return void
       
    88           */
       
    89 		void ExportL();
       
    90 		
       
    91 
       
    92 	private: //*********************Private Member(Behaviours)******************************************/
       
    93 	
       
    94 	    /** 
       
    95           * Constructor.
       
    96       	  * @param CCalendarSessionInfo  to set the iCalenderSessionInfo which is used to access various resources
       
    97 		  *										like CCalSession, CCalEntryView etc
       
    98 		  * @param CAsyncRequestObserver For ASyncronous usage of this Object this paramater is set / Default is NULL
       
    99 		  *											Set in case of Asynchronous call only
       
   100 		  * @param MCalCallbackBase      For Asyncronous usage of this Object this paramater is set
       
   101      	  */
       
   102 		CCalendarExport( CCalendarSessionInfo* aCalSessionInfo, CAsyncRequestObserver* aAsyncRequestObserver = NULL, 
       
   103 																MCalCallbackBase* aCallBack = NULL );
       
   104 		
       
   105 		/** 
       
   106           * 2nd Phase of Two Phase Construction
       
   107           *
       
   108      	  * @param aFormat used to set the iFormat it can be either ICAL or VCAL, two popular Calendar formats  
       
   109 		  *												a local copy is made	
       
   110 		  * NOTE: Ownership of any of the parameters is not taken through this function call
       
   111 		  * @return void				
       
   112      	  */
       
   113 		void ConstructL( const TDesC8& aFormat, CCalendarExportParams* aParams );
       
   114 		
       
   115 		/**
       
   116      	  * Internal Function ExportToBuffer which is called to actually export the data to Buffer
       
   117           *
       
   118           * @since S60_3_2_200726
       
   119           * @param aCalEntryArray 	Calender Entries of the Items to be exported to the Output Buffer
       
   120           *
       
   121           * @param aOutputBuffer 	This Buffer contains the Output (Exported from the calender)
       
   122           *
       
   123           * @return void
       
   124           */
       
   125 		void ExportToBufferL( const RPointerArray<CCalEntry>& aCalEntryArray, HBufC8*& aOutputBuffer );
       
   126 		
       
   127 		/**
       
   128      	  * Internal Function For fetching all CCalEntries of the Calender and call ExportToBuffer
       
   129           * (this is called in case of both Synchronous(EXPORTL where no Local or Global UIDs are specified)and from RUNL of Asynchronous)
       
   130           * @since S60_3_2_200726
       
   131           *
       
   132           * @param aOutputBuffer 	This Buffer contains the Output (Exported from the calender)
       
   133           *
       
   134           * @return void
       
   135           */
       
   136 		void GetCalEntriesAndExportL(HBufC8*& aOutputBuffer);
       
   137 		
       
   138 		/**
       
   139      	  * Internal Function For Conversion of LocalUIDS to CCalEntry and call ExportToBuffer
       
   140           * (this is called in case of Asynchronous from RUNL)
       
   141           * @since S60_3_2_200726
       
   142           *
       
   143           * @param aOutputBuffer 	This Buffer contains the Output (Exported from the calender)
       
   144           *
       
   145           * @return void
       
   146           */
       
   147 		void ConvertLUIDAndExportL(HBufC8*& aOutputBuffer);
       
   148 		
       
   149 		/**
       
   150      	  * Internal Function For Conversion of GlobalUIDS to CCalEntry and call ExportToBuffer
       
   151           * (this is called in case of Asynchronous from RUNL)
       
   152           * @since S60_3_2_200726
       
   153           *
       
   154           * @param aOutputBuffer 	This Buffer contains the Output (Exported from the calender)
       
   155           *
       
   156           * @return void
       
   157           */
       
   158 		void ConvertGUIDAndExportL(HBufC8*& aOutputBuffer);
       
   159 		
       
   160 		/**
       
   161 		 * Inherited from CActive class...Active Object for Aynchronous Support 
       
   162 		 */ 
       
   163 		virtual void DoCancel();
       
   164 
       
   165 		/**
       
   166 		 * Inherited from CActive class...Active Object for Aynchronous Support
       
   167 		 */ 
       
   168 		virtual void RunL();
       
   169 		
       
   170 		/** 
       
   171           * Service Functions to activate the Asynchronous Request by activating the Active Object using SetActive()
       
   172       	  * @param aReason  Give the reason it can be KErrNone or any error
       
   173 		  *
       
   174 		  * @return void
       
   175      	  */
       
   176 		void ActivateRequest( TInt aReason );
       
   177 		
       
   178 		/** 
       
   179           * Service Functions to Enable Proper Completion of Asynchronous Request called at the end of RUNL to send output
       
   180       	  * @param aReason  Give the reason it can be KErrNone or any error
       
   181 		  *
       
   182 		  * @return void
       
   183      	  */
       
   184 		void NotifyRequestResult( TInt aReason );
       
   185 		
       
   186 
       
   187 	private: //*********************Private Member(Properties)******************************************/
       
   188 			
       
   189 		/**
       
   190           * This is the handle to CCalendarSessionInfo Service class which is used to access various resources
       
   191 		  *										like CCalSession, CCalEntryView etc
       
   192 		  * Pure USES A Relalationship...This class doesnot own this and So, it wont delete it
       
   193           */
       
   194 		CCalendarSessionInfo* iCalSessionInfo;   
       
   195 		
       
   196 		/**
       
   197      	  * For Syncronous usage of this Object this paramater is set / Default is NULL
       
   198      	  * Own. This class is responsible for deleting it. HAS A Relationship
       
   199      	  */
       
   200 		MCalCallbackBase* iCallBack;
       
   201 		
       
   202 		/**
       
   203      	  * For Syncronous usage of this Object this paramater is set / Default is NULL
       
   204      	  * Own. This class is responsible for deleting it. HAS A Relationship
       
   205      	  */
       
   206 		CAsyncRequestObserver* iAsyncRequestObserver;
       
   207 
       
   208 		/**
       
   209      	  * Handle to the Library Class Object which provies the Conversion functionality i.e.., export
       
   210      	  * Own. This class is responsible for deleting it. HAS A Relationship
       
   211      	  */
       
   212 		CCalenExporter *iCalenExporter; 
       
   213 	
       
   214 		/**
       
   215      	  * Handle to the Library Class Object which provies the Conversion functionality i.e.., export
       
   216      	  * Own. This class is responsible for deleting it. HAS A Relationship
       
   217      	  */
       
   218 		HBufC8* iFormat;
       
   219 	
       
   220 		/**
       
   221      	  * Handle to the input params. This class takes the responsibility for deleting it. HAS A Relationship
       
   222      	  */
       
   223 		CCalendarExportParams* iParams;
       
   224 
       
   225 		/**
       
   226      	  * Output Buffer used only in case of Asynchronous calls
       
   227      	  * Own. This class takes the responsibility for deleting it. HAS A Relationship
       
   228      	  */	
       
   229 		HBufC8* iOutputBuffer;
       
   230 		
       
   231 	};
       
   232 	
       
   233 
       
   234 #endif CALENDAREXPORTEXPORT_H_