|
1 /* |
|
2 * Copyright (c) 2008 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: Base class for Event item adapters |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CPIMAGNEVENTADAPTER_H |
|
20 #define CPIMAGNEVENTADAPTER_H |
|
21 |
|
22 // INTERNAL INCLUDES |
|
23 #include "cpimagnitemadapter.h" |
|
24 #include "pimevent.h" |
|
25 |
|
26 // FORWARD DECLARATIONS |
|
27 class MPIMEventItem; |
|
28 class MPIMRepeatRuleData; |
|
29 class CCalEntry; |
|
30 |
|
31 // CLASS DECLARATION |
|
32 /** |
|
33 * Event Item Adapter |
|
34 * Does basic conversions between PIM Event items and native calendar |
|
35 * entries. This is a base class for all Event item adapters |
|
36 */ |
|
37 NONSHARABLE_CLASS(CPIMAgnEventAdapter) : public CPIMAgnItemAdapter |
|
38 { |
|
39 public: // Destructor |
|
40 |
|
41 /** |
|
42 * Destructor. |
|
43 */ |
|
44 virtual ~CPIMAgnEventAdapter(); |
|
45 |
|
46 public: // New abstract methods |
|
47 |
|
48 /** |
|
49 * Constructs a Agenda Model entry from the framework PIM item. |
|
50 * |
|
51 * @param aItem The item to convert |
|
52 * |
|
53 * @return an entry constructed according to framework item. |
|
54 * The \b ownership of the card is transferred to the caller. |
|
55 * |
|
56 * @par Leaving: |
|
57 * This method may leave. |
|
58 */ |
|
59 virtual CCalEntry* CreateItemToAgnL(const MPIMEventItem& aItem) = 0; |
|
60 |
|
61 /** |
|
62 * Converts from Agenda Model entry to the framework PIM item. |
|
63 * |
|
64 * @param aItem PIM Item data container store the entry data. |
|
65 * @param aEntry Agenda Model entry to convert. |
|
66 * |
|
67 * @par Leaving: |
|
68 * This method may leave. |
|
69 */ |
|
70 virtual void ReadAgnToItemL(MPIMEventItem& aItem, |
|
71 CCalEntry& aEntry) = 0; |
|
72 |
|
73 /** |
|
74 * Updates the Agenda Model entry according to the framework PIM item. |
|
75 * |
|
76 * @param aItem PIM Item with the current data. |
|
77 * @param aEntry Agenda Model entry to update. |
|
78 * |
|
79 * @par Leaving: |
|
80 * This method may leave. |
|
81 */ |
|
82 virtual void UpdateItemToAgnL(const MPIMEventItem& aItem, |
|
83 CCalEntry& aEntry) = 0; |
|
84 |
|
85 protected: // New pure virtual functions |
|
86 |
|
87 /** |
|
88 * Converts the start field of an Agenda Model entry into |
|
89 * the framework PIM item field |
|
90 * |
|
91 * @param aItem Framework PIM Item. |
|
92 * @param aEntry Agenda Model entry |
|
93 * |
|
94 * @par Leaving: |
|
95 * This method may leave. |
|
96 */ |
|
97 virtual void ReadStartFromAgnL( |
|
98 MPIMEventItem& aItem, |
|
99 CCalEntry& aEntry) = 0; |
|
100 |
|
101 /** |
|
102 * Converts the end field of an Agenda Model entry into |
|
103 * the framework PIM item field |
|
104 * |
|
105 * @param aItem Framework PIM Item. |
|
106 * @param aEntry Agenda Model entry |
|
107 * |
|
108 * @par Leaving: |
|
109 * This method may leave. |
|
110 */ |
|
111 virtual void ReadEndFromAgnL( |
|
112 MPIMEventItem& aItem, |
|
113 CCalEntry& aEntry) = 0; |
|
114 |
|
115 protected: // New virtual functions |
|
116 |
|
117 /** |
|
118 * Converts a date field of a framework PIM item into |
|
119 * a native calendar entry. |
|
120 * @param aItem Framework PIM Item. |
|
121 * @param aEntry Native Calendar entry |
|
122 * @param aField Date field which is to be converted |
|
123 * |
|
124 * @par Leaving: |
|
125 * This method may leave. |
|
126 */ |
|
127 virtual void ConvertDateFieldToAgnL( |
|
128 const MPIMEventItem& aItem, |
|
129 CCalEntry& aEntry, |
|
130 const TPIMEventField aField); |
|
131 |
|
132 /** |
|
133 * Converts a Event string field from a framework PIM item |
|
134 * into an Agenda model entry field and adds it to the entry |
|
135 * |
|
136 * @param aItem Framework PIM item |
|
137 * @param aEntry Agenda Model entry |
|
138 * @param aField PIM field which is to be converted |
|
139 */ |
|
140 virtual void ConvertStringFieldToAgnL( |
|
141 const MPIMEventItem& aItem, |
|
142 CCalEntry& aEntry, |
|
143 const TPIMEventField aField) const; |
|
144 |
|
145 /** |
|
146 * Converts the summary field of an Agenda Model entry into |
|
147 * the framework PIM item field |
|
148 * |
|
149 * @param aItem Framework PIM Item. |
|
150 * @param aEntry Agenda Model entry |
|
151 * |
|
152 * @par Leaving: |
|
153 * This method may leave. |
|
154 */ |
|
155 virtual void ReadSummaryFromAgnL( |
|
156 MPIMEventItem& aItem, |
|
157 CCalEntry& aEntry); |
|
158 |
|
159 /** |
|
160 * Converts the location field of an Agenda Model entry into |
|
161 * the framework PIM item field |
|
162 * |
|
163 * @param aItem Framework PIM Item. |
|
164 * @param aEntry Agenda Model entry |
|
165 * |
|
166 * @par Leaving: |
|
167 * This method may leave. |
|
168 */ |
|
169 virtual void ReadLocationFromAgnL( |
|
170 MPIMEventItem& aItem, |
|
171 CCalEntry& aEntry); |
|
172 |
|
173 /** |
|
174 * Converts the note field of an Agenda Model entry into |
|
175 * the framework PIM item field |
|
176 * |
|
177 * @param aItem Framework PIM Item. |
|
178 * @param aEntry Agenda Model entry |
|
179 * |
|
180 * @par Leaving: |
|
181 * This method may leave. |
|
182 */ |
|
183 virtual void ReadNoteFromAgnL( |
|
184 MPIMEventItem& aItem, |
|
185 CCalEntry& aEntry); |
|
186 |
|
187 /** |
|
188 * Converts the alarm field of an Agenda Model entry into |
|
189 * the framework PIM item field |
|
190 * |
|
191 * @param aItem Framework PIM Item. |
|
192 * @param aEntry Agenda Model entry |
|
193 * |
|
194 * @par Leaving: |
|
195 * This method may leave. |
|
196 */ |
|
197 virtual void ReadAlarmFromAgnL( |
|
198 MPIMEventItem& aItem, |
|
199 CCalEntry& aEntry); |
|
200 |
|
201 /** |
|
202 * Converts the alarm field of a framework PIM item into |
|
203 * native calendar entry |
|
204 * |
|
205 * @param aItem Framework PIM Item. |
|
206 * @param aEntry Calendar entry |
|
207 * |
|
208 * @par Leaving: |
|
209 * This method may leave. |
|
210 */ |
|
211 virtual void ConvertAlarmToAgnL( |
|
212 const MPIMEventItem& aItem, |
|
213 CCalEntry& aEntry); |
|
214 |
|
215 /** |
|
216 * Adds common default values for the native calendar entries |
|
217 * Base classes must call this function if they overwrite |
|
218 * this method |
|
219 * |
|
220 * @param aItem PIM API item from which the data is extracted |
|
221 * @param aEntry Native entry which will contain the data |
|
222 */ |
|
223 virtual void AddDefaultValuesToEntryL( |
|
224 const MPIMEventItem& aItem, |
|
225 CCalEntry& aEntry) const; |
|
226 |
|
227 protected: // New functions |
|
228 |
|
229 /** |
|
230 * Converts the fields of an Agenda Model entry into |
|
231 * the framework PIM item fields |
|
232 * |
|
233 * @param aItem Framework PIM Item. |
|
234 * @param aEntry Agenda Model entry |
|
235 * @param aFields Array of supported field types |
|
236 * @param aSize Size of the array of supported field types |
|
237 * |
|
238 * @par Leaving: |
|
239 * This method may leave. |
|
240 */ |
|
241 void ReadFieldsFromAgnL( |
|
242 MPIMEventItem& aItem, |
|
243 CCalEntry& aEntry, |
|
244 const TPIMField aSupportedFields[], |
|
245 TInt aSize); |
|
246 |
|
247 /** |
|
248 * Converts the fields of an Agenda Model entry into |
|
249 * the framework PIM item fields |
|
250 * |
|
251 * @param aItem Framework PIM Item. |
|
252 * @param aEntry Agenda Model entry |
|
253 * |
|
254 * @par Leaving: |
|
255 * This method may leave. |
|
256 */ |
|
257 void ConvertFieldsToAgnL( |
|
258 const MPIMEventItem& aItem, |
|
259 CCalEntry& aEntry); |
|
260 |
|
261 /** |
|
262 * Clears the fields supported by the PIM API from this |
|
263 * Agenda Model entry. |
|
264 * |
|
265 * @param aEntry Agenda Model entry |
|
266 * @param aFields Array of supported field types |
|
267 * @param aSize Size of the array of supported field types |
|
268 * |
|
269 * @par Leaving: |
|
270 * This method may leave. |
|
271 */ |
|
272 void ClearPIMFieldsL( |
|
273 CCalEntry& aEntry, |
|
274 const TPIMField aSupportedFields[], |
|
275 TInt aSize); |
|
276 |
|
277 /** |
|
278 * Converts the repeat information of an Agenda Model entry into |
|
279 * the framework PIM item |
|
280 * |
|
281 * @param aItem Framework PIM Item. |
|
282 * @param aEntry Agenda Model entry |
|
283 * |
|
284 * @par Leaving: |
|
285 * This method may leave. |
|
286 */ |
|
287 void ReadRepeatFromAgnL( |
|
288 MPIMEventItem& aItem, |
|
289 CCalEntry& aEntry); |
|
290 |
|
291 /** |
|
292 * Converts the repeat information of the framework PIM item into |
|
293 * an Agenda Model entry |
|
294 * |
|
295 * @param aItem Framework PIM Item. |
|
296 * @param aEntry Agenda Model entry |
|
297 * |
|
298 * @par Leaving: |
|
299 * This method may leave. |
|
300 */ |
|
301 void ConvertRepeatToAgnL( |
|
302 const MPIMEventItem& aItem, |
|
303 CCalEntry& aEntry); |
|
304 |
|
305 /** |
|
306 * Reads entry's class details and converts them into PIM class. |
|
307 * |
|
308 * @param aItem Framework PIM Item. |
|
309 * @param aEntry Agenda Model entry |
|
310 * |
|
311 * @par Leaving: |
|
312 * This method may leave. |
|
313 */ |
|
314 void ReadClassFromAgnL( |
|
315 MPIMEventItem& aItem, |
|
316 CCalEntry& aEntry); |
|
317 |
|
318 /** |
|
319 * Converts the class information of the framework PIM item into |
|
320 * an Agenda Model entry |
|
321 * |
|
322 * @param aItem Framework PIM Item. |
|
323 * @param aEntry Agenda Model entry |
|
324 * |
|
325 * @par Leaving: |
|
326 * This method may leave. |
|
327 */ |
|
328 void ConvertClassToAgnL( |
|
329 const MPIMEventItem& aItem, |
|
330 CCalEntry& aEntry); |
|
331 |
|
332 /** |
|
333 * Sets the native entry alarm field. |
|
334 * |
|
335 * @param aEntry Native calendar entry |
|
336 * @param aValue Value of the alarm field |
|
337 */ |
|
338 void SetAlarmToEntryL(CCalEntry& aEntry, const TInt aValue) const; |
|
339 |
|
340 /** |
|
341 * Checks that length of given string does not exceed |
|
342 * maximum length. |
|
343 * |
|
344 * @param aStringValue String value which is to be checked |
|
345 */ |
|
346 void EnsureValidStringValueL(const TDesC& aStringValue) const; |
|
347 |
|
348 protected: // Protected constructor |
|
349 |
|
350 /** |
|
351 * C++ constructor. |
|
352 */ |
|
353 CPIMAgnEventAdapter(java::util::FunctionServer* aFuncServer); |
|
354 |
|
355 }; |
|
356 |
|
357 #endif // CPIMAGNEVENTADAPTER_H |
|
358 // End of file |