equal
deleted
inserted
replaced
28 #include "cpimtodoitem.h" |
28 #include "cpimtodoitem.h" |
29 #include "cpimtodopropertyconverter.h" |
29 #include "cpimtodopropertyconverter.h" |
30 #include "cpimeventpropertyconverter.h" |
30 #include "cpimeventpropertyconverter.h" |
31 #include "fs_methodcall.h" |
31 #include "fs_methodcall.h" |
32 #include "logger.h" |
32 #include "logger.h" |
33 #include "cleanupresetanddestroy.h" |
33 #include "javasymbianoslayer.h" |
34 |
34 |
35 // EXTERNAL INCLUDES |
35 // EXTERNAL INCLUDES |
36 #include <vcal.h> |
36 #include <vcal.h> |
37 |
37 |
38 // ============================ MEMBER FUNCTIONS =============================== |
38 // ============================ MEMBER FUNCTIONS =============================== |
163 // |
163 // |
164 void CPIMCalendarConverter::StreamToItemL(RReadStream& aStream, // RReadStream to be converted. |
164 void CPIMCalendarConverter::StreamToItemL(RReadStream& aStream, // RReadStream to be converted. |
165 RPointerArray<CPIMItem>& aItemArray, Versit::TVersitCharSet aCharset) |
165 RPointerArray<CPIMItem>& aItemArray, Versit::TVersitCharSet aCharset) |
166 { |
166 { |
167 JELOG2(EPim); |
167 JELOG2(EPim); |
|
168 |
|
169 |
168 CParserVCal* parser = CParserVCal::NewL(); |
170 CParserVCal* parser = CParserVCal::NewL(); |
169 CleanupStack::PushL(parser); |
171 CleanupStack::PushL(parser); |
170 parser->SetDefaultCharSet(aCharset); |
172 parser->SetDefaultCharSet(aCharset); |
171 parser->InternalizeL(aStream); |
173 parser->InternalizeL(aStream); |
172 |
174 |
197 static_cast<CParserVCalEntity*>(todoArray->At(i)); |
199 static_cast<CParserVCalEntity*>(todoArray->At(i)); |
198 ParserToToDoL(*entity, aItemArray); |
200 ParserToToDoL(*entity, aItemArray); |
199 } |
201 } |
200 } |
202 } |
201 CleanupStack::PopAndDestroy(3, parser); // parser, eventArray, todoArray |
203 CleanupStack::PopAndDestroy(3, parser); // parser, eventArray, todoArray |
|
204 |
|
205 |
202 } |
206 } |
203 |
207 |
204 // ----------------------------------------------------------------------------- |
208 // ----------------------------------------------------------------------------- |
205 // CPIMCalendarConverter::CPIMCalendarConverter |
209 // CPIMCalendarConverter::CPIMCalendarConverter |
206 // C++ default constructor can NOT contain any code, that |
210 // C++ default constructor can NOT contain any code, that |
236 // |
240 // |
237 void CPIMCalendarConverter::ParserToEventL(CParserVCalEntity& aParser, |
241 void CPIMCalendarConverter::ParserToEventL(CParserVCalEntity& aParser, |
238 RPointerArray<CPIMItem>& aItemArray) |
242 RPointerArray<CPIMItem>& aItemArray) |
239 { |
243 { |
240 JELOG2(EPim); |
244 JELOG2(EPim); |
241 CleanupClosePushL(aItemArray); |
245 |
242 CPIMEventItem* item = CPIMEventItem::NewLC(iEventValidator); |
246 CPIMEventItem* item = CPIMEventItem::NewLC(iEventValidator); |
243 TPIMDate alarm(TInt64(0)); |
247 TPIMDate alarm(TInt64(0)); |
244 // We don't take the ownership of the propertyArray, so the properties |
248 // We don't take the ownership of the propertyArray, so the properties |
245 // are deleted when the parser is |
249 // are deleted when the parser is |
246 CArrayPtr<CParserProperty>* propertyArray = aParser.ArrayOfProperties( |
250 CArrayPtr<CParserProperty>* propertyArray = aParser.ArrayOfProperties( |
263 TTimeIntervalSeconds interval(0); |
267 TTimeIntervalSeconds interval(0); |
264 User::LeaveIfError(startDate.SecondsFrom(alarm, interval)); |
268 User::LeaveIfError(startDate.SecondsFrom(alarm, interval)); |
265 item->addInt(EPIMEventAlarm, KPIMAttrNone, interval.Int()); |
269 item->addInt(EPIMEventAlarm, KPIMAttrNone, interval.Int()); |
266 } |
270 } |
267 } |
271 } |
|
272 CleanupClosePushL(aItemArray); |
268 User::LeaveIfError(aItemArray.Append(item)); |
273 User::LeaveIfError(aItemArray.Append(item)); |
269 CleanupStack::Pop(item); // item |
274 CleanupStack::Pop(item); // item |
270 CleanupStack::Pop(&aItemArray); |
275 CleanupStack::Pop(&aItemArray); |
271 } |
276 } |
272 |
277 |
277 // |
282 // |
278 void CPIMCalendarConverter::ParserToToDoL(CParserVCalEntity& aParser, |
283 void CPIMCalendarConverter::ParserToToDoL(CParserVCalEntity& aParser, |
279 RPointerArray<CPIMItem>& aItemArray) |
284 RPointerArray<CPIMItem>& aItemArray) |
280 { |
285 { |
281 JELOG2(EPim); |
286 JELOG2(EPim); |
282 CleanupClosePushL(aItemArray); |
287 |
283 CPIMToDoItem* item = CPIMToDoItem::NewLC(iToDoValidator); |
288 CPIMToDoItem* item = CPIMToDoItem::NewLC(iToDoValidator); |
284 TPIMDate alarm(TInt64(0)); |
289 TPIMDate alarm(TInt64(0)); |
285 // We don't take the ownership of the propertyArray, so the properties |
290 // We don't take the ownership of the propertyArray, so the properties |
286 // are deleted when the parser is |
291 // are deleted when the parser is |
287 CArrayPtr<CParserProperty>* propertyArray = aParser.ArrayOfProperties( |
292 CArrayPtr<CParserProperty>* propertyArray = aParser.ArrayOfProperties( |
312 } |
317 } |
313 else |
318 else |
314 { |
319 { |
315 item->AddBooleanL(EPIMToDoCompleted, KPIMAttrNone, ETrue); |
320 item->AddBooleanL(EPIMToDoCompleted, KPIMAttrNone, ETrue); |
316 } |
321 } |
|
322 CleanupClosePushL(aItemArray); |
317 User::LeaveIfError(aItemArray.Append(item)); |
323 User::LeaveIfError(aItemArray.Append(item)); |
318 CleanupStack::Pop(item); // item |
324 CleanupStack::Pop(item); // item |
319 CleanupStack::Pop(&aItemArray); |
325 CleanupStack::Pop(&aItemArray); |
320 } |
326 } |
321 |
327 |