|
1 #ifndef AGNVERSIT2IMPORTER_H |
|
2 #define AGNVERSIT2IMPORTER_H/* |
|
3 * Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). |
|
4 * All rights reserved. |
|
5 * This component and the accompanying materials are made available |
|
6 * under the terms of "Eclipse Public License v1.0" |
|
7 * which accompanies this distribution, and is available |
|
8 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
9 * |
|
10 * Initial Contributors: |
|
11 * Nokia Corporation - initial contribution. |
|
12 * |
|
13 * Contributors: |
|
14 * |
|
15 * Description: Implements the import functionality of CAgnVersit2 |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 // System includes. |
|
22 #include <calentry.h> // for CCalEntry::TType |
|
23 #include "ICalRuleSegment.h" |
|
24 |
|
25 // User includes. |
|
26 #include "MAgnImpUtil.h" |
|
27 |
|
28 // Forward class declarations. |
|
29 class CAgnVersit2StringProvider; |
|
30 class CICal; |
|
31 class CICalComponent; |
|
32 class CICalProperty; |
|
33 class CTzRules; |
|
34 class RReadStream; |
|
35 |
|
36 /** |
|
37 Implementation class for CAgnVersit2::ImportL. |
|
38 @internalTechnology |
|
39 */ |
|
40 class CAgnVersit2Importer : public CBase, public MAgnImpUtil |
|
41 { |
|
42 private: // Types |
|
43 /** |
|
44 Nested class used internally to maintain a set of rules searchable by TZID. |
|
45 @internalTechnology |
|
46 */ |
|
47 class CTzNamedRules : public CBase |
|
48 { |
|
49 public: // Construction/destruction |
|
50 CTzNamedRules(); |
|
51 ~CTzNamedRules(); |
|
52 |
|
53 public: // Members |
|
54 CTzRules* iRules; |
|
55 HBufC* iName; |
|
56 }; |
|
57 |
|
58 public: // Construction/destruction. |
|
59 static CAgnVersit2Importer* NewL(CAgnVersit2StringProvider& aStringProvider); |
|
60 static CAgnVersit2Importer* NewLC(CAgnVersit2StringProvider& aStringProvider); |
|
61 ~CAgnVersit2Importer(); |
|
62 |
|
63 public: // Methods. |
|
64 void ImportL(RPointerArray<CCalEntry>& aEntries, RReadStream& aReadStream, MAgnImportObserver& aObserver); |
|
65 |
|
66 private: // Construction. |
|
67 CAgnVersit2Importer(CAgnVersit2StringProvider& aStringProvider); |
|
68 void ConstructL(); |
|
69 |
|
70 private: // Methods. |
|
71 void ImportICalL(RPointerArray<CCalEntry>& aEntries, CICal& aCal); |
|
72 |
|
73 // Import component methods. |
|
74 void ImportComponentL(const CICal& aCal, const CICalComponent& aComponent, RPointerArray<CCalEntry>& aEntries); |
|
75 void ImportAlarmL(const CICalComponent& aComponent, CCalEntry& aEntry, const HBufC8& aUid, const TCalTime* aStartTime); |
|
76 void ImportEntryL(const CICal& aCal, const CICalComponent& aComponent, RPointerArray<CCalEntry>& aEntries, HBufC8* aUid, CCalEntry::TType aType); |
|
77 CCalEntry* CreateEntryLC(const CICal& aCal, const CICalComponent& aComponent, HBufC8* aUid, CCalEntry::TType aType); |
|
78 void ImportPropertyL(CCalEntry& aEntry, const CICalProperty& aProperty); |
|
79 void ImportTimezoneL(const CICalComponent& aTimezone); |
|
80 void ImportTimezoneIntervalL(const CICalComponent& aInterval, CTzRules& aRules); |
|
81 |
|
82 // Import property methods. |
|
83 void ImportCategoriesL(const CICalProperty& aProperty, CCalEntry& aEntry) const; |
|
84 void ImportClassL(const CICalProperty& aProperty, CCalEntry& aEntry); |
|
85 TBool ImportRRuleL(const CICalProperty& aProperty, CCalEntry& aEntry, const TCalTime& aStartTime); |
|
86 |
|
87 // Helper methods. |
|
88 void GetCalTimeL(const CICalProperty& aProperty, TCalTime& aTime, TValueType aValueType, TInt aValue = 0); |
|
89 TInt FindRuleSegment(const RPointerArray<CICalRuleSegment>& aRules, CICalRuleSegment::TSegmentType aType) const; |
|
90 const CTzRules* FindTzRule(const TDesC& aName) const; |
|
91 void ReportErrorL(MAgnImportObserver::TImpError aType, const TDesC8& aUid, const TDesC& aContext, TBool aCanContinue = ETrue); |
|
92 |
|
93 private: // Members. |
|
94 CAgnVersit2StringProvider& iStringProvider; |
|
95 MAgnImportObserver* iImportObserver; |
|
96 MAgnImportObserver::TImpResponse iResponse; |
|
97 RPointerArray<CTzNamedRules> iTzRules; |
|
98 const CTzRules* iCurrentTzRules; // This is not owned by the class and should not be deleted by the class. |
|
99 TBool iNeedsTzRules; |
|
100 }; |
|
101 |
|
102 #endif // AGNVERSIT2IMPORTER_H |
|
103 |
|
104 // End of file. |