1 /* |
|
2 * Copyright (c) 2005-2006 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: Header for CIRSearchResultsViewContainer |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CIRSEARCHRESULTSVIEWCONTAINER_H |
|
20 #define CIRSEARCHRESULTSVIEWCONTAINER_H |
|
21 |
|
22 #include <aknlists.h> |
|
23 #include "irimageconverterobserver.h" |
|
24 #include <aknsfld.h> |
|
25 |
|
26 class CIRSearchResultsView; |
|
27 class CAknIconArray; |
|
28 class CIRImageConverter; |
|
29 |
|
30 /** |
|
31 * This classes are used for Advertisements |
|
32 */ |
|
33 class CCustomListBox; |
|
34 class CIRFilteredModel; |
|
35 class MIRListBoxArray; |
|
36 class CIRAdvertisingListBox; |
|
37 |
|
38 |
|
39 /** |
|
40 * Container for Search Results View. |
|
41 */ |
|
42 class CIRSearchResultsViewContainer : public CCoeControl,public MEikListBoxObserver, |
|
43 public MIRImageConverterObserver |
|
44 { |
|
45 |
|
46 public: // Methods |
|
47 |
|
48 /** |
|
49 * NewL. |
|
50 * Two-phased constructor. |
|
51 * @param aRect The rectangle this view will be drawn to. |
|
52 * @param aView which is a plsview's reference |
|
53 * @return a pointer to the created instance of CIRSearchResultsViewContainer. |
|
54 */ |
|
55 static CIRSearchResultsViewContainer* NewL(const TRect& aRect ,CIRSearchResultsView &aView ); |
|
56 |
|
57 /** |
|
58 * NewLC. |
|
59 * Two-phased constructor. |
|
60 * to aRect. |
|
61 * @param aRect Rectangle this view will be drawn to. |
|
62 * @param aView which is a plsview's reference |
|
63 * @return A pointer to the created instance of CIRSearchResultsViewContainer. |
|
64 */ |
|
65 static CIRSearchResultsViewContainer* NewLC(const TRect& aRect,CIRSearchResultsView &aView); |
|
66 |
|
67 |
|
68 /** |
|
69 * ConstructL |
|
70 * 2nd phase constructor. |
|
71 */ |
|
72 void ConstructL( const TRect& aRect); |
|
73 |
|
74 /** |
|
75 * CIRSearchResultsViewContainer() |
|
76 * C++ default constructor. |
|
77 * @param aView View of this container. |
|
78 */ |
|
79 CIRSearchResultsViewContainer(CIRSearchResultsView &aSearchResultsView); |
|
80 |
|
81 /** |
|
82 * ~CIRSearchResultsViewContainer() |
|
83 * Destructor. |
|
84 */ |
|
85 ~CIRSearchResultsViewContainer(); |
|
86 |
|
87 /** |
|
88 * UpdateSearchResultsViewL() |
|
89 * updates the search results data to the search results list |
|
90 */ |
|
91 void UpdateSearchResultsViewL(); |
|
92 |
|
93 |
|
94 // from base class CCoeControl |
|
95 |
|
96 /** |
|
97 * From CCoeControl |
|
98 * |
|
99 * @see CCoeControl::OfferKeyEventL() |
|
100 */ |
|
101 |
|
102 TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ); |
|
103 |
|
104 |
|
105 /** |
|
106 * From MEikListBoxObserver HandleListBoxEventL |
|
107 */ |
|
108 void HandleListBoxEventL( CEikListBox* aListBox, TListBoxEvent aEventType ); |
|
109 |
|
110 |
|
111 /** |
|
112 * From CCoeControl |
|
113 * |
|
114 * @see CCoeControl::GetHelpContext( TCoeHelpContext& aContext ) const |
|
115 */ |
|
116 void GetHelpContext( TCoeHelpContext& aContext ) const; |
|
117 |
|
118 /** |
|
119 * GetCurrentItemIndex() |
|
120 * returns the index of the currently selected item |
|
121 */ |
|
122 TInt GetCurrentItemIndex() const; |
|
123 |
|
124 /** |
|
125 * GetListBoxTopIndex() |
|
126 * returns the index of the top item |
|
127 */ |
|
128 TInt GetListBoxTopIndex() const; |
|
129 |
|
130 |
|
131 /** |
|
132 * CountComponentControls() const |
|
133 * returns the number of components in the view. |
|
134 */ |
|
135 TInt CountComponentControls() const; |
|
136 |
|
137 /** |
|
138 * ComponentControl() |
|
139 * returns the pointer to the control |
|
140 */ |
|
141 CCoeControl* ComponentControl(TInt aIndex) const ; |
|
142 |
|
143 /** |
|
144 * SizeChanged() |
|
145 * Responds to changes to the size and position of the contents of this control. |
|
146 */ |
|
147 void SizeChanged(); |
|
148 |
|
149 /** |
|
150 * HandleResourceChange() |
|
151 * Handles a change to the control's resources. |
|
152 */ |
|
153 void HandleResourceChange(TInt aType); |
|
154 |
|
155 /** |
|
156 * HandleImageConversionEventL() |
|
157 * from base class MIRImageConverterObserver |
|
158 */ |
|
159 void HandleImageConversionEventL( |
|
160 MIRImageConverterObserver::TIRImageConversionEvent /*aEvent*/, TInt aId, TInt aError ); |
|
161 |
|
162 /** |
|
163 * HandleLogoErrorL() |
|
164 * called from the iSearchResultsView when the logo is not downloaded |
|
165 */ |
|
166 void HandleLogoErrorL(); |
|
167 |
|
168 |
|
169 void UpdateSearchResultsL(); |
|
170 |
|
171 /** |
|
172 * CreateCustomListBoxL() |
|
173 * Creates the custom listbox and updates the list according to that |
|
174 */ |
|
175 void CreateCustomListBoxL(); |
|
176 |
|
177 /** |
|
178 * OpenUrlL() |
|
179 * Used to connect to advertisement url |
|
180 */ |
|
181 void OpenUrlL( const TDesC& aHttpLink ); |
|
182 /* |
|
183 * CreateFindBoxL() |
|
184 * Creates the find box for dynamic filtering |
|
185 */ |
|
186 CAknSearchField* CreateFindBoxL(CEikListBox* aListBox, |
|
187 CTextListBoxModel* aModel, CAknSearchField::TSearchFieldStyle aStyle); |
|
188 /* |
|
189 * DisableFindBox() |
|
190 * disable the listbox when focus is not present |
|
191 */ |
|
192 void DisableFindBox(); |
|
193 |
|
194 /** |
|
195 * Function : Comparestrings |
|
196 * Function called to get the actual index of the station |
|
197 */ |
|
198 void Comparestrings(); |
|
199 |
|
200 /* |
|
201 * CIRSearchResultsViewContainer::GetFilterdModelPointer() |
|
202 * returns pointer to filtered model. |
|
203 */ |
|
204 CIRFilteredModel* GetFilterdModelPointer(); |
|
205 /* |
|
206 * CIRSearchResultsViewContainer::GetFindString() |
|
207 * returns the string in the findbox |
|
208 */ |
|
209 TDesC GetFindString(); |
|
210 |
|
211 /* |
|
212 * CIRSearchResultsViewContainer::GetListPointer() |
|
213 * returns pointer to Listbox. |
|
214 */ |
|
215 CIRAdvertisingListBox* GetListPointer(); |
|
216 /* |
|
217 * CIRSearchResultsViewContainer::GetSearchBoxPointer() |
|
218 * returns the search box pointer. |
|
219 */ |
|
220 CAknSearchField* GetSearchBoxPointer(); |
|
221 |
|
222 /* |
|
223 * CIRIsdsPreset* GetAdPreset() |
|
224 * returns the advertisement preset |
|
225 */ |
|
226 CIRIsdsPreset* GetAdvPreset(); |
|
227 /* |
|
228 * CIRIsdsPreset* GetTempPreset() |
|
229 * returns the temporary preset |
|
230 */ |
|
231 CIRIsdsPreset* GetTempPreset(); |
|
232 /** |
|
233 * CreateListBoxL() |
|
234 * Creates ListBox depending upon the presence of Advertisement |
|
235 */ |
|
236 void CreateListBoxL(); |
|
237 /** |
|
238 * Formats list item string with given arguments |
|
239 * |
|
240 * @param aFirstRow text for first row |
|
241 * @param aSecondRow text for second row |
|
242 * @param aIconId Icon ID used on item |
|
243 */ |
|
244 HBufC* FormatItemStringLC( const TDesC& aFirstRow, TInt aIconId ); |
|
245 /** |
|
246 * GetLogoNotSupported() |
|
247 * returns whether the advertisement is supported by the sdk r not |
|
248 */ |
|
249 TBool GetLogoNotSupported(); |
|
250 /** |
|
251 * Creates default (empty) icon |
|
252 * |
|
253 * @return Default icon |
|
254 */ |
|
255 CGulIcon* CreateDefaultIconL(); |
|
256 /** |
|
257 * PresetLogoDownloadL() |
|
258 * Used to download the logos depending the preset values. |
|
259 */ |
|
260 void PresetLogoDownloadL(CIRIsdsPreset* aPreset); |
|
261 |
|
262 private: //Methods |
|
263 |
|
264 |
|
265 // from base class CCoeControl |
|
266 /** |
|
267 * From CCoeControl |
|
268 * |
|
269 * @see CCoeControl::Draw( const TRect& aRect ) const |
|
270 */ |
|
271 void Draw( const TRect& /*aRect*/ ) const; |
|
272 |
|
273 /** |
|
274 * StartConvertL() |
|
275 * used to convert the images depending the index passed |
|
276 * |
|
277 */ |
|
278 void StartConvertL( CIRImageConverter& aConverter, TInt /*aIndex*/, TInt /*aId*/ ); |
|
279 |
|
280 |
|
281 |
|
282 |
|
283 private: // Data |
|
284 |
|
285 /** |
|
286 * iChannelNameArray |
|
287 * array to hold the name of channels |
|
288 */ |
|
289 CDesCArray* iChannelNameArray; |
|
290 |
|
291 /** |
|
292 * iChannelInfoArray |
|
293 * array to hold the description of channels |
|
294 */ |
|
295 CDesCArray* iChannelInfoArray; |
|
296 /** |
|
297 * iItemArray |
|
298 * array for the listbox model |
|
299 */ |
|
300 CDesCArray* iItemArray; |
|
301 |
|
302 /** |
|
303 * iSearchResultsView |
|
304 * reference of the SearchResultsView |
|
305 */ |
|
306 CIRSearchResultsView &iSearchResultsView; |
|
307 |
|
308 /** |
|
309 * boolean for forcibly getting the logo from cache |
|
310 */ |
|
311 TBool iForceGet; |
|
312 |
|
313 /** |
|
314 * response from the cache for the availability of logo(CacheNotValid,NotCached,CacheUseable) |
|
315 */ |
|
316 TInt iResult; |
|
317 |
|
318 /** |
|
319 * to keep track of the icon array index |
|
320 */ |
|
321 TInt iIconIndex; |
|
322 |
|
323 /** |
|
324 * to keep track of the logo url index(for temporary) |
|
325 */ |
|
326 TInt iLogoIndex; |
|
327 /* |
|
328 * iLandScapeCount |
|
329 * used to call the aknfind s HandlePopupFindSizeChanged function only once |
|
330 */ |
|
331 TInt iLandScapeCount; |
|
332 /* |
|
333 * iInvalidIconIndices |
|
334 * instance of RArray |
|
335 */ |
|
336 RArray<TInt> iInvalidIconIndices; |
|
337 |
|
338 /* |
|
339 * iLogosArray |
|
340 * instance of RArray |
|
341 */ |
|
342 RArray<TInt> iLogosArray; |
|
343 |
|
344 /* |
|
345 * iNoLogosArray |
|
346 * instance of RArray |
|
347 */ |
|
348 RArray<TInt> iNoLogosArray; |
|
349 |
|
350 /* |
|
351 * iCurrentItemConverter |
|
352 * instance of CIRImageConverter |
|
353 */ |
|
354 CIRImageConverter* iCurrentItemConverter; |
|
355 |
|
356 /* |
|
357 * iAdBitmap |
|
358 * instance of CFbsBitmap to store the advertisement |
|
359 */ |
|
360 CFbsBitmap* iAdBitmap; |
|
361 |
|
362 private: |
|
363 |
|
364 /** |
|
365 * iStationsListBox |
|
366 * Instance of the SearchResults ListBox |
|
367 */ |
|
368 CIRAdvertisingListBox* iSearchListBox; |
|
369 |
|
370 /* |
|
371 * iConverter |
|
372 * instance of CIRImageConverter |
|
373 */ |
|
374 CIRImageConverter* iConverter; |
|
375 |
|
376 /** |
|
377 * Temporary preset to store url and the logo data |
|
378 */ |
|
379 CIRIsdsPreset *iTempPreset; |
|
380 |
|
381 /** |
|
382 * Temporary preset to store the raw data of Advertisements |
|
383 */ |
|
384 CIRIsdsPreset* iAdvPreset; |
|
385 /* |
|
386 * iFilteredModel |
|
387 * Instance for CIRFilteredModel |
|
388 */ |
|
389 CIRFilteredModel* iFilteredModel; |
|
390 |
|
391 /* |
|
392 * iAdPresent |
|
393 * returns whether the advetisment is present or not |
|
394 */ |
|
395 TBool iAdPresent; |
|
396 /* |
|
397 * iBgContext |
|
398 * Instance of CAknsBasicBackgroundControlContext |
|
399 */ |
|
400 CAknsBasicBackgroundControlContext* iBgContext; |
|
401 /* |
|
402 * iSearchTextBox |
|
403 * Instance for CAknSearchField; |
|
404 */ |
|
405 CAknSearchField* iSearchBox; |
|
406 /* |
|
407 * iFindString |
|
408 * Used to Get the Entered Search string |
|
409 */ |
|
410 TBuf<KSearchBoxTextLength> iFindString; |
|
411 /* |
|
412 * iAdvString |
|
413 * sets the advertisement string |
|
414 */ |
|
415 HBufC* iAdvString; |
|
416 /* |
|
417 * iListBoxArray |
|
418 * Instance of MIRListBoxArray |
|
419 */ |
|
420 MIRListBoxArray* iListBoxArray; |
|
421 /* |
|
422 * iRequestForAdvertisement |
|
423 * sets when the request for advertisment conversation is made |
|
424 */ |
|
425 TBool iRequestForAdvertisement; |
|
426 /* |
|
427 * iLogoDownloadError |
|
428 * sets when the advertisment future is not supported |
|
429 */ |
|
430 TBool iLogoDownloadError; |
|
431 /** |
|
432 * iAdRequestStatusFlag |
|
433 * sets when a request for advertisement is made. |
|
434 */ |
|
435 TBool iAdRequestStatusFlag; |
|
436 /* |
|
437 * iFilteredFlag |
|
438 * This flag is set when dynamic filtering is done and |
|
439 * will be reseted when the characters in the filter box is deleted |
|
440 */ |
|
441 TBool iFilteredFlag; |
|
442 |
|
443 TInt iError; |
|
444 |
|
445 }; |
|
446 |
|
447 #endif // CIRSEARCHRESULTSVIEWCONTAINER_H |
|
448 |
|