|
1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #ifndef __AGMENTRY_H__ |
|
17 #define __AGMENTRY_H__ |
|
18 |
|
19 #include "agmsimpleentry.h" |
|
20 #include "agmgsentry.h" |
|
21 |
|
22 // ------------------------- Referenced clases ------------------------------ |
|
23 |
|
24 class CAgnContent; |
|
25 class CAgnAttendee; |
|
26 class CAgnAttachment; |
|
27 class CAgnCategory; |
|
28 // ------------------------------------------------------------------------- |
|
29 |
|
30 const TReal KGEODefaultValue = -999.999; |
|
31 |
|
32 /** |
|
33 When an entry is added, this struct returns information from the server to the client |
|
34 about any changes/assignment of IDs related to the entry, so that the client-side entry |
|
35 can be updated. |
|
36 @internalComponent |
|
37 */ |
|
38 struct TAgnEntryParameters |
|
39 { |
|
40 TAgnEntryId iEntryId; |
|
41 TCalLocalUid iLocalId; |
|
42 TTime iRecurrenceId; |
|
43 TTime iLastModifiedDateUtc; |
|
44 CalCommon::TRecurrenceRange iRecurrenceRange; |
|
45 TStreamId iTzStreamId; |
|
46 TBool iSystemTzRule; |
|
47 }; |
|
48 |
|
49 NONSHARABLE_CLASS(CAgnEntry) : public CAgnSimpleEntry |
|
50 /** Class representing a full agenda entry. |
|
51 |
|
52 CAgnEntry adds common entry information including summary, description, location, |
|
53 categories and attendees to CAgnSimpleEntry. |
|
54 |
|
55 To find the type of an entry or instance, use CAgnSimpleEntry::Type(). |
|
56 |
|
57 On the client-side, a CAgnEntry is created whenever CCalEntry::NewL is called, and whenever a |
|
58 CCalEntry is fetched from the calendar store. When a CCalInstance is fetched from the calendar store, |
|
59 it will contain a 'light entry' (i.e. a CAgnSimpleEntry), but if any operation is made on that light |
|
60 entry which cannot be handled by CAgnSimpleEntry, the full CAgnEntry will be loaded. |
|
61 |
|
62 On the server-side, CAgnEntry is externalized and internalized to streams in the calendar file. |
|
63 CAgnEntry is not used in any of the indexes. |
|
64 |
|
65 @internalComponent |
|
66 @released |
|
67 */ |
|
68 { |
|
69 public: |
|
70 |
|
71 /** Used with summary, description and alarm action to indicate if the data has changed. |
|
72 These items are all stored on file in separate streams to the entry that owns them.*/ |
|
73 enum TAgnDataChange |
|
74 { |
|
75 EAgnDataNoChange, |
|
76 EAgnDataDeleted, |
|
77 EAgnDataAdded, |
|
78 EAgnDataUpdated |
|
79 }; |
|
80 |
|
81 // construction / destruction |
|
82 IMPORT_C static CAgnEntry* NewL(CCalEntry::TType aType); |
|
83 IMPORT_C static CAgnEntry* NewL(RReadStream& aStream); |
|
84 IMPORT_C static CAgnEntry* NewL(CCalEntry::TType aType, HBufC8* aUid, CCalEntry::TMethod aMethod, TUint aSeqNum); |
|
85 IMPORT_C static CAgnEntry* NewL(CCalEntry::TType aType, HBufC8* aUid, CCalEntry::TMethod aMethod, TUint aSeqNum, |
|
86 const TAgnCalendarTime& aRecurrenceId, CalCommon::TRecurrenceRange aRange); |
|
87 |
|
88 IMPORT_C ~CAgnEntry(); |
|
89 |
|
90 // Alarm properties |
|
91 IMPORT_C const TDesC& AlarmSoundName() const; |
|
92 IMPORT_C void SetAlarmSoundNameL(const TDesC& aAlarmSoundName); |
|
93 IMPORT_C void ClearAlarm(); |
|
94 |
|
95 IMPORT_C void SetAlarmAction(CAgnContent* aAlarmAction); |
|
96 IMPORT_C CAgnContent* AlarmAction() const; |
|
97 IMPORT_C TBool AlarmActionIsLoaded() const; |
|
98 IMPORT_C TAgnDataChange AlarmActionChange() const; |
|
99 |
|
100 IMPORT_C void SetAlarmActionStreamId(const TStreamId& aStreamId); |
|
101 IMPORT_C const TStreamId& AlarmActionStreamId() const; |
|
102 |
|
103 // Synchronisation status |
|
104 IMPORT_C void SetReplicationStatusL(CCalEntry::TReplicationStatus aReplicationStatus); |
|
105 IMPORT_C CCalEntry::TReplicationStatus ReplicationStatus() const; |
|
106 |
|
107 // Persistence |
|
108 IMPORT_C void ExternalizeL(RWriteStream& aStream) const; |
|
109 IMPORT_C void InternalizeL(RReadStream& aStream); |
|
110 |
|
111 IMPORT_C void ExternalizeToBufferL(RWriteStream& aStream) const; |
|
112 IMPORT_C void InternalizeFromBufferL(RReadStream& aStream); |
|
113 |
|
114 IMPORT_C void VerifyBeforeStoreL(); |
|
115 |
|
116 // copy and compare |
|
117 IMPORT_C TBool CompareL(const CAgnEntry& aEntry) const; |
|
118 IMPORT_C void CopyFromL(const CAgnEntry& aSource, CCalEntry::TCopyType aCopyType); |
|
119 IMPORT_C CAgnEntry* CloneL() const; |
|
120 |
|
121 // summary, location, description |
|
122 IMPORT_C void SetSummary(HBufC* aSummary); // takes ownership |
|
123 IMPORT_C const TDesC& Summary() const; |
|
124 IMPORT_C TBool SummaryIsLoaded() const; |
|
125 IMPORT_C TAgnDataChange SummaryChange() const; |
|
126 IMPORT_C const TStreamId& SummaryStreamId() const; |
|
127 IMPORT_C void SetSummaryStreamId(const TStreamId& aStreamId); |
|
128 |
|
129 IMPORT_C void SetLocationL(const TDesC& aLocation); |
|
130 IMPORT_C const TDesC& Location() const; |
|
131 |
|
132 IMPORT_C void SetDescription(HBufC* aText); // takes ownership |
|
133 IMPORT_C const TDesC& Description() const; |
|
134 IMPORT_C TBool DescriptionIsLoaded() const; |
|
135 IMPORT_C const TStreamId& DescriptionStreamId() const; |
|
136 IMPORT_C void SetDescriptionStreamId(const TStreamId& aStreamId); |
|
137 IMPORT_C TAgnDataChange DescriptionChange() const; |
|
138 |
|
139 // dtstamp |
|
140 IMPORT_C void SetDTStampUtcL(const TTime& aDTStampUtc); |
|
141 IMPORT_C const TTime& DTStampUtcL() const; |
|
142 |
|
143 // busy status |
|
144 IMPORT_C void SetBusyStatusL(CCalEntry::TTransp aBusyStatus); |
|
145 IMPORT_C CCalEntry::TTransp BusyStatus() const; |
|
146 |
|
147 // GEO |
|
148 IMPORT_C void GeoValue(TReal& aLatitude, TReal& aLongitude) const; |
|
149 IMPORT_C void SetGeoValueL(const TReal& aLatitude, const TReal& aLongitude); |
|
150 |
|
151 // Categories |
|
152 IMPORT_C TInt CategoryCount() const; |
|
153 IMPORT_C void AddCategoryL(CAgnCategory* aCategory); // takes ownership |
|
154 IMPORT_C CAgnCategory& FetchCategory(TInt aIndex) const; |
|
155 IMPORT_C void DeleteCategory(TInt aIndex); |
|
156 TBool CategoryExist(CAgnCategory& aSearchCategory) const; |
|
157 |
|
158 // Attendees |
|
159 IMPORT_C TInt AttendeeCount() const; |
|
160 IMPORT_C void AddAttendeeL(CAgnAttendee* aAttendee); // takes ownership |
|
161 IMPORT_C CAgnAttendee& FetchAttendee(TInt aIndex) const; |
|
162 IMPORT_C void DeleteAttendee(TInt aIndex); |
|
163 |
|
164 IMPORT_C void SetOrganizerL(CAgnAttendee* aAttendee); // takes ownership |
|
165 IMPORT_C CAgnAttendee* Organizer() const; |
|
166 IMPORT_C void SetPhoneOwnerL(CAgnAttendee* aOwner); // takes ownership |
|
167 IMPORT_C CAgnAttendee* PhoneOwner() const; |
|
168 void CreateAttendeeListL(); |
|
169 |
|
170 // attachments |
|
171 IMPORT_C void AddAttachmentL(CAgnAttachment* aAttachment); // takes ownership |
|
172 IMPORT_C TInt DeleteAttachmentL(const CAgnAttachment& aAttachment); |
|
173 IMPORT_C CAgnAttachment& Attachment(TInt aIndex) const; |
|
174 IMPORT_C TInt AttachmentCount() const; |
|
175 |
|
176 // Group Scheduling data |
|
177 TAgnCalendarTime GetChildRecurrenceId(TCalLocalUid aChildId) const; |
|
178 |
|
179 IMPORT_C CGsData::TGsDataType GsDataType() const; |
|
180 IMPORT_C void SetMethod(CCalEntry::TMethod aMethod); |
|
181 IMPORT_C CCalEntry::TMethod Method() const; |
|
182 IMPORT_C void SetGuid(HBufC8* aGuid); // takes ownership |
|
183 IMPORT_C const TDesC8& Guid() const; |
|
184 IMPORT_C void SetSequenceNumber(TInt aSeqNum); |
|
185 IMPORT_C TInt SequenceNumber() const; |
|
186 IMPORT_C TAgnCalendarTime RecurrenceId() const; |
|
187 IMPORT_C CalCommon::TRecurrenceRange RecurrenceRange() const; |
|
188 |
|
189 IMPORT_C TBool HasChildren() const; |
|
190 |
|
191 // Child entry data |
|
192 IMPORT_C void SetRecurrenceIdFromParentL(const CAgnEntry& aParentEntry); |
|
193 IMPORT_C TCalLocalUid ParentId() const; |
|
194 IMPORT_C void SetParentId(TCalLocalUid aParentId); |
|
195 IMPORT_C void UpdateRecurrenceIdL(const TAgnCalendarTime& aRecId); |
|
196 IMPORT_C void SetRecurrenceRangeL(CalCommon::TRecurrenceRange aRange); |
|
197 //Parent entry data |
|
198 IMPORT_C const RArray<TGsChildRefData>& ChildIds() const; |
|
199 IMPORT_C void AddChildIdL(const TGsChildRefData& aChildRefData); |
|
200 IMPORT_C void RemoveChildId(TCalLocalUid aId); |
|
201 IMPORT_C void PruneRDatesL(const TAgnCalendarTime& aRecurrenceId, CalCommon::TRecurrenceRange aRange); |
|
202 |
|
203 // User integer. |
|
204 IMPORT_C void SetUserInt( TUint32 aUserInt ); |
|
205 IMPORT_C TUint32 UserInt() const; |
|
206 |
|
207 private: |
|
208 // following enums for internal use only |
|
209 enum TFlags |
|
210 { |
|
211 EAgnAlarmActionDeleted = 0x01, |
|
212 }; |
|
213 |
|
214 void SetFlagOn(TFlags aFlag); |
|
215 void SetFlagOff(TFlags aFlag); |
|
216 TBool IsFlagSet(TFlags aFlag) const; |
|
217 |
|
218 CAgnEntry(CCalEntry::TType aType); |
|
219 void ConstructL(HBufC8* aUid, CCalEntry::TMethod aMethod, TUint aSeqNum); |
|
220 void ConstructL(HBufC8* aUid, CCalEntry::TMethod aMethod, TUint aSeqNum, |
|
221 const TAgnCalendarTime& aRecurrenceId, CalCommon::TRecurrenceRange aRange); |
|
222 |
|
223 void ExternalizeGsDataL(RWriteStream& aStream, TBool aToBuffer) const; |
|
224 void InternalizeGsDataL(RReadStream& aStream, TBool aFromBuffer); |
|
225 |
|
226 void ExternalizeEntryL(RWriteStream& aStream, TBool aToBuffer=EFalse) const; |
|
227 void InternalizeEntryL(RReadStream& aStream, TBool aFromBuffer=EFalse); |
|
228 |
|
229 |
|
230 private: |
|
231 |
|
232 CGsData* iGsData; // the group scheduling data |
|
233 |
|
234 HBufC* iSummary; |
|
235 TStreamId iSummaryStreamId; |
|
236 HBufC* iDescription; |
|
237 TStreamId iDescriptionStreamId; |
|
238 HBufC* iLocation; |
|
239 TTime iDTStampUtc; |
|
240 |
|
241 CAgnContent* iAlarmAction; |
|
242 TStreamId iAlarmActionStreamId; |
|
243 HBufC* iAlarmSoundName;// the alarm pre-time is stored in CAgnSimpleEntry |
|
244 RPointerArray<CAgnAttendee>* iAttendeeList; |
|
245 CAgnAttendee* iPhoneOwner; |
|
246 CAgnAttendee* iMeetingOrganizer; |
|
247 RPointerArray<CAgnCategory>* iCategoryList; |
|
248 RPointerArray<CAgnAttachment>* iAttachments; |
|
249 |
|
250 TUint8 iBusyStatus; |
|
251 TUint8 iReplicationStatus; |
|
252 TUint16 iFlags; |
|
253 TReal iLatitude; |
|
254 TReal iLongitude; |
|
255 }; |
|
256 |
|
257 #endif |