|
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: Provides static information about todo lists and creates |
|
15 * todo list adapters. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef CPIMTODOADAPTERMANAGER_H |
|
21 #define CPIMTODOADAPTERMANAGER_H |
|
22 |
|
23 // INCLUDES |
|
24 #include "mpimtodoadaptermanager.h" |
|
25 #include "mpimadaptermanager.h" |
|
26 #include "pimtodo.h" |
|
27 |
|
28 // CONSTANTS |
|
29 |
|
30 // Supported fields by platform |
|
31 const TPIMField KPIMSupportedToDoFields[] = |
|
32 { |
|
33 EPIMToDoSummary, |
|
34 EPIMToDoNote, |
|
35 EPIMToDoDue, |
|
36 EPIMToDoExtAlarm, |
|
37 EPIMToDoPriority, |
|
38 EPIMToDoCompleted, |
|
39 EPIMToDoCompletionDate, |
|
40 EPIMToDoClass, |
|
41 EPIMToDoUid, |
|
42 EPIMToDoRevision |
|
43 }; |
|
44 |
|
45 const TInt KPIMSupportedToDoFieldsCount = sizeof(KPIMSupportedToDoFields) |
|
46 / sizeof(TPIMField); |
|
47 |
|
48 // CLASS DECLARATION |
|
49 |
|
50 /** |
|
51 * PIM Todo Adapter Manager class |
|
52 */ |
|
53 NONSHARABLE_CLASS(CPIMToDoAdapterManager): public CBase, |
|
54 public MPIMAdapterManager, |
|
55 public MPIMToDoAdapterManager |
|
56 { |
|
57 public: // Constructors and destructor |
|
58 |
|
59 /** |
|
60 * Two-phased constructor. |
|
61 */ |
|
62 static CPIMToDoAdapterManager* NewL(const TDesC& aListName); |
|
63 |
|
64 /** |
|
65 * Destructor. |
|
66 */ |
|
67 ~CPIMToDoAdapterManager(); |
|
68 |
|
69 public: // Functions from more specific MPIMToDoAdapterManager |
|
70 |
|
71 |
|
72 /** |
|
73 * Provides access to the \ref MPIMAdapterManager representation of |
|
74 * this object. |
|
75 * |
|
76 * @return The \ref MPIMAdapterManager representation of this object. |
|
77 */ |
|
78 MPIMAdapterManager* GetAdapterManager(); |
|
79 |
|
80 public: // Functions from generic MPIMAdapterManager |
|
81 |
|
82 const TDesC& ListNameL(); |
|
83 |
|
84 /** |
|
85 * Provides number of maximum categories supported by the list adapter. |
|
86 * @return Number of maximum supported categories . |
|
87 */ |
|
88 TInt MaxCategories(); |
|
89 |
|
90 /** |
|
91 * Checks whether a specific field is supported by the list adapter. |
|
92 * @param aField The field to be checked. |
|
93 * @return ETrue if the given field is supported, EFalse otherwise. |
|
94 */ |
|
95 TBool IsSupportedField( |
|
96 TPIMField aField); |
|
97 |
|
98 /** |
|
99 * Provides all fields supported by the list adapter. |
|
100 * |
|
101 * @return An array containing all supported fields. The order of the |
|
102 * fields must be the same as in the native side application |
|
103 * UI. |
|
104 * |
|
105 * @par Leaving: |
|
106 * The method leaves on error. Such error always means that the adapter |
|
107 * is non-functional. |
|
108 */ |
|
109 const CArrayFix<TPIMField>& GetSupportedFieldsL(); |
|
110 |
|
111 /** |
|
112 * Checks whether a specific attribute is supported by the list adapter. |
|
113 * |
|
114 * @param aField The field to which the attribute might be associated. |
|
115 * @param aAttribute The attribute to be checked. |
|
116 * |
|
117 * @return ETrue if the given attribute is supported, EFalse otherwise, |
|
118 * also on unsupported \a aField. |
|
119 */ |
|
120 TBool IsSupportedAttribute( |
|
121 TPIMField aField, |
|
122 TPIMAttribute aAttribute); |
|
123 |
|
124 /** |
|
125 * Provides attributes supported for a field. |
|
126 * |
|
127 * @param aField The field to which the attributes are associated with. |
|
128 * |
|
129 * @return An array containing attributes supported for the \a aField. |
|
130 * The order of attributes must reflect the order of field and |
|
131 * attribute combinations in the native application UI. |
|
132 * |
|
133 * @par Leaving: |
|
134 * The method leaves on error. Error codes should be interpreted as |
|
135 * follows: |
|
136 * @li \c KErrArgument - \a aField is not valid. |
|
137 * @li Other - Array could not be created. |
|
138 */ |
|
139 const CArrayFix<TPIMAttribute>& GetSupportedAttributesL( |
|
140 TPIMField aField); |
|
141 |
|
142 /** |
|
143 * Provides attributes supported for a field, combined into single |
|
144 * integer value. |
|
145 * |
|
146 * @param aField The field to which the attributes are associated with. |
|
147 * |
|
148 * @return An integer holding the combination of all attributes |
|
149 * supported for \a aField. |
|
150 * |
|
151 * @par Leaving. |
|
152 * The method leaves on error. Error codes should be interpreted as |
|
153 * follows: |
|
154 * @li \c KErrArgument - \a aField is not valid. |
|
155 */ |
|
156 TPIMAttribute GetSupportedAttributesCombinedL( |
|
157 TPIMField aField); |
|
158 |
|
159 /** |
|
160 * Provides all attributes supported for all fields, combined into |
|
161 * single integer value. |
|
162 * |
|
163 * @return An integer holding the combination of all attributes |
|
164 * supported for all fields. |
|
165 */ |
|
166 TPIMAttribute GetAllSupportedAttributesCombined(); |
|
167 |
|
168 /** |
|
169 * Checks whether a specific array element is supported by the list |
|
170 * adapter. |
|
171 * |
|
172 * @param aStringArrayField The field to which the array element belongs |
|
173 * @param aArrayElement The array element to be checked. |
|
174 * |
|
175 * @return ETrue if the given array element is supported, EFalse if not. |
|
176 */ |
|
177 TBool IsSupportedArrayElement( |
|
178 TPIMField aStringArrayElement, |
|
179 TPIMArrayElement aArrayElement); |
|
180 |
|
181 /** |
|
182 * Provides supported array elements for a specific field. |
|
183 * |
|
184 * @param aStringArrayField A string array field. |
|
185 * |
|
186 * @return An array containing supported array elements for the field. |
|
187 * |
|
188 * @par Leaving: |
|
189 * The method leaves on error. Error codes should be interpreted as |
|
190 * follows: |
|
191 * @li \c KErrArgument - \a aField is not valid. |
|
192 * @li Other - Array could not be created. |
|
193 */ |
|
194 const CArrayFix<TPIMArrayElement>& GetSupportedArrayElementsL( |
|
195 TPIMField aStringArrayField); |
|
196 |
|
197 /** |
|
198 * Provides the number of maximum values supported for a specific field. |
|
199 * |
|
200 * @param aField The field to be evaluated. |
|
201 * |
|
202 * @return Number of values supported for the field. -1 for unlimited, |
|
203 * 0 if not supported. |
|
204 */ |
|
205 TInt MaxValues( |
|
206 TPIMField aField); |
|
207 |
|
208 /** |
|
209 * Provides the array size of a specific string array field. |
|
210 * The values in a string array field are arrays themselves. |
|
211 * StringArraySize method returns the number of elements in every value |
|
212 * of the field. |
|
213 * |
|
214 * @param aStringArrayField The string array field to be evaluated. |
|
215 * @return Number of elements in a single string array value. |
|
216 * |
|
217 * @par Leaving: |
|
218 * The method leaves with \c KErrArgument if \a aStringArrayField |
|
219 * is not a string array field or is not supported. |
|
220 */ |
|
221 TInt StringArraySizeL( |
|
222 TPIMField aStringArrayField); |
|
223 |
|
224 /** |
|
225 * Provides pointer to a function which implements an algorithm that |
|
226 * determines the order of two items. |
|
227 * |
|
228 * @return Item comparison function. |
|
229 */ |
|
230 TPIMItemComparisonFunc ItemOrder(); |
|
231 |
|
232 /** |
|
233 * Compares two MPIMItemData objects. |
|
234 * Used for determining |
|
235 * their ordering in an item enumeration. |
|
236 * |
|
237 * @param aFirst first object to compare |
|
238 * @param aSecond second object to compare |
|
239 * @return |
|
240 * @li < 0, if aFirst becomes \b before aSecond |
|
241 * @li 0, if the objects are equal in the ordering |
|
242 * @li > 0, if aFirst becomes \b after aSecond |
|
243 */ |
|
244 static TInt ItemComparisonFunc( |
|
245 const MPIMItem& aFirst, |
|
246 const MPIMItem& aSecond); |
|
247 |
|
248 /** |
|
249 * Compares two MPIMItemData objects. |
|
250 * Used for determining their ordering in an item enumeration. |
|
251 * This is the leaving version of the comparison function. |
|
252 * |
|
253 * @param aFirst first object to compare |
|
254 * @param aSecond second object to compare |
|
255 * @return |
|
256 * @li < 0, if aFirst becomes \b before aSecond |
|
257 * @li 0, if the objects are equal in the ordering |
|
258 * @li > 0, if aFirst becomes \b after aSecond |
|
259 */ |
|
260 static TInt ItemComparisonFuncL( |
|
261 const MPIMItem& aFirst, |
|
262 const MPIMItem& aSecond); |
|
263 |
|
264 private: |
|
265 |
|
266 /** |
|
267 * C++ default constructor. |
|
268 */ |
|
269 CPIMToDoAdapterManager(); |
|
270 |
|
271 /** |
|
272 * 2nd phase constructor. |
|
273 */ |
|
274 void ConstructL(const TDesC& aListName); |
|
275 |
|
276 private: // Member data |
|
277 |
|
278 // All the following arrays are owned by CPIMToDoAdapterManager class |
|
279 CArrayFixFlat< TPIMField>* iSupportedToDoFields; |
|
280 CArrayFixFlat< TPIMAttribute>* iEmptyToDoAttributeArray; |
|
281 |
|
282 /** Owned. */ |
|
283 TDesC* iListName; |
|
284 }; |
|
285 |
|
286 #endif // CPIMTODOADAPTERMANAGER_H |
|
287 // End of File |