|
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: Handles PIM API todo item <-> Agenda Model todo conversions |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CPIMAGNTODOADAPTER_H |
|
20 #define CPIMAGNTODOADAPTER_H |
|
21 |
|
22 // INCLUDES |
|
23 #include "cpimagnitemadapter.h" |
|
24 #include "pimtodo.h" |
|
25 |
|
26 // FORWARD DECLARATIONS |
|
27 class MPIMToDoItem; |
|
28 class MPIMItemData; |
|
29 class CCalEntry; |
|
30 |
|
31 // CLASS DECLARATION |
|
32 |
|
33 /** |
|
34 * ToDo Item Adapter |
|
35 * Does conversion of Todo items between framework representation and |
|
36 * Agenda Model representation. |
|
37 */ |
|
38 NONSHARABLE_CLASS(CPIMAgnToDoAdapter): public CPIMAgnItemAdapter |
|
39 { |
|
40 public: // Constructor and destructor |
|
41 /** |
|
42 * Two-phased constructor. |
|
43 */ |
|
44 static CPIMAgnToDoAdapter* NewL(java::util::FunctionServer* aFuncServer); |
|
45 |
|
46 /** |
|
47 * Destructor. |
|
48 */ |
|
49 virtual ~CPIMAgnToDoAdapter(); |
|
50 |
|
51 public: // new methods |
|
52 /** |
|
53 * Constructs a Agenda Model entry from the framework PIM item. |
|
54 * |
|
55 * @param aItem The item to convert |
|
56 * |
|
57 * @return A CCalEntry constructed according to framework item. |
|
58 * The \b ownership of the card is transferred to the caller. |
|
59 * |
|
60 * @par Leaving: |
|
61 * This method may leave. |
|
62 */ |
|
63 CCalEntry* CreateItemToAgnL(const MPIMToDoItem& aItem); |
|
64 |
|
65 /** |
|
66 * Converts from Agenda Model entry to the framework PIM item. |
|
67 * |
|
68 * @param aItem PIM Item data container store the entry data. |
|
69 * @param aEntry Agenda Model entry to convert. |
|
70 * |
|
71 * @par Leaving: |
|
72 * This method may leave. |
|
73 */ |
|
74 void ReadAgnToItemL(MPIMToDoItem& aItem, |
|
75 CCalEntry& aEntry); |
|
76 |
|
77 /** |
|
78 * Updates the Agenda Model entry according to the framework PIM item. |
|
79 * |
|
80 * @param aItem PIM Item with the current data. |
|
81 * @param aEntry Agenda Model entry to update. |
|
82 * |
|
83 * @par Leaving: |
|
84 * This method may leave. |
|
85 */ |
|
86 void UpdateItemToAgnL(const MPIMToDoItem& aItem, |
|
87 CCalEntry& aEntry); |
|
88 |
|
89 private: |
|
90 |
|
91 /** |
|
92 * ExportItemL |
|
93 * Exports PIM ToDo item to native Calendar ToDo entry |
|
94 * |
|
95 * @param aItem The exported PIM item |
|
96 * @param aEntry The native entry in which the data is exported |
|
97 * @param aResetEntry Indicates that should the native entry |
|
98 * be reseted or not |
|
99 */ |
|
100 void ExportItemL( |
|
101 const MPIMToDoItem& aItem, |
|
102 CCalEntry& aEntry, |
|
103 TBool aResetEntry); |
|
104 |
|
105 /** |
|
106 * AddDefaultValuesToEntryL |
|
107 * Adds default values to the native entry which are required |
|
108 * by the native Calendar application |
|
109 * |
|
110 * @param aData PIM Item data |
|
111 * @param aEntry The native entry in which the data is exported |
|
112 */ |
|
113 void AddDefaultValuesToEntryL( |
|
114 const MPIMItemData& aData, |
|
115 CCalEntry& aEntry) const; |
|
116 |
|
117 /** |
|
118 * ReadStringFieldsL |
|
119 * Read string fields from native Calendar ToDo entry and imports |
|
120 * the data to PIM API ToDo item |
|
121 * |
|
122 * @param aData PIM Item data |
|
123 * @param aEntry Calendar entry from which the data is imported |
|
124 */ |
|
125 void ReadStringFieldsL(MPIMItemData& aData, CCalEntry& aEntry); |
|
126 |
|
127 /** |
|
128 * ReadIntFieldsL |
|
129 * Read int fields from native Calendar ToDo entry and imports |
|
130 * the data to PIM API ToDo item |
|
131 * |
|
132 * @param aData PIM Item data |
|
133 * @param aEntry Calendar entry from which the data is imported |
|
134 */ |
|
135 void ReadIntFieldsL(MPIMItemData& aData, CCalEntry& aEntry); |
|
136 |
|
137 /** |
|
138 * ReadDateFieldsL |
|
139 * Read date fields from native Calendar ToDo entry and imports |
|
140 * the data to PIM API ToDo item |
|
141 * |
|
142 * @param aData PIM Item data |
|
143 * @param aEntry Calendar entry from which the data is imported |
|
144 */ |
|
145 void ReadDateFieldsL(MPIMItemData& aData, CCalEntry& aEntry); |
|
146 |
|
147 /** |
|
148 * Converts the field of the framework PIM item into the field of |
|
149 * an Agenda Model entry |
|
150 * |
|
151 * @param aField PIM Item field. |
|
152 * @param aEntry Agenda Model entry. |
|
153 * @param aItem PIM Item with the current data. |
|
154 * |
|
155 * @par Leaving: |
|
156 * This method may leave. |
|
157 */ |
|
158 void ConvertToAgnL( |
|
159 TPIMToDoField aField, |
|
160 CCalEntry& aEntry, |
|
161 const MPIMItemData& aItem); |
|
162 |
|
163 /** |
|
164 * Converts the date field of the framework PIM item into the field of |
|
165 * an Agenda Model entry |
|
166 * |
|
167 * @param aField PIM Item field. |
|
168 * @param aIndex Index of the field. |
|
169 * @param aTodo Agenda Model entry typecasted to a todo. |
|
170 * @param aItem PIM Item with the current data. |
|
171 * |
|
172 * @par Leaving: |
|
173 * This method may leave. |
|
174 */ |
|
175 void ConvertDateToAgnL( |
|
176 TPIMToDoField aField, |
|
177 TInt aIndex, |
|
178 CCalEntry& aEntry, |
|
179 const MPIMItemData& aItem); |
|
180 |
|
181 /** |
|
182 * Converts the string field of the framework PIM item into the field of |
|
183 * an Agenda Model entry |
|
184 * |
|
185 * @param aField PIM Item field. |
|
186 * @param aIndex Index of the field. |
|
187 * @param aEntry Agenda Model entry. |
|
188 * @param aItem PIM Item with the current data. |
|
189 * |
|
190 * @par Leaving: |
|
191 * This method may leave. |
|
192 */ |
|
193 void ConvertStringToAgnL( |
|
194 TPIMToDoField aField, |
|
195 TInt aIndex, |
|
196 CCalEntry& aEntry, |
|
197 const MPIMItemData& aItem); |
|
198 |
|
199 /** |
|
200 * Converts the int field of the framework PIM item into the field of |
|
201 * an Agenda Model entry |
|
202 * |
|
203 * @param aField PIM Item field. |
|
204 * @param aIndex Index of the field. |
|
205 * @param aTodo Agenda Model entry typecasted to a todo. |
|
206 * @param aItem PIM Item with the current data. |
|
207 * |
|
208 * @par Leaving: |
|
209 * This method may leave. |
|
210 */ |
|
211 void ConvertIntToAgnL( |
|
212 TPIMToDoField aField, |
|
213 TInt aIndex, |
|
214 CCalEntry& aEntry, |
|
215 const MPIMItemData& aItem); |
|
216 |
|
217 /** |
|
218 * Converts the boolean field of the framework PIM item into the field |
|
219 * of an Agenda Model entry |
|
220 * |
|
221 * @param aField PIM Item field. |
|
222 * @param aIndex Index of the field. |
|
223 * @param aTodo Agenda Model entry typecasted to a todo. |
|
224 * @param aItem PIM Item with the current data. |
|
225 * |
|
226 * @par Leaving: |
|
227 * This method may leave. |
|
228 */ |
|
229 void ConvertBooleanToAgnL( |
|
230 TPIMToDoField aField, |
|
231 TInt aIndex, |
|
232 CCalEntry& aEntry, |
|
233 const MPIMItemData& aItem); |
|
234 |
|
235 /** |
|
236 * Returns native alarm field offset in TTimeIntervalMinutes. The value |
|
237 * is calculated from PIM API alarm field value and from the difference |
|
238 * between that value and due date |
|
239 * |
|
240 * @param aItemData Rererence to item data |
|
241 * @param aEntry Native ToDo Calendar entry |
|
242 * @return Native alarm offset in minutes |
|
243 */ |
|
244 TTimeIntervalMinutes AlarmOffsetL( |
|
245 const MPIMItemData& aItemData, |
|
246 CCalEntry& aEntry); |
|
247 |
|
248 private: |
|
249 |
|
250 /** |
|
251 * C++ constructor. |
|
252 */ |
|
253 CPIMAgnToDoAdapter(java::util::FunctionServer* aFuncServer); |
|
254 |
|
255 }; |
|
256 |
|
257 #endif // CPIMAGNTODOADAPTER_H |
|
258 // End of file |