|
1 /* |
|
2 * Copyright (c) 2005-2009 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 "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: Implements the export functionality of CESMRAgnVersit2 |
|
15 * |
|
16 * |
|
17 */ |
|
18 |
|
19 #ifndef CESMRAGNVERSIT2EXPORTER_H |
|
20 #define CESMRAGNVERSIT2EXPORTER_H |
|
21 |
|
22 // Agenda includes. |
|
23 #include <calentry.h> // for CCalEntry::TReplicationStatus |
|
24 #include <caluser.h> // for CCalAttendee::TCalRole |
|
25 |
|
26 // Forward class declarations. |
|
27 class CESMRAgnVersit2StringProvider; |
|
28 class CESMRICal; |
|
29 class CESMRICalComponent; |
|
30 class CESMRICalProperty; |
|
31 class CTzRules; |
|
32 class MESMRAgnExportObserver; |
|
33 class RWriteStream; |
|
34 |
|
35 /** |
|
36 * Implementation class for CESMRAgnVersit2::ExportL. |
|
37 * @internalTechnology |
|
38 */ |
|
39 class CESMRAgnVersit2Exporter : public CBase |
|
40 { |
|
41 public: // Construction/destruction. |
|
42 /** |
|
43 * Constructs a new CESMRAgnVersit2Exporter and returns it. |
|
44 * @param aObserver Application interface for error reporting. |
|
45 * @param aWriteStream Stream to write output to. |
|
46 * @param aStringProvider localisable string resources |
|
47 * @return The new CESMRAgnVersit2Exporter |
|
48 * @internalTechnology |
|
49 */ |
|
50 static CESMRAgnVersit2Exporter* NewL(CESMRAgnVersit2StringProvider& aStringProvider); |
|
51 |
|
52 /** |
|
53 * Constructs a new CESMRAgnVersit2Exporter and returns it. |
|
54 * A pointer to the new object is left on the cleanup stack. |
|
55 * @param aObserver Application interface for error reporting. |
|
56 * @param aWriteStream Stream to write output to. |
|
57 * @param aStringProvider localisable string resources |
|
58 * @return The new CESMRAgnVersit2Exporter |
|
59 * @internalTechnology |
|
60 */ |
|
61 static CESMRAgnVersit2Exporter* NewLC(CESMRAgnVersit2StringProvider& aStringProvider); |
|
62 |
|
63 /** |
|
64 * C++ Destructor. |
|
65 */ |
|
66 ~CESMRAgnVersit2Exporter(); |
|
67 |
|
68 public: // Methods. |
|
69 /** |
|
70 * Exports a given calendar entry. |
|
71 * @param aEntry entry to export. |
|
72 * @param aFlags not used. |
|
73 * @internalTechnology |
|
74 */ |
|
75 void ExportL(const CCalEntry& aEntry, |
|
76 RWriteStream& aWriteStream, |
|
77 TUint aExportFlags, |
|
78 MESMRAgnExportObserver& aObserver); |
|
79 |
|
80 /** |
|
81 * Exports an array of calendar entries to a single iCalendar |
|
82 * @param aEntries array of entries to export. |
|
83 * @param aFlags not used. |
|
84 * @internalTechnology |
|
85 */ |
|
86 void ExportL(RPointerArray<CCalEntry>& aEntries, |
|
87 RWriteStream& aWriteStream, |
|
88 TUint aExportFlags, |
|
89 MESMRAgnExportObserver& aObserver); |
|
90 |
|
91 public: |
|
92 /** |
|
93 * Constructs mail address buffer, |
|
94 * inserts MAILTO: prefix if it's not already available |
|
95 * @param aAddress Mail address |
|
96 * @internalTechnology |
|
97 */ |
|
98 static HBufC* ConstructMailtoPropertyLC(const TDesC& aAddress); |
|
99 |
|
100 private: // Construction. |
|
101 CESMRAgnVersit2Exporter(CESMRAgnVersit2StringProvider& aStringProvider); |
|
102 |
|
103 void ConstructL(); |
|
104 |
|
105 private: // Methods. |
|
106 CESMRICal* AddICalLC(const CCalEntry& aEntry) const; |
|
107 |
|
108 // Add Component methods. |
|
109 void AddAnnivL(CESMRICalComponent& aAnniv, const CCalEntry& aEntry) const; |
|
110 void AddAlarmL(CESMRICalComponent& aComponent, const CCalEntry& aEntry) const; |
|
111 void AddApptL(CESMRICalComponent& aAppt, const CCalEntry& aEntry) const; |
|
112 void AddComponentL(CESMRICal& aICal, const CCalEntry& aEntry) const; |
|
113 void AddEventL(CESMRICalComponent& aEvent, const CCalEntry& aEntry) const; |
|
114 void AddReminderL(CESMRICalComponent& aReminder, const CCalEntry& aEntry) const; |
|
115 void AddTimezoneL(CESMRICal& aICal, const CCalEntry& aEntry); |
|
116 void AddTodoL(CESMRICalComponent& aTodo, const CCalEntry& aEntry) const; |
|
117 |
|
118 // Add Property methods. |
|
119 void AddAttendeePropertiesL(CESMRICalComponent& aComponent, const CCalEntry& aEntry) const; |
|
120 void AddCategoriesPropertyL(CESMRICalComponent& aComponent, const CCalEntry& aEntry)const ; |
|
121 void AddClassPropertyL(CESMRICalComponent& aComponent, const CCalEntry& aEntry) const; |
|
122 void AddExceptionDatePropertyL(CESMRICalComponent& aComponent, const CCalEntry& aEntry) const; |
|
123 void AddIntegerPropertyL(CESMRICalComponent& aComponent, TInt aInt, const TDesC& aProperty) const; |
|
124 void AddOrganizerPropertyL(CESMRICalComponent& aComponent, const CCalEntry& aEntry) const; |
|
125 void AddTextPropertyL(CESMRICalComponent& aComponent, const TDesC& aText, const TDesC& aProperty) const; |
|
126 void AddRDatePropertyL(CESMRICalComponent& aComponent, const CCalEntry& aEntry) const; |
|
127 void AddRRulePropertyL(CESMRICalComponent& aComponent, const CCalEntry& aEntry)const; |
|
128 CESMRICalProperty& AddDateTimePropertyL(CESMRICalComponent& aComponent, const TCalTime& aTime, const TDesC& aProperty) const; |
|
129 CESMRICalProperty& AddFloatingDateTimePropertyL(CESMRICalComponent& aComponent, const TTime& aFloatingTime, const TDesC& aProperty) const; |
|
130 CESMRICalProperty& AddUtcDateTimePropertyL(CESMRICalComponent& aComponent, const TTime& aUtcTime, const TDesC& aProperty) const; |
|
131 |
|
132 // Helper methods. |
|
133 static const TDesC& ClassStringL(const CCalEntry::TReplicationStatus aStatus); |
|
134 const TDesC& CategoryStringL(const CCalCategory& aCategory) const; |
|
135 static const TDesC& RoleFromEnum(CCalAttendee::TCalRole aRole); |
|
136 static const TDesC& StatusFromEnum(CCalAttendee::TCalStatus aStatus); |
|
137 static const TDesC& DayFromInt(TUint8 aDayInt); |
|
138 static const TDesC& DayFromTDay(TDay aDay); |
|
139 static TInt WeekNumFromDayOfMonth(TInt aDayOfMonth); |
|
140 |
|
141 private: // Members. |
|
142 MESMRAgnExportObserver* iObserver; |
|
143 CESMRAgnVersit2StringProvider& iStringProvider; |
|
144 RPointerArray<HBufC> iTzNameArray; |
|
145 RPointerArray<CTzRules> iTimeZoneArray; |
|
146 TUint iExportProperties; |
|
147 TInt iTimezoneIndex; |
|
148 }; |
|
149 |
|
150 #endif // CESMRAGNVERSIT2EXPORTER_H |
|
151 |
|
152 // End of file. |