internetradio2.0/uisrc/ircategoryview.cpp
changeset 0 09774dfdd46b
equal deleted inserted replaced
-1:000000000000 0:09774dfdd46b
       
     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:  Category view class
       
    15 *
       
    16 */
       
    17 
       
    18 /* ---------------------------------------------------------------------------
       
    19 *  Version history:
       
    20 *  Template version:
       
    21 *  <ccm_history>
       
    22 *
       
    23 *  Version: 9, Thu Aug 18 14:32:00 2008 by Rohit
       
    24 *  Ref:
       
    25 *  Fixed bug : Stations view is displaying correst results but previous genre/lang label
       
    26 *  Modified ResponseL() to remove extra decrement of currentIndex.
       
    27 *
       
    28 *  Version: 2, Thurs March 20 15:50:00 2008 by Prabina
       
    29 *  Ref:
       
    30 *  Created new views for the Station Directory Views , Enabled the Touch toolbar functionality , 
       
    31 *  Help Options enabled
       
    32 *
       
    33 *  </ccm_history>
       
    34 * ============================================================================
       
    35 */
       
    36 /* ---------------------------------------------------------------------------
       
    37 *  Version history:
       
    38 *  Template version:
       
    39 *  <ccm_history>
       
    40 *
       
    41 *  Version: 3, Fri March 21 17:20:00 2008 by Prabina
       
    42 *  Ref:
       
    43 *  Added WorkAround for supporting different Resolutions , Added Wait Dialog for Loading of stations , 
       
    44 *  Handled Single/Double tapping on the list itmes
       
    45 *
       
    46 *  </ccm_history>
       
    47 * ============================================================================
       
    48 */
       
    49 /* ---------------------------------------------------------------------------
       
    50 *  Version history:
       
    51 *  Template version:
       
    52 *  <ccm_history>
       
    53 *
       
    54 *  Version: 4, Mon March 24 18:00:00 2008 by Prabina
       
    55 *  Ref:
       
    56 *  Added WorkAround for adding different stations to favourites list , Added Wait dialog for adding to favourites
       
    57 *
       
    58 *
       
    59 *  </ccm_history>
       
    60 * ============================================================================
       
    61 */
       
    62 /* ---------------------------------------------------------------------------
       
    63 *  Version history:
       
    64 *  Template version:
       
    65 *  <ccm_history>
       
    66 *
       
    67 *  Version: 5, Tues March 25 17:30:00 2008 by Prabina
       
    68 *  Ref:
       
    69 *  Fixing the PCLint errors
       
    70 *
       
    71 *
       
    72 *  </ccm_history>
       
    73 * ============================================================================
       
    74 */
       
    75 /* ---------------------------------------------------------------------------
       
    76 *  Version history:
       
    77 *  Template version:
       
    78 *  <ccm_history>
       
    79 *
       
    80 *  Version: 6, Tues March 29 10:30:00 2008 by Prabina
       
    81 *  Ref:
       
    82 *  Category View Container Derived from CCoeControl
       
    83 *
       
    84 *
       
    85 *  </ccm_history>
       
    86 * ============================================================================
       
    87 */
       
    88 /* ---------------------------------------------------------------------------
       
    89 *  Version history:
       
    90 *  Template version:
       
    91 *  <ccm_history>
       
    92 *
       
    93 *  Version: 5, Thurs July 18 12:00:00 2008 by Prabina
       
    94 *  Ref:
       
    95 *  Code Review Comments Fixed
       
    96 *
       
    97 *
       
    98 *  </ccm_history>
       
    99 * ============================================================================
       
   100 */
       
   101 
       
   102 
       
   103 #include <akniconarray.h>
       
   104 #include <akntitle.h>
       
   105 #include <eikmenup.h>
       
   106 #include <gulicon.h>
       
   107 #include <stringloader.h>
       
   108 #include <psserv.h>
       
   109 #include <hlplch.h>
       
   110 #include <aknnotewrappers.h> 
       
   111 #include <eikenv.h> 
       
   112 #include <internetradio.rsg>
       
   113  
       
   114 
       
   115 #include "irui.h"
       
   116 #include "ir.hrh"
       
   117 #include "ircommon.h"
       
   118 #include "irdebug.h"
       
   119 #include "irbaseview.h"
       
   120 #include "ircategoryview.h"
       
   121 #include "ircategoryviewcontainer.h"
       
   122 #include "irstationsview.h"
       
   123 #include "irapplication.h"
       
   124 #include "irisdswrapper.h"
       
   125 #include "irsettings.h"
       
   126 #include "irnowplayingwrapper.h"
       
   127 #include "irimageconverter.h"
       
   128 #include "irlogodownloadengine.h"
       
   129 #include "irdataprovider.h"
       
   130 #include "irhttpdataprovider.h"
       
   131 #include "irnetworkcontroller.h"
       
   132 #include "irdialoglauncher.h"
       
   133 
       
   134 // ==================== LOCAL FUNCTIONS ====================
       
   135 
       
   136 // ================= MEMBER FUNCTIONS =======================
       
   137 
       
   138 // ---------------------------------------------------------------------------
       
   139 // CIRCategoryView::CIRCategoryView() 
       
   140 // C++ default constructor can NOT contain any code, that might leave.
       
   141 // ---------------------------------------------------------------------------
       
   142 //
       
   143 CIRCategoryView::CIRCategoryView():iCallRequestPending(EFalse) 
       
   144     {
       
   145 	IRLOG_DEBUG( "CIRCategoryView::CIRCategoryView" );
       
   146     iCategoryReqMade = EFalse;
       
   147 	}
       
   148 
       
   149 
       
   150 // ---------------------------------------------------------------------------
       
   151 // void CIRCategoryView::ConstructL()
       
   152 // EPOC default constructor can leave.
       
   153 // ---------------------------------------------------------------------------
       
   154 //
       
   155 void CIRCategoryView::ConstructL()
       
   156     {
       
   157 	IRLOG_DEBUG( "CIRCategoryView::ConstructL - Entering" );
       
   158     CIRBaseView::ConstructL( R_IR_CATEGORY );
       
   159 	SetCurrentFocus(0);
       
   160 	iFilteredIndex = 0;
       
   161     iFirstTimeLaunchFlag= EFalse;
       
   162    	iRequestPending = EFalse;
       
   163 
       
   164 	IRLOG_DEBUG( "CIRCategoryView::ConstructL - Exiting" );
       
   165     }
       
   166 
       
   167 // -----------------------------------------------------------------------------
       
   168 // CIRCategoryView::NewL()
       
   169 // Two-phased constructor.
       
   170 // -----------------------------------------------------------------------------
       
   171 //
       
   172 CIRCategoryView* CIRCategoryView::NewL()
       
   173     {
       
   174  	IRLOG_DEBUG( "CIRCategoryView::NewL" );
       
   175     CIRCategoryView* self = CIRCategoryView::NewLC();
       
   176     CleanupStack::Pop( self );
       
   177     IRLOG_DEBUG( "CIRCategoryView::NewL - Exiting" );
       
   178     return self;
       
   179     }
       
   180 
       
   181 // ---------------------------------------------------------------------------
       
   182 // CIRCategoryView* CIRCategoryView::NewLC()
       
   183 // Two-phased constructor.
       
   184 // ---------------------------------------------------------------------------
       
   185 //
       
   186 CIRCategoryView* CIRCategoryView::NewLC()
       
   187     {
       
   188 	IRLOG_DEBUG( "CIRCategoryView::NewLC - Entering" );
       
   189     CIRCategoryView* self = new( ELeave ) CIRCategoryView;
       
   190     CleanupStack::PushL( self );
       
   191     self->ConstructL();
       
   192 	IRLOG_DEBUG( "CIRCategoryView::NewLC - Exiting" );
       
   193     return self;
       
   194     }
       
   195 
       
   196     
       
   197 // ---------------------------------------------------------------------------
       
   198 // CIRCategoryView::~CIRCategoryView()
       
   199 // Destructor
       
   200 // ---------------------------------------------------------------------------
       
   201 //
       
   202 CIRCategoryView::~CIRCategoryView()
       
   203     {
       
   204 	IRLOG_DEBUG( "CIRCategoryView::~CIRCategoryView - Entering" );
       
   205     if ( iContainer )
       
   206         {
       
   207         AppUi()->RemoveFromViewStack( *this, iContainer );
       
   208         delete iContainer;
       
   209         iContainer = NULL;
       
   210         }
       
   211     iFilteredIndex = 0;
       
   212 	IRLOG_DEBUG( "CIRCategoryView::~CIRCategoryView - Exiting" );
       
   213     }
       
   214 
       
   215 // ---------------------------------------------------------------------------
       
   216 // TUid CIRCategoryView::Id() const
       
   217 // From class CAknView.
       
   218 // Returns view id.
       
   219 // ---------------------------------------------------------------------------
       
   220 //
       
   221 TUid CIRCategoryView::Id() const
       
   222     {
       
   223     IRLOG_DEBUG( "CIRCategoryView::Id" );
       
   224     return KIRCategoryViewId;
       
   225     }
       
   226 
       
   227 // ---------------------------------------------------------------------------
       
   228 // void CIRCategoryView::DoActivateL( )
       
   229 // From class CAknView.
       
   230 // Handles view activation.
       
   231 // ---------------------------------------------------------------------------
       
   232 //
       
   233 void CIRCategoryView::DoActivateL( const TVwsViewId& aPrevViewId, 
       
   234         TUid aCustomMessageId, const TDesC8& aCustomMessage )
       
   235     {
       
   236 	IRLOG_DEBUG( "CIRCategoryView::DoActivateL - Entering" );
       
   237 	TInt customMessageId = aCustomMessageId.iUid;
       
   238 	if(customMessageId == 1)
       
   239 		{
       
   240 		SetCurrentFocus(0);
       
   241 		SetCurrentTopItem(0);	
       
   242 		iFirstTimeLaunchFlag= ETrue;
       
   243 		}
       
   244 	aCustomMessageId.iUid = 0;
       
   245 	
       
   246 	////////////////////////////////////////////////////////////
       
   247 
       
   248 	if(iCategoryReqMade)
       
   249 		{
       
   250 		if(iContainer)
       
   251 			{
       
   252 		    delete iContainer;
       
   253 		    iContainer = NULL;
       
   254 			}
       
   255 	    iCategoryReqMade = EFalse;
       
   256 		}
       
   257 	
       
   258 	////////////////////////////////////////////////////////////
       
   259 	
       
   260     if ( !iContainer )
       
   261         {
       
   262  	    iContainer = CIRCategoryViewContainer::NewL( *this, ClientRect() );
       
   263  	    iContainer->CreateListBoxL();
       
   264         AppUi()->AddToViewStackL( *this, iContainer);
       
   265         }
       
   266     else
       
   267         {
       
   268 		// we must notify a resource change in order to update the skin context
       
   269 		// This is a flaw of CEikFormattedCellListBox
       
   270 		iContainer->SetRect(ClientRect());
       
   271         iContainer->HandleResourceChange(KEikDynamicLayoutVariantSwitch);
       
   272         AppUi()->AddToViewStackL( *this, iContainer);
       
   273         }
       
   274 
       
   275 
       
   276     iContainer->ActivateL();
       
   277     iContainer->MakeVisible( ETrue );
       
   278   	SetStatusPaneTextL();
       
   279     CIRBaseView::DoActivateL( aPrevViewId, aCustomMessageId, aCustomMessage );
       
   280     HandleStatusPaneSizeChange();
       
   281     iUi->iNetworkController->RegisterActiveNetworkObserverL(*this);
       
   282 
       
   283     EnableObserverL(EIRSystemEventObserver);
       
   284 	IRLOG_DEBUG( "CIRCategoryView::DoActivateL - Exiting" );
       
   285 	}
       
   286 
       
   287 // ---------------------------------------------------------------------------
       
   288 // void CIRCategoryView::DoDeactivate()
       
   289 // From class CAknView.
       
   290 // Handles view deactivation.
       
   291 // ---------------------------------------------------------------------------
       
   292 //
       
   293 void CIRCategoryView::DoDeactivate()
       
   294     {
       
   295 	IRLOG_DEBUG( "CIRCategoryView::DoDeactivate - Entering" );
       
   296     if(&(iUi->SystemEventCollector()))
       
   297 	    {
       
   298 		DisableObserver(EIRSystemEventObserver);
       
   299 	    }
       
   300     if ( iContainer )
       
   301         {
       
   302         if(iContainer->iCategoryListBox && iContainer->iSearchTextBox)
       
   303 	        {
       
   304 			iContainer->iSearchTextBox->GetSearchText(iContainer->iFindString);
       
   305 			if(iContainer->iSearchTextBox && iContainer->iFindString.Length()!=0)
       
   306 				{
       
   307 				if(iIndex)
       
   308 					{
       
   309 					SetCurrentFocus(iIndex);
       
   310 					}
       
   311 				else
       
   312 					{
       
   313 					iContainer->Comparestrings();
       
   314 					SetCurrentFocus(iIndex);
       
   315 					}
       
   316 				}
       
   317 			else
       
   318 				{
       
   319 				SetCurrentFocus(iContainer->GetCurrentItemIndex());
       
   320 				}
       
   321 			SetCurrentTopItem(iContainer->GetListBoxTopIndex());
       
   322 	        }
       
   323         AppUi()->RemoveFromViewStack( *this, iContainer );
       
   324         iContainer->MakeVisible( EFalse );
       
   325         }
       
   326     iUi->iNetworkController->DeleteActiveNetworkObserver(*this);
       
   327         
       
   328     iFirstTimeLaunchFlag= EFalse;
       
   329 	IRLOG_DEBUG( "CIRCategoryView::DoDeactivate - Exiting" );
       
   330     }
       
   331 
       
   332 // ---------------------------------------------------------------------------
       
   333 // void CIRCategoryView::HandleCommandL( TInt aCommand )
       
   334 // From class CAknView.
       
   335 // Command handling function.
       
   336 // ---------------------------------------------------------------------------
       
   337 //
       
   338 void CIRCategoryView::HandleCommandL( TInt aCommand )
       
   339 	{
       
   340 	IRLOG_DEBUG( "CIRCategoryView::HandleCommandL - Entering" );
       
   341     CIRUi* appUi = static_cast<CIRUi*>( AppUi() );
       
   342 	iCommand = aCommand;
       
   343 	switch(aCommand)
       
   344 		{
       
   345 		case ESelectCmd:
       
   346 			{
       
   347 			if( iUi->VerifyNetworkConnectivityL() )
       
   348 				{
       
   349 				iRequestPending = ETrue;
       
   350 				break;			
       
   351 				}
       
   352 			else if ( !iUi->CheckAndNotifyLowDiskSpaceL() )
       
   353 				{
       
   354 				iRequestIssued = ETrue;	
       
   355 				TInt currentIndex = iContainer->GetCurrentItemIndex();
       
   356 				if (currentIndex == 0 )
       
   357 					{
       
   358 					if (iUi->iIsdsWrapper->iCatBannerUrl && !iContainer->GetLogoNotSupported())
       
   359 						{
       
   360 						if(iUi->iIsdsWrapper->iCatClickThroughUrl)
       
   361 							{
       
   362 							if(iUi->iIsdsWrapper->iCatClickThroughUrl->Length() != 0)
       
   363 								{
       
   364 								iContainer->OpenUrlL(*iUi->iIsdsWrapper->iCatClickThroughUrl);
       
   365 								}
       
   366 							}
       
   367 						else
       
   368 							{
       
   369 							iUi->iIsdsWrapper->GetDialogLauncherInstance()->ShowErrorNoteL
       
   370 												(R_IRAPP_ERROR_URL_UNAVAILABLE,ETrue);
       
   371 							}
       
   372 
       
   373 						}
       
   374 					else
       
   375 						{
       
   376 						DoChannelRequestL();			
       
   377 						}
       
   378 					}
       
   379 				else
       
   380 					{
       
   381 					DoChannelRequestL();		
       
   382 					}
       
   383 				}	
       
   384 
       
   385 			}
       
   386 		break;
       
   387 		//Activate NowPlaying view.	
       
   388 		case EGotoNowPlayingViewCmd:
       
   389 			{ 
       
   390 			appUi->SetHistory(EFalse);
       
   391 			appUi->SavePrevIDL(KIRCategoryViewId, aCommand); 			
       
   392 			}
       
   393 		break;
       
   394 
       
   395 	//Activate settings view.	
       
   396 		case ESettingsCmd:
       
   397 			{
       
   398 			AppUi()->ActivateLocalViewL(KIRSettingsViewId);
       
   399 			}
       
   400 			break;
       
   401 		case EAdvertisementUrl:
       
   402 			{
       
   403 			if( iUi->VerifyNetworkConnectivityL() )
       
   404 				{
       
   405 				break;
       
   406 				}
       
   407 			if ( !iUi->CheckAndNotifyLowDiskSpaceL() )
       
   408 				{
       
   409 				if (iUi->iIsdsWrapper->iCatBannerUrl && !iContainer->GetLogoNotSupported())
       
   410 					{
       
   411 					if(iUi->iIsdsWrapper->iCatClickThroughUrl)
       
   412 						{
       
   413 						if(iUi->iIsdsWrapper->iCatClickThroughUrl->Length() != 0)
       
   414 							{
       
   415 							iContainer->OpenUrlL(*iUi->iIsdsWrapper->iCatClickThroughUrl);
       
   416 							}
       
   417 						}
       
   418 					else
       
   419 						{
       
   420 						iUi->iIsdsWrapper->GetDialogLauncherInstance()->ShowErrorNoteL
       
   421 							(R_IRAPP_ERROR_URL_UNAVAILABLE,ETrue);
       
   422 						}
       
   423 					
       
   424 					}
       
   425 				}
       
   426 			}
       
   427 		break;
       
   428 			
       
   429 		case EHelpCmd:
       
   430 			{
       
   431 			if ( !iUi->CheckAndNotifyLowDiskSpaceL() )
       
   432 				{
       
   433 				HlpLauncher::LaunchHelpApplicationL( iEikonEnv->WsSession(), AppUi()->AppHelpContextL() );
       
   434 				}
       
   435 			}
       
   436 		break;
       
   437 		default:
       
   438 			{
       
   439 			CIRBaseView::HandleCommandL( aCommand );
       
   440 			}
       
   441 		}
       
   442 	IRLOG_DEBUG( "CIRCategoryView::HandleCommandL - Exiting" );
       
   443 	}
       
   444 // ---------------------------------------------------------------------------
       
   445 // void CIRCategoryView::SetStatusPaneTextL()
       
   446 // Sets the title pane of the search results view
       
   447 // ---------------------------------------------------------------------------
       
   448 //
       
   449     
       
   450 void CIRCategoryView:: SetStatusPaneTextL()
       
   451  	{
       
   452 	IRLOG_DEBUG( "CIRCategoryView::SetStatusPaneTextL - Entering" );
       
   453 	switch (iUi->iCategoryViewTitleType)
       
   454 		{
       
   455 		// if the browse by genre's is selected.
       
   456 		case EGenreData:
       
   457 			{
       
   458 			SetTitleL( R_IRAPP_GENRE_STATLIST_TITLE );
       
   459 			}
       
   460 			break;
       
   461 		// if the browse by language's is selected.	
       
   462 		case ELanguageData:
       
   463 			{
       
   464 			SetTitleL( R_IRAPP_LANGUAGE_STATLIST_TITLE );
       
   465 			}
       
   466 			break;
       
   467 		// if the browse by country is selected.	
       
   468 		case ECountryData:
       
   469 			{
       
   470 			SetTitleL( R_IRAPP_COUNTRY_STATLIST_TITLE );
       
   471 			}
       
   472 			break;
       
   473 		// if top station's is selected.	
       
   474 		case ETopStationData:
       
   475 			{
       
   476 			SetTitleL( R_IRAPP_TOP_STATLIST_TITLE );
       
   477 			}
       
   478 			break;
       
   479 		default:
       
   480 			{
       
   481 			//No implementation
       
   482 			}
       
   483 		}
       
   484 	IRLOG_DEBUG( "CIRCategoryView::SetStatusPaneTextL - Exiting" );
       
   485 	}
       
   486  	
       
   487     
       
   488 // ---------------------------------------------------------------------------
       
   489 // CIRCategoryView::DoChannelRequestL()
       
   490 // 
       
   491 // ---------------------------------------------------------------------------
       
   492 //
       
   493 void CIRCategoryView::DoChannelRequestL()
       
   494 	{
       
   495 	IRLOG_DEBUG( "CIRCategoryView::DoChannelRequestL - Entering" );
       
   496 	iLoadingCancelled = EFalse;
       
   497 	TInt currentIndex  = iContainer->GetCurrentItemIndex();
       
   498 	
       
   499 	if(iContainer->iSearchTextBox)
       
   500 		iContainer->iSearchTextBox->GetSearchText(iContainer->iFindString);
       
   501 	if(iContainer->iSearchTextBox && iContainer->iFindString.Length()!=0)
       
   502 		{
       
   503 		iFilteredIndex = currentIndex;
       
   504 		iContainer->Comparestrings();
       
   505 		currentIndex = iIndex;
       
   506 		SetCurrentFocus(currentIndex);
       
   507 		if(iContainer->GetLogoNotSupported())
       
   508 			{
       
   509 			currentIndex = 	currentIndex +1;
       
   510 			}
       
   511 		iIsdsWrapper->IsdsChannelRequestL(this,currentIndex);
       
   512 		iUi->iStationsView->iResultsReqMade = ETrue;
       
   513 		}
       
   514 	else
       
   515 		{
       
   516 		if(iContainer->GetLogoNotSupported())
       
   517 			{
       
   518 			currentIndex = 	currentIndex +1;
       
   519 			}
       
   520 		iIsdsWrapper->IsdsChannelRequestL(this,currentIndex);
       
   521 		iUi->iStationsView->iResultsReqMade = ETrue;
       
   522 		}
       
   523 	IRLOG_DEBUG( "CIRCategoryView::DoChannelRequestL - Exiting" );
       
   524 
       
   525 	}
       
   526 
       
   527 // ---------------------------------------------------------------------------
       
   528 // void CIRCategoryView::ResponseL()
       
   529 // Activates the Stations view after getting the IsdsResponse
       
   530 // ---------------------------------------------------------------------------
       
   531 //
       
   532 void CIRCategoryView::ResponseL(CIRIsdsPreset* /*aPreset*/)
       
   533 	{
       
   534 	IRLOG_DEBUG( "CIRCategoryView::ResponseL - Entering" );
       
   535 	iRequestIssued = EFalse;	
       
   536 	CIRUi* appUi = static_cast<	CIRUi*>(AppUi());
       
   537 	if(!iLoadingCancelled )
       
   538 		{
       
   539 		
       
   540 		iUi->iStationsViewTitleString.Copy(KNullDesC);	
       
   541 		iUi->iStationsViewTitleString.Close();
       
   542 		// Gets the item text if the conditions above are met.
       
   543 		if(iContainer->iSearchTextBox && iContainer->iFindString.Length()!=0)
       
   544 			{
       
   545 			TPtrC16 currentItemText = iContainer->iItemArray->MdcaPoint(iIndex);//iContainer->GetCurrentItemIndex()
       
   546 
       
   547 			// We have to find the position of tabs to decide the components
       
   548 			// available in the item text (icon, heading and text).
       
   549 			TInt tabPosition1 = currentItemText.Locate('\t');
       
   550 			TInt tabPosition2 = currentItemText.Mid(tabPosition1 + 1).Locate('\t');
       
   551 
       
   552 
       
   553 			TInt itemDataLength = tabPosition2 - tabPosition1;
       
   554 			iUi->iStationsViewTitleString.Create(itemDataLength);
       
   555 			iUi->iStationsViewTitleString.Copy(currentItemText.Mid((tabPosition1+1),itemDataLength));
       
   556 			}
       
   557 		else
       
   558 			{
       
   559 			TInt currentIndex = iContainer->GetCurrentItemIndex();
       
   560 
       
   561 			TPtrC16 currentItemText = iContainer->iItemArray->MdcaPoint(currentIndex);
       
   562 
       
   563 			// We have to find the position of tabs to decide the components
       
   564 			// available in the item text (icon, heading and text).
       
   565 			TInt tabPosition1 = currentItemText.Locate('\t');
       
   566 			TInt tabPosition2 = currentItemText.Mid(tabPosition1 + 1).Locate('\t');
       
   567 
       
   568 
       
   569 			TInt itemDataLength = tabPosition2 - tabPosition1;
       
   570 			iUi->iStationsViewTitleString.Create(itemDataLength);
       
   571 			iUi->iStationsViewTitleString.Copy(currentItemText.Mid((tabPosition1+1),itemDataLength));
       
   572 			}
       
   573 		    TBuf8<2> dummy;
       
   574 			TVwsViewId viewId(TUid::Uid(KUIDIRAPP),KIRStationsViewId);
       
   575 		
       
   576 		
       
   577 		if(appUi->IsForeground())
       
   578 			{
       
   579 			AppUi()->ActivateViewL(viewId ,TUid::Uid(1),dummy);
       
   580 			appUi->iActivationPending = KNullUid ;	
       
   581 			}
       
   582 		else
       
   583 			{
       
   584 			appUi->iActivationPending =KIRStationsViewId;	
       
   585 			}
       
   586 	
       
   587 		}
       
   588 		
       
   589 	IRLOG_DEBUG( "CIRCategoryView::ResponseL - Exiting" );
       
   590 	}
       
   591 
       
   592 // ---------------------------------------------------------------------------
       
   593 // void CIRCategoryView::PresetResponseL()
       
   594 // Issues Request to listen to a particular channel 
       
   595 // ---------------------------------------------------------------------------
       
   596 //
       
   597 void CIRCategoryView::PresetResponseL(CIRIsdsPreset* /*aPreset*/)
       
   598 	{
       
   599 	IRLOG_DEBUG( "CIRCategoryView::PresetResponseL - Entering" );
       
   600 	//No Implementation Required
       
   601 	IRLOG_DEBUG( "CIRCategoryView::PresetResponseL - Exiting" );
       
   602 	}
       
   603 // ---------------------------------------------------------------------------
       
   604 // void CIRCategoryView::ErrorL()
       
   605 // Handles the errors from Isds 
       
   606 // ---------------------------------------------------------------------------
       
   607 //
       
   608 void CIRCategoryView::ErrorL()
       
   609 	{
       
   610 	IRLOG_DEBUG( "CIRCategoryView::ErrorL - Entering" );
       
   611 	if(iIsdsWrapper->iConnTimeOut)
       
   612 		{
       
   613 		iIsdsWrapper->iConnTimeOut = EFalse;	
       
   614 		}
       
   615 	IRLOG_DEBUG( "CIRCategoryView::ErrorL - Exiting" );
       
   616 
       
   617 	}
       
   618 
       
   619 // ---------------------------------------------------------------------------
       
   620 // void CIRCategoryView::DynInitMenuPaneL()
       
   621 // Dynamically initialises a menu pane
       
   622 // ---------------------------------------------------------------------------
       
   623 //
       
   624 void CIRCategoryView::DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane)
       
   625 	{
       
   626 	IRLOG_DEBUG( "CIRCategoryView::DynInitMenuPaneL - Entering" );
       
   627 	
       
   628 	CIRUi* appUi = static_cast<CIRUi*>( AppUi() );
       
   629 
       
   630 	if(!aMenuPane) User::Leave(KErrNotFound);
       
   631 		{
       
   632 		if(aResourceId == R_IR_MENU_CATEGORY)
       
   633 			{				
       
   634 			// Now Playing option
       
   635 			if(iNowPlayingWrapper->iPlaying)
       
   636 				{
       
   637 				aMenuPane->SetItemDimmed(EGotoNowPlayingViewCmd,EFalse);
       
   638 				}
       
   639 			else
       
   640 				{
       
   641 				aMenuPane->SetItemDimmed(EGotoNowPlayingViewCmd,ETrue);
       
   642 				}
       
   643 			}
       
   644 		}
       
   645 	IRLOG_DEBUG( "CIRCategoryView::DynInitMenuPaneL - Exiting" );
       
   646 	}
       
   647 
       
   648 // ---------------------------------------------------------------------------
       
   649 // From class CAknView.
       
   650 // Event handler for status pane size changes.
       
   651 // ---------------------------------------------------------------------------
       
   652 //
       
   653 void CIRCategoryView::HandleStatusPaneSizeChange()
       
   654     {
       
   655 	IRLOG_DEBUG( "CIRCategoryView::HandleStatusPaneSizeChange - Entering" );
       
   656     CIRBaseView::HandleStatusPaneSizeChange();
       
   657 
       
   658     if ( iContainer )
       
   659         {
       
   660         iContainer->SetRect( ClientRect() );
       
   661         }
       
   662 	IRLOG_DEBUG( "CIRCategoryView::HandleStatusPaneSizeChange - Exiting" );
       
   663     }
       
   664 
       
   665 // ---------------------------------------------------------------------------
       
   666 // From class CAknView.
       
   667 // Foreground event handling function.
       
   668 // ---------------------------------------------------------------------------
       
   669 //
       
   670 void CIRCategoryView::HandleForegroundEventL( TBool aForeground )
       
   671 	{
       
   672 	IRLOG_DEBUG( "CIRCategoryView::HandleForegroundEventL - Entering" );
       
   673 
       
   674 	CIRBaseView::HandleForegroundEventL( aForeground );
       
   675 	if ( aForeground )
       
   676 		{
       
   677 		if ( iContainer )
       
   678 			{
       
   679 			iContainer->DrawDeferred();
       
   680 			}
       
   681 		}
       
   682 	IRLOG_DEBUG( "CIRCategoryView::HandleForegroundEventL - Exiting" );
       
   683 	}
       
   684 // ---------------------------------------------------------------------------
       
   685 // CIRCategoryView::PresetLogoDownloadedL()
       
   686 // from base class MLogoDownloadObserver
       
   687 // ---------------------------------------------------------------------------
       
   688 //
       
   689 void CIRCategoryView::PresetLogoDownloadedL(CIRIsdsPreset* aPreset)
       
   690 	{
       
   691 	IRLOG_DEBUG( "CIRCategoryView::PresetLogoDownloadedL - Entering" );
       
   692 	if(iContainer)
       
   693 		{
       
   694 		iContainer->PresetLogoDownloadL(aPreset);
       
   695 		}
       
   696 	IRLOG_DEBUG( "CIRCategoryView::PresetLogoDownloadedL - Exiting" );
       
   697 	}
       
   698 
       
   699 
       
   700 // ---------------------------------------------------------------------------
       
   701 // CIRCategoryView::PresetLogoDownloadError()
       
   702 // from base class MLogoDownloadObserver
       
   703 // ---------------------------------------------------------------------------
       
   704 //
       
   705 void CIRCategoryView::PresetLogoDownloadError(CIRIsdsPreset* )
       
   706 	{
       
   707 	IRLOG_DEBUG( "CIRCategoryView::PresetLogoDownloadError - Entering" );
       
   708 	//call the API of stations view container
       
   709 	if(iContainer)
       
   710 		{
       
   711 		TRAP_IGNORE(iContainer->HandleLogoErrorL())
       
   712 		}
       
   713 	IRLOG_DEBUG( "CIRCategoryView::PresetLogoDownloadError - Exiting" );
       
   714 	}
       
   715 
       
   716 
       
   717 // ---------------------------------------------------------------------------
       
   718 // CIRCategoryView::LogoRequestL()
       
   719 // called from the container				
       
   720 // ---------------------------------------------------------------------------
       
   721 //
       
   722 void CIRCategoryView::AdRequestL()
       
   723 	{
       
   724 	IRLOG_DEBUG( "CIRCategoryView::LogoRequestL - Entering" );
       
   725 	if(iContainer)
       
   726 		{
       
   727 		iUi->iIsdsWrapper->GetISDSInstance()->GetDataProvider()->GetHttpDataProvider()->
       
   728 		GetLogoDownloadEngine()->SendRequestL(iContainer->iAdvPreset,this);
       
   729 		}
       
   730 	IRLOG_DEBUG( "CIRCategoryView::LogoRequestL - Exiting" );
       
   731 	}
       
   732 // ---------------------------------------------------------
       
   733 // CIRCategoryView::SetActualFilteredItemIndex ()
       
   734 // Sets the actual index of the station
       
   735 // ---------------------------------------------------------
       
   736 //
       
   737 void CIRCategoryView::SetActualFilteredItemIndex(TInt aIndex)
       
   738 	{
       
   739 	IRLOG_DEBUG( "CIRCategoryView::SetListBoxMarkedCount - Entering." );
       
   740 	iIndex = aIndex;
       
   741 	IRLOG_DEBUG( "CIRCategoryView::SetListBoxMarkedCount - Exiting." );
       
   742 	}
       
   743 
       
   744 
       
   745 
       
   746 // ---------------------------------------------------------------------------
       
   747 // CIRCategoryView::GetFilteredIndex()
       
   748 // Returns the filtered Index				
       
   749 // ---------------------------------------------------------------------------
       
   750 //
       
   751 TInt CIRCategoryView::GetFilteredIndex()
       
   752 	{
       
   753 	IRLOG_DEBUG( "CIRCategoryView::GetFilteredIndex - Entering" );
       
   754 	return iFilteredIndex;
       
   755 	}
       
   756 // ---------------------------------------------------------
       
   757 // CIRCategoryView::GetFirstLaunchFlag ()
       
   758 // returns whether is launching for the first time /coming from other view
       
   759 // which is activated from this view.
       
   760 // ---------------------------------------------------------
       
   761 //
       
   762 TBool CIRCategoryView::GetFirstLaunchFlag()
       
   763 	{
       
   764 	IRLOG_DEBUG( "CIRStationsView::GetFirstLaunchFlag - Entering." );
       
   765 	IRLOG_DEBUG( "CIRStationsView::GetFirstLaunchFlag - Exiting." );
       
   766 	return iFirstTimeLaunchFlag;
       
   767 	}
       
   768 // ---------------------------------------------------------
       
   769 // CIRCategoryView::HandleSystemEventL
       
   770 // from base class MIRSystemEventObserver
       
   771 // ---------------------------------------------------------
       
   772 //
       
   773 void CIRCategoryView::HandleSystemEventL(TIRSystemEventType aEventType)
       
   774 	{
       
   775 	IRLOG_DEBUG(" CIRCategoryView::::HandleSystemEventL - Entering");
       
   776 	
       
   777 	switch (aEventType)
       
   778 		{
       
   779 		case EIRCallActivated:
       
   780 			{
       
   781 			if( iUi->GetNetworkControllerInstance()->IdentifyConnectionType() != EWiFi )
       
   782 				{
       
   783 				if(iUi->iIsdsWrapper->iIsdsWaitDialog)
       
   784 					{
       
   785 					TRAP_IGNORE( iUi->iIsdsWrapper->DestroyWaitDialogL() );
       
   786 					}
       
   787 				if(!iCallRequestPending && iCommand==ESelectCmd)
       
   788 					{
       
   789 					iUi->iIsdsWrapper->IsdsCancelRequest();
       
   790 					iCallRequestPending = ETrue;
       
   791 					}
       
   792 				}
       
   793 			break;
       
   794 			}
       
   795 		case EIRCallDeactivated:
       
   796 			{
       
   797 			if(iCallRequestPending && iCommand==ESelectCmd)
       
   798 				{
       
   799 				iCallRequestPending = EFalse;
       
   800 				HandleCommandL( iCommand );
       
   801 				}
       
   802 			break;
       
   803 			}
       
   804 		default:
       
   805 			{
       
   806 			break;
       
   807 			}
       
   808 		}
       
   809 	IRLOG_DEBUG( "CIRCategoryView::HandleSystemEventL - Exiting." );
       
   810 	}	
       
   811 
       
   812 // ---------------------------------------------------------------------------
       
   813 //Notifies all observers whose network request is active
       
   814 // to reissue the request  
       
   815 //NotifyActiveNetworkObserversL()
       
   816 // ---------------------------------------------------------------------------
       
   817 
       
   818 void CIRCategoryView::NotifyActiveNetworkObserversL(TIRNetworkEvent aEvent)
       
   819 	{
       
   820 	IRLOG_DEBUG( "CIRCategoryView::NotifyActiveNetworkObserversL - Entering" );
       
   821 	IRRDEBUG2("CIRCategoryView::NotifyActiveNetworkObserversL entering ", KNullDesC);
       
   822 
       
   823 	switch(aEvent)
       
   824 		{
       
   825 		case ENetworkConnectionDisconnected:
       
   826 			{
       
   827 			iNowPlayingWrapper->HandleNetworkDisconnected();
       
   828 			}
       
   829 			break;
       
   830 		case ENetworkConnectionEstablished:
       
   831 			{
       
   832 			if(iContainer)
       
   833 				{
       
   834 				TBool reIssueRequest = EFalse;
       
   835 				if(iUi->iNetworkController->IsHandingOverConnection())
       
   836 					{
       
   837 					if(iRequestIssued)
       
   838 						{
       
   839 						iRequestIssued=EFalse;
       
   840 						reIssueRequest = ETrue;	
       
   841 						}
       
   842 					}
       
   843 					
       
   844 				if(iRequestPending || reIssueRequest )
       
   845 					{
       
   846 					iRequestPending=EFalse;
       
   847 					TInt currentIndex = iContainer->GetCurrentItemIndex();
       
   848 					if (currentIndex == 0 )
       
   849 						{
       
   850 						if (iUi->iIsdsWrapper->iCatBannerUrl && !iContainer->GetLogoNotSupported())
       
   851 							{
       
   852 							if(iUi->iIsdsWrapper->iCatClickThroughUrl)
       
   853 								{
       
   854 								if(iUi->iIsdsWrapper->iCatClickThroughUrl->Length() != 0)
       
   855 									{
       
   856 									iContainer->OpenUrlL(*iUi->iIsdsWrapper->iCatClickThroughUrl);
       
   857 									}
       
   858 								}
       
   859 							}
       
   860 						else
       
   861 							{
       
   862 							iRequestIssued=ETrue;
       
   863 							DoChannelRequestL();			
       
   864 							}
       
   865 						}
       
   866 					else
       
   867 						{
       
   868 						iRequestIssued=ETrue;
       
   869 						DoChannelRequestL();		
       
   870 						}
       
   871 					}
       
   872 				if(iUi->iNetworkController->IsHandingOverConnection())
       
   873 					{
       
   874 					ResetPendingRequests(EFalse);			
       
   875 					}
       
   876 				}
       
   877 			}
       
   878 		}
       
   879 		
       
   880     IRRDEBUG2("CIRCategoryView::NotifyActiveNetworkObserversL exiting ", KNullDesC);
       
   881 	
       
   882 	IRLOG_DEBUG( "CIRCategoryView::NotifyActiveNetworkObserversL - Exiting" );
       
   883 	}
       
   884 
       
   885 // -----------------------------------------------------------------------------
       
   886 // Notified by network controller when user cancels network connection, to reset 
       
   887 // the pending requests  
       
   888 // ResetPendingRequests()
       
   889 // -----------------------------------------------------------------------------
       
   890 void CIRCategoryView::ResetPendingRequests(TBool aValue)
       
   891 	{
       
   892 	iRequestPending = aValue;
       
   893 	iRequestIssued = aValue;	
       
   894 	}