internetradio2.0/uisrc/irmaincontainer.cpp
changeset 3 ee64f059b8e1
parent 2 2e1adbfc62af
child 4 3f2d53f144fe
child 5 0930554dc389
equal deleted inserted replaced
2:2e1adbfc62af 3:ee64f059b8e1
     1 /*
       
     2 * Copyright (c) 2004 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:  
       
    15 *
       
    16 */
       
    17 
       
    18 #include <akniconarray.h>
       
    19 #include <barsread.h>
       
    20 #include <stringloader.h>
       
    21 #include <internetradio.rsg>
       
    22 #include <internetradio.mbg>
       
    23 #include <aknsbasicbackgroundcontrolcontext.h> 
       
    24 #include <avkon.mbg>
       
    25 #include <aknsfld.h> 
       
    26 #include <eikprogi.h> 
       
    27 
       
    28 
       
    29 #include "irui.h"
       
    30 #include "ir.hrh"
       
    31 #include "irdebug.h"
       
    32 #include "irmainview.h"
       
    33 #include "irmaincontainer.h"
       
    34 #include "iraap.hlp.hrh"
       
    35 #include "irisdswrapper.h"
       
    36 #include "irimageconverter.h"
       
    37 #include "irfilteredmodel.h"
       
    38 #include "irfavoritesdb.h"
       
    39 #include "irisdspreset.h"
       
    40 #include "irpreset.h"
       
    41 #include "irhistory.h"
       
    42 #include "irdialoglauncher.h"
       
    43 #include "mirlistboxarray.h"
       
    44 #include "iradvertisinglistbox.h"
       
    45 #include "irnowplayingwrapper.h"
       
    46 #include "irnetworkcontroller.h"
       
    47 
       
    48 
       
    49 //Literals Declaration
       
    50 
       
    51 // Format string for two row list item with logo, %S containing:
       
    52 // 1. Icon ID for logo image
       
    53 // 2. First row text
       
    54 // 3. Second row text
       
    55 _LIT( KIRFormatStringWithIcon, "%d\t%S\t%S" );
       
    56 _LIT( KIRFormatStringWithoutIcon, "\t%S\t%S" );
       
    57 _LIT(KAvkonBitmapFile,"z:\\resource\\apps\\avkon2.mbm");
       
    58 
       
    59 //Constants Declaration
       
    60 const TInt KProgressbarFinalValue = 100;
       
    61 const TInt KProgressTimer = 500000;
       
    62 const TInt KExtraLength = 30;
       
    63 const TInt KRange = 999;
       
    64 const TInt KIRNoLogo = -1;
       
    65 // Length of list item with known sized elements: (the number of column separators) + 3 (maximum length for icon id)
       
    66 const TInt KIRListItemBaseLength = 5;
       
    67 
       
    68 
       
    69 #define KCONTROLSCOUNT 0
       
    70 
       
    71 
       
    72 // ================= MEMBER FUNCTIONS =======================
       
    73 
       
    74 // -----------------------------------------------------------------------------
       
    75 // CIRMainContainer::NewL()
       
    76 // Two-phased constructor.
       
    77 // -----------------------------------------------------------------------------
       
    78 //
       
    79 CIRMainContainer* CIRMainContainer::NewL( CIRMainView& aView, const TRect& aRect )
       
    80     {
       
    81  	IRLOG_DEBUG( "CIRMainContainer::NewL" );
       
    82     CIRMainContainer* self = CIRMainContainer::NewLC( aView, aRect );
       
    83     CleanupStack::Pop( self );
       
    84     IRLOG_DEBUG( "CIRMainContainer::NewL - Exiting" );
       
    85     return self;
       
    86     }
       
    87 
       
    88 // -----------------------------------------------------------------------------
       
    89 // CIRMainContainer::NewLC()
       
    90 // Two-phased constructor.
       
    91 // -----------------------------------------------------------------------------
       
    92 //
       
    93 CIRMainContainer* CIRMainContainer::NewLC( CIRMainView& aView, const TRect& aRect )
       
    94     {
       
    95  	IRLOG_DEBUG( "CIRMainContainer::NewLC" );
       
    96     CIRMainContainer* self = new ( ELeave ) CIRMainContainer(aView);
       
    97     CleanupStack::PushL( self );
       
    98     self->ConstructL( aRect );
       
    99     IRLOG_DEBUG( "CIRMainContainer::NewLC - Exiting" );
       
   100     return self;
       
   101     }
       
   102 
       
   103 // ---------------------------------------------------------------------------
       
   104 // CIRMainContainer::CIRMainContainer()  
       
   105 // C++ default constructor can NOT contain any code, that might leave.
       
   106 // ---------------------------------------------------------------------------
       
   107 //
       
   108 CIRMainContainer::CIRMainContainer(CIRMainView& aView) :iMainView(aView)
       
   109 	{
       
   110 	IRLOG_DEBUG( "CIRMainContainer::CIRMainContainer" );
       
   111 	iLastPlayedChannel = EFalse;
       
   112 	iProgressCount = 1;
       
   113 	iDeletingCount = 1;
       
   114 	iFilteredFlag = EFalse;
       
   115 	iContextSensitiveFlag = EFalse;
       
   116 	iMoveFocusLast = EFalse;
       
   117 	IRLOG_DEBUG( "CIRMainContainer::CIRMainContainer - Exiting" );
       
   118 	}
       
   119     
       
   120 // ---------------------------------------------------------------------------
       
   121 // CIRMainContainer::ConstructL
       
   122 // ---------------------------------------------------------------------------
       
   123 //
       
   124 void CIRMainContainer::ConstructL( const TRect& aRect)
       
   125     {
       
   126 	IRLOG_DEBUG( "CIRMainContainer::ConstructL - Entering" );
       
   127     CreateWindowL();
       
   128     SetRect(aRect);
       
   129     iImageCount = 1;
       
   130     iFinalCount = 0;
       
   131     iLogoDownloadError = EFalse;
       
   132     iBgContext = CAknsBasicBackgroundControlContext::NewL(KAknsIIDQsnBgScreen , aRect, ETrue); 
       
   133  	
       
   134    
       
   135     iConverter = CIRImageConverter::NewL();
       
   136 	iConverter->EnableAnimations( EFalse );
       
   137 	iConverter->SetObserver( this );
       
   138 
       
   139 	iCurrentItemConverter = CIRImageConverter::NewL();
       
   140 	iCurrentItemConverter->SetObserver( this );
       
   141     
       
   142     // Added For Dynamic Filtering
       
   143     iFilteredModel=new(ELeave) CIRFilteredModel;
       
   144     iFilteredModel->ConstructL();
       
   145    	iListBoxArray = MIRListBoxArray::NewL();
       
   146     iFavouritesListBox = new (ELeave) CIRAdvertisingListBox;
       
   147 
       
   148 	IRLOG_DEBUG( "CIRMainContainer::ConstructL - Exiting" );
       
   149 	}
       
   150 // ---------------------------------------------------------------------------
       
   151 // CIRMainContainer::CreateCustomListBoxL()
       
   152 // Creates the listbox
       
   153 // ---------------------------------------------------------------------------
       
   154 //
       
   155 void CIRMainContainer::CreateCustomListBoxL()
       
   156 	{
       
   157 	IRLOG_DEBUG( "CIRMainContainer::CreateCustomListBoxL...Entering" );
       
   158 	TRect rect;
       
   159 	//For displaying Ads
       
   160 	iFavouritesListBox->SetContainerWindowL(*this);
       
   161 	// Added For Dynamic Filtering
       
   162 	iFavouritesListBox->ConstructL (this,EAknListBoxMarkableList,iFilteredModel);
       
   163 	
       
   164 	 
       
   165     // Construct list.
       
   166     TResourceReader rr;
       
   167     iCoeEnv->CreateResourceReaderLC( rr, R_IR_CHANNEL_LIST );
       
   168     ConstructFromResourceL( rr );
       
   169     CleanupStack::PopAndDestroy(); // rr
       
   170     
       
   171     iListArray = static_cast<CDesCArray*>( iFavouritesListBox->Model()->ItemTextArray());
       
   172     iListBoxArray->SetListArray(iListArray);
       
   173     
       
   174     iFilteredModel->SetListArray(iListBoxArray); 
       
   175     
       
   176     CAknIconArray* iconArray = new ( ELeave ) CAknIconArray(iMainView.iUi->
       
   177     														iFavPresets->MaxPresetCount());
       
   178 	CleanupStack::PushL( iconArray );
       
   179 	
       
   180    // Creating mark icon and appending to iconarray.
       
   181 	CFbsBitmap* markBitmap = NULL;
       
   182     CFbsBitmap* markBitmapMask = NULL;
       
   183     
       
   184     //CListItemDrawer is using this logical color as default for its marked icons
       
   185     TRgb defaultColor;
       
   186     defaultColor = iEikonEnv->Color(EColorControlText);
       
   187     
       
   188 
       
   189     AknsUtils::CreateColorIconLC(AknsUtils::SkinInstance(),
       
   190     			KAknsIIDQgnIndiMarkedAdd,
       
   191     			KAknsIIDQsnIconColors,
       
   192     			EAknsCIQsnIconColorsCG13,
       
   193     			markBitmap,
       
   194     			markBitmapMask,
       
   195     			KAvkonBitmapFile,
       
   196     			EMbmAvkonQgn_indi_marked_add,
       
   197     			EMbmAvkonQgn_indi_marked_add_mask,
       
   198     			defaultColor
       
   199     			);
       
   200     
       
   201     CGulIcon* markIcon = CGulIcon::NewL( markBitmap,markBitmapMask );
       
   202     // poping markBitmap, markBitmapMask
       
   203     // codescanner fix
       
   204     CleanupStack::Pop( markBitmapMask );
       
   205     CleanupStack::Pop( markBitmap ); 
       
   206     CleanupStack::PushL( markIcon );      
       
   207     iconArray->AppendL( markIcon );
       
   208 
       
   209     CleanupStack::Pop( markIcon );	
       
   210     
       
   211 	for ( TInt i = 0; i <  iMainView.iUi->iFavPresets->MaxPresetCount() ; i++ )
       
   212 		{
       
   213 		CGulIcon* icon = CreateDefaultIconL();
       
   214         CleanupStack::PushL( icon );
       
   215         iconArray->AppendL( icon );
       
   216         CleanupStack::Pop( icon );
       
   217 		}
       
   218 
       
   219 	CleanupStack::Pop( iconArray  );
       
   220     iFavouritesListBox->ItemDrawer()->FormattedCellData()->SetIconArrayL( iconArray );  
       
   221     iFavouritesListBox->SetRect( Rect());
       
   222     iFavouritesListBox->ActivateL();
       
   223 
       
   224     iFavouritesListBox->CreateScrollBarFrameL( ETrue );
       
   225     iFavouritesListBox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff, 
       
   226                                               CEikScrollBarFrame::EAuto);
       
   227  	iFavouritesListBox->SetListBoxObserver( this );     
       
   228  	
       
   229 	// Set the icon array for this list. List takes ownership of the array. 
       
   230 	// Also move icon is added.
       
   231  	SetIconsL();
       
   232  	UpdateAllL();
       
   233 	iFavouritesListBox->ItemDrawer()->FormattedCellData()->SetMarqueeParams
       
   234 									(KLoop, KScrollAmount, KScrollDelay, KInterval);
       
   235     iFavouritesListBox->ItemDrawer()->ColumnData()->EnableMarqueeL( ETrue );
       
   236 	TInt favCount = iMainView.iUi->iFavPresets->iFavPresetList.Count();
       
   237 	if(favCount>1)
       
   238 		{
       
   239 		if(iFavouritesSearchBox)
       
   240 			{
       
   241 			DisableFindBox();
       
   242 			}
       
   243 		// Added For Dynamic Filtering
       
   244 		iFavouritesSearchBox = CreateFindBoxL(iFavouritesListBox, iFilteredModel,
       
   245 		  CAknSearchField::ESearch);
       
   246 		SizeChanged();	
       
   247 		}
       
   248 	else
       
   249 		{
       
   250 		DisableFindBox();	
       
   251 		}
       
   252  	
       
   253 	IRLOG_DEBUG( "CIRMainContainer::CreateCustomListBoxL - Exiting" );
       
   254     }
       
   255 // ---------------------------------------------------------------------------
       
   256 // CIRMainContainer::CreateDefaultIconL
       
   257 // ---------------------------------------------------------------------------
       
   258 //
       
   259 CGulIcon* CIRMainContainer::CreateDefaultIconL()
       
   260     {
       
   261 	IRLOG_DEBUG( "CIRMainContainer::CreateDefaultIconL - Entering" );
       
   262     CFbsBitmap* bitmap = new ( ELeave ) CFbsBitmap;
       
   263     CleanupStack::PushL( bitmap );
       
   264     User::LeaveIfError( bitmap->Create( TSize(), EGray2 ) );
       
   265     CFbsBitmap* mask = new ( ELeave ) CFbsBitmap;
       
   266     CleanupStack::PushL( mask );
       
   267     User::LeaveIfError( mask->Create( TSize(), EGray2 ) );
       
   268     CGulIcon* icon = CGulIcon::NewL( bitmap, mask );
       
   269     icon->SetBitmapsOwnedExternally( EFalse );
       
   270     CleanupStack::Pop( 2, bitmap );
       
   271 	IRLOG_DEBUG( "CIRMainContainer::CreateDefaultIconL - Exiting" );
       
   272     return icon;
       
   273     }
       
   274 // ---------------------------------------------------------------------------
       
   275 // CIRMainContainer::SetIconsL()
       
   276 // Used to set icons to the list
       
   277 // ---------------------------------------------------------------------------
       
   278 //
       
   279 void CIRMainContainer::SetIconsL()
       
   280 	{
       
   281 	// Set the icon array for this list. List takes ownership of the array. 
       
   282 	// Also move icon is added.
       
   283 	
       
   284 		iMainView.iUi->iFavPresets->GetAllPreset();
       
   285 		iMainView.SetMovingFlag(EFalse);
       
   286 		
       
   287 
       
   288 	const RIRPresetArray& presets = iMainView.iUi->iFavPresets->Presets();
       
   289 	for ( TInt i = 0; i < presets.Count(); i++ )
       
   290 		{
       
   291 		if ( presets[i]->GetLogoData().Length() )
       
   292 			{
       
   293 			iInvalidIconIndices.InsertInOrderL( presets[i]->Index() );
       
   294 			}
       
   295 		iNoLogosArray.InsertInOrderL(presets[i]->Index());		
       
   296 		}
       
   297     // Checking whether the lastplayed is present or not.
       
   298 	if(iMainView.iUi->iLastPlayed->FileExists() )
       
   299 		{
       
   300 		// Checking whether the lastplayed is having logo data.
       
   301 		//If present sends the data for conversation.
       
   302 		if(iMainView.iUi->iLastPlayed->iLastPlayedStation->GetLogoData().Length())
       
   303 	        {
       
   304 	        iImageLast = ETrue;
       
   305 	        TInt index = iMainView.iUi->iLastPlayed->iLastPlayedStation->GetIndex();
       
   306 			StartConvertL( *iConverter, index, KErrUnknown );
       
   307 	    	}
       
   308 		// If the lastplayed is not having logo data and having the image url
       
   309 		// then send a request for downloading the logo
       
   310 	    else if(iMainView.iUi->iLastPlayed->iLastPlayedStation->GetImgUrl().Length())
       
   311 		    {
       
   312 			if((iMainView.iUi->iNetworkController->GetNetworkStatus() ))
       
   313 			    {
       
   314 			    SendRequestForLastPlayedLogoL();
       
   315 		        }
       
   316 		     else if ( iInvalidIconIndices.Count() )
       
   317 				{
       
   318 				StartConvertL( *iConverter, iInvalidIconIndices[0], KErrUnknown );
       
   319 				}
       
   320 		    }
       
   321  	
       
   322 	    // If both logodata and image url is not present for lastplayed then logo
       
   323 	    // request for other stations has to be made.
       
   324 	    else
       
   325 		    {
       
   326 			if ( iInvalidIconIndices.Count() )
       
   327 				{
       
   328 				StartConvertL( *iConverter, iInvalidIconIndices[0], KErrUnknown );
       
   329 				}
       
   330 		    }
       
   331 		}
       
   332 	else
       
   333 		{
       
   334 		if ( iInvalidIconIndices.Count() )
       
   335 			{
       
   336 			StartConvertL( *iConverter, iInvalidIconIndices[0], KErrUnknown );
       
   337 			}
       
   338 		}
       
   339 	}
       
   340 // ---------------------------------------------------------------------------
       
   341 // void CIRMainContainer::SendRequestForLastPlayedLogoL()
       
   342 // 
       
   343 // ---------------------------------------------------------------------------
       
   344 //
       
   345 void CIRMainContainer::SendRequestForLastPlayedLogoL()
       
   346 	{
       
   347 	IRLOG_DEBUG( "CIRMainContainer::SendRequestForLastPlayedLogoL - Entering" );
       
   348 	//code to download the logo
       
   349 	if(iTempPreset)
       
   350 		{
       
   351 		delete iTempPreset;
       
   352 		iTempPreset = NULL;
       
   353 		}
       
   354 	iTempPreset=CIRIsdsPreset::NewL();
       
   355 	iTempPreset->SetChannelType(1);
       
   356 	iTempPreset->SetImgUrl(iMainView.iUi->iLastPlayed->iLastPlayedStation->GetImgUrl());
       
   357 	iMainView.LogoRequestL();
       
   358 	IRLOG_DEBUG( "CIRMainContainer::SendRequestForLastPlayedLogoL - Exiting" );
       
   359 	}
       
   360 // ---------------------------------------------------------------------------
       
   361 // CIRMainContainer:: GetTempPreset()
       
   362 // returns the temporary preset 
       
   363 // ---------------------------------------------------------------------------
       
   364  CIRIsdsPreset* CIRMainContainer::GetTempPreset()
       
   365 	 {
       
   366 	 IRLOG_DEBUG( "CIRMainContainer::GetTempPreset " );
       
   367 	 return iTempPreset;
       
   368 	 }
       
   369 // ---------------------------------------------------------------------------
       
   370 // CIRMainContainer::~CIRMainContainer()
       
   371 // Destructor
       
   372 // ---------------------------------------------------------------------------
       
   373 //
       
   374 CIRMainContainer::~CIRMainContainer()
       
   375     {
       
   376 	IRLOG_DEBUG( "CIRMainContainer::~CIRMainContainer - Entering" );
       
   377 	delete iConverter;
       
   378 	delete iCurrentItemConverter;
       
   379 	iInvalidIconIndices.Close();
       
   380 	iLogosArray.Close();
       
   381 	iNoLogosArray.Close();  
       
   382   	iMultiDeleteString.Close();
       
   383   	iFilterIndexExist.Close();
       
   384     if(iFavouritesListBox)
       
   385     	{
       
   386     	delete iFavouritesListBox;
       
   387     	iFavouritesListBox = NULL;
       
   388     	}
       
   389     if(iFavouritesSearchBox)
       
   390 		{
       
   391 		delete iFavouritesSearchBox;
       
   392 		iFavouritesSearchBox = NULL;
       
   393 		}
       
   394 	if(iBgContext)
       
   395 		{
       
   396 		delete iBgContext;
       
   397 		iBgContext = NULL;	
       
   398 		}
       
   399 	if(iAdvString)
       
   400 		{
       
   401 		delete iAdvString;
       
   402 		iAdvString = NULL;	
       
   403 		}
       
   404     if(iTempPreset)
       
   405 		{
       
   406 		delete iTempPreset;
       
   407 		iTempPreset = NULL;
       
   408 		}
       
   409 	if(iItem)
       
   410 		{
       
   411 		delete iItem;
       
   412 		iItem = NULL;	
       
   413 		}
       
   414 	if(iLastplayed)
       
   415 		{
       
   416 		delete iLastplayed;
       
   417 		iLastplayed = NULL;	
       
   418 	 	}
       
   419     if(iProgressDialog)
       
   420     	{
       
   421     	delete iProgressDialog;
       
   422     	iProgressDialog= NULL;
       
   423     	}
       
   424     if(iProgressInfo)
       
   425     	{
       
   426     	delete iProgressInfo;
       
   427     	iProgressInfo= NULL;
       
   428     	}
       
   429     if(iListBoxArray )
       
   430 	    {
       
   431 	    delete iListBoxArray ;
       
   432 	    iListBoxArray = NULL;	
       
   433 	    }
       
   434 	iImageCount = 1;
       
   435 	IRLOG_DEBUG( "CIRMainContainer::~CIRMainContainer - Exiting" );
       
   436     }
       
   437 // ---------------------------------------------------------------------------
       
   438 // CIRMainContainer::LastPlayedDisplayL()()
       
   439 // Displays the lastplayed station
       
   440 // ---------------------------------------------------------------------------
       
   441 //
       
   442 void CIRMainContainer::LastPlayedDisplayL()
       
   443 	{
       
   444 	IRLOG_DEBUG( "CIRMainContainer::LastPlayedDisplayL - Entering" );
       
   445 	if(iLastplayed)
       
   446 		{
       
   447 		delete iLastplayed;
       
   448 		iLastplayed = NULL;	
       
   449 		}
       
   450 	if(iMainView.iNowPlayingWrapper->iPlaying)
       
   451 			{
       
   452 		 	iLastplayed = StringLoader::LoadL(R_IRAPP_MAIN_MENU_NOW);
       
   453 			}
       
   454 		else
       
   455 			{
       
   456 			iLastplayed = StringLoader::LoadL(R_IRAPP_MAIN_MENU_LAST);
       
   457 			}
       
   458 
       
   459 	if(iMainView.iUi->iLastPlayed->FileExists())
       
   460 		{
       
   461 		iLastPlayedChannel = ETrue;
       
   462 		// Added For Dynamic Filtering
       
   463 		if(iMainView.iUi->iLastPlayed->iLastPlayedStation->GetLogoData().Length() && !iImageLast 
       
   464 			&& !iLogoDownloadError)
       
   465 			{
       
   466 			if(iItem)
       
   467 				{
       
   468 				delete iItem;
       
   469 				iItem = NULL;
       
   470 
       
   471 				}
       
   472 			iItem = HBufC::NewL( KIRFormatStringWithIcon().Length() + 2 + 
       
   473 			iLastplayed->Length()+iMainView.iUi->iLastPlayed->iLastPlayedStation->GetName().Length() );
       
   474 			TPtr pItem( iItem->Des() );
       
   475 			pItem.Format( KIRFormatStringWithIcon,iMainView.iUi->iLastPlayed->
       
   476 						  iLastPlayedStation->GetIndex()+1, iLastplayed,
       
   477 			  &iMainView.iUi->iLastPlayed->iLastPlayedStation->GetName());
       
   478 			} 
       
   479 		else
       
   480 			{
       
   481 			if(iItem)
       
   482 				{
       
   483 				delete iItem;
       
   484 				iItem = NULL;
       
   485 				}
       
   486 			iItem = HBufC::NewL( KIRFormatStringWithoutIcon().Length() + 2 + 
       
   487 			iLastplayed->Length()+iMainView.iUi->iLastPlayed->iLastPlayedStation->GetName().Length() );
       
   488 			TPtr pItem( iItem->Des() );
       
   489 			pItem.Format( KIRFormatStringWithoutIcon, iLastplayed,
       
   490 			  		&iMainView.iUi->iLastPlayed->iLastPlayedStation->GetName());
       
   491 			}
       
   492 		iFavouritesListBox->SetLastPlayed(iLastPlayedChannel);
       
   493 		iFilteredModel->SetAdvFlag(iLastPlayedChannel,*iItem);
       
   494 		iFilteredModel->SetItemAtZero(iLastPlayedChannel,*iItem,ETrue);
       
   495 		iFavouritesListBox->SetListItemFormat( iItem);
       
   496 
       
   497 	   // Creating mark icon and appending to iconarray.
       
   498 		CFbsBitmap* bitmap = NULL;
       
   499 	    CFbsBitmap* bitmapMask = NULL;
       
   500 	    
       
   501 	    //CListItemDrawer is using this logical color as default for its marked icons
       
   502 	    TRgb defaultColor;
       
   503 	    defaultColor = iEikonEnv->Color(EColorControlText);
       
   504 	    
       
   505 	    AknsUtils::CreateColorIconLC(AknsUtils::SkinInstance(),
       
   506 	    			KAknsIIDQgnIndiMarkedAdd,
       
   507 	    			KAknsIIDQsnIconColors,
       
   508 	    			EAknsCIQsnIconColorsCG13,
       
   509 	    			bitmap,
       
   510 	    			bitmapMask,
       
   511 	    			KAvkonBitmapFile,
       
   512 	    			EMbmInternetradioQgn_ir_transparent,
       
   513 	    			EMbmInternetradioQgn_ir_transparent_mask,
       
   514 	    			defaultColor
       
   515 	    			);
       
   516 	    
       
   517 	    CGulIcon* icon = CGulIcon::NewL( bitmap,bitmapMask );
       
   518 	    // poping markBitmap, markBitmapMask
       
   519 	    // codescanner fix
       
   520 	    CleanupStack::Pop( bitmapMask );
       
   521 	    CleanupStack::Pop( bitmap ); 
       
   522 	    CleanupStack::PushL( icon ); 
       
   523 		iFavouritesListBox->SetAdvertisementIconL(icon,ETrue);
       
   524 		CleanupStack::Pop( icon );	
       
   525 		
       
   526 		iListArray->AppendL( iItem->Des() );
       
   527 		} 
       
   528 	else
       
   529 		{
       
   530 		if(iAdvString)
       
   531 			{
       
   532 			delete iAdvString;
       
   533 			iAdvString = NULL;	
       
   534 			}
       
   535 		_LIT(KNullFormat,"\t \t ");
       
   536 		iAdvString = HBufC::NewL(KExtraLength);
       
   537 		TPtr ptr(iAdvString->Des());
       
   538 		ptr.Copy(KNullFormat);
       
   539 		iFilteredModel->SetItemAtZero(iLastPlayedChannel,*iAdvString);
       
   540 		}
       
   541 	IRLOG_DEBUG( "CIRMainContainer::LastPlayedDisplayL - Exiting" );
       
   542 	}
       
   543 // ---------------------------------------------------------------------------
       
   544 // TKeyResponse CIRMainContainer::OfferKeyEventL()
       
   545 // From class CCoeControl.
       
   546 // We need to catch the selection key event in order to do a couple of things
       
   547 // in moving state make the movement, and in normal state open channel 
       
   548 // specific popup menu. Up and down buttons are forwarded to the list.
       
   549 // ---------------------------------------------------------------------------
       
   550 //
       
   551 TKeyResponse CIRMainContainer::OfferKeyEventL( 
       
   552         const TKeyEvent& aKeyEvent, TEventCode aType )
       
   553 	{
       
   554 
       
   555 	IRLOG_DEBUG( "CIRMainContainer::OfferKeyEventL - Entering" );
       
   556 	TKeyResponse keyResp( EKeyWasNotConsumed );
       
   557 	switch ( aKeyEvent.iCode )
       
   558 		{
       
   559 		case EKeyLeftArrow: // fall-through intended here
       
   560 		case EKeyRightArrow:
       
   561 		case EKeyIncVolume:
       
   562 		case EKeyDecVolume:
       
   563 			{
       
   564 			keyResp = EKeyWasNotConsumed;
       
   565 			break;
       
   566 			}
       
   567 		case EKeyOK:        
       
   568 			{
       
   569 			iMainView.SetCurrentFocus(iFavouritesListBox->CurrentItemIndex());
       
   570 			if(!iMainView.GetMovingFlag())
       
   571 				{
       
   572 				if(iMainView.GetMarkedFlag()||iMainView.GetMarkedAllFlag())
       
   573 					{
       
   574 					ProcessPointerEventL(iFavouritesListBox->CurrentItemIndex()); //aListBox->CurrentItemIndex() not used         
       
   575 					break;
       
   576 					}
       
   577 				else
       
   578 					{
       
   579 					iMainView.SetCurrentFocus(GetCurrentItemIndex());
       
   580 					iMainView.HandleCommandL(EListenCmd);
       
   581 					}
       
   582 				}
       
   583 			break;
       
   584 			}
       
   585 		default:
       
   586 			{
       
   587 			if(!iMainView.GetMovingFlag())
       
   588 				{
       
   589 				if((iMainView.GetListBoxMarkedCount() != GetListPointer()->Model()->NumberOfItems()))
       
   590 					{
       
   591 					if(iFavouritesListBox)
       
   592 						{
       
   593 						if ( iFavouritesSearchBox )
       
   594 							{
       
   595 							keyResp = iFavouritesSearchBox->OfferKeyEventL( aKeyEvent, aType );
       
   596 
       
   597 							if( keyResp == EKeyWasNotConsumed )
       
   598 								{
       
   599 								keyResp = iFavouritesListBox->OfferKeyEventL( aKeyEvent, aType );
       
   600 								}
       
   601 	//						iFilteredFlag = ETrue
       
   602 							CAknFilteredTextListBoxModel* model = 
       
   603 							static_cast<CAknFilteredTextListBoxModel*>( iFavouritesListBox->Model() );
       
   604 							model->Filter()->HandleOfferkeyEventL();					
       
   605 							TInt filterModelCount = iFilteredModel->NumberOfItems();
       
   606 							TInt favCount = iMainView.iUi->iFavPresets->iFavPresetList.Count();
       
   607 							if(favCount != 0)
       
   608 								{
       
   609 								if(filterModelCount == 0 && !(iMainView.iUi->iLastPlayed->FileExists()))
       
   610 									{
       
   611 									HBufC* noMatchesTextResource = StringLoader::LoadLC(R_IRAPP_STATIONLIST_NOMATCHES);
       
   612 									iFavouritesListBox->View()->SetListEmptyTextL(*noMatchesTextResource);
       
   613 									CleanupStack::PopAndDestroy( noMatchesTextResource );
       
   614 									}
       
   615 								}
       
   616 						iFavouritesSearchBox->GetSearchText(iFindString);
       
   617 						if(iFindString.Length()!=0)
       
   618 							{
       
   619 							iFilteredFlag = ETrue;
       
   620 							}
       
   621 							iMainView.SetToolbarItems();
       
   622 							}
       
   623 						}
       
   624 					}
       
   625 				else
       
   626 					{
       
   627 					if(iFavouritesListBox)
       
   628 						{
       
   629 						if ( iFavouritesSearchBox )
       
   630 							{
       
   631 /*							TBool needRefresh( EFalse );
       
   632 							// Offers the key event to find box.
       
   633 							if ( AknFind::HandleFindOfferKeyEventL( aKeyEvent, aType, this,
       
   634 							iFavouritesListBox, iFavouritesSearchBox,EFalse,needRefresh ) == EKeyWasConsumed )
       
   635 							if(GetLastPlayedChannel()&&(iMainView.iUnMarkedArray.Count()==0))
       
   636 								{
       
   637 								}*/
       
   638 							keyResp = iFavouritesSearchBox->OfferKeyEventL( aKeyEvent, aType );
       
   639 
       
   640 							if( keyResp == EKeyWasNotConsumed )
       
   641 								{
       
   642 								keyResp = iFavouritesListBox->OfferKeyEventL( aKeyEvent, aType );
       
   643 								}
       
   644 							CAknFilteredTextListBoxModel* model = 
       
   645 							static_cast<CAknFilteredTextListBoxModel*>( iFavouritesListBox->Model() );
       
   646 							model->Filter()->HandleOfferkeyEventL();					
       
   647 								
       
   648 							iMainView.SetToolbarItems();
       
   649 							return EKeyWasNotConsumed;
       
   650 							}
       
   651 						}
       
   652 					}
       
   653 				if(	aKeyEvent.iScanCode==EStdKeyBackspace)
       
   654 					{
       
   655 					if(iFavouritesSearchBox)
       
   656 						{
       
   657 						iFavouritesSearchBox->GetSearchText(iFindString);
       
   658 						if(iFindString.Length()==0)
       
   659 							{
       
   660 							iFilteredFlag = EFalse;
       
   661 							}
       
   662 						}
       
   663 					}
       
   664 				}
       
   665 			iMainView.SetToolbarItems();
       
   666 			break;
       
   667 			}
       
   668 		}
       
   669 	IRLOG_DEBUG( "CIRMainContainer::OfferKeyEventL - Exiting" );
       
   670 	return keyResp; 
       
   671 	}
       
   672 
       
   673 // ---------------------------------------------------------------------------
       
   674 // CIRMainContainer::HandleListBoxEventL()
       
   675 // From class MEikListBoxObserver.
       
   676 // List box event handler.
       
   677 // ---------------------------------------------------------------------------
       
   678 //
       
   679 void CIRMainContainer::HandleListBoxEventL( CEikListBox* /*aListBox*/, TListBoxEvent aEventType )
       
   680     {
       
   681 	IRLOG_DEBUG( "CIRMainContainer::HandleListBoxEventL - Entering" );
       
   682 	switch ( aEventType )
       
   683 		{
       
   684 		/**  Keypress event. */
       
   685 		case EEventEnterKeyPressed:
       
   686 		/*  Item two-taps event*/
       
   687 		case EEventItemDoubleClicked:
       
   688 			{
       
   689 			if(!iMainView.GetMovingFlag())
       
   690 				{
       
   691 				iMainView.SetCurrentFocus(iFavouritesListBox->CurrentItemIndex());
       
   692 				if(iMainView.GetMarkedFlag()||iMainView.GetMarkedAllFlag())
       
   693 					{
       
   694 					ProcessPointerEventL(iFavouritesListBox->CurrentItemIndex()); //aListBox->CurrentItemIndex() not used         
       
   695 					break;
       
   696 					}
       
   697 				else
       
   698 					{
       
   699 					iMainView.SetCurrentFocus(GetCurrentItemIndex());
       
   700 					iMainView.HandleCommandL(EListenCmd);
       
   701 					}
       
   702 				}
       
   703 			break;
       
   704 			} 
       
   705 		case EEventItemClicked:
       
   706 			{
       
   707 			iMainView.SetCurrentFocus(iFavouritesListBox->CurrentItemIndex());
       
   708 			if(iMainView.GetMovingFlag())
       
   709 				{
       
   710 				CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current();
       
   711 				// If the move functionalitiy is enabled and the focus is on the lasplayed then
       
   712 				// only the cancel option has to be shown
       
   713 				if(iMainView.GetCurrentFocus() == 0 && iMainView.iUi->iLastPlayed->FileExists())
       
   714 					{
       
   715 					cba->SetCommandSetL( R_IRAPP_SOFTKEY_CANCEL_CBA );
       
   716 					cba->DrawDeferred();
       
   717 					iMoveFocusLast = ETrue;
       
   718 					}
       
   719 				else
       
   720 					{
       
   721 					// If the move functionalitiy is enabled and if the focus is first moved to lastplayed ,
       
   722 					// then after if the focus is moved to some other station in the list then
       
   723 					// done and cancel as to be shown as left and right softkeys
       
   724 					if(iMoveFocusLast)
       
   725 						{
       
   726 						cba->SetCommandSetL( R_IR_CBA_DONE_CANCEL );
       
   727 						cba->DrawDeferred();
       
   728 						}
       
   729 					}
       
   730 				
       
   731 				}
       
   732 			}
       
   733 		break;
       
   734 	default:
       
   735 		break;
       
   736 		}
       
   737 	IRLOG_DEBUG( "CIRMainContainer::HandleListBoxEventL - Exiting" );
       
   738     }
       
   739 // ----------------------------------------------------------------------------
       
   740 // CIRMainContainer::ProcessPointerEventL
       
   741 // Handler for pointer events, when the current focused item is tapped
       
   742 // ----------------------------------------------------------------------------
       
   743 //
       
   744 void CIRMainContainer::ProcessPointerEventL( TInt /* aIndex */)
       
   745 	{
       
   746 	IRLOG_DEBUG( "CIRMainContainer::ProcessPointerEventL - Entering" );
       
   747 	// Open the context sensitive menu 
       
   748 	iContextSensitiveFlag = ETrue; 
       
   749 	iMainView.ProcessCommandL(  EAknSoftkeyContextOptions );   
       
   750 	IRLOG_DEBUG( "CIRMainContainer::ProcessPointerEventL - Exiting" );
       
   751 	}
       
   752 
       
   753 // ---------------------------------------------------------------------------
       
   754 // CIRMainContainer::Draw()
       
   755 // From class CCoeControl.
       
   756 // Draws the control.
       
   757 // ---------------------------------------------------------------------------
       
   758 //
       
   759 void CIRMainContainer::Draw( const TRect&/* aRect */) const
       
   760     {
       
   761 	IRLOG_DEBUG( "CIRMainContainer::Draw - Entering" );
       
   762 
       
   763     CWindowGc& gc = SystemGc();
       
   764     if(iFavouritesListBox)
       
   765 	    {
       
   766 	   	iFavouritesListBox->SetGC(gc);
       
   767 	   	iFavouritesListBox->SetControlFlag(ETrue);
       
   768 	    }
       
   769     gc.SetPenStyle( CGraphicsContext::ENullPen );
       
   770     gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
       
   771 	
       
   772     // draw background skin first. 
       
   773  	MAknsSkinInstance* skin = AknsUtils::SkinInstance();
       
   774   	
       
   775 	TRect clientRect(((CEikAppUi*)(CCoeEnv::Static()->AppUi()))->ClientRect());
       
   776 
       
   777 	AknsDrawUtils::DrawBackground ( skin, iBgContext, this, gc, TPoint(0,0),
       
   778 					 TRect(TPoint(0,0),clientRect.iBr), KAknsDrawParamDefault  );	
       
   779 	
       
   780  	IRLOG_DEBUG( "CIRMainContainer::Draw - Exiting" );
       
   781     }
       
   782 
       
   783 
       
   784 // ---------------------------------------------------------------------------
       
   785 // CIRMainContainer::GetHelpContext()
       
   786 // From class CCoeControl.
       
   787 // Opens help by context.
       
   788 // ---------------------------------------------------------------------------
       
   789 //
       
   790 void CIRMainContainer::GetHelpContext( TCoeHelpContext& aContext ) const
       
   791     {
       
   792 	IRLOG_DEBUG( "CIRMainContainer::GetHelpContext - Entering" );
       
   793     aContext = TCoeHelpContext( KIRMCVUid, KIR_HELP_STATIONS  );
       
   794 	IRLOG_DEBUG( "CIRMainContainer::GetHelpContext - Exiting" );
       
   795 
       
   796     }
       
   797     
       
   798 // ---------------------------------------------------------------------------
       
   799 // CIRMainContainer::UpdateAllL()
       
   800 // updates the favourites data 
       
   801 // ---------------------------------------------------------------------------
       
   802 //    
       
   803 
       
   804 void CIRMainContainer::UpdateAllL()
       
   805 	{
       
   806 	IRLOG_DEBUG( "CIRMainContainer::UpdateAllL() - Entering" );
       
   807 	iListArray->Reset();
       
   808 	
       
   809 	iMainView.iUi->iFavPresets->GetAllPreset();
       
   810 	iMainView.SetMovingFlag(EFalse);
       
   811 		
       
   812 	LastPlayedDisplayL();
       
   813 	TInt favCount = iMainView.iUi->iFavPresets->iFavPresetList.Count();
       
   814 	const RIRPresetArray& presets = iMainView.iUi->iFavPresets->Presets();
       
   815 	for(TInt i=0;i<favCount;i++)
       
   816 		{
       
   817 		TUint indval;
       
   818 		indval=i+1;
       
   819 		RBuf stationName;
       
   820 		stationName.Create(iMainView.iUi->iFavPresets->iFavPresetList[i]->
       
   821 		Name().Length()+KExtraLength);
       
   822 		stationName.AppendNum(indval);
       
   823 		_LIT(KDot,". ");
       
   824 		stationName.Append(KDot);
       
   825 		stationName.Append(iMainView.iUi->iFavPresets->iFavPresetList[i]->Name()); 
       
   826 
       
   827 		//check whether logo url exist for the current channel of the search results
       
   828 		for(TInt m = 0; m < iNoLogosArray.Count(); m++)
       
   829 			{
       
   830 			if(m < iNoLogosArray.Count() && i<presets.Count() &&
       
   831 			   presets[i]->Index() == iNoLogosArray[m])				
       
   832 				{
       
   833 				if(iMainView.iUi->iFavPresets->iFavPresetList[i]->GetShortDescription().Length())
       
   834 					{
       
   835 					//logo should not be displayed in the main view for this particular station
       
   836 					//but has short description
       
   837 					//element is not marked,has short description and no logo data (Format \t%S\t%S)
       
   838 					HBufC* itemString = FormatItemStringLC( stationName, iMainView.iUi->iFavPresets->
       
   839 					iFavPresetList[i]->GetShortDescription(), KIRNoLogo );
       
   840 					iListArray->AppendL( itemString->Des() );
       
   841 					CleanupStack::PopAndDestroy( itemString );
       
   842 					break;
       
   843 					}
       
   844 				else
       
   845 					{
       
   846 					//logo should not be displayed in the main view for this particular station
       
   847 					//but has no short description
       
   848 					//element is not marked,don't have short desciption and  no logo data (Format \t%S\t)
       
   849 					HBufC* itemString = FormatItemStringLC( stationName,KNullDesC , KIRNoLogo );
       
   850 					iListArray->AppendL( itemString->Des() );
       
   851 					CleanupStack::PopAndDestroy( itemString );
       
   852 					break;							
       
   853 					}
       
   854 				}
       
   855 			}
       
   856 
       
   857 		for(TInt n = 0; n < iLogosArray.Count(); n++)
       
   858 			{
       
   859 			if(presets[i]->Index() == iLogosArray[n])
       
   860 				{
       
   861 				TInt index = n+1;
       
   862 				if(iMainView.iUi->iLastPlayed->FileExists() && iMainView.iUi->
       
   863 					iLastPlayed->iLastPlayedStation->GetLogoData().Length() && !iLogoDownloadError)
       
   864 					{
       
   865 					index = index +1;
       
   866 					}
       
   867 				
       
   868 				
       
   869 				if(iMainView.iUi->iFavPresets->iFavPresetList[i]->GetShortDescription().Length())
       
   870 					{
       
   871 					//logo should be displayed in the main view for this particular station
       
   872 					//element is not marked and has logo data (Format %d\t%S\t%S)
       
   873 					//has short description
       
   874 					HBufC* itemString = FormatItemStringLC( stationName, iMainView.iUi->
       
   875 					iFavPresets->iFavPresetList[i]->GetShortDescription(),index);
       
   876 					iListArray->AppendL( itemString->Des() );
       
   877 					CleanupStack::PopAndDestroy( itemString );
       
   878 					break;
       
   879 					}
       
   880 				else
       
   881 					{
       
   882 					//logo should be displayed in the main view for this particular station
       
   883 					//element is not marked and has logo data (Format %d\t%S)
       
   884 					//has no short description
       
   885 					HBufC* itemString = FormatItemStringLC( stationName,KNullDesC,index);
       
   886 					iListArray->AppendL( itemString->Des() );
       
   887 					CleanupStack::PopAndDestroy( itemString );
       
   888 					break;								
       
   889 					}
       
   890 				}
       
   891 			}
       
   892 
       
   893 		stationName.Close();
       
   894 		}
       
   895 	if(iFilteredFlag)
       
   896 		{
       
   897 		CAknFilteredTextListBoxModel* model = 
       
   898 		static_cast<CAknFilteredTextListBoxModel*>( iFavouritesListBox->Model() );
       
   899 		model->Filter()->HandleOfferkeyEventL();					
       
   900 				
       
   901 		if((iMainView.GetCurrentFocus()-1)!=-1)
       
   902 			{
       
   903 			// Getting whether the element deleted is the last element
       
   904 			// of the filtered elements.Returns true if it other than lat element 
       
   905 			// and false if it last element
       
   906 			TBool flag = CheckFiltered();
       
   907 			if(!flag)
       
   908 				{
       
   909 				// If the deleted element id last element set the focus to first element 
       
   910 				// of the array
       
   911 				iFavouritesListBox->SetCurrentItemIndex(0);
       
   912 				}
       
   913 			}
       
   914 		else if((iMainView.GetCurrentFocus()-1) ==-1)
       
   915 			{
       
   916 			iFavouritesListBox->SetCurrentItemIndex(0);	
       
   917 			}
       
   918 		else if(iMainView.GetCurrentFocus() == -1 && GetListBoxCount() != 0)
       
   919 			{
       
   920 			iFavouritesListBox->SetCurrentItemIndex(0);
       
   921 			}
       
   922 
       
   923 		}
       
   924 	else
       
   925 		{
       
   926 		if(GetListBoxCount() == 1 && iLastPlayedChannel )
       
   927 			{
       
   928 			iFavouritesListBox->SetCurrentItemIndex(0);	
       
   929 			}
       
   930 		else if(GetListBoxCount() == 0 && !iLastPlayedChannel )
       
   931 			{
       
   932 			}
       
   933 		else
       
   934 			{
       
   935 			if(iMainView.GetCurrentFocus()>= GetListBoxCount())
       
   936 				{
       
   937 				TInt focus ;
       
   938 				if(iMainView.GetCurrentFocus()-1 >= GetListBoxCount() )
       
   939 					{
       
   940 					focus =0;
       
   941 					}
       
   942 				else
       
   943 					{
       
   944 					focus =	iMainView.GetCurrentFocus()-1;
       
   945 					}
       
   946 				iFavouritesListBox->SetCurrentItemIndex(focus);
       
   947 				}
       
   948 			else
       
   949 				{
       
   950 //				iFavouritesListBox->SetCurrentItemIndex(iMainView.GetCurrentFocus())
       
   951 				}
       
   952 			}
       
   953 		iFavouritesListBox->HandleItemAdditionL();
       
   954 		}
       
   955 	if( !iFilteredFlag && favCount <=1)
       
   956 	DisplayFilterListBoxL();
       
   957 
       
   958 	EnableEmptyListBox();
       
   959 //	iMainView.HandleCommandL(EUnmarkAll)
       
   960 	if(favCount == 0 && !(iMainView.iUi->iLastPlayed->FileExists()))
       
   961 		{
       
   962 		HBufC* findStationsTextResource = StringLoader::LoadLC(R_IRAPP_FAVOURITES_LIST_EMPTY);
       
   963 		iFavouritesListBox->View()->SetListEmptyTextL(*findStationsTextResource);
       
   964 		CleanupStack::PopAndDestroy( findStationsTextResource );
       
   965 		}
       
   966 	if(iFinalCount == favCount)
       
   967 		{
       
   968 		if(!iProgressStart && iProgressFlag)
       
   969 			{
       
   970 			iMainView.iIsdsWrapper->GetDialogLauncherInstance()->
       
   971 			ShowConfirmationNoteL( iMultiDeleteString,ETrue );	
       
   972 			}
       
   973 		else if(iProgressInfo && iProgressStart)
       
   974 			{
       
   975 			if ( KProgressbarFinalValue <= iProgressInfo->CurrentValue() )
       
   976 				{
       
   977 				iProgressDialog->ProcessFinishedL();
       
   978 				iProgressDialog = NULL;
       
   979 				iProgressInfo = NULL;
       
   980 				DrawDeferred();	
       
   981 				iMainView.iIsdsWrapper->GetDialogLauncherInstance()->
       
   982 				ShowConfirmationNoteL( iMultiDeleteString,ETrue );	
       
   983 				}  
       
   984 			}
       
   985 		iProgressStart = EFalse;
       
   986 		iProgressFlag = EFalse;
       
   987 		iDeletingCount = 1;
       
   988 		iMainView.iMarkedIndexArray.Reset();
       
   989 		iMainView.SetToolbarItems();
       
   990 		iContextSensitiveFlag = EFalse; 
       
   991 		iFinalCount = 0;
       
   992 	    if(iMainView.GetCurrentFocus() == -1 && GetListBoxCount() != 0)
       
   993 			{
       
   994 			iFavouritesListBox->SetCurrentItemIndex(0);
       
   995 			}
       
   996 		}
       
   997 	IRLOG_DEBUG( "CIRMainContainer::UpdateAllL() - Exiting" );
       
   998 	}
       
   999 // ---------------------------------------------------------------------------
       
  1000 // CIRMainContainer::EnableEmptyListBox
       
  1001 // Creating of Empty Listbox.
       
  1002 // ---------------------------------------------------------------------------
       
  1003 //
       
  1004 void CIRMainContainer::EnableEmptyListBox()
       
  1005 	{
       
  1006 	IRLOG_DEBUG( "CIRMainContainer::EnableEmptyListBox() - Entering" );
       
  1007 
       
  1008 	TInt filteredCount;
       
  1009 	filteredCount = GetFilterdModelPointer()->NumberOfItems();
       
  1010 	if(iLastPlayedChannel)
       
  1011 		{
       
  1012 		filteredCount = filteredCount -1;
       
  1013 		}
       
  1014 	TBuf<KFindStringLength> findString;
       
  1015 	if(iFavouritesSearchBox)
       
  1016 	iFavouritesSearchBox->GetSearchText(findString);
       
  1017 	IRLOG_DEBUG( "CIRMainContainer::EnableEmptyListBox() - Exiting" );
       
  1018 	}
       
  1019 // ---------------------------------------------------------------------------
       
  1020 // CIRMainContainer::FormatItemStringLC
       
  1021 // Formatter for list item strings.
       
  1022 // ---------------------------------------------------------------------------
       
  1023 //
       
  1024 HBufC* CIRMainContainer::FormatItemStringLC( const TDesC& aFirstRow, const TDesC& aSecondRow,
       
  1025 											 TInt aIconId )
       
  1026     {
       
  1027  	IRLOG_DEBUG( "CIRMainContainer::FormatItemStringLC() - Entering" );
       
  1028     TInt length = KIRListItemBaseLength + aFirstRow.Length() + aSecondRow.Length();
       
  1029     HBufC* itemString = HBufC::NewLC( length );
       
  1030     
       
  1031     TPtrC formatStringWithIcon( KIRFormatStringWithIcon );
       
  1032     TPtrC formatStringWithoutIcon( KIRFormatStringWithoutIcon );
       
  1033 
       
  1034     if( aIconId >= 0 && aIconId <= KRange )
       
  1035         {
       
  1036         itemString->Des().Format( formatStringWithIcon, aIconId, &aFirstRow, &aSecondRow );
       
  1037         }
       
  1038     else 
       
  1039         {
       
  1040         itemString->Des().Format( formatStringWithoutIcon, &aFirstRow, &aSecondRow );
       
  1041         }
       
  1042     
       
  1043  	IRLOG_DEBUG( "CIRMainContainer::FormatItemStringLC() - Exiting" );
       
  1044     return itemString;
       
  1045     }
       
  1046 // ---------------------------------------------------------------------------
       
  1047 // CIRMainContainer::GetCurrentItemIndex()
       
  1048 // returns the index of the currently selected item
       
  1049 // ---------------------------------------------------------------------------
       
  1050 //
       
  1051 TInt CIRMainContainer::GetCurrentItemIndex() const
       
  1052     {
       
  1053     IRLOG_DEBUG( "CIRMainContainer::GetCurrentItemIndex" );
       
  1054 	return iFavouritesListBox->CurrentItemIndex();
       
  1055     }
       
  1056 
       
  1057 // ---------------------------------------------------------------------------
       
  1058 // CIRMainContainer::GetListBoxTopIndex()
       
  1059 // returns the index of the top item
       
  1060 // ---------------------------------------------------------------------------
       
  1061 //
       
  1062 TInt CIRMainContainer::GetListBoxTopIndex() const
       
  1063 	{
       
  1064     IRLOG_DEBUG( "CIRMainContainer::GetListBoxTopIndex" );
       
  1065 	return iFavouritesListBox->View()->TopItemIndex () ;
       
  1066 	}
       
  1067 // ---------------------------------------------------------------------------
       
  1068 //void CIRMainContainer::HandlePresetChangedL( TInt /*aId*/, TUid /*aDataHandler*/, MPSPresetObserver::TPSReason /*aReason*/ )
       
  1069 // From class MPSPresetObserver.
       
  1070 // Handles preset content change.
       
  1071 // ---------------------------------------------------------------------------
       
  1072 //
       
  1073 void CIRMainContainer::HandlePresetChangedL( TInt /*aId*/, TUid /*aDataHandler*/, MPSPresetObserver::TPSReason /*aReason*/ )
       
  1074     {
       
  1075     IRLOG_DEBUG( "CIRMainContainer::HandlePresetChangedL - Entering" );
       
  1076     if(iMainView.GetAddToFavouratesFlag()|| iMainView.GetMovingFlag())
       
  1077 	    {
       
  1078 		iInvalidIconIndices.Reset();
       
  1079 		iLogosArray.Reset();
       
  1080 		iNoLogosArray.Reset();  
       
  1081 		iImageCount = 1;
       
  1082 	    SetIconsL();
       
  1083 	    }
       
  1084 	if(iProgressFlag)
       
  1085 		{
       
  1086 		iAftertime.HomeTime();
       
  1087 		iIntervalsec = iAftertime.MicroSecondsFrom(iBeforetime);
       
  1088 		if(iIntervalsec>=KProgressTimer)
       
  1089 			{
       
  1090 			CreateProgressBarL();	
       
  1091 			}
       
  1092 	    if(iProgressInfo)
       
  1093 		    {
       
  1094 			RBuf Feed;
       
  1095 			HBufC* bufferText ;
       
  1096 			bufferText = StringLoader::LoadLC(R_IRAPP_FAVOURITES_PROG_DELETING,iDeletingCount/*iProgressCount*/);
       
  1097 			Feed.Create(*bufferText);
       
  1098 			CleanupStack::PopAndDestroy(bufferText);
       
  1099 			iProgressDialog->SetTextL(Feed);
       
  1100 
       
  1101 			TReal32 progressValue;
       
  1102 			progressValue	 = iProgressCount*iProgress;
       
  1103 			iProgressInfo->SetAndDraw(progressValue); 
       
  1104 			iProgressCount++; 
       
  1105 			Feed.Close();
       
  1106 		    }
       
  1107 		iMarkedElementsCount--;
       
  1108 //		iMainView.	iCurrentFocus =iMarkedElementsCount
       
  1109 		iDeletingCount++;
       
  1110 		TInt favCount = iMainView.iUi->iFavPresets->iFavPresetList.Count();
       
  1111 		if(iFinalCount == favCount)
       
  1112 			{
       
  1113 		 	UpdateAllL();
       
  1114 			}
       
  1115 		}
       
  1116 	else	
       
  1117 		{
       
  1118  	  	UpdateAllL();
       
  1119 		}
       
  1120 
       
  1121    	IRLOG_DEBUG( "CIRMainContainer::HandlePresetChangedL - Exiting" );
       
  1122     }
       
  1123 // ---------------------------------------------------------------------------
       
  1124 // void CIRMainContainer::CheckConnectionL() 
       
  1125 // Checks for the connection and creates  a connection to channel.
       
  1126 // ---------------------------------------------------------------------------
       
  1127 //	
       
  1128 void CIRMainContainer::CheckConnectionL(TInt aUrlIndex)
       
  1129 	{
       
  1130    	IRLOG_DEBUG( "CIRMainContainer::CheckConnectionL - Entering" );
       
  1131 	if( iMainView.iUi->VerifyNetworkConnectivityL() )
       
  1132 	    {
       
  1133         iMainView.SetRequestPendingStatus(ETrue) ;
       
  1134         iMainView.SetFavListen(ETrue) ;
       
  1135         iUrlIndex = aUrlIndex;
       
  1136         }	
       
  1137 	else 
       
  1138 		{
       
  1139 		iMainView.DoConnectToChannelL( aUrlIndex ); 
       
  1140 		iUrlIndex = aUrlIndex;
       
  1141 		}
       
  1142    	IRLOG_DEBUG( "CIRMainContainer::CheckConnectionL - Exiting" );
       
  1143 
       
  1144 	}
       
  1145 
       
  1146 
       
  1147 //----------------------------------------------------------------------------
       
  1148 // CIRMainContainer::CountComponentControls() const
       
  1149 // returns the number of components in the view.
       
  1150 //----------------------------------------------------------------------------
       
  1151 //
       
  1152 TInt CIRMainContainer::CountComponentControls() const
       
  1153 	{
       
  1154 	IRLOG_DEBUG( "CIRMainContainer::CountComponentControls - Entering" );
       
  1155 	TInt count(KCONTROLSCOUNT);
       
  1156 	if(iFavouritesListBox)
       
  1157 		{
       
  1158 		count++;
       
  1159 		}
       
  1160 	if(iFavouritesSearchBox)
       
  1161 		{
       
  1162 		count++;
       
  1163 		}
       
  1164 	IRLOG_DEBUG( "CIRMainContainer::CountComponentControls - Exiting" );
       
  1165 	return count;
       
  1166 	}
       
  1167 //----------------------------------------------------------------------------
       
  1168 // CIRMainContainer::ComponentControl() const
       
  1169 // returns a pointer to the control under this view depending on the index
       
  1170 // passed,to the framework.
       
  1171 //----------------------------------------------------------------------------
       
  1172 // 
       
  1173 CCoeControl* CIRMainContainer::ComponentControl(TInt aIndex) const
       
  1174 	{
       
  1175 	IRLOG_DEBUG( "CIRMainContainer::ComponentControl - Entering" );
       
  1176 	IRLOG_DEBUG( "CIRMainContainer::ComponentControl - Exiting" );
       
  1177 	switch(aIndex)
       
  1178 		{
       
  1179 		case 0:
       
  1180 			{
       
  1181 			if(iFavouritesListBox)
       
  1182 			return iFavouritesListBox;
       
  1183 			}
       
  1184 		case 1:
       
  1185 			{
       
  1186 			if(iFavouritesSearchBox)
       
  1187 			return iFavouritesSearchBox;	
       
  1188 			}
       
  1189 		default:
       
  1190 			return NULL;
       
  1191 		}
       
  1192 	}
       
  1193 // ---------------------------------------------------------------------------
       
  1194 // void CIRMainContainer::SizeChanged(const TRect& aRect)
       
  1195 // Responds to changes to the size and position of the contents of this control.
       
  1196 // ---------------------------------------------------------------------------
       
  1197 //
       
  1198 
       
  1199 void CIRMainContainer::SizeChanged()
       
  1200 	{
       
  1201 	IRLOG_DEBUG( "CIRMainContainer::SizeChanged - Entering" );
       
  1202 	if(iMainView.iUi->IsLandscapeOrientation())
       
  1203 		{
       
  1204 		if(iFavouritesListBox && iFavouritesSearchBox && iLandScapeCount ==0)
       
  1205 			{
       
  1206 	   		AknFind::HandlePopupFindSizeChanged(this,iFavouritesListBox,iFavouritesSearchBox);
       
  1207 	   		iLandScapeCount ++;
       
  1208 			}
       
  1209 		}
       
  1210 	if(iFavouritesListBox && iFavouritesSearchBox)
       
  1211 		{
       
  1212 	    AknLayoutUtils::LayoutControl(iFavouritesListBox,  Rect(),
       
  1213             AKN_LAYOUT_WINDOW_list_gen_pane(1));
       
  1214         AknLayoutUtils::LayoutControl(iFavouritesSearchBox,  Rect(),
       
  1215             AKN_LAYOUT_WINDOW_find_pane);
       
  1216 		}
       
  1217 		
       
  1218 	else
       
  1219 		{
       
  1220 		if(iFavouritesListBox)
       
  1221 			{
       
  1222 			AknLayoutUtils::LayoutControl(iFavouritesListBox, Rect(),
       
  1223             	AKN_LAYOUT_WINDOW_list_gen_pane(0));
       
  1224 			}
       
  1225 		}
       
  1226 		
       
  1227 	TRect clientRect(((CEikAppUi*)(CCoeEnv::Static()->AppUi()))->ClientRect());
       
  1228 	TRect parentRectSize(TPoint(0,0),clientRect.iBr);
       
  1229 
       
  1230 	if ( iBgContext )
       
  1231 		{
       
  1232 		iBgContext->SetRect(parentRectSize);
       
  1233 		}
       
  1234 	IRLOG_DEBUG( "CIRMainContainer::SizeChanged - Exiting" );
       
  1235 	}
       
  1236 	
       
  1237 // ---------------------------------------------------------------------------
       
  1238 // void CIRMainContainer::HandleResourceChange(TInt aType)
       
  1239 // Handles a change to the control's resources.
       
  1240 // ---------------------------------------------------------------------------
       
  1241 //
       
  1242 void CIRMainContainer::HandleResourceChange(TInt aType)
       
  1243 	{
       
  1244 	IRLOG_DEBUG( "CIRMainContainer::HandleResourceChange - Entering" );
       
  1245     CCoeControl::HandleResourceChange( aType );
       
  1246     // application layout change request notification
       
  1247     if ( aType == KEikDynamicLayoutVariantSwitch )
       
  1248         {
       
  1249         // reconstruct controls if needed
       
  1250    		AknFind::HandlePopupFindSizeChanged(this,iFavouritesListBox,iFavouritesSearchBox);
       
  1251         SizeChanged();
       
  1252         }
       
  1253 	iMainView.SetToolbarItems();
       
  1254 	DrawDeferred();
       
  1255 	IRLOG_DEBUG( "CIRMainContainer::HandleResourceChange - Exiting" );
       
  1256 	}
       
  1257 //----------------------------------------------------------------------------
       
  1258 // CIRMainContainer::CreateFindBoxL()
       
  1259 // creates the Find box when any character is Pressed
       
  1260 //----------------------------------------------------------------------------
       
  1261 // 
       
  1262 CAknSearchField* CIRMainContainer::CreateFindBoxL(CEikListBox* aListBox,
       
  1263 CTextListBoxModel* aModel, CAknSearchField::TSearchFieldStyle aStyle)
       
  1264 	{
       
  1265 	IRLOG_DEBUG( "CIRMainContainer::CreateFindBoxL - Entering" );
       
  1266 	CAknSearchField* findbox = NULL;
       
  1267 	if (aListBox && aModel)
       
  1268 		{
       
  1269 		// Gets pointer of CAknFilteredTextListBoxModel.
       
  1270 		// Added For Dynamic Filtering
       
  1271 		 iFilteredModel = STATIC_CAST( CIRFilteredModel*, aModel );
       
  1272 		// Creates FindBox.
       
  1273 		findbox = CAknSearchField::NewL( *this, aStyle, NULL,
       
  1274 		KAknExListFindBoxTextLength);
       
  1275 		CleanupStack::PushL(findbox);
       
  1276 		// Creates CAknListBoxFilterItems class.
       
  1277 		iFilteredModel->CreateFilterL( aListBox, findbox );
       
  1278 		//Filter can get by model->Filter()
       
  1279 		CleanupStack::Pop(findbox); // findbox
       
  1280 		}
       
  1281 
       
  1282 	IRLOG_DEBUG( "CIRMainContainer::CreateFindBoxL - Exiting" );
       
  1283 	return findbox;
       
  1284 	}
       
  1285 //----------------------------------------------------------------------------
       
  1286 // CIRMainContainer::DisableFindBox()
       
  1287 // Deletes the findbox
       
  1288 //----------------------------------------------------------------------------
       
  1289 // 
       
  1290 void CIRMainContainer::DisableFindBox()
       
  1291 	{
       
  1292 	IRLOG_DEBUG( "CIRMainContainer::DisableFindBox - Entering" );
       
  1293 	if (iFavouritesSearchBox)
       
  1294 		{
       
  1295 		iFilteredModel->RemoveFilter();
       
  1296 		// Important to set the find box non-focusing before
       
  1297 		// deleting it, otherwise the focus changes triggered
       
  1298 		// by the removal of the control from stack will focus
       
  1299 		// the find box which is under deletion
       
  1300 		iFavouritesSearchBox->SetNonFocusing();
       
  1301 		delete iFavouritesSearchBox;
       
  1302 		iFavouritesSearchBox = NULL;
       
  1303 		// Inform list box that find is hidden
       
  1304 		DrawDeferred();
       
  1305 		SizeChanged();
       
  1306 		}
       
  1307 	IRLOG_DEBUG( "CIRMainContainer::DisableFindBox - Exiting" );
       
  1308 	}
       
  1309 
       
  1310 // ---------------------------------------------------------------------------
       
  1311 // Function : Comparestrings
       
  1312 // Function called to compare the filtered string inthe Itemarray
       
  1313 // ---------------------------------------------------------------------------
       
  1314 //
       
  1315 void  CIRMainContainer::Comparestrings()
       
  1316 	{
       
  1317 	IRLOG_DEBUG( "CIRMainContainer::Comparestrings - Entering" );
       
  1318 	if(iFilteredModel->NumberOfItems())
       
  1319 		{
       
  1320 		TPtrC16 filteredString = iFilteredModel->ItemText (iMainView.GetCurrentFocus());
       
  1321 		for(TInt i=0;i<iListArray->Count();i++)
       
  1322 			{
       
  1323 			TPtrC16 matchString=iListArray->MdcaPoint(i);
       
  1324 			if(filteredString==matchString)
       
  1325 				{
       
  1326 				iMainView.SetActualFilteredItemIndex(i);
       
  1327 				break;
       
  1328 				}
       
  1329 
       
  1330 			}
       
  1331 		}
       
  1332 	IRLOG_DEBUG( "CIRMainContainer::Comparestrings - Exiting" );
       
  1333 	}
       
  1334 // ---------------------------------------------------------------------------
       
  1335 // Function : SetFilteredIndexArrayL
       
  1336 // stores the indexs of all the filtered elements
       
  1337 // ---------------------------------------------------------------------------
       
  1338 //
       
  1339 void  CIRMainContainer::SetFilteredIndexArrayL()
       
  1340 	{
       
  1341 	IRLOG_DEBUG( "CIRMainContainer::SetFilteredIndexArrayL - Entering" );
       
  1342 	iFilterIndexExist.Reset();
       
  1343 	TInt filterModelCount = iFilteredModel->NumberOfItems();
       
  1344 	TInt j=0;
       
  1345 	if(iMainView.iUi->iLastPlayed->FileExists())
       
  1346 		{
       
  1347 		j=1;	
       
  1348 		}
       
  1349 	if(iFilteredModel->NumberOfItems())
       
  1350 		{
       
  1351 		for( ;j<iFilteredModel->NumberOfItems();j++)
       
  1352 			{
       
  1353 			TPtrC16 filteredString = iFilteredModel->ItemText (j);
       
  1354 			for(TInt i=0;i<iListArray->Count();i++)
       
  1355 				{
       
  1356 				TPtrC16 matchString=iListArray->MdcaPoint(i);
       
  1357 				if(filteredString==matchString)
       
  1358 					{
       
  1359 					iFilterIndexExist.InsertInOrderL(i);
       
  1360 					}
       
  1361 				}
       
  1362 			}
       
  1363 		}
       
  1364 	IRLOG_DEBUG( "CIRMainContainer::SetFilteredIndexArrayL - Exiting" );
       
  1365 	}
       
  1366 // ---------------------------------------------------------------------------
       
  1367 // Function : CheckFiltered
       
  1368 // checks whether the deleted index exists in the filteredindex array or not
       
  1369 // ---------------------------------------------------------------------------
       
  1370 //
       
  1371 TBool CIRMainContainer::CheckFiltered()
       
  1372 	{
       
  1373 	IRLOG_DEBUG( "CIRMainContainer::CheckFiltered - Exiting" );
       
  1374 	TBool filteredIndexExist(EFalse);
       
  1375 	TInt currentFocus = iMainView.GetCurrentFocus();
       
  1376 	for(TInt i=0;i<iFilterIndexExist.Count();i++)
       
  1377 		{
       
  1378 		// checks whether the current focus index is present in the  filtered index array r not
       
  1379 		// and also check whether it is the last element of the array or not.
       
  1380 		if(currentFocus == iFilterIndexExist[i] && i!= (iFilterIndexExist.Count()-1))	
       
  1381 			{
       
  1382 			// sets the flag to true is the index is present in the array and no the last element
       
  1383 			filteredIndexExist = ETrue;
       
  1384 			return filteredIndexExist;	
       
  1385 			}
       
  1386 		}
       
  1387 	IRLOG_DEBUG( "CIRMainContainer::CheckFiltered - Exiting" );
       
  1388 	return filteredIndexExist;
       
  1389 	}
       
  1390 
       
  1391 // ---------------------------------------------------------------------------
       
  1392 // void CIRMainContainer::HandleImageConversionEventL( MIRImageConverterObserver::TIRImageConversionEvent /*aEvent*/, 
       
  1393 // from base class MIRImageConverterObserver
       
  1394 // ---------------------------------------------------------------------------
       
  1395 //
       
  1396 void CIRMainContainer::HandleImageConversionEventL( MIRImageConverterObserver::
       
  1397 													TIRImageConversionEvent /*aEvent*/,
       
  1398                                                     TInt aId, 
       
  1399                                                     TInt aError )
       
  1400 	{
       
  1401 	IRLOG_DEBUG( "CIRMainContainer::HandleImageConversionEventL - Entering" );
       
  1402 	iError=aError;
       
  1403 	if(aError == KErrNotSupported && iImageLast)
       
  1404 		{
       
  1405 		iImageLast	= EFalse;
       
  1406 		iLogoDownloadError	= ETrue;
       
  1407 		}
       
  1408 	if(!aError)
       
  1409 		{
       
  1410 		CArrayPtr<CGulIcon>* iconArray = iFavouritesListBox->
       
  1411 											 ItemDrawer()->FormattedCellData()->IconArray();
       
  1412 		TInt imageCount;
       
  1413 		if(iImageLast)
       
  1414 			{
       
  1415 			imageCount = iImageCount;
       
  1416 			TInt index = iMainView.iUi->iLastPlayed->iLastPlayedStation->GetIndex();
       
  1417 			CFbsBitmap* bitmap = NULL;
       
  1418 			CFbsBitmap* mask = NULL;
       
  1419 			CGulIcon* icon = CGulIcon::NewLC();
       
  1420 			aId == KErrUnknown ? iConverter->TransferBitmapOwnership( bitmap, mask ) : 
       
  1421 			     iCurrentItemConverter->TransferBitmapOwnership( bitmap, mask );
       
  1422 
       
  1423 			if ( bitmap && mask )
       
  1424 				{
       
  1425 				icon->SetBitmap( bitmap );
       
  1426 				icon->SetMask( mask );
       
  1427 				icon->SetBitmapsOwnedExternally( EFalse );
       
  1428 
       
  1429 				iconArray->InsertL( imageCount, icon );
       
  1430 				CleanupStack::Pop( icon );
       
  1431 				if(  imageCount+1 < iconArray->Count())
       
  1432 					{
       
  1433 					icon = iconArray->At(imageCount+1 );
       
  1434 					iconArray->Delete(imageCount +1);
       
  1435 					delete icon;
       
  1436 					}
       
  1437 				}
       
  1438 			DrawDeferred();
       
  1439 			iImageLast = EFalse;
       
  1440 			}
       
  1441 		else
       
  1442 			{
       
  1443 			imageCount = iImageCount;
       
  1444 			iLogosArray.InsertInOrderL(iInvalidIconIndices[0]);
       
  1445 			iNoLogosArray.Remove(iNoLogosArray.FindInOrder(iInvalidIconIndices[0]));
       
  1446 			if ( aError == KErrNone )
       
  1447 				{
       
  1448 				CIRPreset* preset = NULL; 
       
  1449 
       
  1450 				if ( aId == KErrUnknown )
       
  1451 					{
       
  1452 					if ( iInvalidIconIndices.Count() )
       
  1453 						{
       
  1454 						preset = iMainView.iUi->iFavPresets->PresetByIndex( iInvalidIconIndices[0] );
       
  1455 						iInvalidIconIndices.Remove( 0 );
       
  1456 						}
       
  1457 					}
       
  1458 				else
       
  1459 					{
       
  1460 					preset = iMainView.iUi->iFavPresets->PresetById( aId );
       
  1461 					}
       
  1462 				if ( preset )
       
  1463 					{
       
  1464 					CFbsBitmap* bitmap = NULL;
       
  1465 					CFbsBitmap* mask = NULL;
       
  1466 					CGulIcon* icon = CGulIcon::NewLC();
       
  1467 					aId == KErrUnknown ? iConverter->TransferBitmapOwnership( bitmap, mask ) : 
       
  1468 					     iCurrentItemConverter->TransferBitmapOwnership( bitmap, mask );
       
  1469 					if ( bitmap && mask )
       
  1470 						{
       
  1471 
       
  1472 						icon->SetBitmap( bitmap );
       
  1473 						icon->SetMask( mask );
       
  1474 						icon->SetBitmapsOwnedExternally( EFalse );
       
  1475 
       
  1476 						iconArray->InsertL( imageCount, icon );
       
  1477 						CleanupStack::Pop( icon );
       
  1478 						if(  imageCount+1 < iconArray->Count())
       
  1479 							{
       
  1480 							icon = iconArray->At(imageCount+1 );
       
  1481 							iconArray->Delete(imageCount +1);
       
  1482 							delete icon;
       
  1483 							}
       
  1484 						}
       
  1485 					DrawDeferred();
       
  1486 					}
       
  1487 				}
       
  1488 			}
       
  1489 		iImageCount ++;
       
  1490 		UpdateAllL();
       
  1491 		if ( iInvalidIconIndices.Count() && aId == KErrUnknown )
       
  1492 			{
       
  1493 			StartConvertL( *iConverter, iInvalidIconIndices[0], KErrUnknown );
       
  1494 			}	
       
  1495 		}
       
  1496 	IRLOG_DEBUG( "CIRMainContainer::HandleImageConversionEventL - Exiting" );
       
  1497 	}
       
  1498 
       
  1499 
       
  1500 // ---------------------------------------------------------------------------
       
  1501 // void CIRMainContainer::StartConvertL( CIRImageConverter& aConverter, TInt aIndex, TInt aId )
       
  1502 // used to convert the images depending the index passed
       
  1503 // ---------------------------------------------------------------------------
       
  1504 //
       
  1505 void CIRMainContainer::StartConvertL( CIRImageConverter& aConverter, TInt aIndex, TInt aId )
       
  1506 	{
       
  1507 	IRLOG_DEBUG( "CIRMainContainer::StartConvertL - Entering" );
       
  1508 	iError=KErrNone;
       
  1509 	if(iImageLast)
       
  1510 		{
       
  1511 		if ( iMainView.iUi->iLastPlayed->iLastPlayedStation &&
       
  1512 		     iMainView.iUi->iLastPlayed->iLastPlayedStation->GetLogoData().Length() )
       
  1513 			{
       
  1514 			aConverter.SetDataL( iMainView.iUi->iLastPlayed->iLastPlayedStation->GetLogoData() );
       
  1515 			if(iError==KErrNone)
       
  1516 				{
       
  1517 				aConverter.StartL(KBitmapSize, aId );
       
  1518 				}
       
  1519 			if(iError!=KErrNone)
       
  1520 				{
       
  1521 				if ( iInvalidIconIndices.Count() )
       
  1522 					{
       
  1523 					iImageLast = EFalse;
       
  1524 					iLogoDownloadError	= ETrue;
       
  1525 					StartConvertL( *iConverter, iInvalidIconIndices[0], KErrUnknown );
       
  1526 					}
       
  1527 				}
       
  1528 			}
       
  1529 		}
       
  1530 	else
       
  1531 		{
       
  1532 		CIRPreset* preset = iMainView.iUi->iFavPresets->PresetByIndex( aIndex );
       
  1533 		if ( preset && preset->GetLogoData().Length() )
       
  1534 			{
       
  1535 			aConverter.SetDataL( preset->GetLogoData() );
       
  1536 			if ( iError==KErrNone )
       
  1537 				{
       
  1538 				aConverter.StartL(KBitmapSize, aId );
       
  1539 				}
       
  1540 			if(iError!=KErrNone)
       
  1541 				{
       
  1542 				if ( iInvalidIconIndices.Count() )
       
  1543 					{
       
  1544 					iInvalidIconIndices.Remove( 0 );
       
  1545 					}	
       
  1546 				if ( iInvalidIconIndices.Count() )
       
  1547 					{
       
  1548 					StartConvertL( *iConverter, iInvalidIconIndices[0], KErrUnknown );
       
  1549 					}
       
  1550 				}
       
  1551 			}
       
  1552 		}
       
  1553 	IRLOG_DEBUG( "CIRMainContainer::StartConvertL - Exiting" );
       
  1554 	}
       
  1555 
       
  1556 // ---------------------------------------------------------------------------
       
  1557 // CIRMainContainer::PresetLogoDownloadL()
       
  1558 // 
       
  1559 // ---------------------------------------------------------------------------
       
  1560 //
       
  1561 void CIRMainContainer::PresetLogoDownloadL(CIRIsdsPreset* /*aPreset*/)
       
  1562 	{
       
  1563 	IRLOG_DEBUG( "CIRMainContainer::PresetLogoDownloadL - Entering" );
       
  1564     iImageLast = ETrue;
       
  1565     TInt index = iMainView.iUi->iLastPlayed->iLastPlayedStation->GetIndex();
       
  1566 	StartConvertL( *iConverter, index, KErrUnknown );
       
  1567 	IRLOG_DEBUG( "CIRMainContainer::PresetLogoDownloadL - Exiting" );
       
  1568 	}
       
  1569 
       
  1570 
       
  1571 // ---------------------------------------------------------------------------
       
  1572 // void CIRMainContainer::HandleLogoErrorL()
       
  1573 // called from the iSearchResultsView when the logo is not downloaded
       
  1574 // ---------------------------------------------------------------------------
       
  1575 //
       
  1576 void CIRMainContainer::HandleLogoErrorL()
       
  1577 	{
       
  1578 	iImageLast = EFalse;
       
  1579 	iLogoDownloadError	= ETrue;
       
  1580 	if ( iInvalidIconIndices.Count() )
       
  1581 		{
       
  1582 		StartConvertL( *iConverter, iInvalidIconIndices[0], KErrUnknown );
       
  1583 		}
       
  1584 	}
       
  1585 // ---------------------------------------------------------------------------
       
  1586 // CIRMainContainer::cmdMarkL()
       
  1587 // implement the mark/unmark feature
       
  1588 // ---------------------------------------------------------------------------
       
  1589 //
       
  1590 void CIRMainContainer::cmdMarkL(TInt item,TBool mark)
       
  1591 	{
       
  1592 	IRLOG_DEBUG( "CIRMainContainer::cmdMark - Entering" );
       
  1593 	CTextListBoxModel* model =iFavouritesListBox->Model();
       
  1594 	TInt itemCount = model->NumberOfItems();
       
  1595 	CListBoxView* listBoxView =iFavouritesListBox->View();
       
  1596 	if (mark)
       
  1597 		{
       
  1598 		for (TUint i = 0; i < itemCount; i++)
       
  1599 		if(iLastPlayedChannel)
       
  1600 			{
       
  1601 			if (item == 0 || item == i)
       
  1602 			listBoxView->SelectItemL(i);
       
  1603 			listBoxView->DeselectItem(0);
       
  1604 			}
       
  1605 		else
       
  1606 			{
       
  1607 			if (item == -1 || item == i)
       
  1608 			listBoxView->SelectItemL(i);
       
  1609 			}
       
  1610 		}
       
  1611 	else
       
  1612 		{
       
  1613 		for (TUint i = 0; i < itemCount; i++)
       
  1614 		if(iLastPlayedChannel)
       
  1615 			{
       
  1616 			if (item == 0 || item == i)
       
  1617 			listBoxView->DeselectItem(i);
       
  1618 			}
       
  1619 		else
       
  1620 			{
       
  1621 			if (item == -1 || item == i)
       
  1622 			listBoxView->DeselectItem(i);
       
  1623 			}
       
  1624 		}
       
  1625 	for (TInt i = 0; i < itemCount; i++)
       
  1626 	if(iLastPlayedChannel)
       
  1627 		{
       
  1628 		if (item == 0 || item == i)
       
  1629 		listBoxView->SelectItemL(0);
       
  1630 		}
       
  1631 	IRLOG_DEBUG( "CIRMainContainer::cmdMark - Exiting" );
       
  1632 	}
       
  1633 // ---------------------------------------------------------------------------
       
  1634 // CIRMainContainer::GetListBoxCount()
       
  1635 // returns the listbox count.
       
  1636 // ---------------------------------------------------------------------------
       
  1637 //
       
  1638 TInt CIRMainContainer::GetListBoxCount()
       
  1639 	{
       
  1640 	IRLOG_DEBUG( "CIRMainContainer::GetListBoxCount " );
       
  1641 	return iListArray->Count();	
       
  1642 	}
       
  1643 
       
  1644 // ---------------------------------------------------------------------------
       
  1645 // CIRMainContainer::GetUrlIndex()
       
  1646 // returns the url index.
       
  1647 // ---------------------------------------------------------------------------
       
  1648 //
       
  1649 TInt CIRMainContainer::GetUrlIndex()
       
  1650 	{
       
  1651 	IRLOG_DEBUG( "CIRMainContainer::GetListBoxCount " );
       
  1652 	return iUrlIndex;	
       
  1653 	}
       
  1654 
       
  1655 // ---------------------------------------------------------------------------
       
  1656 // CIRMainContainer::GetListPointer()
       
  1657 // returns pinter to Listbox.
       
  1658 // ---------------------------------------------------------------------------
       
  1659 //
       
  1660 CIRAdvertisingListBox* CIRMainContainer::GetListPointer()
       
  1661 	{
       
  1662 	IRLOG_DEBUG( "CIRMainContainer::GetListPointer" );
       
  1663 	return iFavouritesListBox;	
       
  1664 	}
       
  1665 // ---------------------------------------------------------------------------
       
  1666 // CIRMainContainer::GetSearchBoxPointer()
       
  1667 // returns the search box pointer.
       
  1668 // ---------------------------------------------------------------------------
       
  1669 //
       
  1670 CAknSearchField* CIRMainContainer::GetSearchBoxPointer()
       
  1671 	{
       
  1672 	IRLOG_DEBUG( "CIRMainContainer::GetSearchBoxPointer" );
       
  1673 	return 	iFavouritesSearchBox;
       
  1674 	}
       
  1675 // ---------------------------------------------------------------------------
       
  1676 // CIRMainContainer::GetLastPlayedChannel()
       
  1677 // returns whether the lastplayed channel exists or not.
       
  1678 // ---------------------------------------------------------------------------
       
  1679 //
       
  1680 TBool CIRMainContainer::GetLastPlayedChannel()
       
  1681 	{
       
  1682 	IRLOG_DEBUG( "CIRMainContainer::GetLastPlayedChannel" );
       
  1683 	return iLastPlayedChannel;	
       
  1684 	}
       
  1685 
       
  1686 // ---------------------------------------------------------------------------
       
  1687 // CIRMainContainer::GetFilterdModelPointer()
       
  1688 // returns pinter to filtered model.
       
  1689 // ---------------------------------------------------------------------------
       
  1690 //
       
  1691 CIRFilteredModel* CIRMainContainer::GetFilterdModelPointer()
       
  1692 	{
       
  1693 	IRLOG_DEBUG( "CIRMainContainer::GetListPointer" );
       
  1694 	return iFilteredModel;	
       
  1695 	}
       
  1696 
       
  1697 // ---------------------------------------------------------------------------
       
  1698 // CIRMainContainer::DeleteMultiStationsL()
       
  1699 // To delete multiple items from favourites list.
       
  1700 // ---------------------------------------------------------------------------
       
  1701 //
       
  1702 void CIRMainContainer::DeleteMultiStationsL()
       
  1703 	{
       
  1704 	IRLOG_DEBUG( "CIRMainContainer::MultiDelete - Entering" );
       
  1705 	HBufC* textResource = NULL;
       
  1706 	if(iMainView.iMarkedIndexArray.Count()==1)
       
  1707 		{
       
  1708 		if(iMainView.iMarkedIndexArray[0]<= iMainView.iUi->iFavPresets->
       
  1709 					                 iFavPresetList.Count())
       
  1710 			{
       
  1711 			SetFilteredIndexArrayL();
       
  1712 			textResource = StringLoader::LoadLC( R_IRAPP_NOTE_REMOVED,iMainView.iUi->iFavPresets->
       
  1713 						                 iFavPresetList[iMainView.iMarkedIndexArray[0]]->Name());
       
  1714 			}
       
  1715 		}
       
  1716 	else
       
  1717 		{
       
  1718 		textResource = StringLoader::LoadLC( R_IRAPP_NOTE_REMOVED_MANY,
       
  1719 											iMainView.iMarkedIndexArray.Count());
       
  1720 		}
       
  1721 	iMultiDeleteString.Create(*textResource);
       
  1722 
       
  1723 	TInt favouritesCount = iMainView.iUi->iFavPresets->iFavPresetList.Count();
       
  1724 	iMarkedElementsCount = iMainView.iMarkedIndexArray.Count();
       
  1725 	iFinalCount = favouritesCount- iMarkedElementsCount;
       
  1726 	iProgress = KProgressbarFinalValue/iMarkedElementsCount;
       
  1727 	
       
  1728 
       
  1729 	TInt numOfItems = GetListBoxCount();
       
  1730 	iBeforetime.HomeTime();
       
  1731 	for(TInt j =0; j<iMainView.iMarkedIndexArray.Count();j++)
       
  1732 		{
       
  1733 		TInt presentIndex = iMainView.iMarkedIndexArray[j];
       
  1734 		for(TInt i=0;i<=numOfItems;i++)
       
  1735 			{
       
  1736 			if((iMainView.iMarkedIndexArray[j])==i)
       
  1737 				{
       
  1738 				TInt channeUniqId;
       
  1739 				channeUniqId = iMainView.iUi->iFavPresets->
       
  1740 							   iFavPresetList[iMainView.iMarkedIndexArray[j]]->Id();
       
  1741 				// delete the index from the logo's array
       
  1742 				RemoveFromLogoArray(iMainView.iMarkedIndexArray[j]);
       
  1743 				iMainView.iUi->iFavPresets->DeletePresetL(channeUniqId);
       
  1744 				iAftertime.HomeTime();
       
  1745 				iIntervalsec = iAftertime.MicroSecondsFrom(iBeforetime);
       
  1746 				if(iIntervalsec>=KProgressTimer)
       
  1747 					{
       
  1748 					CreateProgressBarL();	
       
  1749 					}
       
  1750 				}
       
  1751 			}
       
  1752 		iProgressFlag = ETrue;
       
  1753 		}
       
  1754 	if(iMainView.iCurrentFocus<0 ||iMainView.iCurrentFocus>GetListBoxCount())
       
  1755 		{
       
  1756 		iMainView.SetCurrentFocus(0);
       
  1757 		}
       
  1758 	cmdMarkL(0,EFalse);
       
  1759 	iMainView.SetMarkedAllFlag(EFalse);
       
  1760 	iMainView.SetMarkedFlag(EFalse);
       
  1761 	iMainView.iUnMarkedArray.Reset();
       
  1762 	iMainView.SetListBoxMarkedCount(0);
       
  1763 	CleanupStack::PopAndDestroy(textResource);
       
  1764 	cmdMarkL(-1,EFalse);
       
  1765 	IRLOG_DEBUG( "CIRMainContainer::MultiDelete - Exiting" );
       
  1766 	}
       
  1767 // ---------------------------------------------------------------------------
       
  1768 // CIRMainContainer::DeleteChannelL
       
  1769 // ---------------------------------------------------------------------------
       
  1770 //
       
  1771 void CIRMainContainer::DeleteChannelL( TInt aIndex ) 
       
  1772 	{
       
  1773 	IRLOG_DEBUG( "CIRMainContainer::DeleteChannelL - Entering" );
       
  1774 	SetFilteredIndexArrayL();
       
  1775 	RBuf channel;
       
  1776 	HBufC* textResource =  NULL;
       
  1777 	if(aIndex < iMainView.iUi->iFavPresets->iFavPresetList.Count())
       
  1778 	textResource = StringLoader::LoadLC( R_IRAPP_NOTE_REMOVED,iMainView.iUi->iFavPresets->
       
  1779 											iFavPresetList[aIndex]->Name() );
       
  1780 	// delete the index from the logo's array
       
  1781 	RemoveFromLogoArray(aIndex);
       
  1782 		
       
  1783 	channel.Create(*textResource);
       
  1784 	TInt channeUniqId = iMainView.iUi->iFavPresets->iFavPresetList[aIndex]->Id();
       
  1785 	// Removes the station from the Favourites preset.
       
  1786 	iMainView.iUi->iFavPresets->DeletePresetL(channeUniqId);
       
  1787 	iMainView.iIsdsWrapper->GetDialogLauncherInstance()->ShowConfirmationNoteL( channel,ETrue );
       
  1788 	CleanupStack::PopAndDestroy(textResource);
       
  1789 	channel.Close();
       
  1790 	iContextSensitiveFlag = EFalse; 
       
  1791 	IRLOG_DEBUG( "CIRainContainer::DeleteChannelL - Exiting" );
       
  1792 	}
       
  1793 //----------------------------------------------------------------------------
       
  1794 // CIRMainContainer::RemoveFromLogoArray() 
       
  1795 // Removes the element from logo array.
       
  1796 //----------------------------------------------------------------------------
       
  1797 // 	
       
  1798 void CIRMainContainer::RemoveFromLogoArray(TInt aIndex)
       
  1799 	{
       
  1800 	TBool indexFound = EFalse;
       
  1801 	const RIRPresetArray& presets = iMainView.iUi->iFavPresets->Presets();
       
  1802 	CArrayPtr<CGulIcon>* iconArray = iFavouritesListBox->
       
  1803 										 ItemDrawer()->FormattedCellData()->IconArray();
       
  1804 	// checks whether the index to deleted in the iNolOgosArray or not
       
  1805 	for(TInt i=0;i<iNoLogosArray.Count();i++)
       
  1806 		{
       
  1807 		if(iNoLogosArray[i]==presets[aIndex]->Index() && aIndex <presets.Count())
       
  1808 			{
       
  1809 			iNoLogosArray.Remove(i);
       
  1810 			indexFound = ETrue;
       
  1811 			return;
       
  1812 			}
       
  1813 		}
       
  1814 	if(!indexFound)
       
  1815 		{
       
  1816 		for(TInt i=0;i<iLogosArray.Count();i++)	
       
  1817 			{
       
  1818 			TInt index = i+1;
       
  1819 			if(iMainView.iUi->iLastPlayed->FileExists() && iMainView.iUi->
       
  1820 				iLastPlayed->iLastPlayedStation->GetLogoData().Length())
       
  1821 				{
       
  1822 				index = index +1;
       
  1823 				}
       
  1824 	// checks whether the index to be is present deleted in the iNologosArray or not
       
  1825 			if(iLogosArray[i] == presets[aIndex]->Index())
       
  1826 				{
       
  1827 				iLogosArray.Remove(i);
       
  1828 				iconArray->Delete(index);
       
  1829 				return;
       
  1830 				}
       
  1831 			}
       
  1832 		}
       
  1833 	
       
  1834 	}
       
  1835 	
       
  1836 //----------------------------------------------------------------------------
       
  1837 // CIRMainContainer::DisplayFilterListBoxL() 
       
  1838 // Displayin gof filter box depending on favourites
       
  1839 //----------------------------------------------------------------------------
       
  1840 // 	
       
  1841 void CIRMainContainer::DisplayFilterListBoxL()
       
  1842 	{
       
  1843 	IRLOG_DEBUG( "CIRMainContainer::DisplayFilterListBoxL - Entering" );
       
  1844 	TInt favCount = iMainView.iUi->iFavPresets->iFavPresetList.Count();
       
  1845 	if(favCount>1)
       
  1846 		{
       
  1847 		if(iFavouritesSearchBox)
       
  1848 			{
       
  1849 			DisableFindBox();
       
  1850 			}
       
  1851 		// Added For Dynamic Filtering
       
  1852 		iFavouritesSearchBox = CreateFindBoxL(iFavouritesListBox, iFilteredModel,
       
  1853 		  CAknSearchField::ESearch);
       
  1854 		SizeChanged();	
       
  1855 		}
       
  1856 	else
       
  1857 		{
       
  1858 		if(iFavouritesSearchBox)
       
  1859 			{
       
  1860 			DisableFindBox();
       
  1861 			}
       
  1862 		}
       
  1863 	IRLOG_DEBUG( "CIRMainContainer::DisplayFilterListBoxL - Exiting" );
       
  1864 	}
       
  1865 
       
  1866 
       
  1867 // -----------------------------------------------------------------------------
       
  1868 // CIRMainContainer::DialogDismissedL()
       
  1869 // Called when/if the dialog has been dismissed.
       
  1870 // iIdle must be canceled when cancel button is pressed.
       
  1871 // -----------------------------------------------------------------------------
       
  1872 //
       
  1873 void CIRMainContainer::DialogDismissedL( TInt aButtonId )
       
  1874     {
       
  1875     // Check when pressing cancel button.
       
  1876 	switch(aButtonId)
       
  1877 		{
       
  1878 		case EAknSoftkeyDone:   
       
  1879 		case EAknSoftkeyCancel:
       
  1880 			{   
       
  1881 			if(iProgressDialog)
       
  1882 				{	
       
  1883 				iProgressDialog = NULL;
       
  1884 				iProgressInfo = NULL;
       
  1885 				}
       
  1886 			}
       
  1887 		break;
       
  1888 		default:
       
  1889 		break;
       
  1890 		}
       
  1891 	return;
       
  1892 	}
       
  1893 
       
  1894 // ---------------------------------------------------------------------------
       
  1895 // Function : FilteredIndexL()
       
  1896 // Function called when mark all is called after dynamic filtering
       
  1897 // ---------------------------------------------------------------------------
       
  1898 //
       
  1899 void CIRMainContainer::FilteredIndexL()
       
  1900 	{
       
  1901 	for (TInt j = 0;j<iFilteredModel->NumberOfItems();j++)
       
  1902 		{
       
  1903 		TPtrC16 filteredString = iFilteredModel->ItemText (j);
       
  1904 		for(TInt i=0;i<iListArray->Count();i++)
       
  1905 			{
       
  1906 			TPtrC16 matchString=iListArray->MdcaPoint(i);
       
  1907 			if(filteredString==matchString)
       
  1908 				{
       
  1909 				if(iLastPlayedChannel && filteredString == iListArray->MdcaPoint(0))
       
  1910 					{
       
  1911 					// If Lastplayed is present then don't insert that element into marked array.	
       
  1912 					}
       
  1913 				else
       
  1914 					{
       
  1915 					if(iLastPlayedChannel)
       
  1916 						{
       
  1917 						i = i-1;	
       
  1918 						}
       
  1919 					iMainView.iMarkedIndexArray.InsertInOrderL(i);	
       
  1920 					}
       
  1921 				break;
       
  1922 				}
       
  1923 
       
  1924 			}
       
  1925 		}
       
  1926 	}
       
  1927 // ---------------------------------------------------------------------------
       
  1928 // Function : CreateProgressBarL()
       
  1929 // Function called when mark all is called after dynamic filtering
       
  1930 // ---------------------------------------------------------------------------
       
  1931 //
       
  1932 void CIRMainContainer::CreateProgressBarL()
       
  1933 	{
       
  1934 	if(!iProgressDialog)
       
  1935 		{
       
  1936 		iProgressStart = EFalse;
       
  1937 		iProgressCount = 1;
       
  1938 		if(iMarkedElementsCount)
       
  1939 			{
       
  1940 			iProgress = KProgressbarFinalValue/iMarkedElementsCount;
       
  1941 			}
       
  1942 		iProgressDialog = new (ELeave) CAknProgressDialog(
       
  1943 	           (REINTERPRET_CAST(CEikDialog**, &iProgressDialog)),
       
  1944 	           ETrue);
       
  1945 	    iProgressDialog->PrepareLC(R_IRAPP_PROGRESS_DIALOG_CANCEL);
       
  1946 	    iProgressInfo = iProgressDialog->GetProgressInfoL();
       
  1947 	    iProgressDialog->SetCallback(this);
       
  1948 		iProgressDialog->RunLD();
       
  1949 		iProgressInfo->SetFinalValue(KProgressbarFinalValue);
       
  1950 		iProgressStart = ETrue;
       
  1951 		}
       
  1952 	}
       
  1953 // ---------------------------------------------------------------------------
       
  1954 // CIRMainContainer::GetContextSenstiveFlag()
       
  1955 // returns the context senstive flag.
       
  1956 // ---------------------------------------------------------------------------
       
  1957 //
       
  1958 TBool CIRMainContainer::GetContextSenstiveFlag()
       
  1959 	{
       
  1960 	IRLOG_DEBUG( "CIRMainContainer::GetContextSenstiveFlag" );
       
  1961 	return iContextSensitiveFlag;	
       
  1962 	}
       
  1963 // ---------------------------------------------------------
       
  1964 // CIRMainContainer::SetContextSenstiveFlag
       
  1965 // Sets the context sensitive flag
       
  1966 // ---------------------------------------------------------
       
  1967 //
       
  1968 void CIRMainContainer::SetContextSenstiveFlag(TBool aContextSensitiveFlag)
       
  1969 	{
       
  1970 	IRLOG_DEBUG( "CIRMainContainer::SetContextSenstiveFlag - Entering." );
       
  1971 	iContextSensitiveFlag = aContextSensitiveFlag;
       
  1972 	IRLOG_DEBUG( "CIRMainContainer::SetContextSenstiveFlag - Exiting." );
       
  1973 	}
       
  1974 
       
  1975 // ---------------------------------------------------------------------------
       
  1976 // CIRMainContainer::GetFilteredFlag()
       
  1977 // returns the filtered flag.
       
  1978 // ---------------------------------------------------------------------------
       
  1979 //
       
  1980 TBool CIRMainContainer::GetFilteredFlag()
       
  1981 	{
       
  1982 	IRLOG_DEBUG( "CIRMainContainer::GetContextSenstiveFlag" );
       
  1983 	return iFilteredFlag;	
       
  1984 	}
       
  1985 
       
  1986 // ---------------------------------------------------------
       
  1987 // CIRMainContainer::RefreshView
       
  1988 // Resets all the values and draws the view with new values
       
  1989 // ---------------------------------------------------------
       
  1990 //
       
  1991 void CIRMainContainer::RefreshViewL()
       
  1992 	{
       
  1993 	IRLOG_DEBUG( "CIRMainContainer::RefreshViewL - Entering." );
       
  1994 	iInvalidIconIndices.Reset();
       
  1995 	iLogosArray.Reset();
       
  1996 	iNoLogosArray.Reset();  
       
  1997 	iImageCount = 1;
       
  1998  	iLogoDownloadError	= EFalse;
       
  1999     SetIconsL();
       
  2000     UpdateAllL();
       
  2001 	IRLOG_DEBUG( "CIRMainContainer::RefreshViewL - Exiting." );
       
  2002 	}