|
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: Converts properties vTodo <-> PIM API |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CPIMTODOPROPERTYCONVERTER_H |
|
20 #define CPIMTODOPROPERTYCONVERTER_H |
|
21 |
|
22 // INTERNAL INCLUDES |
|
23 #include "pimtodo.h" |
|
24 #include "pimcommon.h" |
|
25 |
|
26 // EXTERNAL INCLUDES |
|
27 #include <e32base.h> |
|
28 |
|
29 // CLASS DECLARATION |
|
30 class CParserProperty; |
|
31 class CPIMParserProperty; |
|
32 class CPIMItem; |
|
33 class CPIMToDoItem; |
|
34 class CParserVCalEntity; |
|
35 class CParserPropertyValue; |
|
36 |
|
37 /** |
|
38 * Converts Properties from versit objects to fields in PIM ToDo items. |
|
39 */ |
|
40 NONSHARABLE_CLASS(CPIMToDoPropertyConverter): public CBase |
|
41 { |
|
42 public: // Constructors and destructor |
|
43 |
|
44 /** |
|
45 * Two-phased constructor. |
|
46 */ |
|
47 static CPIMToDoPropertyConverter* NewL(); |
|
48 |
|
49 /** |
|
50 * Destructor |
|
51 */ |
|
52 virtual ~CPIMToDoPropertyConverter(); |
|
53 |
|
54 public: // New functions |
|
55 |
|
56 /** |
|
57 * Inserts a property from a vToDo to a PIM ToDo. |
|
58 * |
|
59 * @param aProperty property to insert |
|
60 * @param aItem item to insert into |
|
61 * @param aAlarm value of DALARM property is stored here |
|
62 */ |
|
63 void ConvertPropertyL(const CParserProperty& aProperty, |
|
64 CPIMToDoItem& aItem, |
|
65 TPIMDate& aAlarm); |
|
66 |
|
67 /** |
|
68 * Inserts a Field from a PIM ToDo Item to CParserVCalEntity. |
|
69 * The field is insterted as a property. |
|
70 * |
|
71 * @param aItem item to read the field from |
|
72 * @param aParser parser to insert the property to. |
|
73 * @param aField field to convert |
|
74 * |
|
75 */ |
|
76 void ConvertToDoFieldL(const CPIMItem& aItem, |
|
77 CParserVCalEntity& aParser, |
|
78 TPIMToDoField aField); |
|
79 |
|
80 /** |
|
81 * Adds a new property to the vCalendar parser |
|
82 * Note that property value and array of params are popped |
|
83 * from the cleanup stack inside this function |
|
84 * |
|
85 * @param aPropertyValue Property value for the vCalendar property |
|
86 * This needs not to be pushed to the cleanup stack before |
|
87 * this function call since it is done straight from the start |
|
88 * of this function |
|
89 * @param aPropertyName Name of the property |
|
90 * @param aParser vCalendar parser into which the new property is pushed |
|
91 */ |
|
92 void AddPropertyToParserL( |
|
93 CParserPropertyValue* aPropertyValue, |
|
94 const TDesC8& aPropertyName, |
|
95 CParserVCalEntity& aParser); |
|
96 |
|
97 private: |
|
98 /** |
|
99 * C++ default constructor. |
|
100 */ |
|
101 CPIMToDoPropertyConverter(); |
|
102 |
|
103 /** |
|
104 * Converts a date property from a vToDo to a PIM ToDo Item. |
|
105 * |
|
106 * @param aProperty property to convert |
|
107 * @param aItem item to write the field to |
|
108 * |
|
109 */ |
|
110 void ConvertDatePropertyL(const CPIMParserProperty& aProperty, |
|
111 CPIMToDoItem& aItem); |
|
112 |
|
113 /** |
|
114 * Converts a string field from a vTodo to a PIM ToDo Item. |
|
115 * |
|
116 * @param aProperty property to convert |
|
117 * @param aItem item to write the field to |
|
118 * |
|
119 */ |
|
120 void ConvertStringPropertyL(const CPIMParserProperty& aProperty, |
|
121 CPIMToDoItem& aItem); |
|
122 |
|
123 /** |
|
124 * Converts a priority property from a vTodo to a PIM ToDo Item. |
|
125 * |
|
126 * @param aProperty property to convert |
|
127 * @param aItem item to write the field to |
|
128 */ |
|
129 void ConvertPriorityPropertyL(const CPIMParserProperty& aProperty, |
|
130 CPIMToDoItem& aItem); |
|
131 |
|
132 /** |
|
133 * Converts a date field from a PIM ToDo Item to |
|
134 * a CParserVCalEntity. |
|
135 * The field is stored in the parser as a property. |
|
136 * |
|
137 * @param aItem item to read the field from |
|
138 * @param aParser parser to insert the property to. |
|
139 * @param aField field to convert |
|
140 * @param aIndex index to the field to convert |
|
141 * |
|
142 * @par Leaving: |
|
143 * This method leaves on an error with system wide error codes. |
|
144 */ |
|
145 void ConvertDateFieldL(const CPIMItem& aItem, |
|
146 CParserVCalEntity& aParser, |
|
147 TPIMToDoField aField, |
|
148 TInt aIndex); |
|
149 |
|
150 /** |
|
151 * Converts a string field from a PIM ToDo Item to |
|
152 * a CParserVCalEntity. |
|
153 * The field is stored in the parser as a property. |
|
154 * |
|
155 * @param aItem item to read the field from |
|
156 * @param aParser parser to insert the property to. |
|
157 * @param aField field to convert |
|
158 * @param aIndex index to the field to convert |
|
159 * |
|
160 * @par Leaving: |
|
161 * This method leaves on an error with system wide error codes. |
|
162 */ |
|
163 void ConvertStringFieldL(const CPIMItem& aItem, |
|
164 CParserVCalEntity& aParser, |
|
165 TPIMToDoField aField, |
|
166 TInt aIndex); |
|
167 |
|
168 /** |
|
169 * Converts an int field from a PIM ToDo Item to |
|
170 * a CParserVCalEntity. |
|
171 * The field is stored in the parser as a property. |
|
172 * |
|
173 * @param aItem item to read the field from |
|
174 * @param aParser parser to insert the property to. |
|
175 * @param aField field to convert |
|
176 * @param aIndex index to the field to convert |
|
177 * |
|
178 * @par Leaving: |
|
179 * This method leaves on an error with system wide error codes. |
|
180 */ |
|
181 void ConvertIntFieldL(const CPIMItem& aItem, |
|
182 CParserVCalEntity& aParser, |
|
183 TPIMToDoField aField, |
|
184 TInt aIndex); |
|
185 |
|
186 /** |
|
187 * Converts the completed field from a PIM ToDo Item to a |
|
188 * CParserVCalEntity. The field is stored in the parser as a |
|
189 * COMPLETED (completion date) property. Current date is used |
|
190 * as a date value. |
|
191 * |
|
192 * @param aItem item to read the field from |
|
193 * @param aParser parser to insert the property to. |
|
194 * @param aField field to convert |
|
195 * @param aIndex index to the field to convert |
|
196 * |
|
197 * @par Leaving: |
|
198 * This method leaves on an error with system wide error codes. |
|
199 */ |
|
200 void ConvertCompletedFieldL(const CPIMItem& aItem, |
|
201 CParserVCalEntity& aParser, |
|
202 TPIMToDoField aField, |
|
203 TInt aIndex); |
|
204 |
|
205 /** |
|
206 * Coverts the ToDo.CLASS field from a PIM Event item to |
|
207 * a CParserVCalEntity. |
|
208 * The field is stored in the parser as a property. |
|
209 * |
|
210 * @param aItem item to read the field from |
|
211 * @param aParser parser to insert the property to. |
|
212 * @param aField field to convert |
|
213 * @param aIndex index to the field to convert |
|
214 * |
|
215 * @par Leaving: |
|
216 * This method leaves on an error with system wide error codes. |
|
217 */ |
|
218 void ConvertClassFieldL( |
|
219 const CPIMItem& aItem, |
|
220 CParserVCalEntity& aParser, |
|
221 TPIMToDoField aField, |
|
222 TInt aIndex); |
|
223 |
|
224 /** |
|
225 * Convert CLASS property from a vCalendar to a PIM ToDo Item. |
|
226 * (This is not done among other string/HBufC properties, because |
|
227 * the resulting data is not string, but int.) |
|
228 * |
|
229 * @param aProperty property to convert |
|
230 * @param aItem item to write the dates to |
|
231 */ |
|
232 void ConvertClassPropertyL( |
|
233 const CPIMParserProperty& aProperty, |
|
234 CPIMToDoItem& aItem); |
|
235 |
|
236 /** |
|
237 * Converts an alarm field from a PIM ToDo Item to |
|
238 * a CParserVCalEntity. |
|
239 * The field is stored in the parser as a property. |
|
240 * |
|
241 * @param aItem item to read the field from |
|
242 * @param aParser parser to insert the property to. |
|
243 * @param aField field to convert |
|
244 * @param aIndex index to the field to convert |
|
245 * |
|
246 * @par Leaving: |
|
247 * This method leaves on an error with system wide error codes. |
|
248 */ |
|
249 void ConvertAlarmFieldL( |
|
250 const CPIMItem& aItem, |
|
251 CParserVCalEntity& aParser, |
|
252 TPIMToDoField aField, |
|
253 TInt aIndex); |
|
254 |
|
255 /** |
|
256 * Convert Alarm property from a vCalendar to a PIM ToDo Item. |
|
257 * |
|
258 * @param aProperty property to convert |
|
259 * @param aAlarm value of DALARM property is stored here |
|
260 */ |
|
261 void ConvertAlarmPropertyL( |
|
262 const CPIMParserProperty& aProperty, |
|
263 TPIMDate& aAlarm); |
|
264 |
|
265 }; |
|
266 |
|
267 #endif // CPIMTODOPROPERTYCONVERTER_H |
|
268 |
|
269 // End of file |