|
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: Class for providing list filtering. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CMPXCOMMONCONTAINERFILTEREDLIST_H |
|
20 #define CMPXCOMMONCONTAINERFILTEREDLIST_H |
|
21 |
|
22 // INCLUDES |
|
23 |
|
24 #include <coemain.h> |
|
25 |
|
26 // FORWARD DECLARATIONS |
|
27 |
|
28 class CMPXMedia; |
|
29 class CMPXMediaArray; |
|
30 class TMPXItemId; |
|
31 |
|
32 // CLASS DECLARATION |
|
33 |
|
34 /** |
|
35 * Class for providing list filtering. |
|
36 * |
|
37 */ |
|
38 NONSHARABLE_CLASS( CMPXCommonContainerFilteredList ) : |
|
39 public CBase |
|
40 { |
|
41 public: // Constructing and destructing. |
|
42 |
|
43 /** |
|
44 * Two-phased constructor. |
|
45 * |
|
46 * @return New object. |
|
47 */ |
|
48 static CMPXCommonContainerFilteredList* NewL(); |
|
49 |
|
50 /** |
|
51 * Two-phased constructor. |
|
52 * |
|
53 * @return New object. |
|
54 */ |
|
55 static CMPXCommonContainerFilteredList* NewLC(); |
|
56 |
|
57 /** |
|
58 * Destructor. |
|
59 */ |
|
60 virtual ~CMPXCommonContainerFilteredList(); |
|
61 |
|
62 public: // Data changes. |
|
63 |
|
64 /** |
|
65 * Replaces media list with new one. |
|
66 * |
|
67 * @param aMediaList New media list. |
|
68 */ |
|
69 void ReplaceMediaListL( const CMPXMediaArray& aMediaList ); |
|
70 |
|
71 /** |
|
72 * Call when filtering word changes. Causes filtered list to be updated. |
|
73 * Calling with zero-length filtering word stops filtering. |
|
74 * |
|
75 * @param aWord New filtering word. |
|
76 */ |
|
77 void SetFilteringWordL( const TDesC& aWord ); |
|
78 |
|
79 /** |
|
80 * Checks if full or filtered data is currently shown. |
|
81 * |
|
82 * @return ETrue if filtered data is shown. |
|
83 */ |
|
84 TBool IsFiltering(); |
|
85 |
|
86 public: // Data fetching and status information. |
|
87 |
|
88 /** |
|
89 * Checks if media list exists. |
|
90 * |
|
91 * @return ETrue if media list exists. |
|
92 */ |
|
93 TBool HasMediaList(); |
|
94 |
|
95 /** |
|
96 * Returns count of filtered media items. |
|
97 * |
|
98 * @return Count of filtered items. |
|
99 */ |
|
100 TInt FilteredCount(); |
|
101 |
|
102 /** |
|
103 * Checks that given filtered index is valid. |
|
104 * |
|
105 * @return ETrue if filtered index is valid. |
|
106 */ |
|
107 TBool IsFilteredIndexValid( TInt aFilteredIndex ); |
|
108 |
|
109 /** |
|
110 * Translates filtered index to real index of media list. |
|
111 * |
|
112 * @param aFilteredIndex Filtered index. |
|
113 * @return Real index. |
|
114 */ |
|
115 TInt FilteredIndexToRealIndex( TInt aFilteredIndex ); |
|
116 |
|
117 private: |
|
118 |
|
119 /** |
|
120 * Constructor. |
|
121 */ |
|
122 CMPXCommonContainerFilteredList(); |
|
123 |
|
124 /** |
|
125 * Updates internal filtering based on new filtering word. |
|
126 * |
|
127 * @param aWord New filtering word. |
|
128 */ |
|
129 void ReAdjustFilteringL( const TDesC& aWord ); |
|
130 |
|
131 private: |
|
132 |
|
133 /** |
|
134 * Array of medias. |
|
135 * Own. |
|
136 */ |
|
137 CMPXMediaArray* iMediaList; |
|
138 |
|
139 /** |
|
140 * Array of real indexes that together are the filtered list. |
|
141 * Own. |
|
142 */ |
|
143 RArray<TInt> iFilteredMediaList; |
|
144 |
|
145 /** |
|
146 * Internal flag for indicating if data is being filtered. |
|
147 */ |
|
148 TBool iFiltering; |
|
149 |
|
150 /** |
|
151 * Filtering word used for current filtering. |
|
152 * Own. |
|
153 */ |
|
154 HBufC* iFilteringWord; |
|
155 }; |
|
156 |
|
157 #endif // CMPXCOMMONCONTAINERFILTEREDLIST_H |