diff -r 000000000000 -r f979ecb2b13e pimappservices/calendarvcalplugin/Inc/agnversit.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pimappservices/calendarvcalplugin/Inc/agnversit.h Tue Feb 02 10:12:19 2010 +0200 @@ -0,0 +1,136 @@ +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +/** + @file + @internalComponent +*/ + +#ifndef __AGNVERSIT_H__ +#define __AGNVERSIT_H__ + +#include +#include +#include +#include +#include "calversit.h" +#include + +#include "agmvcal.h" + +class TTzRule; +class CAgnVCalConverter; + +class CCalImportExportActive : public CActive + { +public: + CCalImportExportActive(CAgnVCalConverter& aConverter); + ~CCalImportExportActive(); + void Start(); + + // from CActive + void RunL(); + void DoCancel(); + TInt RunError(TInt aError); +private: + CAgnVCalConverter& iConverter; + }; + +class CAgnVCalConverter : public CAgnVersit + { +public: + + enum TState + { + EIdle, + EImporting, + EExporting, + }; + + static CAgnVCalConverter* NewL(); + +//from MAgnVersit + void ImportVCalL(TInt aFlags, RReadStream& aReadStream, RPointerArray& aEntryArray); + void ExportVCalL(RWriteStream& aWriteStream, const RPointerArray& aEntryArray, const Versit::TVersitCharSet aCharSet); + + ~CAgnVCalConverter(); + + void ImportVCalAsyncL(TInt aFlags, RReadStream& aReadStream, RPointerArray& aEntryArray, MCalDataExchangeCallBack& aObserver); + void ExportVCalAsyncL(RWriteStream& aWriteStream, RPointerArray& aCalEntryArray, MCalDataExchangeCallBack& aObserver, const Versit::TVersitCharSet aCharSet); +//To be called by CCalImportExportActive + void NextExportStepL(); + void NextImportStepL(); + void CancelImportExport(TInt aError = KErrNone); + CAgnVCalConverter::TState AsyncState() const; +private: + void ConstructL(); + + CTzRules* ImportTzRulesL(CParserVCal& aCalParser) const; + CTzRules* DaylightRulesL(CParserVCal& aCalParser, TTimeIntervalMinutes aStdOffset) const; + TTzRule TzRuleL(TTimeIntervalMinutes aOldTzOffset, TTimeIntervalMinutes aNewTzOffset, TTime aStartTime, TTime aEndTime) const; + TTimeIntervalMinutes StandardTimeOffsetL(CParserVCal& aCalParser) const; + TBool ValidDaylightProperty(CParserProperty& aDaylightProperty) const; + void ConvertEntryToVCalAndExportL(CParserVCal* aVcal, const RPointerArray& aEntryArray, RWriteStream& aWriteStream); + void ExportEntryBySameTzL(RWriteStream& aWriteStream); + void ExportEntryWithoutTzRuleL(RWriteStream& aWriteStream); + void FindEntryWithoutTzRuleL(RPointerArray& aSameTzEntry); + void FindSameTzEntryL(RPointerArray& aSameTzEntry); + void CheckCompletion(); + void InitialiseSameTzEntryArrayL(); +private: + TBool iTzConnected; + RTz iTzServer; + + // for asynchronous import / export + MCalDataExchangeCallBack* iObserver; + + CCalImportExportActive* iImportExportActive; + RPointerArray* iEntryArray; //Not owned + RPointerArray* iSametzEntries; //Not owned. The entries with same tz rule or do have tz rules + RPointerArray* iVCalArray; //Array of vCal used when importing asynchronously. + RArray iEntryIndexToExport;//Each of its element is the index of the entries in the array of iEntryArray + + CVCalToAgendaEntryConverter* iImportConverter; + CAgendaEntryToVCalConverter* iExportConverter; + Versit::TVersitCharSet iCharSet; + + RWriteStream* iWriteStream; + CParserVCal* iVCal; + TState iAsyncState; + + TInt iTotalNumEntry; //The number of entries + TInt iTotalCounter; //The counter out of total entries + TInt iSameTzCounter; //The counter out of number of entries with the particular tz + TInt iMaxNumEntryInStep; //The maxum number of entries to import\export in one step + }; + +/** +@internalComponent +@released +*/ +enum TAgnVersitPanic + { + EAgnVersitPanicNotNull, + EAgnVersitPanicNoEntryArray, + EAgnVersitPanicNoAAlarmProps, + EAgnVersitPanicWrongTimeType, + EAgnVersitWrongAttribute, + EAgnVersitPanicWrongArgument, + EAgnVersitPanicImportExportFailure + }; + +extern void Panic(TAgnVersitPanic aPanic); + +#endif