|
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: Implementation of the class CFMRadioScanLocalStationsContainer |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include <e32math.h> |
|
21 #include <AknsSkinInstance.h> |
|
22 #include <AknsUtils.h> |
|
23 #include <AknsDrawUtils.h> |
|
24 #include <AknsBasicBackgroundControlContext.h> |
|
25 #include <akntoolbar.h> |
|
26 #include <gulutil.h> |
|
27 #include <w32std.h> |
|
28 #include <fmradio.rsg> |
|
29 #include <StringLoader.h> |
|
30 #include <eiklabel.h> |
|
31 #include <AknWaitDialog.h> |
|
32 #include <eikclbd.h> |
|
33 #include <AknIconArray.h> |
|
34 #include <gulicon.h> |
|
35 #include <fmradiouids.h> |
|
36 #include <aknconsts.h> |
|
37 #include <avkon.mbg> |
|
38 |
|
39 #if defined __SERIES60_HELP || defined FF_S60_HELPS_IN_USE |
|
40 #include "radio.hlp.hrh" |
|
41 #endif |
|
42 #include "fmradioapp.h" |
|
43 #include "fmradioappui.h" |
|
44 #include "fmradioscanlocalstationscontainer.h" |
|
45 #include "fmradioscanlocalstationsview.h" |
|
46 |
|
47 // CONSTANTS |
|
48 |
|
49 // ================= MEMBER FUNCTIONS ======================= |
|
50 |
|
51 // ---------------------------------------------------------------------------- |
|
52 // CFMRadioScanLocalStationsContainer::CFMRadioScanLocalStationsContainer |
|
53 // Default constructor |
|
54 // ---------------------------------------------------------------------------- |
|
55 // |
|
56 CFMRadioScanLocalStationsContainer::CFMRadioScanLocalStationsContainer( CRadioEngine& aRadioEngine ): |
|
57 iRadioEngine( aRadioEngine ) |
|
58 { |
|
59 } |
|
60 |
|
61 // --------------------------------------------------------- |
|
62 // CFMRadioScanLocalStationsContainer::NewL |
|
63 // Two-phase constructor of CFMRadioScanLocalStationsContainer |
|
64 // --------------------------------------------------------- |
|
65 // |
|
66 CFMRadioScanLocalStationsContainer* CFMRadioScanLocalStationsContainer::NewL( const TRect& aRect, CRadioEngine& aRadioEngine ) |
|
67 { |
|
68 CFMRadioScanLocalStationsContainer* self = new (ELeave) CFMRadioScanLocalStationsContainer( aRadioEngine ); |
|
69 CleanupStack::PushL( self ); |
|
70 self->ConstructL( aRect ); |
|
71 CleanupStack::Pop( self ); |
|
72 return self; |
|
73 } |
|
74 |
|
75 // ---------------------------------------------------- |
|
76 // CFMRadioScanLocalStationsContainer::ConstructL |
|
77 // EPOC two phased constructor |
|
78 // ---------------------------------------------------- |
|
79 // |
|
80 void CFMRadioScanLocalStationsContainer::ConstructL( const TRect& aRect ) |
|
81 { |
|
82 // check the layout orientation |
|
83 CFMRadioAppUi* appUi = static_cast<CFMRadioAppUi*>( iCoeEnv->AppUi() ); |
|
84 TBool isLandscape = appUi->IsLandscapeOrientation(); |
|
85 CreateWindowL(); |
|
86 |
|
87 iSkin = AknsUtils::SkinInstance(); |
|
88 |
|
89 // Instantiate a listbox for the channel list |
|
90 iChannelList = new ( ELeave ) CAknSingleNumberStyleListBox(); |
|
91 iChannelList->SetContainerWindowL( *this ); |
|
92 iChannelList->SetListBoxObserver( this ); |
|
93 iChannelList->ConstructL( this, CEikListBox::ELoopScrolling | EAknListBoxSelectionList ); // Looped list |
|
94 // Create scrollbars |
|
95 iChannelList->CreateScrollBarFrameL( ETrue ); |
|
96 |
|
97 CAknIconArray* listIconArray = new ( ELeave ) CAknIconArray( 1 ); |
|
98 CleanupStack::PushL( listIconArray ); |
|
99 CreateListIconsL( *listIconArray ); |
|
100 iChannelList->ItemDrawer()->ColumnData()->SetIconArray( listIconArray ); |
|
101 CleanupStack::Pop( listIconArray ); |
|
102 |
|
103 // Array for channels |
|
104 iChannelItemArray = new( ELeave ) CDesCArrayFlat( KMaxNumberOfChannelListItems ); |
|
105 InitializeChannelListL(); |
|
106 SetRect( aRect ); |
|
107 |
|
108 CFMRadioScanLocalStationsView* searchStationsView = static_cast<CFMRadioScanLocalStationsView*> ( appUi->View( KFMRadioScanLocalStationsViewId ) ); |
|
109 |
|
110 ActivateL(); |
|
111 } |
|
112 |
|
113 // ---------------------------------------------------- |
|
114 // CFMRadioScanLocalStationsContainer::CreateListIconsL |
|
115 // ---------------------------------------------------- |
|
116 // |
|
117 void CFMRadioScanLocalStationsContainer::CreateListIconsL( CArrayPtr<CGulIcon>& aArray ) |
|
118 { |
|
119 if ( iBitMaps.Count() ) |
|
120 { |
|
121 // release any previously created bitmaps |
|
122 iBitMaps.ResetAndDestroy(); |
|
123 } |
|
124 |
|
125 TRgb defaultColor = iEikonEnv->Color( EColorControlText ); |
|
126 |
|
127 // speaker icon |
|
128 CFbsBitmap* playingIconBitmap = NULL; |
|
129 CFbsBitmap* playingIconBitmapMask = NULL; |
|
130 |
|
131 AknsUtils::CreateColorIconLC( iSkin, |
|
132 KAknsIIDQgnIndiSpeaker, |
|
133 KAknsIIDQsnIconColors, |
|
134 EAknsCIQsnIconColorsCG13, |
|
135 playingIconBitmap, |
|
136 playingIconBitmapMask, |
|
137 KAvkonBitmapFile, |
|
138 EMbmAvkonQgn_indi_speaker, |
|
139 EMbmAvkonQgn_indi_speaker_mask, |
|
140 defaultColor |
|
141 ); |
|
142 iBitMaps.AppendL( playingIconBitmap ); |
|
143 iBitMaps.AppendL( playingIconBitmapMask ); |
|
144 CleanupStack::Pop( 2 ); // playingIconBitmap, playingIconBitmapMask |
|
145 |
|
146 CGulIcon* playingIcon = CGulIcon::NewLC(); |
|
147 playingIcon->SetBitmapsOwnedExternally( ETrue ); |
|
148 playingIcon->SetBitmap( playingIconBitmap ); |
|
149 playingIcon->SetMask( playingIconBitmap ); |
|
150 aArray.AppendL( playingIcon ); |
|
151 CleanupStack::Pop( playingIcon ); |
|
152 } |
|
153 |
|
154 // ---------------------------------------------------- |
|
155 // CFMRadioScanLocalStationsContainer::~CFMRadioScanLocalStationsContainer |
|
156 // Class destructor |
|
157 // ---------------------------------------------------- |
|
158 // |
|
159 CFMRadioScanLocalStationsContainer::~CFMRadioScanLocalStationsContainer() |
|
160 { |
|
161 delete iChannelList; |
|
162 iBitMaps.ResetAndDestroy(); |
|
163 iBitMaps.Close(); |
|
164 delete iChannelItemArray; |
|
165 } |
|
166 |
|
167 // ---------------------------------------------------- |
|
168 // CFMRadioScanLocalStationsContainer::InitializeChannelListL |
|
169 // Create the channel list (initially all spots are set as empty) |
|
170 // ---------------------------------------------------- |
|
171 // |
|
172 void CFMRadioScanLocalStationsContainer::InitializeChannelListL() |
|
173 { |
|
174 iChannelList->Reset(); |
|
175 iChannelItemArray->Reset(); |
|
176 iChannelList->ScrollBarFrame()->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto ); |
|
177 // Pass the array to the listbox model and set the ownership type |
|
178 iChannelList->Model()->SetItemTextArray( (MDesCArray*) iChannelItemArray ); |
|
179 iChannelList->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); |
|
180 iChannelList->HandleItemAdditionL(); |
|
181 DrawDeferred(); |
|
182 } |
|
183 |
|
184 // ---------------------------------------------------- |
|
185 // CFMRadioScanLocalStationsContainer::UpdateChannelListContentL |
|
186 // Update the content of the channel at aIndex with the |
|
187 // values specified |
|
188 // ---------------------------------------------------- |
|
189 // |
|
190 void CFMRadioScanLocalStationsContainer::UpdateChannelListContentL( TInt aIndex, |
|
191 const TDesC& aInfoText, |
|
192 TInt aChannelFrequency, |
|
193 TBool aNowPlaying, |
|
194 TBool aInfoTextPlacement ) |
|
195 { |
|
196 TBuf<KLengthOfChannelItemString> textChannelItem; |
|
197 TBuf<KLengthOfChIndexStringChList> textChIndex; |
|
198 TBuf<KLengthOfChannelItemIconIndexString> textChIconIndex; |
|
199 |
|
200 textChIndex.SetLength( 0 ); |
|
201 |
|
202 textChIconIndex.Format( KChIconIndexFormatChList, KNowPlayingIconIndexChList ) ; |
|
203 textChannelItem.Append( textChIndex ); |
|
204 textChannelItem.Append( KColumnListSeparator ); |
|
205 |
|
206 TReal frequency = static_cast<TReal>( aChannelFrequency / static_cast<TReal>( KHzConversionFactor )); |
|
207 // Gets locale decimal separator automatically |
|
208 TRealFormat format(KFrequencyMaxLength, iRadioEngine.DecimalCount() ); |
|
209 TBuf<30> frequencyString; |
|
210 frequencyString.Num( frequency, format ); |
|
211 |
|
212 HBufC* listItemString = NULL; |
|
213 if ( aInfoTextPlacement ) // frequency and PS name |
|
214 { |
|
215 const TInt granularity = 2; |
|
216 |
|
217 CDesCArray* stringsArray = new ( ELeave ) CDesCArrayFlat( granularity ); |
|
218 CleanupStack::PushL( stringsArray ); |
|
219 stringsArray->AppendL( frequencyString ); |
|
220 stringsArray->AppendL( aInfoText ); |
|
221 |
|
222 listItemString = StringLoader::LoadL( R_QTN_FMRADIO_SINGLE_FREQ_NAME, *stringsArray, iEikonEnv ); |
|
223 CleanupStack::PopAndDestroy( stringsArray ); |
|
224 CleanupStack::PushL( listItemString ); |
|
225 } |
|
226 else // frequency |
|
227 { |
|
228 listItemString = StringLoader::LoadLC( R_QTN_FMRADIO_SINGLE_FREQ, frequencyString, iEikonEnv ); |
|
229 } |
|
230 |
|
231 // Update for display of Hindi Devnagari Numbers |
|
232 TPtr listItemStringPtr = listItemString->Des(); |
|
233 AknTextUtils::LanguageSpecificNumberConversion( listItemStringPtr ); |
|
234 |
|
235 textChannelItem.Append( *listItemString ); |
|
236 CleanupStack::PopAndDestroy( listItemString ); |
|
237 |
|
238 // Set 'Now Playing' icon to the channel item |
|
239 textChannelItem.Append( KColumnListSeparator ); |
|
240 |
|
241 if ( aNowPlaying ) |
|
242 { |
|
243 textChannelItem.Append( textChIconIndex ); |
|
244 } |
|
245 |
|
246 if ( aIndex < iChannelItemArray->Count() && aIndex >= 0 ) |
|
247 { |
|
248 iChannelItemArray->Delete( aIndex ); |
|
249 iChannelItemArray->InsertL( aIndex, textChannelItem ); |
|
250 } |
|
251 else |
|
252 { |
|
253 iChannelItemArray->AppendL( textChannelItem ); |
|
254 iChannelList->HandleItemAdditionL(); // Update list |
|
255 iChannelList->UpdateScrollBarsL(); |
|
256 } |
|
257 |
|
258 iChannelList->DrawDeferred(); |
|
259 } |
|
260 |
|
261 // -------------------------------------------------------------------------------- |
|
262 // CFMRadioScanLocalStationsContainer::InsertScannedChannelToListL |
|
263 // -------------------------------------------------------------------------------- |
|
264 // |
|
265 void CFMRadioScanLocalStationsContainer::InsertScannedChannelToListL( TInt aIndex, TInt aChannelFrequency ) |
|
266 { |
|
267 TBuf<KLengthOfChannelItemString> textChannelItem; |
|
268 TBuf<KLengthOfChIndexStringChList> textChIndex; |
|
269 |
|
270 textChannelItem.Append( textChIndex ); |
|
271 textChannelItem.Append( KColumnListSeparator ); |
|
272 |
|
273 TReal frequency = static_cast<TReal>( aChannelFrequency / static_cast<TReal>( KHzConversionFactor )); |
|
274 // Gets locale decimal separator automatically |
|
275 TRealFormat format(KFrequencyMaxLength, iRadioEngine.DecimalCount() ); |
|
276 TBuf<30> frequencyString; |
|
277 frequencyString.Num( frequency, format ); |
|
278 |
|
279 HBufC* listItemString = listItemString = StringLoader::LoadLC( R_QTN_FMRADIO_SINGLE_FREQ, frequencyString, iEikonEnv ); |
|
280 // Update for display of Hindi Devnagari Numbers |
|
281 TPtr listItemStringPtr = listItemString->Des(); |
|
282 AknTextUtils::LanguageSpecificNumberConversion( listItemStringPtr ); |
|
283 textChannelItem.Append( *listItemString ); |
|
284 CleanupStack::PopAndDestroy( listItemString ); |
|
285 |
|
286 // Set 'Now Playing' icon to the channel item |
|
287 textChannelItem.Append( KColumnListSeparator ); |
|
288 |
|
289 if ( aIndex <= ( iChannelItemArray->Count() - 1 ) ) |
|
290 { |
|
291 iChannelItemArray->InsertL( aIndex, textChannelItem ); |
|
292 } |
|
293 else |
|
294 { |
|
295 iChannelItemArray->AppendL( textChannelItem ); |
|
296 } |
|
297 |
|
298 iChannelList->HandleItemAdditionL(); // Update list |
|
299 iChannelList->UpdateScrollBarsL(); |
|
300 iChannelList->DrawDeferred(); |
|
301 } |
|
302 |
|
303 // ---------------------------------------------------- |
|
304 // CFMRadioScanLocalStationsContainer::RemoveChannelListContentL |
|
305 // |
|
306 // ---------------------------------------------------- |
|
307 // |
|
308 void CFMRadioScanLocalStationsContainer::RemoveChannelListContentL( TInt aIndex ) |
|
309 { |
|
310 if ( aIndex < iChannelItemArray->Count() ) |
|
311 { |
|
312 iChannelItemArray->Delete( aIndex ); |
|
313 iChannelList->HandleItemRemovalL(); |
|
314 iChannelList->UpdateScrollBarsL(); |
|
315 |
|
316 TInt channelCount = iChannelItemArray->Count(); |
|
317 // check if the last channel is saved and update current item |
|
318 if ( aIndex == channelCount && channelCount > 0 ) |
|
319 { |
|
320 iChannelList->SetCurrentItemIndex( channelCount - 1 ); |
|
321 } |
|
322 iChannelList->DrawDeferred(); |
|
323 } |
|
324 } |
|
325 |
|
326 // ---------------------------------------------------- |
|
327 // CFMRadioScanLocalStationsContainer::UpdateNowPlayingIconL |
|
328 // Displays 'Now Playing' icon in the current selected channel item. |
|
329 // ---------------------------------------------------- |
|
330 // |
|
331 void CFMRadioScanLocalStationsContainer::UpdateNowPlayingIconL( TInt aNewIndex, TInt aOldIndex ) |
|
332 { |
|
333 HideNowPlayingIconL( aOldIndex, EFalse ); |
|
334 |
|
335 if ( aNewIndex >= 0 && aNewIndex < iChannelItemArray->Count() ) |
|
336 { |
|
337 TBuf<KLengthOfChannelItemIconIndexString> textChIconIndex; |
|
338 textChIconIndex.Format( KChIconIndexFormatChList, KNowPlayingIconIndexChList ); |
|
339 HBufC* channelItem = HBufC::NewLC( KLengthOfChannelItemString ); |
|
340 channelItem->Des().Copy( iChannelItemArray->MdcaPoint( aNewIndex ) ); |
|
341 TPtr ptr( channelItem->Des() ); |
|
342 ptr.Append( textChIconIndex ); // Add icon index |
|
343 |
|
344 iChannelItemArray->InsertL( aNewIndex, *channelItem ); |
|
345 CleanupStack::PopAndDestroy( channelItem ); |
|
346 iChannelList->HandleItemAdditionL(); // Update list |
|
347 iChannelItemArray->Delete( aNewIndex + 1 ); |
|
348 iChannelList->HandleItemRemovalL(); |
|
349 iChannelList->UpdateScrollBarsL(); |
|
350 } |
|
351 // required for fast channel browsing |
|
352 iChannelList->DrawNow(); |
|
353 } |
|
354 |
|
355 // ---------------------------------------------------- |
|
356 // CFMRadioScanLocalStationsContainer::HideNowPlayingIconL |
|
357 // Hides 'Now Playing' icon from the last selected channel. |
|
358 // ---------------------------------------------------- |
|
359 // |
|
360 void CFMRadioScanLocalStationsContainer::HideNowPlayingIconL( TInt aIndex, TBool aDraw ) |
|
361 { |
|
362 if ( aIndex >= 0 && aIndex < iChannelItemArray->Count() ) |
|
363 { |
|
364 HBufC* channelItem = HBufC::NewLC( KLengthOfChannelItemString ); |
|
365 channelItem->Des().Copy( iChannelItemArray->MdcaPoint( aIndex ) ); |
|
366 TPtr ptr( channelItem->Des() ); |
|
367 |
|
368 TBuf<KLengthOfChannelItemIconIndexString> textChIconIndex; |
|
369 TPtrC iconIndexPtr( textChIconIndex ); |
|
370 TInt err = TextUtils::ColumnText( iconIndexPtr, 2, &ptr ); |
|
371 |
|
372 if ( iconIndexPtr.Length() > 0 ) |
|
373 { |
|
374 ptr.Delete( ptr.Length() - iconIndexPtr.Length(), iconIndexPtr.Length() ); // Remove icon index |
|
375 iChannelItemArray->InsertL( aIndex, *channelItem ); |
|
376 iChannelList->HandleItemAdditionL(); // Update list |
|
377 iChannelItemArray->Delete( aIndex + 1 ); |
|
378 iChannelList->HandleItemRemovalL(); |
|
379 iChannelList->UpdateScrollBarsL(); |
|
380 |
|
381 } |
|
382 CleanupStack::PopAndDestroy( channelItem ); |
|
383 if ( aDraw ) |
|
384 { |
|
385 iChannelList->DrawDeferred(); |
|
386 } |
|
387 } |
|
388 } |
|
389 |
|
390 // ---------------------------------------------------- |
|
391 // CFMRadioScanLocalStationsContainer::SetFaded |
|
392 // Fades the entire window and controls in the window owned |
|
393 // by this container control. |
|
394 // ---------------------------------------------------- |
|
395 // |
|
396 void CFMRadioScanLocalStationsContainer::SetFaded( TBool aFaded ) |
|
397 { |
|
398 iFadeStatus = aFaded; |
|
399 Window().SetFaded( aFaded, RWindowTreeNode::EFadeIncludeChildren ); |
|
400 } |
|
401 |
|
402 // ---------------------------------------------------- |
|
403 // CFMRadioScanLocalStationsContainer::UpdateLastListenedChannel |
|
404 // Updates channel index - the highlighted channel in the list. |
|
405 // ---------------------------------------------------- |
|
406 // |
|
407 void CFMRadioScanLocalStationsContainer::UpdateLastListenedChannel( TInt aIndex ) |
|
408 { |
|
409 if ( aIndex < iChannelItemArray->Count() && |
|
410 aIndex > -1 ) |
|
411 { |
|
412 iLastChIndex = aIndex; |
|
413 |
|
414 iChannelList->SetCurrentItemIndex( iLastChIndex ); |
|
415 iChannelList->ScrollToMakeItemVisible( iLastChIndex ); |
|
416 DrawDeferred(); |
|
417 } |
|
418 |
|
419 } |
|
420 |
|
421 // ---------------------------------------------------- |
|
422 // CFMRadioScanLocalStationsContainer::CurrentlySelectedChannel |
|
423 // Returns the index of the selected channel item from the |
|
424 // channel list. |
|
425 // ---------------------------------------------------- |
|
426 // |
|
427 TInt CFMRadioScanLocalStationsContainer::CurrentlySelectedChannel() const |
|
428 { |
|
429 return iChannelList->CurrentItemIndex(); // Index of selected channel |
|
430 } |
|
431 |
|
432 // ---------------------------------------------------- |
|
433 // CFMRadioScanLocalStationsContainer::HandleListBoxEventL |
|
434 // For handling listbox-, in this case, channel list events. |
|
435 // The event equals to selecting a channel item from the list. |
|
436 // ---------------------------------------------------- |
|
437 // |
|
438 void CFMRadioScanLocalStationsContainer::HandleListBoxEventL( CEikListBox* /*aListBox*/, |
|
439 TListBoxEvent aEventType ) |
|
440 { |
|
441 // Check the event generated by keypress and report the event, |
|
442 // Also check for Pen Enabled touch screen event |
|
443 switch ( aEventType ) |
|
444 { |
|
445 case EEventEnterKeyPressed: |
|
446 case EEventItemSingleClicked: // new event for item activation |
|
447 { |
|
448 ReportEventL( MCoeControlObserver::EEventStateChanged ); |
|
449 break; |
|
450 } |
|
451 default: |
|
452 { |
|
453 break; |
|
454 } |
|
455 } |
|
456 } |
|
457 |
|
458 // ----------------------------------------------------------------------------- |
|
459 // CFMRadioScanLocalStationsContainer::HandleResourceChange |
|
460 // ----------------------------------------------------------------------------- |
|
461 // |
|
462 void CFMRadioScanLocalStationsContainer::HandleResourceChange( TInt aType ) |
|
463 { |
|
464 CCoeControl::HandleResourceChange( aType ); |
|
465 if ( aType == KEikDynamicLayoutVariantSwitch ) |
|
466 { |
|
467 SizeChanged(); |
|
468 } |
|
469 else if ( aType == KAknsMessageSkinChange ) |
|
470 { |
|
471 CArrayPtr<CGulIcon>* iconArray = iChannelList->ItemDrawer()->ColumnData()->IconArray(); |
|
472 // update icons with new skin |
|
473 iconArray->ResetAndDestroy(); |
|
474 TRAP_IGNORE( CreateListIconsL( *iconArray ) ) |
|
475 } |
|
476 } |
|
477 |
|
478 // --------------------------------------------------------- |
|
479 // CFMRadioScanLocalStationsContainer::SizeChanged |
|
480 // Called by framework when the view size is changed |
|
481 // --------------------------------------------------------- |
|
482 // |
|
483 void CFMRadioScanLocalStationsContainer::SizeChanged() |
|
484 { |
|
485 iChannelList->SetRect( Rect() ); |
|
486 } |
|
487 |
|
488 // --------------------------------------------------------- |
|
489 // CFMRadioScanLocalStationsContainer::CountComponentControls |
|
490 // Return the number of controls in the window owned by this container |
|
491 // --------------------------------------------------------- |
|
492 // |
|
493 TInt CFMRadioScanLocalStationsContainer::CountComponentControls() const |
|
494 { |
|
495 return 1; |
|
496 } |
|
497 |
|
498 // --------------------------------------------------------- |
|
499 // CFMRadioScanLocalStationsContainer::ComponentControl |
|
500 // Return the control corresponding to the specified index |
|
501 // --------------------------------------------------------- |
|
502 // |
|
503 CCoeControl* CFMRadioScanLocalStationsContainer::ComponentControl( TInt aIndex ) const |
|
504 { |
|
505 CCoeControl* control = NULL; |
|
506 |
|
507 switch ( aIndex ) |
|
508 { |
|
509 case 0: |
|
510 { |
|
511 control = iChannelList; |
|
512 break; |
|
513 } |
|
514 default: |
|
515 { |
|
516 break; |
|
517 } |
|
518 } |
|
519 |
|
520 return control; |
|
521 } |
|
522 |
|
523 // --------------------------------------------------------- |
|
524 // CFMRadioScanLocalStationsContainer::OfferKeyEventL |
|
525 // Allow the channel list to process key events |
|
526 // --------------------------------------------------------- |
|
527 // |
|
528 TKeyResponse CFMRadioScanLocalStationsContainer::OfferKeyEventL( const TKeyEvent& aKeyEvent, |
|
529 TEventCode aType ) |
|
530 { |
|
531 TKeyResponse response = EKeyWasNotConsumed; |
|
532 |
|
533 switch ( aKeyEvent.iCode ) |
|
534 { |
|
535 case EKeyLeftArrow: |
|
536 case EKeyRightArrow: |
|
537 return EKeyWasNotConsumed; |
|
538 |
|
539 case EKeyUpArrow: |
|
540 case EKeyDownArrow: |
|
541 response = iChannelList->OfferKeyEventL( aKeyEvent, aType ); |
|
542 if (response == EKeyWasConsumed) |
|
543 { |
|
544 ReportEventL( MCoeControlObserver::EEventRequestFocus ); |
|
545 } |
|
546 return response; |
|
547 |
|
548 |
|
549 default: |
|
550 switch ( aKeyEvent.iScanCode ) //we need to use the scan code, because we need to process the event wrt the keyUp and keyDown action |
|
551 { |
|
552 case EKeyboardKey1: // Timed key |
|
553 case EKeyboardKey2: // Normal keys |
|
554 case EKeyboardKey3: |
|
555 case EKeyboardKey4: |
|
556 case EKeyboardKey5: |
|
557 case EKeyboardKey6: |
|
558 case EKeyboardKey7: |
|
559 case EKeyboardKey8: |
|
560 case EKeyboardKey9: |
|
561 case EKeyboardKey0: |
|
562 return EKeyWasNotConsumed; |
|
563 default: |
|
564 break; |
|
565 } |
|
566 break; |
|
567 } |
|
568 return iChannelList->OfferKeyEventL( aKeyEvent, aType ); |
|
569 } |
|
570 |
|
571 // --------------------------------------------------------------------------- |
|
572 // CFMRadioScanLocalStationsContainer::GetHelpContext |
|
573 // Gets Help |
|
574 // --------------------------------------------------------------------------- |
|
575 // |
|
576 void CFMRadioScanLocalStationsContainer::GetHelpContext( TCoeHelpContext& aContext ) const |
|
577 { |
|
578 #if defined __SERIES60_HELP || defined FF_S60_HELPS_IN_USE |
|
579 aContext.iMajor = TUid::Uid( KUidFMRadioApplication ); |
|
580 aContext.iContext = KFMRADIO_HLP_SEARCH; |
|
581 #endif |
|
582 } |
|
583 |
|
584 // --------------------------------------------------------- |
|
585 // CFMRadioScanLocalStationsContainer::FocusChanged(TDrawNow aDrawNow) |
|
586 // --------------------------------------------------------- |
|
587 // |
|
588 void CFMRadioScanLocalStationsContainer::FocusChanged( TDrawNow aDrawNow ) |
|
589 { |
|
590 CCoeControl::FocusChanged( aDrawNow ); |
|
591 if ( iChannelList ) |
|
592 { |
|
593 iChannelList->SetFocus( IsFocused(), aDrawNow ); |
|
594 } |
|
595 } |
|
596 |
|
597 // -------------------------------------------------------------------------------- |
|
598 // CFMRadioScanLocalStationsContainer::ResetChannelListL |
|
599 // Sets toolbar visibility |
|
600 // -------------------------------------------------------------------------------- |
|
601 // |
|
602 void CFMRadioScanLocalStationsContainer::ResetChannelListL() |
|
603 { |
|
604 iChannelItemArray->Reset(); |
|
605 iChannelList->ScrollBarFrame()->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EOff ); |
|
606 iChannelList->HandleItemRemovalL(); |
|
607 iChannelList->DrawDeferred(); |
|
608 } |
|
609 |
|
610 // --------------------------------------------------------- |
|
611 // CFMRadioScanLocalStationsContainer::SetStationListEmptyTextL |
|
612 // --------------------------------------------------------- |
|
613 // |
|
614 void CFMRadioScanLocalStationsContainer::SetStationListEmptyTextL( const TDesC& aText ) |
|
615 { |
|
616 iChannelList->View()->SetListEmptyTextL( aText ); |
|
617 } |
|
618 |
|
619 // --------------------------------------------------------- |
|
620 // CFMRadioScanLocalStationsContainer::HandlePointerEventL |
|
621 // --------------------------------------------------------- |
|
622 // |
|
623 void CFMRadioScanLocalStationsContainer::HandlePointerEventL( const TPointerEvent& aPointerEvent ) |
|
624 { |
|
625 // don't handle any pointer events if view is faded |
|
626 if ( !iFadeStatus ) |
|
627 { |
|
628 CCoeControl::HandlePointerEventL( aPointerEvent ); |
|
629 } |
|
630 } |
|
631 |
|
632 // End of File |