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