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