|
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 vCalendar <-> PIM API |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CPIMCALENDARCONVERTER_H |
|
20 #define CPIMCALENDARCONVERTER_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32base.h> // CBase |
|
24 #include <vutil.h> // Versit |
|
25 #include "pimtodo.h" // TPIMToDoField |
|
26 #include "pimevent.h" // TPIMEventField |
|
27 #include "pimcommon.h" // TPIMAttribute |
|
28 #include "functionserver.h" |
|
29 |
|
30 // FORWARD DECLARATIONS |
|
31 class CPIMItem; |
|
32 class RWriteStream; |
|
33 class RReadStream; |
|
34 class CParserVCalEntity; |
|
35 class CParserProperty; |
|
36 class CPIMEventValidator; |
|
37 class CPIMToDoValidator; |
|
38 class CPIMToDoPropertyConverter; |
|
39 class CPIMEventPropertyConverter; |
|
40 |
|
41 // CLASS DECLARATION |
|
42 |
|
43 /** |
|
44 * Converts PIM ToDo/Event Items <-> vCalendars. |
|
45 * vCalendars are stored in streams. |
|
46 */ |
|
47 NONSHARABLE_CLASS(CPIMCalendarConverter): public CBase |
|
48 { |
|
49 public: // Constructors and destructor |
|
50 |
|
51 /** |
|
52 * Two-phased constructor. |
|
53 */ |
|
54 static CPIMCalendarConverter* NewL( |
|
55 const CPIMEventValidator& aEventValidator, |
|
56 const CPIMToDoValidator& aToDoValidator, |
|
57 java::util::FunctionServer* aFuncServer); |
|
58 |
|
59 /** |
|
60 * Destructor. |
|
61 */ |
|
62 virtual ~CPIMCalendarConverter(); |
|
63 |
|
64 public: // New functions |
|
65 |
|
66 /** |
|
67 * Converts Event/ToDo Items to vCalendars. |
|
68 * The converted vCalendars are stored in a stream. |
|
69 * |
|
70 * @param aStream RWriteStream to write the vCalendar to. |
|
71 * @param aItem CPIMItem which is to be converted. |
|
72 * |
|
73 * @par Leaving: |
|
74 * @li \c KErrArgument - \a aItem is not event or todo |
|
75 */ |
|
76 void ItemToStreamL(RWriteStream& aStream, |
|
77 const CPIMItem& aItem, |
|
78 const Versit::TVersitCharSet aCharset); |
|
79 |
|
80 /** |
|
81 * Converts vCalendars to Event/ToDo items. |
|
82 * |
|
83 * @param aStream RReadStream to be converted. |
|
84 * @param aItemArray array where created items are stored. |
|
85 */ |
|
86 void StreamToItemL(RReadStream& aStream, |
|
87 RPointerArray<CPIMItem>& aItemArray, |
|
88 const Versit::TVersitCharSet aCharset); |
|
89 |
|
90 private: |
|
91 |
|
92 /** |
|
93 * C++ default constructor. |
|
94 */ |
|
95 CPIMCalendarConverter(const CPIMEventValidator& aEventValidator, |
|
96 const CPIMToDoValidator& aToDoValidator, |
|
97 java::util::FunctionServer* aFuncServer); |
|
98 |
|
99 /** |
|
100 * By default Symbian 2nd phase constructor is private. |
|
101 */ |
|
102 void ConstructL(); |
|
103 |
|
104 /** |
|
105 * Converts vEvents to Event items. |
|
106 * |
|
107 * @param aParser vEvent to convert |
|
108 * @param aItemArray array where the created item is stored. |
|
109 */ |
|
110 void ParserToEventL(CParserVCalEntity& aParser, |
|
111 RPointerArray<CPIMItem>& aItemArray); |
|
112 |
|
113 /** |
|
114 * Converts vToDos to ToDo items. |
|
115 * |
|
116 * @param aParser vTodo to convert |
|
117 * @param aItemArray array where the created item is stored. |
|
118 */ |
|
119 void ParserToToDoL(CParserVCalEntity& aParser, |
|
120 RPointerArray<CPIMItem>& aItemArray); |
|
121 |
|
122 private: // Data |
|
123 |
|
124 // Validates events |
|
125 const CPIMEventValidator& iEventValidator; |
|
126 |
|
127 // Validates ToDos |
|
128 const CPIMToDoValidator& iToDoValidator; |
|
129 |
|
130 // Converts ToDo properties |
|
131 CPIMToDoPropertyConverter* iToDoConverter; |
|
132 |
|
133 // Converts Event properties |
|
134 CPIMEventPropertyConverter* iEventConverter; |
|
135 |
|
136 java::util::FunctionServer* iFuncServer; |
|
137 |
|
138 }; |
|
139 |
|
140 #endif // CPIMCALENDARCONVERTER_H |
|
141 // End of File |