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: Custom grouper class definition |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 #ifndef __CUPNPAPPCUSTOMGROUPER_H__ |
|
26 #define __CUPNPAPPCUSTOMGROUPER_H__ |
|
27 |
|
28 // INCLUDES |
|
29 #include <e32base.h> |
|
30 #include <e32std.h> |
|
31 #include <MCLFCustomGrouper.h> |
|
32 #include <CLFContentListing.hrh> |
|
33 // this will be included when it back in SDK |
|
34 // #include <CLFContentListingExtended.hrh> |
|
35 |
|
36 #include "upnpcontentserverdefs.h" |
|
37 |
|
38 // FORWARD DECLARATIONS |
|
39 class MCLFItem; |
|
40 class MCLFModifiableItem; |
|
41 |
|
42 // CLASS DECLARATION |
|
43 |
|
44 /** |
|
45 * CLF Custom Grouper. |
|
46 * Example of Custom Grouper that can be used to group files in the |
|
47 * list model. With Custom Groupers you can create grouping functionality that |
|
48 * is not supported in Content Listing Framework by default. This Custom |
|
49 * Grouper can group items of a list model by any field. In this example |
|
50 * application, this Custom Grouper is used to group music items by artist |
|
51 * name. |
|
52 */ |
|
53 class CUpnpCustomGrouper |
|
54 : public CBase, |
|
55 public MCLFCustomGrouper |
|
56 { |
|
57 public: // Constructors and destructor |
|
58 |
|
59 /** |
|
60 * Creates and returns a new instance of this class. |
|
61 * @param aGroupingCriteria Group items by this criteria |
|
62 * @return Pointer to the CCECustomGrouper object |
|
63 */ |
|
64 |
|
65 static CUpnpCustomGrouper* NewL( |
|
66 TCLFExtendedFieldId aGroupingCriteria ); |
|
67 |
|
68 /** |
|
69 * Destructor. |
|
70 */ |
|
71 virtual ~CUpnpCustomGrouper(); |
|
72 |
|
73 private: // Constructors |
|
74 /** |
|
75 * C++ default constructor. |
|
76 * @param aGroupingCriteria Group list items by this criteria |
|
77 */ |
|
78 CUpnpCustomGrouper( TCLFExtendedFieldId aGroupingCriteria ); |
|
79 |
|
80 protected: // Functions from base classes |
|
81 |
|
82 /** |
|
83 * From MCLFCustomGrouper. Method for grouping Content Listing |
|
84 * Framework items. Will get called when grouping operation is executed |
|
85 * by calling refresh for the list model. |
|
86 * @since S60 3.1 |
|
87 * @param aSourceList Source list |
|
88 * @param aGroupedList Grouped/destination list |
|
89 */ |
|
90 void GroupItemsL( const TArray<MCLFItem*>& aSourceList, |
|
91 RPointerArray<MCLFItem>& aGroupedList ); |
|
92 |
|
93 private: // New functions |
|
94 |
|
95 /** |
|
96 * Checks if group has been added to the destination array already. |
|
97 * @param aGroupName Name of the group to be checked |
|
98 * @return ETrue If group has been added to the model, EFalse if not |
|
99 */ |
|
100 TBool GroupAlreadyExists( const TDesC& aGroupName ); |
|
101 |
|
102 private: // Data |
|
103 |
|
104 // Array for keeping track, which items have been added to the |
|
105 // model. Deletes items when they are no longer needed. |
|
106 RPointerArray<MCLFModifiableItem> iModItems; |
|
107 |
|
108 // Criteria for grouping |
|
109 TCLFExtendedFieldId iGroupingCriteria; |
|
110 |
|
111 }; |
|
112 |
|
113 #endif // __CUPNPAPPCUSTOMGROUPER_H__ |
|
114 |
|
115 // End of File |
|