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 __CCALDATAEXCHANGE_H__ williamr@2: #define __CCALDATAEXCHANGE_H__ williamr@2: williamr@2: #include williamr@2: williamr@2: class CCalDataExchangeImpl; williamr@2: class CCalSession; williamr@2: class RWriteStream; williamr@2: williamr@2: /** The default number of entries to import or export between callbacks. williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: const TInt KDefaultNumberOfEntriesToHandle = 10; williamr@2: williamr@2: /** A call back class to show the progress of long-running operations. williamr@2: williamr@2: When a long-running operation is carried out, this class is used to signal its progress, williamr@2: and when the function is complete. williamr@2: williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: class MCalDataExchangeCallBack williamr@2: { williamr@2: public: williamr@2: /** Progress callback. williamr@2: williamr@2: This calls the observing class with the percentage complete of the current operation. williamr@2: This also propagates any error to the observing class. williamr@2: williamr@2: @param aPercentageCompleted The percentage complete. */ williamr@2: virtual void Progress(TInt aPercentageCompleted) = 0; williamr@2: williamr@2: /** Progress callback. williamr@2: williamr@2: This calls the observing class when the current operation is finished. */ williamr@2: virtual void Completed() = 0; williamr@2: williamr@2: /* Retrieve the number of entries to handle at once. williamr@2: @return The number of entries to handle at once. williamr@2: */ williamr@2: virtual TInt NumberOfEntriesToHandleAtOnce() { return KDefaultNumberOfEntriesToHandle; }; williamr@2: }; williamr@2: williamr@2: /** williamr@2: This class provides functionality for importing and exporting vCal entries. williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: NONSHARABLE_CLASS(CCalDataExchange) : public CBase williamr@2: { williamr@2: public: williamr@2: IMPORT_C static CCalDataExchange* NewL(CCalSession& aSession); williamr@2: IMPORT_C ~CCalDataExchange(); williamr@2: williamr@2: IMPORT_C void ImportL(TUid aDataFormat, RReadStream& aReadStream, RPointerArray& aCalEntryArray); williamr@2: IMPORT_C void ImportL(TUid aDataFormat, RReadStream& aReadStream, RPointerArray& aCalEntryArray, TInt aFlags); williamr@2: IMPORT_C void ExportL(TUid aDataFormat, RWriteStream& aWriteStream, RPointerArray& aCalEntryArray); williamr@2: williamr@2: IMPORT_C void ImportL(TUid aDataFormat, RReadStream& aReadStream, RPointerArray& aCalEntryArray, TInt aFlags, TInt aNumEntries); williamr@2: williamr@2: IMPORT_C void ImportAsyncL(TUid aDataFormat, RReadStream& aReadStream, RPointerArray& aCalEntryArray, MCalDataExchangeCallBack& aObserver, TInt aFlags); williamr@2: IMPORT_C void ExportAsyncL(TUid aDataFormat, RWriteStream& aWriteStream, RPointerArray& aCalEntryArray, MCalDataExchangeCallBack& aObserver); williamr@2: williamr@2: private: williamr@2: CCalDataExchange(); williamr@2: void ConstructL(CCalSession& aSession); williamr@2: williamr@2: private: williamr@2: CCalDataExchangeImpl* iImpl; williamr@2: }; williamr@2: williamr@2: #endif // __CCALDATAEXCHANGE_H__