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: Definition for MediaServant fill list controller class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 #ifndef C_MSFILLRULECONTROLLER_H |
|
23 #define C_MSFILLRULECONTROLLER_H |
|
24 |
|
25 // INCLUDES |
|
26 #include <e32base.h> |
|
27 #include "cmcommontypes.h" |
|
28 |
|
29 |
|
30 // FORWARD DECLARATIONS |
|
31 class CMSEngine; |
|
32 class CCmFillRuleContainer; |
|
33 class CCmFillRule; |
|
34 class CMSFillList; |
|
35 |
|
36 /** |
|
37 * CMSFillRuleController class. |
|
38 * |
|
39 * @since S60 5.1 |
|
40 */ |
|
41 NONSHARABLE_CLASS( CMSFillRuleController ): public CBase |
|
42 { |
|
43 public: |
|
44 |
|
45 /** |
|
46 * two-phase constructor. |
|
47 */ |
|
48 static CMSFillRuleController* NewL( CMSEngine& aMSEngine ); |
|
49 |
|
50 /** |
|
51 * two-phase constructor. |
|
52 */ |
|
53 static CMSFillRuleController* NewLC( CMSEngine& aMSEngine ); |
|
54 |
|
55 /** |
|
56 * Destructor. |
|
57 */ |
|
58 virtual ~CMSFillRuleController(); |
|
59 |
|
60 /** |
|
61 * Returns rule pointer array |
|
62 * @since S60 5.1 |
|
63 * @return RPointerArray<CMSFillList>, pointer array |
|
64 */ |
|
65 RPointerArray<CMSFillList>* FillListArray(); |
|
66 |
|
67 /** |
|
68 * Initialises container |
|
69 * @since S60 5.1 |
|
70 */ |
|
71 void InitializeRuleContainersL(); |
|
72 |
|
73 /** |
|
74 * Creates default fill lists |
|
75 * @since S60 5.1 |
|
76 */ |
|
77 void CreateFillRulesL(); |
|
78 |
|
79 /** |
|
80 * Deletes current rule |
|
81 * @since S60 5.1 |
|
82 * @param TInt, index to be deleted |
|
83 */ |
|
84 void DeleteRuleL( TInt aCurrentIndex ); |
|
85 |
|
86 /** |
|
87 * Adds new rule |
|
88 * @since S60 5.1 |
|
89 * @param aRule, new fill rule |
|
90 */ |
|
91 void AddRuleL( CCmFillRule* aRule ); |
|
92 |
|
93 /** |
|
94 * Changes priorites of two rules |
|
95 * @since S60 5.1 |
|
96 * @param aTotalItem, items on the list |
|
97 * @param aCurrentItem, selected item |
|
98 * @param aDirection, move direction |
|
99 */ |
|
100 void ChangePriority( TUint aTotalItem, |
|
101 TUint aCurrentItem, |
|
102 TInt aDirection ); |
|
103 |
|
104 /** |
|
105 * Saves rules to server |
|
106 * @since S60 5.1 |
|
107 */ |
|
108 void SaveRulesL(); |
|
109 |
|
110 /** |
|
111 * Reads rule container and recreates rule array |
|
112 * @since S60 5.1 |
|
113 */ |
|
114 void UpdateArrayL(); |
|
115 |
|
116 /** |
|
117 * Checks priority changes |
|
118 * @since S60 5.1 |
|
119 * @return TBool, ETrue if changed, EFalse otherwise |
|
120 */ |
|
121 TBool HasPriorityChangedL(); |
|
122 |
|
123 /** |
|
124 * Checks activity changes |
|
125 * @since S60 5.1 |
|
126 * @param aStatus, status to be checked |
|
127 * @return TBool, ETrue if changed, EFalse otherwise |
|
128 */ |
|
129 TBool HasSelectionsChanged( TCmFillRuleStatus aStatus ); |
|
130 |
|
131 /** |
|
132 * Restores original list selections |
|
133 * @since S60 5.1 |
|
134 */ |
|
135 void RestoreOriginalSelections(); |
|
136 |
|
137 private: |
|
138 |
|
139 /** |
|
140 * Constructor. |
|
141 */ |
|
142 CMSFillRuleController( CMSEngine& aMSEngine ); |
|
143 |
|
144 /** |
|
145 * ConstructL |
|
146 * Second phase constructor. |
|
147 */ |
|
148 void ConstructL(); |
|
149 |
|
150 /** |
|
151 * Sets priorities of rules (if deleted or added) |
|
152 * @since S60 5.1 |
|
153 */ |
|
154 void SetPriorities(); |
|
155 |
|
156 /** |
|
157 * Sort function that arranges pointers by rule priority |
|
158 * @since S60 5.1 |
|
159 * @param rule1, rule to be sorted |
|
160 * @param rule2, rule to be sorted |
|
161 */ |
|
162 static TInt compare ( const CMSFillList& rule1, |
|
163 const CMSFillList& rule2); |
|
164 |
|
165 |
|
166 private: |
|
167 |
|
168 /** |
|
169 * pointer to application engine |
|
170 */ |
|
171 CMSEngine* iMSEngine; // not owned |
|
172 /** |
|
173 * Fill rules |
|
174 */ |
|
175 CCmFillRuleContainer* iRuleContainer; // owned |
|
176 /** |
|
177 * Pointer array to fillrules |
|
178 */ |
|
179 RPointerArray<CMSFillList> iFillListArray; // owned |
|
180 |
|
181 }; |
|
182 |
|
183 |
|
184 |
|
185 /**************** FILL LIST CLASS ******************/ |
|
186 |
|
187 |
|
188 /** |
|
189 * CMSFillList class. |
|
190 * |
|
191 * @since S60 5.1 |
|
192 */ |
|
193 NONSHARABLE_CLASS( CMSFillList ) : public CBase |
|
194 { |
|
195 public: |
|
196 |
|
197 /** |
|
198 * NewL |
|
199 * 2-phase constructor. |
|
200 */ |
|
201 static CMSFillList* NewL( CMSEngine& aMSEngine, |
|
202 CCmFillRule& aFillList ); |
|
203 |
|
204 /** |
|
205 * NewL |
|
206 * 2-phase constructor. |
|
207 */ |
|
208 static CMSFillList* NewLC( CMSEngine& aMSEngine, |
|
209 CCmFillRule& aFillList ); |
|
210 |
|
211 /** |
|
212 * Destructor. |
|
213 */ |
|
214 virtual ~CMSFillList(); |
|
215 |
|
216 /** |
|
217 * Fill list |
|
218 * @since S60 5.1 |
|
219 * @return CCmFillRule, fill list |
|
220 */ |
|
221 CCmFillRule* List(); |
|
222 |
|
223 /** |
|
224 * List Size |
|
225 * @since S60 5.1 |
|
226 * @return TUint32, List size in bytes |
|
227 */ |
|
228 TUint32 ListSize(); |
|
229 |
|
230 /** |
|
231 * List's item count |
|
232 * @since S60 5.1 |
|
233 * @return TUint64, item count |
|
234 */ |
|
235 TUint32 ItemCount(); |
|
236 |
|
237 /** |
|
238 * Priority |
|
239 * @since S60 5.1 |
|
240 * @return TInt, List priority |
|
241 */ |
|
242 TInt Priority() const; |
|
243 |
|
244 /** |
|
245 * Original selection status |
|
246 * @since S60 5.1 |
|
247 * @return TCmFillRuleStatus, selection status |
|
248 */ |
|
249 TCmFillRuleStatus OriginalSelectionStatus(); |
|
250 |
|
251 private: |
|
252 |
|
253 /** |
|
254 * Constructor. |
|
255 */ |
|
256 CMSFillList( CMSEngine& aMSEngine, CCmFillRule& aFillList ); |
|
257 |
|
258 /** |
|
259 * ConstructL |
|
260 * Second phase constructor. |
|
261 */ |
|
262 void ConstructL(); |
|
263 |
|
264 private: |
|
265 /** |
|
266 * Fill list size ( in bytes ) |
|
267 */ |
|
268 TUint32 iListSize; |
|
269 /** |
|
270 * List item count |
|
271 */ |
|
272 TUint32 iItemCount; |
|
273 /** |
|
274 * MS Engine |
|
275 */ |
|
276 CMSEngine* iMSEngine; // not owned |
|
277 /** |
|
278 * Fill list |
|
279 */ |
|
280 CCmFillRule* iFillList; // not owned |
|
281 /** |
|
282 * Original selection state |
|
283 */ |
|
284 TCmFillRuleStatus iSelected; |
|
285 }; |
|
286 #endif // C_MSFILLRULECONTROLLER_H |
|
287 |
|
288 |
|
289 // End of File |
|