williamr@2
|
1 |
/*
|
williamr@2
|
2 |
* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
|
williamr@2
|
3 |
* All rights reserved.
|
williamr@2
|
4 |
* This component and the accompanying materials are made available
|
williamr@2
|
5 |
* under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
|
williamr@2
|
6 |
* which accompanies this distribution, and is available
|
williamr@2
|
7 |
* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
|
williamr@2
|
8 |
*
|
williamr@2
|
9 |
* Initial Contributors:
|
williamr@2
|
10 |
* Nokia Corporation - initial contribution.
|
williamr@2
|
11 |
*
|
williamr@2
|
12 |
* Contributors:
|
williamr@2
|
13 |
*
|
williamr@2
|
14 |
* Description:
|
williamr@2
|
15 |
*
|
williamr@2
|
16 |
*/
|
williamr@2
|
17 |
|
williamr@2
|
18 |
|
williamr@2
|
19 |
#ifndef MCLFITEMLISTMODEL_H
|
williamr@2
|
20 |
#define MCLFITEMLISTMODEL_H
|
williamr@2
|
21 |
|
williamr@2
|
22 |
// INCLUDES
|
williamr@2
|
23 |
#include <CLFContentListing.hrh>
|
williamr@2
|
24 |
#include <bamdesca.h>
|
williamr@2
|
25 |
|
williamr@2
|
26 |
// DATA TYPES
|
williamr@2
|
27 |
/**
|
williamr@2
|
28 |
* Content Listing Framework list model refresh type.
|
williamr@2
|
29 |
*/
|
williamr@2
|
30 |
enum TCLFRefreshTypeFlags
|
williamr@2
|
31 |
{
|
williamr@2
|
32 |
/// Post filter is refreshed
|
williamr@2
|
33 |
ECLFRefreshPostFilter = 0x1,
|
williamr@2
|
34 |
/// Grouping is refreshed
|
williamr@2
|
35 |
ECLFRefreshGrouping = 0x2,
|
williamr@2
|
36 |
/// Sorting is refreshed
|
williamr@2
|
37 |
ECLFRefreshSorting = 0x4,
|
williamr@2
|
38 |
/// All filters are used
|
williamr@2
|
39 |
ECLFRefreshAll = 0xFFFFFFFF
|
williamr@2
|
40 |
};
|
williamr@2
|
41 |
|
williamr@2
|
42 |
// FORWARD DECLARATIONS
|
williamr@2
|
43 |
class MCLFItemListModelExt;
|
williamr@2
|
44 |
class MCLFItem;
|
williamr@2
|
45 |
class MCLFPostFilter;
|
williamr@2
|
46 |
class MCLFCustomGrouper;
|
williamr@2
|
47 |
class MCLFPostFilter;
|
williamr@2
|
48 |
class MCLFSortingStyle;
|
williamr@2
|
49 |
class MCLFCustomSorter;
|
williamr@2
|
50 |
class TResourceReader;
|
williamr@2
|
51 |
|
williamr@2
|
52 |
// CLASS DECLARATION
|
williamr@2
|
53 |
|
williamr@2
|
54 |
/**
|
williamr@2
|
55 |
* List Model for Content Listing Framework.
|
williamr@2
|
56 |
* This model is used to list Content Listing items. These items provide
|
williamr@2
|
57 |
* infomation of media files on the device and one item represents one media
|
williamr@2
|
58 |
* file. The model can be manipulated by sorters, post filters and groupers.
|
williamr@2
|
59 |
* List Model is created by using Content Listing Engine.<br><br>
|
williamr@2
|
60 |
* Usage:
|
williamr@2
|
61 |
* @code
|
williamr@2
|
62 |
* // Create a new List Model instance
|
williamr@2
|
63 |
* MCLFItemListModel* listModel = iEngine->CreateListModelLC( *myObserver );
|
williamr@2
|
64 |
*
|
williamr@2
|
65 |
* // Append music-type to wanted types array to exclude
|
williamr@2
|
66 |
* // all other files than music files from the list model
|
williamr@2
|
67 |
* RArray<TCLFMediaType> myMediaTypes;
|
williamr@2
|
68 |
* CleanupClosePushL( myMediaTypes );
|
williamr@2
|
69 |
* myMediaTypes.AppendL( ECLFMediaTypeMusic );
|
williamr@2
|
70 |
*
|
williamr@2
|
71 |
* // Set wanted types with SetWantedMimeTypesL or/and SetWantedMediaTypesL.
|
williamr@2
|
72 |
* // You can add both if you want.
|
williamr@2
|
73 |
* listModel->SetWantedMediaTypesL( myMediaTypes.Array() );
|
williamr@2
|
74 |
* CleanupStack::PopAndDestroy( &myMediaTypes );
|
williamr@2
|
75 |
*
|
williamr@2
|
76 |
* // Set sorting style (if you want to sort items)
|
williamr@2
|
77 |
* listModel->SetSortingStyle( mySortingStyle );
|
williamr@2
|
78 |
*
|
williamr@2
|
79 |
* // You can also add post filter, custom sorter and custom grouper to model.
|
williamr@2
|
80 |
*
|
williamr@2
|
81 |
* // Refresh the List Model.
|
williamr@2
|
82 |
* // The model will fetch items from server and use post filter to filter items,
|
williamr@2
|
83 |
* // grouping style or custom grouper to group items and finally sort items
|
williamr@2
|
84 |
* // with sorting style or custom sorter.
|
williamr@2
|
85 |
* listModel->RefreshL();
|
williamr@2
|
86 |
*
|
williamr@2
|
87 |
* // You can also refresh the post filter and sorting only. This call does not
|
williamr@2
|
88 |
* // fetch items from the server. The model is only filtered and sorted.
|
williamr@2
|
89 |
* listModel->RefreshL( ECLFRefreshPostFilter | ECLFRefreshSorting );
|
williamr@2
|
90 |
* @endcode
|
williamr@2
|
91 |
*
|
williamr@2
|
92 |
* @lib ContentListingFramework.lib
|
williamr@2
|
93 |
* @since S60 3.1
|
williamr@2
|
94 |
*/
|
williamr@2
|
95 |
class MCLFItemListModel
|
williamr@2
|
96 |
{
|
williamr@2
|
97 |
public: // Constructors and destructor
|
williamr@2
|
98 |
|
williamr@2
|
99 |
/**
|
williamr@2
|
100 |
* Destructor.
|
williamr@2
|
101 |
*/
|
williamr@2
|
102 |
virtual ~MCLFItemListModel() {}
|
williamr@2
|
103 |
|
williamr@2
|
104 |
public: // New functions
|
williamr@2
|
105 |
|
williamr@2
|
106 |
/**
|
williamr@2
|
107 |
* Get Content Listing Framework item from the List Model.
|
williamr@2
|
108 |
* @since S60 3.1
|
williamr@2
|
109 |
* @pre aIndex >= 0 && aIndex < ItemCount()
|
williamr@2
|
110 |
* @param aIndex Index of the item
|
williamr@2
|
111 |
* @return Content Listing Framework item
|
williamr@2
|
112 |
*/
|
williamr@2
|
113 |
virtual const MCLFItem& Item( TInt aIndex ) const = 0;
|
williamr@2
|
114 |
|
williamr@2
|
115 |
/**
|
williamr@2
|
116 |
* Get number of items that are in the model.
|
williamr@2
|
117 |
* @since S60 3.1
|
williamr@2
|
118 |
* @return Count of items
|
williamr@2
|
119 |
*/
|
williamr@2
|
120 |
virtual TInt ItemCount() const = 0;
|
williamr@2
|
121 |
|
williamr@2
|
122 |
/**
|
williamr@2
|
123 |
* Activate or remove Sorting style.
|
williamr@2
|
124 |
* Setting a new sorting style will remove all old secondary sorters.
|
williamr@2
|
125 |
* Removing the sorting will also remove all secondary sorters too.
|
williamr@2
|
126 |
* @since S60 3.1
|
williamr@2
|
127 |
* @param aSortingStyle Sorting style to activate,
|
williamr@2
|
128 |
* if the pointer is NULL then sorting styles are removed
|
williamr@2
|
129 |
*/
|
williamr@2
|
130 |
virtual void SetSortingStyle( MCLFSortingStyle* aSortingStyle ) = 0;
|
williamr@2
|
131 |
|
williamr@2
|
132 |
/**
|
williamr@2
|
133 |
* Append a secondary sorting style to the list model.
|
williamr@2
|
134 |
* If an item doesn't have the field defined by primary or
|
williamr@2
|
135 |
* any previous secondary sorting style, the items are sorted using
|
williamr@2
|
136 |
* the next secondary sorting style. When a sorting style is
|
williamr@2
|
137 |
* appended using this method, it becomes the least significant
|
williamr@2
|
138 |
* sorting style until a new one is added after it.
|
williamr@2
|
139 |
* Items with undefined fields are placed before or after items
|
williamr@2
|
140 |
* with defined fields, depending on the undefined field position
|
williamr@2
|
141 |
* setting in MCLFSortingStyle.
|
williamr@2
|
142 |
* @since S60 3.1
|
williamr@2
|
143 |
* @param aSortingStyle Secondary sorting style to add.
|
williamr@2
|
144 |
*/
|
williamr@2
|
145 |
virtual void AppendSecondarySortingStyleL(
|
williamr@2
|
146 |
MCLFSortingStyle& aSortingStyle ) = 0;
|
williamr@2
|
147 |
|
williamr@2
|
148 |
/**
|
williamr@2
|
149 |
* Activate or remove custom sorter.
|
williamr@2
|
150 |
* Custom sorter will overwrite sorting style (if there is a sorting
|
williamr@2
|
151 |
* style activated). See MCLFCustomSorter for an example implementation
|
williamr@2
|
152 |
* of a custom sorter.
|
williamr@2
|
153 |
* @since S60 3.1
|
williamr@2
|
154 |
* @param aCustomSorter Custom sorter to activate.
|
williamr@2
|
155 |
* If the pointer is NULL, sorting style is used (if there is one
|
williamr@2
|
156 |
* activated)
|
williamr@2
|
157 |
*/
|
williamr@2
|
158 |
virtual void SetCustomSorter( MCLFCustomSorter* aCustomSorter ) = 0;
|
williamr@2
|
159 |
|
williamr@2
|
160 |
/**
|
williamr@2
|
161 |
* Activate a grouping style for the List Model. Use ECLFNoGrouping as
|
williamr@2
|
162 |
* the grouping style if you want to remove grouping.
|
williamr@2
|
163 |
* Default grouping style is ECLFNoGrouping.
|
williamr@2
|
164 |
* @since S60 3.1
|
williamr@2
|
165 |
* @param aGrouping Grouping style to activate
|
williamr@2
|
166 |
*/
|
williamr@2
|
167 |
virtual void SetGroupingStyle( TCLFGrouping aGrouping ) = 0;
|
williamr@2
|
168 |
|
williamr@2
|
169 |
/**
|
williamr@2
|
170 |
* Activate or remove custom grouper. See MCLFCustomGrouper for an example
|
williamr@2
|
171 |
* implementation of a custom grouper.
|
williamr@2
|
172 |
* Custom grouper will overwrite grouping style.
|
williamr@2
|
173 |
* @since S60 3.1
|
williamr@2
|
174 |
* @param aCustomGrouper Custom grouper to activate,
|
williamr@2
|
175 |
* if pointer is NULL then then grouping style is used
|
williamr@2
|
176 |
*/
|
williamr@2
|
177 |
virtual void SetCustomGrouper( MCLFCustomGrouper* aCustomGrouper ) = 0;
|
williamr@2
|
178 |
|
williamr@2
|
179 |
/**
|
williamr@2
|
180 |
* Activate or remove post filter. Post filter removes items from the
|
williamr@2
|
181 |
* List Model. See MCLFPostFilter for an example implementation of a
|
williamr@2
|
182 |
* post filter.
|
williamr@2
|
183 |
* @since S60 3.1
|
williamr@2
|
184 |
* @param aPostFilter Post filter to activate,
|
williamr@2
|
185 |
* if pointer is NULL then active post filter will be removed.
|
williamr@2
|
186 |
*/
|
williamr@2
|
187 |
virtual void SetPostFilter( MCLFPostFilter* aPostFilter ) = 0;
|
williamr@2
|
188 |
|
williamr@2
|
189 |
/**
|
williamr@2
|
190 |
* Wanted mime types of media files that will be requested to the model.
|
williamr@2
|
191 |
* Overwrites old mime types if they were set.
|
williamr@2
|
192 |
* @since S60 3.1
|
williamr@2
|
193 |
* @param aMimeTypes List of wanted mime types. Mime types can contain
|
williamr@2
|
194 |
* wildcard characters "*" and "?", where "*" matches
|
williamr@2
|
195 |
* zero or more consecutive occurrences of any character
|
williamr@2
|
196 |
* and "?" matches a single occurrence of any character
|
williamr@2
|
197 |
*/
|
williamr@2
|
198 |
virtual void SetWantedMimeTypesL( const MDesCArray& aMimeTypes ) = 0;
|
williamr@2
|
199 |
|
williamr@2
|
200 |
/**
|
williamr@2
|
201 |
* Wanted mime types of media files that will be requested to the model.
|
williamr@2
|
202 |
* Overwrites old mime types if they were set.
|
williamr@2
|
203 |
* @since S60 3.1
|
williamr@2
|
204 |
* @param aResource Resource reader to mime type list resource.
|
williamr@2
|
205 |
* Use resource struct CLF_MIME_TYPE_ARRAY.
|
williamr@2
|
206 |
*/
|
williamr@2
|
207 |
virtual void SetWantedMimeTypesL( TResourceReader& aResource ) = 0;
|
williamr@2
|
208 |
|
williamr@2
|
209 |
/**
|
williamr@2
|
210 |
* Wanted media types of media files that will be requested to the model.
|
williamr@2
|
211 |
* Overwrites old media types if they were set.
|
williamr@2
|
212 |
* @since S60 3.1
|
williamr@2
|
213 |
* @param aMediaTypes List of wanted media types
|
williamr@2
|
214 |
*/
|
williamr@2
|
215 |
virtual void SetWantedMediaTypesL(
|
williamr@2
|
216 |
const TArray<TInt>& aMediaTypes ) = 0;
|
williamr@2
|
217 |
|
williamr@2
|
218 |
|
williamr@2
|
219 |
/**
|
williamr@2
|
220 |
* Wanted media types of media files that will be requested to the model.
|
williamr@2
|
221 |
* Overwrites old media types if they were set.
|
williamr@2
|
222 |
* @since S60 3.1
|
williamr@2
|
223 |
* @param aResource Resource reader to media type list resource.
|
williamr@2
|
224 |
* Use resource struct CLF_MEDIA_TYPE_ARRAY
|
williamr@2
|
225 |
*/
|
williamr@2
|
226 |
virtual void SetWantedMediaTypesL( TResourceReader& aResource ) = 0;
|
williamr@2
|
227 |
|
williamr@2
|
228 |
/**
|
williamr@2
|
229 |
* Refresh the model. This function is asynchronous (non-blocking) and
|
williamr@2
|
230 |
* MCLFOperationObserver is called when the refresh operation is
|
williamr@2
|
231 |
* completed. <br>
|
williamr@2
|
232 |
* <br>
|
williamr@2
|
233 |
* Operations in refresh are executed in the following order:<br>
|
williamr@2
|
234 |
* 1. Model gets wanted items from server.
|
williamr@2
|
235 |
* Use SetWantedMediaTypesL and/or SetWantedMimeTypesL to define
|
williamr@2
|
236 |
* wanted items.<br>
|
williamr@2
|
237 |
* 2. Model uses post filter to filter items.<br>
|
williamr@2
|
238 |
* 3. Model groups items if grouping is selected.<br>
|
williamr@2
|
239 |
* 4. Model sorting items.<br>
|
williamr@2
|
240 |
* @since S60 3.1
|
williamr@2
|
241 |
*/
|
williamr@2
|
242 |
virtual void RefreshL() = 0;
|
williamr@2
|
243 |
|
williamr@2
|
244 |
/**
|
williamr@2
|
245 |
* Refresh the model. This function is synchronous (blocking). Use
|
williamr@2
|
246 |
* parameter(s) to define the type of refresh. See TCLFRefreshTypeFlags
|
williamr@2
|
247 |
* for refresh flags.
|
williamr@2
|
248 |
* @since S60 3.1
|
williamr@2
|
249 |
* @param aRefreshType Flag(s) to use for refreshing.
|
williamr@2
|
250 |
*/
|
williamr@2
|
251 |
virtual void RefreshL( TInt32 aRefreshType ) = 0;
|
williamr@2
|
252 |
|
williamr@2
|
253 |
/**
|
williamr@2
|
254 |
* Cancel asynchronous refresh operation.
|
williamr@2
|
255 |
* @since S60 3.1
|
williamr@2
|
256 |
*/
|
williamr@2
|
257 |
virtual void CancelRefresh() = 0;
|
williamr@2
|
258 |
|
williamr@2
|
259 |
private: // Extension interface
|
williamr@2
|
260 |
|
williamr@2
|
261 |
/**
|
williamr@2
|
262 |
* This member is internal and not intended for use.
|
williamr@2
|
263 |
*/
|
williamr@2
|
264 |
virtual MCLFItemListModelExt* Extension() { return NULL; }
|
williamr@2
|
265 |
|
williamr@2
|
266 |
};
|
williamr@2
|
267 |
|
williamr@2
|
268 |
#endif // MCLFITEMLISTMODEL_H
|
williamr@2
|
269 |
|
williamr@2
|
270 |
// End of File
|