|
1 /* |
|
2 * Copyright (c) 2006-2007 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: Capsulating fill rule |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 #ifndef __CMFILLRULE_H |
|
24 #define __CMFILLRULE_H |
|
25 |
|
26 // INCLUDES |
|
27 #include <e32base.h> |
|
28 #include <badesca.h> // CDesCArray typedef |
|
29 #include "cmcommontypes.h" |
|
30 #include "cmcommon.h" |
|
31 |
|
32 // FORWARD DECLARATIONS |
|
33 class RWriteStream; |
|
34 class RReadStream; |
|
35 class CCmRule; |
|
36 class CCmMediaServer; |
|
37 |
|
38 /** |
|
39 * CCmFillRule class |
|
40 * Capsulating fill rules |
|
41 * @lib cmcommon.lib |
|
42 * @since S60 v3.0 |
|
43 */ |
|
44 class CCmFillRule : public CBase |
|
45 { |
|
46 |
|
47 public: |
|
48 |
|
49 /* Constructors and destructor. */ |
|
50 |
|
51 /** |
|
52 * Creates new CCMFillRule class. |
|
53 * @param None |
|
54 * @return pointer to CFillRule class |
|
55 */ |
|
56 IMPORT_C static CCmFillRule* NewL(); |
|
57 |
|
58 /** |
|
59 * Creates new CCMFillRule class and |
|
60 * leaves the instance in the cleanup stack. |
|
61 * @param None |
|
62 * @return pointer to CCMFillRule class |
|
63 */ |
|
64 IMPORT_C static CCmFillRule* NewLC(); |
|
65 |
|
66 /** |
|
67 * Destructor. |
|
68 */ |
|
69 IMPORT_C virtual ~CCmFillRule(); |
|
70 |
|
71 public: |
|
72 |
|
73 /** |
|
74 * AddRuleL. |
|
75 * @since Series 60 3.1 |
|
76 * @param aDataField ( metadatafield of the rule ) |
|
77 * @param aOperator ( comparison type ) |
|
78 * @returns index of the rule |
|
79 */ |
|
80 IMPORT_C TInt AddRuleL( TCmMetadataField aDataField, |
|
81 TCmOperatorType aOperator ); |
|
82 |
|
83 /** |
|
84 * Rule. |
|
85 * @since Series 60 3.1 |
|
86 * @param aIndex rule index |
|
87 * @param aDataField metadatafield of the rule |
|
88 * @param aOperator rule operator |
|
89 * @param aParamCount param count on return |
|
90 * @returns index of the rule |
|
91 */ |
|
92 IMPORT_C void RuleL( TInt aIndex, TCmMetadataField* aDataField, |
|
93 TCmOperatorType* aOperator, TInt* aParamCount ); |
|
94 |
|
95 /** |
|
96 * Deletes rule. |
|
97 * @since Series 60 3.1 |
|
98 * @param aDataField metadatafield of the rule |
|
99 * @returns None |
|
100 */ |
|
101 IMPORT_C void DeleteRule( TCmMetadataField aDataField ); |
|
102 |
|
103 /** |
|
104 * Deletes rule. |
|
105 * @since Series 60 3.1 |
|
106 * @param aDataField metadatafield of the rule |
|
107 * @param aOper, comparison method |
|
108 * @returns None |
|
109 */ |
|
110 IMPORT_C void DeleteRule( TCmMetadataField aDataField, |
|
111 TCmOperatorType aOper ); |
|
112 |
|
113 /** |
|
114 * AddRuleParamL. |
|
115 * @since Series 60 3.1 |
|
116 * @param aIndex index of the rule |
|
117 * @param aParam parameter |
|
118 * @returns index of the rule |
|
119 */ |
|
120 IMPORT_C TInt AddRuleParamL( TInt aIndex, const TDesC8& aParam ); |
|
121 |
|
122 /** |
|
123 * AddRuleParamL ( indexed param ). |
|
124 * @since Series 60 3.1 |
|
125 * @param aIndex index of the rule |
|
126 * @param aParam parameter |
|
127 * @returns index of the rule |
|
128 */ |
|
129 IMPORT_C TInt AddRuleParamL( TInt aIndex, TInt aParam ); |
|
130 |
|
131 /** |
|
132 * RuleParam. |
|
133 * @since Series 60 3.1 |
|
134 * @param aRuleIndex index to rule |
|
135 * @param aParamIndex index to param |
|
136 * @param aParam, where param is loaded |
|
137 * @returns None |
|
138 */ |
|
139 IMPORT_C void RuleParamL( TInt aRuleIndex, TInt aParamIndex, |
|
140 TPtrC8* aParam ); |
|
141 |
|
142 /** |
|
143 * RuleParam. |
|
144 * @since Series 60 3.1 |
|
145 * @param aRuleIndex index to rule |
|
146 * @param aParamIndex index to param |
|
147 * @param aParam, where param is loaded |
|
148 * @returns None |
|
149 */ |
|
150 IMPORT_C void RuleParamL( TInt aRuleIndex, TInt aParamIndex, |
|
151 TInt& aParam ); |
|
152 |
|
153 /** |
|
154 * AddMediaServerL. |
|
155 * @since Series 60 3.1 |
|
156 * @param aUDN |
|
157 * @returns index of the media server |
|
158 */ |
|
159 IMPORT_C TInt AddMediaServerL( const TDesC8& aUDN ); |
|
160 |
|
161 /** |
|
162 * AddMediaServerL. |
|
163 * @since Series 60 3.1 |
|
164 * @param aDbId |
|
165 * @returns index of the media server |
|
166 */ |
|
167 IMPORT_C TInt AddMediaServerL( TInt aDbId ); |
|
168 |
|
169 /** |
|
170 * DeleteMediaServer. |
|
171 * @since Series 60 3.1 |
|
172 * @param aUDN |
|
173 * @returns None |
|
174 */ |
|
175 IMPORT_C void DeleteMediaServer( const TDesC8& aUDN ); |
|
176 |
|
177 /** |
|
178 * DeleteMediaServer. |
|
179 * @since Series 60 3.1 |
|
180 * @param aDbId |
|
181 * @returns None |
|
182 */ |
|
183 IMPORT_C void DeleteMediaServer( TInt aDbId ); |
|
184 |
|
185 /** |
|
186 * AddExcAlbum. |
|
187 * @since Series 60 3.1 |
|
188 * @param aAlbum |
|
189 * @returns None |
|
190 */ |
|
191 IMPORT_C void AddExcAlbumL( const TDesC& aAlbum ); |
|
192 |
|
193 /** |
|
194 * AddExcPlayList. |
|
195 * @since Series 60 3.1 |
|
196 * @param aPlayList |
|
197 * @returns None |
|
198 */ |
|
199 IMPORT_C void AddExcPlayListL( const TDesC& aPlayList ); |
|
200 |
|
201 /** |
|
202 * RemoveExcAlbumL. |
|
203 * @since Series 60 3.1 |
|
204 * @param aAlbum |
|
205 * @returns None |
|
206 */ |
|
207 IMPORT_C void RemoveExcAlbum( const TDesC& aAlbum ); |
|
208 |
|
209 /** |
|
210 * RemoveExcPlayListL. |
|
211 * @since Series 60 3.1 |
|
212 * @param aPlayList |
|
213 * @returns None |
|
214 */ |
|
215 IMPORT_C void RemoveExcPlayList( const TDesC& aPlayList ); |
|
216 |
|
217 /** |
|
218 * ExcAlbumsL. |
|
219 * @since Series 60 3.1 |
|
220 * @returns array of albums |
|
221 */ |
|
222 IMPORT_C CDesCArray& ExcAlbums() const; |
|
223 |
|
224 /** |
|
225 * ExcPlayListsL. |
|
226 * @since Series 60 3.1 |
|
227 * @returns array of play lists |
|
228 */ |
|
229 IMPORT_C CDesCArray& ExcPlayLists() const; |
|
230 |
|
231 /** |
|
232 * MediaServer. |
|
233 * @since Series 60 3.1 |
|
234 * @param aIndex index of the rule |
|
235 * @returns server uuid |
|
236 */ |
|
237 IMPORT_C const TDesC8& MediaServerL( TInt aIndex ); |
|
238 |
|
239 /** |
|
240 * MediaServer. |
|
241 * @since Series 60 3.1 |
|
242 * @param aIndex index of the rule |
|
243 * @param aServer ref. to server |
|
244 * @returns None |
|
245 */ |
|
246 IMPORT_C void MediaServerL( TInt aIndex, TInt& aServer ); |
|
247 |
|
248 /** |
|
249 * SetNameL. |
|
250 * @since Series 60 3.1 |
|
251 * @param aName |
|
252 * @returns KErrNone |
|
253 */ |
|
254 IMPORT_C TInt SetNameL( const TDesC8& aName ); |
|
255 |
|
256 /** |
|
257 * Name. |
|
258 * @since Series 60 3.1 |
|
259 * @returns name of the fill rule |
|
260 */ |
|
261 IMPORT_C TDesC8& Name() const; |
|
262 |
|
263 /** |
|
264 * SetListId. |
|
265 * @since Series 60 3.1 |
|
266 * @param aId |
|
267 * @returns None |
|
268 */ |
|
269 IMPORT_C void SetListId( const TUint aId ); |
|
270 |
|
271 /** |
|
272 * ListId. |
|
273 * @since Series 60 3.1 |
|
274 * @returns id of the fill list |
|
275 */ |
|
276 IMPORT_C TUint ListId() const; |
|
277 |
|
278 /** |
|
279 * SetAmount. |
|
280 * @since Series 60 3.1 |
|
281 * @param aAmount |
|
282 * @returns None |
|
283 */ |
|
284 IMPORT_C void SetAmount( TUint32 aAmount ); |
|
285 |
|
286 /** |
|
287 * Amount. |
|
288 * @since Series 60 3.1 |
|
289 * @returns amount |
|
290 */ |
|
291 IMPORT_C TUint32 Amount() const; |
|
292 |
|
293 /** |
|
294 * SetLimitType. |
|
295 * @since Series 60 3.1 |
|
296 * @param aLimitType |
|
297 * @returns None |
|
298 */ |
|
299 IMPORT_C void SetLimitType( TCmLimitType aLimitType ); |
|
300 |
|
301 /** |
|
302 * LimitType. |
|
303 * @since Series 60 3.1 |
|
304 * @returns limit type |
|
305 */ |
|
306 IMPORT_C TCmLimitType LimitType() const; |
|
307 |
|
308 /** |
|
309 * SetMediaType. |
|
310 * @since Series 60 3.1 |
|
311 * @param aMediaType |
|
312 * @returns None |
|
313 */ |
|
314 IMPORT_C void SetMediaType( TCmMediaType aMediaType ); |
|
315 |
|
316 /** |
|
317 * MediaType. |
|
318 * @since Series 60 3.1 |
|
319 * @returns media type ( video, image, music or what ) |
|
320 */ |
|
321 IMPORT_C TCmMediaType MediaType() const; |
|
322 |
|
323 /** |
|
324 * SetMethod. |
|
325 * @since Series 60 3.1 |
|
326 * @param aMethod |
|
327 * @returns None |
|
328 */ |
|
329 IMPORT_C void SetMethod( TCmFillMethod aMethod ); |
|
330 |
|
331 /** |
|
332 * Method. |
|
333 * @since Series 60 3.1 |
|
334 * @returns method |
|
335 */ |
|
336 IMPORT_C TCmFillMethod Method() const; |
|
337 |
|
338 /** |
|
339 * SetSelected. |
|
340 * @since Series 60 3.1 |
|
341 * @param aSelected |
|
342 * @returns None |
|
343 */ |
|
344 IMPORT_C void SetSelected( TCmFillRuleStatus aSelected ); |
|
345 |
|
346 /** |
|
347 * Selected. |
|
348 * @since Series 60 3.1 |
|
349 * @returns status |
|
350 */ |
|
351 IMPORT_C TCmFillRuleStatus Selected() const; |
|
352 |
|
353 /** |
|
354 * SetStatus. |
|
355 * @since Series 60 3.1 |
|
356 * @param aStatus |
|
357 * @returns None |
|
358 */ |
|
359 IMPORT_C void SetStatus( TCmListItemStatus aStatus ); |
|
360 |
|
361 /** |
|
362 * Selected. |
|
363 * @since Series 60 3.1 |
|
364 * @returns status |
|
365 */ |
|
366 IMPORT_C TCmListItemStatus Status() const; |
|
367 |
|
368 /** |
|
369 * SetPriority. |
|
370 * @since Series 60 3.1 |
|
371 * @param aPriority |
|
372 * @returns None |
|
373 */ |
|
374 IMPORT_C void SetPriority( TUint8 aPriority ); |
|
375 |
|
376 /** |
|
377 * Priority. |
|
378 * @since Series 60 3.1 |
|
379 * @returns Priority |
|
380 */ |
|
381 IMPORT_C TUint8 Priority() const; |
|
382 |
|
383 /** |
|
384 * SetTemplateId. |
|
385 * @since Series 60 3.1 |
|
386 * @param aTemplateId |
|
387 * @returns None |
|
388 */ |
|
389 IMPORT_C void SetTemplateId( TUint8 aTemplateId ); |
|
390 |
|
391 /** |
|
392 * TemplateId. |
|
393 * @since Series 60 3.1 |
|
394 * @returns TemplateId |
|
395 */ |
|
396 IMPORT_C TUint8 TemplateId() const; |
|
397 |
|
398 /** |
|
399 * SetListRealSizeInBytes. |
|
400 * @since Series 60 3.1 |
|
401 * @param aRealSize |
|
402 * @returns None |
|
403 */ |
|
404 IMPORT_C void SetListRealSizeInBytes( TUint32 aRealSize ); |
|
405 |
|
406 /** |
|
407 * ListRealSizeInBytes. |
|
408 * @since Series 60 3.1 |
|
409 * @returns List's real size |
|
410 */ |
|
411 IMPORT_C TUint32 ListRealSizeInBytes() const; |
|
412 |
|
413 /** |
|
414 * SetListRealCount. |
|
415 * @since Series 60 3.1 |
|
416 * @param aRealCount |
|
417 * @returns None |
|
418 */ |
|
419 IMPORT_C void SetListRealCount( TUint32 aRealCount ); |
|
420 |
|
421 /** |
|
422 * ListRealCount. |
|
423 * @since Series 60 3.1 |
|
424 * @returns List's real count |
|
425 */ |
|
426 IMPORT_C TUint32 ListRealCount() const; |
|
427 |
|
428 /** |
|
429 * RuleCount. |
|
430 * @since Series 60 3.1 |
|
431 * @returns count |
|
432 */ |
|
433 IMPORT_C TInt RuleCount() const; |
|
434 |
|
435 /** |
|
436 * MediaServerCount. |
|
437 * @since Series 60 3.1 |
|
438 * @returns count |
|
439 */ |
|
440 IMPORT_C TInt MediaServerCount() const; |
|
441 |
|
442 /** |
|
443 * ParamCount. |
|
444 * @since Series 60 3.1 |
|
445 * @param aIndex index of the rule |
|
446 * @returns count |
|
447 */ |
|
448 IMPORT_C TInt ParamCountL( TInt aIndex ) const; |
|
449 |
|
450 /** |
|
451 * Externalizes container information to stream. |
|
452 * Leaves in case of errors. |
|
453 * @since Series 60 3.1 |
|
454 * @param reference to RWriteStream |
|
455 * @return none |
|
456 */ |
|
457 void ExternalizeL( RWriteStream& aStream ) const; |
|
458 |
|
459 /** |
|
460 * Internalizes container information from stream. |
|
461 * Leaves in case of errors. |
|
462 * @since Series 60 3.1 |
|
463 * @param reference to RReadStream |
|
464 * @return none |
|
465 */ |
|
466 void InternalizeL( RReadStream& aStream ); |
|
467 |
|
468 private: |
|
469 |
|
470 /** |
|
471 * Constructor. |
|
472 */ |
|
473 CCmFillRule(); |
|
474 |
|
475 /** |
|
476 * Second-phase constructor. |
|
477 */ |
|
478 void ConstructL(); |
|
479 |
|
480 |
|
481 private: // data |
|
482 |
|
483 /** Rule name */ |
|
484 HBufC8* iName; // owned |
|
485 |
|
486 /** Amount */ |
|
487 TUint32 iAmount; |
|
488 |
|
489 /** List's real size in MBs */ |
|
490 TUint32 iRealSize; |
|
491 |
|
492 /** List's real item count */ |
|
493 TUint32 iRealCount; |
|
494 |
|
495 /** Limit type */ |
|
496 TCmLimitType iLimitType; |
|
497 |
|
498 /** Media type */ |
|
499 TCmMediaType iMediaType; |
|
500 |
|
501 /** Method */ |
|
502 TCmFillMethod iMethod; |
|
503 |
|
504 /** State of the fill rule ( Selected or not ) */ |
|
505 TCmFillRuleStatus iSelected; |
|
506 |
|
507 /** Array rules included to fill rule */ |
|
508 RPointerArray<CCmRule> iRuleArray; // items owned |
|
509 |
|
510 /** Array rules included to fill rule */ |
|
511 RPointerArray<CCmMediaServer> iMediaServerArray; // items owned |
|
512 |
|
513 /** Priority of the fill rule */ |
|
514 TUint8 iPriority; |
|
515 |
|
516 /** Id of the tempate that was used when creating rule */ |
|
517 TUint8 iTemplateId; |
|
518 |
|
519 /** Id of the fill list */ |
|
520 TUint iId; |
|
521 |
|
522 /** Excluded albums */ |
|
523 CDesCArray* iExcAlbums; // owned. |
|
524 |
|
525 /** Excluded playlists */ |
|
526 CDesCArray* iExcPlayLists; // owned. |
|
527 |
|
528 /** How to handle list items after fill */ |
|
529 TCmListItemStatus iStatus; |
|
530 }; |
|
531 |
|
532 #endif // __CMFILLRULE_H |