internetradio2.0/uisrc/irsearchresultsview.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:  Search Results view class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #include <akniconarray.h>
       
    22 #include <akntitle.h>
       
    23 #include <eikmenup.h>
       
    24 #include <gulicon.h>
       
    25 #include <stringloader.h>
       
    26 #include <psserv.h>
       
    27 #include <hlplch.h>
       
    28 #include <aknnotewrappers.h>
       
    29 #include <eikenv.h>
       
    30 #include <internetradio.rsg>
       
    31 #include <internetradio.mbg>
       
    32 #include "irviewstack.h"
       
    33 //For Touch Toolbar
       
    34 #include <akntoolbar.h>
       
    35 #include <akntouchpane.h>
       
    36 #include <aknbutton.h>
       
    37 
       
    38 #include "irui.h"
       
    39 #include "ir.hrh"
       
    40 #include "ircommon.h"
       
    41 #include "irdebug.h"
       
    42 #include "irbaseview.h"
       
    43 #include "irsearchResultsview.h"
       
    44 #include "irsearchresultsviewcontainer.h"
       
    45 #include "irisdswrapper.h"
       
    46 #include "irsettings.h"
       
    47 #include "irnowplayingwrapper.h"
       
    48 #include "irpubsub.h"
       
    49 
       
    50 #include "hlplch.h"
       
    51 #include "irimageconverter.h"
       
    52 #include "irlogodownloadengine.h"
       
    53 #include "irdataprovider.h"
       
    54 #include "irhttpdataprovider.h"
       
    55 #include "irdialoglauncher.h"
       
    56 #include "irdebug.h" //  PC-Lint comments :: SPP
       
    57 #include "irfilteredmodel.h"
       
    58 
       
    59 #include "iractivenetworkobserver.h"
       
    60 #include "irnetworkcontroller.h" 
       
    61 
       
    62 const TInt KStringSize = 20;
       
    63 const TInt KLogosSize = 59;
       
    64 const TInt KLogosReqFrom = 0;
       
    65 
       
    66 
       
    67 // ---------------------------------------------------------------------------
       
    68 // CIRSearchResultsView::CIRSearchResultsView()
       
    69 // C++ default constructor can NOT contain any code, that might leave.
       
    70 // ---------------------------------------------------------------------------
       
    71 //
       
    72 CIRSearchResultsView::CIRSearchResultsView():iCallRequestPending(EFalse)
       
    73 	{
       
    74 	IRLOG_DEBUG( "CIRSearchResultsView::CIRSearchResultsView " );
       
    75 	iSearchReqMade = EFalse;
       
    76     }
       
    77 
       
    78 
       
    79 // ---------------------------------------------------------------------------
       
    80 // void CIRSearchResultsView::ConstructL()
       
    81 // EPOC default constructor can leave.
       
    82 // ---------------------------------------------------------------------------
       
    83 //
       
    84 void CIRSearchResultsView::ConstructL()
       
    85     {
       
    86     IRLOG_DEBUG( "CIRSearchResultsView::ConstructL - Entering " );
       
    87     CIRBaseView::ConstructL( R_IR_SEARCHRESULTS );
       
    88     
       
    89 	MAknsSkinInstance * skin=AknsUtils::SkinInstance () ;
       
    90     TRgb color;
       
    91     TInt skinColor=AknsUtils::GetCachedColor(skin, color, KAknsIIDQsnTextColors,
       
    92     				                                      EAknsCIQsnTextColorsCG6 );
       
    93 	if(color.Gray2()!=0)
       
    94 		{
       
    95 		CreateAndSetToolbarL(R_IR_SEARCHRESULTS_WHITE_TOOLBAR);
       
    96 		}
       
    97 	else
       
    98 		{
       
    99 		CreateAndSetToolbarL(R_IR_SEARCHRESULTS_BLACK_TOOLBAR);	
       
   100 		}
       
   101 	if( AknLayoutUtils::PenEnabled() && Toolbar() )
       
   102 		{
       
   103 		Toolbar()->SetToolbarObserver( this );
       
   104 		}
       
   105 	SetCurrentFocus(0);
       
   106 	iFilteredIndex = 0;
       
   107 	iRequestPending = EFalse;
       
   108     iAddToFav= EFalse;
       
   109 	IRLOG_DEBUG( "CIRSearchResultsView::ConstructL - Exiting " );
       
   110     }
       
   111 
       
   112 // -----------------------------------------------------------------------------
       
   113 // CIRSearchResultsView::NewL()
       
   114 // Two-phased constructor.
       
   115 // -----------------------------------------------------------------------------
       
   116 //
       
   117 CIRSearchResultsView* CIRSearchResultsView::NewL()
       
   118     {
       
   119  	IRLOG_DEBUG( "CIRSearchResultsView::NewL" );
       
   120  	CIRSearchResultsView* self = CIRSearchResultsView::NewLC();
       
   121     CleanupStack::Pop( self );
       
   122     IRLOG_DEBUG( "CIRSearchResultsView::NewL - Exiting" );
       
   123     return self;
       
   124     }
       
   125 
       
   126 // ---------------------------------------------------------------------------
       
   127 // CIRSearchResultsView::NewLC()
       
   128 // Two-phased constructor.
       
   129 // ---------------------------------------------------------------------------
       
   130 //
       
   131 CIRSearchResultsView* CIRSearchResultsView::NewLC()
       
   132     {
       
   133     IRLOG_DEBUG( "CIRSearchResultsView::NewLC - Entering" );
       
   134     CIRSearchResultsView* self = new( ELeave ) CIRSearchResultsView();
       
   135     CleanupStack::PushL( self );
       
   136     self->ConstructL();
       
   137     IRLOG_DEBUG( "CIRSearchResultsView::NewLC - Exiting" );
       
   138     return self;
       
   139     }
       
   140 
       
   141 // ---------------------------------------------------------------------------
       
   142 // CIRSearchResultsView::~CIRSearchResultsView()
       
   143 // Destructor
       
   144 // ---------------------------------------------------------------------------
       
   145 //
       
   146 CIRSearchResultsView::~CIRSearchResultsView()
       
   147 	{
       
   148 	IRLOG_DEBUG( "CIRSearchResultsView::~CIRSearchResultsView - Entering " );
       
   149 	if (iContainer)
       
   150 		{
       
   151 		AppUi()->RemoveFromViewStack( *this, iContainer);
       
   152 		delete iContainer;
       
   153 		iContainer = NULL;
       
   154 		}
       
   155 	if( AknLayoutUtils::PenEnabled() && Toolbar() )
       
   156 		{
       
   157 		Toolbar()->SetToolbarVisibility(EFalse, EFalse);
       
   158 		Toolbar()->SetToolbarObserver( NULL );
       
   159 		}
       
   160 	iFilteredIndex = 0;
       
   161 	IRLOG_DEBUG( "CIRSearchResultsView::~CIRSearchResultsView - Exiting " );
       
   162 	}
       
   163 
       
   164 // ---------------------------------------------------------------------------
       
   165 // TUid CIRSearchResultsView::Id() const
       
   166 // From class CAknView.
       
   167 // Returns view id.
       
   168 // ---------------------------------------------------------------------------
       
   169 //
       
   170 TUid CIRSearchResultsView::Id() const
       
   171     {
       
   172     IRLOG_DEBUG( "CIRSearchResultsView::Id" );
       
   173     return KIRSearchResultsViewID;
       
   174     }
       
   175 
       
   176 // ---------------------------------------------------------------------------
       
   177 // void CIRSearchResultsView::DoActivateL( )
       
   178 // From class CAknView.
       
   179 // Handles view activation.
       
   180 // ---------------------------------------------------------------------------
       
   181 //
       
   182 void CIRSearchResultsView::DoActivateL( const TVwsViewId& aPrevViewId,
       
   183         TUid aCustomMessageId, const TDesC8& aCustomMessage )
       
   184     {
       
   185 	IRLOG_DEBUG( "CIRSearchResultsView::DoActivateL() started." );
       
   186 	if(iUi->IsForeground())
       
   187 		{
       
   188 		TInt customMessageId = aCustomMessageId.iUid;
       
   189 		if(customMessageId == 1)
       
   190 			{
       
   191 			SetCurrentFocus(0);
       
   192 			SetCurrentTopItem(0);
       
   193 			iFirstTimeLaunchFlag= ETrue;
       
   194 			}
       
   195 		aCustomMessageId.iUid = 0;
       
   196 
       
   197 
       
   198 	////////////////////////////////////////////////////////////
       
   199 
       
   200 	if(iSearchReqMade)
       
   201 		{
       
   202 		if(iContainer)
       
   203 			{
       
   204 		    delete iContainer;
       
   205 		    iContainer = NULL;
       
   206 			}
       
   207 	    iSearchReqMade = EFalse;
       
   208 		}
       
   209 	
       
   210 	////////////////////////////////////////////////////////////
       
   211 	  	SetStatusPaneTextL();
       
   212 	    CIRBaseView::DoActivateL( aPrevViewId, aCustomMessageId, aCustomMessage );
       
   213 
       
   214 
       
   215 		ConstructToolbarL();
       
   216         iUi->iPresentViewID = KIRSearchResultsViewID;
       
   217 	    if ( !iContainer )
       
   218 	        {
       
   219 	        iContainer = CIRSearchResultsViewContainer::NewL(ClientRect(),*this);
       
   220 		    iContainer->CreateListBoxL();
       
   221 	    	AppUi()->AddToViewStackL( *this, iContainer);
       
   222 	        }
       
   223 	    else
       
   224 	        {
       
   225 			// we must notify a resource change in order to update the skin context
       
   226 			// This is a flaw of CEikFormattedCellListBox
       
   227 			iContainer->SetRect(ClientRect());
       
   228 	        iContainer->HandleResourceChange(KEikDynamicLayoutVariantSwitch);
       
   229 	        AppUi()->AddToViewStackL( *this, iContainer);
       
   230 	        }
       
   231 
       
   232 
       
   233 	    iContainer->ActivateL();
       
   234 	    iContainer->MakeVisible( ETrue );
       
   235 
       
   236 
       
   237 	    HandleStatusPaneSizeChange();
       
   238     	EnableObserverL(EIRSystemEventObserver);
       
   239    	    iUi->iNetworkController->RegisterActiveNetworkObserverL(*this);
       
   240 		}
       
   241 		IRLOG_DEBUG( "CIRSearchResultsView::DoActivateL() exiting." );
       
   242 	}
       
   243 
       
   244 // ---------------------------------------------------------------------------
       
   245 // void CIRSearchResultsView::DoDeactivate()
       
   246 // From class CAknView.
       
   247 // Handles view deactivation.
       
   248 // ---------------------------------------------------------------------------
       
   249 //
       
   250 void CIRSearchResultsView::DoDeactivate()
       
   251     {
       
   252     IRLOG_DEBUG( "CIRSearchResultsView::DoDeactivate() - Entering." );
       
   253     if(&(iUi->SystemEventCollector()))
       
   254 	    {
       
   255 		DisableObserver(EIRSystemEventObserver);
       
   256 	    }
       
   257     if ( iContainer )
       
   258         {
       
   259         if(iContainer->GetListPointer() && iContainer->GetSearchBoxPointer())
       
   260 	        {
       
   261 	        TBuf<KFindStringLength> findstring = iContainer->GetFindString();
       
   262 			iContainer->GetSearchBoxPointer()->GetSearchText(findstring);
       
   263 			if(iContainer->GetSearchBoxPointer() && findstring.Length()!=0)
       
   264 				{
       
   265 				if(!iIndex)
       
   266 					{
       
   267 					TInt currentIndex = iContainer->GetCurrentItemIndex();
       
   268 					iFilteredIndex = currentIndex;
       
   269 					iContainer->Comparestrings();
       
   270 					}
       
   271 				SetCurrentFocus(iIndex);
       
   272 				}
       
   273 			else
       
   274 				{
       
   275 				TInt currentIndex = iContainer->GetCurrentItemIndex();
       
   276 				SetCurrentFocus(currentIndex);
       
   277 				}
       
   278 		 SetCurrentTopItem(iContainer->GetListBoxTopIndex());
       
   279 	     }
       
   280         iUi->RemoveFromViewStack( *this, iContainer );
       
   281         iContainer->MakeVisible( EFalse );
       
   282         }
       
   283 		// Disable focus of toobar, so that it can't steal it from other views
       
   284 	if( AknLayoutUtils::PenEnabled() && Toolbar() )
       
   285 		{
       
   286 		Toolbar()->SetToolbarVisibility(EFalse, EFalse);
       
   287 		Toolbar()->SetToolbarObserver( NULL );
       
   288 		}
       
   289      iFirstTimeLaunchFlag= EFalse;
       
   290      iUi->iNetworkController->DeleteActiveNetworkObserver(*this);
       
   291 	 IRLOG_DEBUG( "CIRSearchResultsView::DoDeactivate() - Exiting." );
       
   292 
       
   293     }
       
   294 
       
   295 // ---------------------------------------------------------------------------
       
   296 // void CIRSearchResultsView::HandleCommandL( TInt aCommand )
       
   297 // From class CAknView.
       
   298 // Command handling function.
       
   299 // ---------------------------------------------------------------------------
       
   300 //
       
   301 void CIRSearchResultsView::HandleCommandL( TInt aCommand )
       
   302 	{
       
   303 	IRLOG_DEBUG( "CIRSearchResultsView::HandleCommandL - Entering." );
       
   304 	iCommand = aCommand;
       
   305 	switch(aCommand)
       
   306 		{
       
   307 		case EListenCmd:
       
   308 			{
       
   309 			if ( iUi->CheckAndNotifyLowDiskSpaceL() )
       
   310 				{
       
   311 				break;
       
   312 				}
       
   313 			
       
   314 			iUi->SetListenFromPls(EFalse);
       
   315 			if( iUi->VerifyNetworkConnectivityL() )
       
   316 				{
       
   317 				iRequestPending = ETrue;
       
   318 				iListenRequest = ETrue;
       
   319 				break;
       
   320 				}
       
   321 			else
       
   322 				{
       
   323 				ListenChannelL(GetActualIndex());	
       
   324 				}	
       
   325 			break;
       
   326 			}
       
   327 		case ESearchCmd:
       
   328 			{
       
   329 			if ( !iUi->CheckAndNotifyLowDiskSpaceL() )
       
   330 				{
       
   331 				iIsSearchAgain = ETrue;
       
   332 				HBufC *SearchTitle = StringLoader::LoadLC(R_IRAPP_SEARCH_STRING);
       
   333 				_LIT(KNullText,"");
       
   334 				RBuf string1;
       
   335 				string1.Create(KStringSize);
       
   336 				string1.Append(KNullText);
       
   337 				ShowQueryDialogL(*SearchTitle,string1);
       
   338 				CleanupStack::PopAndDestroy(SearchTitle);
       
   339 				string1.Close();
       
   340 				}
       
   341 			}
       
   342 		break;
       
   343 
       
   344 		//Activate NowPlaying view.
       
   345 		case EGotoNowPlayingViewCmd:
       
   346 			{
       
   347 			iUi->SetHistory(EFalse);
       
   348 			iUi->SavePrevIDL(KIRSearchResultsViewID, aCommand);
       
   349 			}
       
   350 		break;
       
   351 
       
   352 		case EAddtoFavouritesCmd:
       
   353 			{
       
   354 			if ( iUi->CheckAndNotifyLowDiskSpaceL() )
       
   355 				{
       
   356 				break;
       
   357 				}
       
   358 			else if( iUi->VerifyNetworkConnectivityL() )
       
   359 				{
       
   360 				iRequestPending = ETrue;
       
   361 				iAddToFav = ETrue;
       
   362 				break;
       
   363 				}
       
   364 			else
       
   365 				{
       
   366 				iAddToFav = ETrue;
       
   367 				AddToFavouritesL(GetActualIndex(),aCommand);
       
   368 				}	
       
   369 			break;
       
   370 			}
       
   371 
       
   372 		//Activate settings view.
       
   373 		case ESettingsCmd:
       
   374 			{
       
   375 			iUi->ActivateLocalViewL(KIRSettingsViewId);
       
   376 			}
       
   377 		break;
       
   378 		case EAddStationManuallyCmd:
       
   379 			{
       
   380 			if ( !iUi->CheckAndNotifyLowDiskSpaceL() )
       
   381 				{
       
   382 				iUi->SetEditStation(EFalse);
       
   383 				iUi->ActivateLocalViewL(KIRAddManuallyStationViewID);
       
   384 				}
       
   385 			}
       
   386 		break;
       
   387 
       
   388 		case EAdvertisementUrl:
       
   389 			{
       
   390 			if ( iUi->CheckAndNotifyLowDiskSpaceL() )
       
   391 				{
       
   392 				break;
       
   393 				}
       
   394 			else if( iUi->VerifyNetworkConnectivityL() )
       
   395 				{
       
   396 				break;
       
   397 				}
       
   398 				if(iUi->iIsdsWrapper->iClickThroughUrl)
       
   399 					{
       
   400 					if(iUi->iIsdsWrapper->iClickThroughUrl->Length() != 0)
       
   401 						{
       
   402 						iContainer->OpenUrlL(*iUi->iIsdsWrapper->iClickThroughUrl);
       
   403 						}
       
   404 					}
       
   405 			else
       
   406 				{
       
   407 				iUi->iIsdsWrapper->GetDialogLauncherInstance()->ShowErrorNoteL
       
   408 					(R_IRAPP_ERROR_URL_UNAVAILABLE,ETrue);
       
   409 				}
       
   410 
       
   411 			}
       
   412 		break;
       
   413 
       
   414 		case EHelpCmd:
       
   415 			{
       
   416 			if ( !iUi->CheckAndNotifyLowDiskSpaceL() )
       
   417 				{
       
   418 				HlpLauncher::LaunchHelpApplicationL( iEikonEnv->WsSession(), AppUi()->AppHelpContextL() );
       
   419 				}
       
   420 			break;
       
   421 			}
       
   422 		case EAknSoftkeyBack:
       
   423         	{
       
   424  			CIRViewStack& viewStack = iUi->ViewStack();
       
   425 
       
   426 			if((iUi->IsFirstTime()))
       
   427 				{
       
   428 				CIRBaseView::HandleCommandL( aCommand );
       
   429 				}
       
   430 			else
       
   431 				{
       
   432 				if(viewStack.Count() == 2 )
       
   433 					{
       
   434 					TUid topView = viewStack.Pop();
       
   435 					if(viewStack.Peek()==KIRMainChoiceViewID)
       
   436 						{
       
   437 						viewStack.PushL(topView);
       
   438 						CIRBaseView::HandleCommandL( aCommand );
       
   439 						}
       
   440 					else
       
   441 						{
       
   442 						viewStack.Pop();
       
   443 						iUi->ActivateLocalViewL(KIRMainChoiceViewID);
       
   444 						}
       
   445 					}
       
   446 				else
       
   447 					{
       
   448 					viewStack.Pop();
       
   449 					iUi->ActivateLocalViewL(KIRMainChoiceViewID);
       
   450 					}
       
   451 				}
       
   452     		}
       
   453      	break;
       
   454 		default:
       
   455 			{
       
   456 			CIRBaseView::HandleCommandL( aCommand );
       
   457 			}
       
   458 		}
       
   459 	IRLOG_DEBUG( "CIRSearchResultsView::HandleCommandL - Exiting" );
       
   460 	}
       
   461 // ---------------------------------------------------------------------------
       
   462 // CIRSearchResultsView::GetActualIndex().
       
   463 // Returns the actual index.
       
   464 // ---------------------------------------------------------------------------
       
   465 //
       
   466 TInt CIRSearchResultsView::GetActualIndex()
       
   467     {
       
   468     TInt currentIndex = iContainer->GetCurrentItemIndex();
       
   469 	SetCurrentFocus(currentIndex);
       
   470 	TBuf<KFindStringLength> findstring ;
       
   471    if(iContainer->GetSearchBoxPointer())
       
   472 	   {
       
   473     	findstring = iContainer->GetFindString();
       
   474     	iContainer->GetSearchBoxPointer()->GetSearchText(findstring);
       
   475 	   }
       
   476 	if(iContainer->GetSearchBoxPointer() && findstring.Length()!=0)
       
   477 		{
       
   478 		iFilteredIndex = currentIndex;
       
   479 		iContainer->Comparestrings();
       
   480 		currentIndex = iIndex;
       
   481 		}
       
   482 	if(iContainer->GetLogoNotSupported())
       
   483 		{
       
   484 		currentIndex = 	currentIndex +1;
       
   485 		}
       
   486 	return currentIndex;
       
   487     }
       
   488 
       
   489 // ---------------------------------------------------------------------------
       
   490 // From class CAknView.
       
   491 // Event handler for status pane size changes.
       
   492 // ---------------------------------------------------------------------------
       
   493 //
       
   494 void CIRSearchResultsView::HandleStatusPaneSizeChange()
       
   495     {
       
   496     IRLOG_DEBUG( "CIRSearchResultsView::HandleStatusPaneSizeChange - Entering" );
       
   497     
       
   498     // the client rect is also set here after screen orientation change
       
   499     if ( iContainer )
       
   500         {
       
   501         iContainer->SetRect( ClientRect() );
       
   502        }
       
   503     IRLOG_DEBUG( "CIRSearchResultsView::HandleStatusPaneSizeChange - Exiting" );
       
   504     }
       
   505 
       
   506 // ---------------------------------------------------------------------------
       
   507 // void CIRSearchResultsView::SetStatusPaneTextL()
       
   508 // Sets the title pane of the search results view
       
   509 // ---------------------------------------------------------------------------
       
   510 //
       
   511 
       
   512 void CIRSearchResultsView:: SetStatusPaneTextL()
       
   513 	{
       
   514 	IRLOG_DEBUG( "CIRSearchResultsView::SetStatusPaneTextL - Entering" );
       
   515 	TInt number = iIsdsWrapper->iStationsData->MdcaCount();
       
   516 	HBufC* stringholder = NULL;
       
   517 
       
   518 	CDesCArray* array = new (ELeave) CDesCArrayFlat(1);
       
   519 	CleanupStack::PushL( array );
       
   520 	array->AppendL( iUi->iSearchString); //First string
       
   521 
       
   522 	MDesCArray* list = STATIC_CAST(MDesCArray*,array);
       
   523 
       
   524 	CArrayFix<TInt>* presetCounts = new (ELeave) CArrayFixFlat<TInt>( 2 );
       
   525 	CleanupStack::PushL( presetCounts );
       
   526 	presetCounts->AppendL( number );
       
   527 
       
   528 	if(1 == number)
       
   529 		{
       
   530 		stringholder = StringLoader::LoadLC( R_IRAPP_SEARCHRESULT_TITLETEXT,*list,
       
   531 											 *presetCounts, iEikonEnv );
       
   532 		}
       
   533 	else
       
   534 		{
       
   535 		stringholder = StringLoader::LoadLC( R_IRAPP_SEARCHRESULTS_TITLETEXT,*list,
       
   536 											 *presetCounts, iEikonEnv );
       
   537 		}
       
   538 	static_cast<CAknTitlePane*>(StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) )->
       
   539 						SetTextL( *stringholder );
       
   540 						
       
   541 	CleanupStack::PopAndDestroy(stringholder);
       
   542 	CleanupStack::PopAndDestroy( presetCounts );
       
   543 
       
   544 	// Pop and delete strings array
       
   545 	CleanupStack::PopAndDestroy();
       
   546 	IRLOG_DEBUG( "CIRSearchResultsView::SetStatusPaneTextL - Exiting" );
       
   547 	}
       
   548 
       
   549 // ---------------------------------------------------------------------------
       
   550 // void CIRSearchResultsView::DynInitMenuPaneL()
       
   551 // Dynamically initialises a menu pane
       
   552 // ---------------------------------------------------------------------------
       
   553 //
       
   554 
       
   555 
       
   556 void CIRSearchResultsView::DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane)
       
   557 	{
       
   558 	IRLOG_DEBUG( "CIRSearchResultsView::DynInitMenuPaneL - Entering" );
       
   559 	if(!aMenuPane) User::Leave(KErrNotFound);
       
   560 		{
       
   561 		if(aResourceId == R_IR_MENU_SEARCHRESULTS)
       
   562 			{
       
   563 			// Now Playing option
       
   564 			if(iNowPlayingWrapper->iPlaying)
       
   565 				{
       
   566 				aMenuPane->SetItemDimmed(EGotoNowPlayingViewCmd,EFalse);
       
   567 				}
       
   568 			else
       
   569 				{
       
   570 				aMenuPane->SetItemDimmed(EGotoNowPlayingViewCmd,ETrue);
       
   571 				}
       
   572 			}
       
   573 		}
       
   574 	IRLOG_DEBUG( "CIRSearchResultsView::DynInitMenuPaneL - Exiting" );
       
   575 	}
       
   576 
       
   577 
       
   578 
       
   579 // ---------------------------------------------------------------------------
       
   580 // Touch Toolbar
       
   581 // Dynamically initialises a tool bar
       
   582 // ---------------------------------------------------------------------------
       
   583 
       
   584 void CIRSearchResultsView::ConstructToolbarL()
       
   585 		{
       
   586 		IRLOG_DEBUG( "CIRSearchResultsView::ConstructToolbarL - Entering" );
       
   587 		SetToolbarItems();
       
   588 
       
   589 		// Update rect, as changes in toolbar visibility also affect layout.
       
   590 		if(iContainer)
       
   591 			{
       
   592 			iContainer->SetRect( ClientRect() );
       
   593 			iContainer->DrawDeferred();
       
   594 			}
       
   595 			
       
   596 		IRLOG_DEBUG( "CIRSearchResultsView::ConstructToolbarL - Exiting" );
       
   597         }
       
   598 
       
   599 
       
   600 // --------------------------------------------------------------------------
       
   601 // CIRSearchResultsView::OfferToolbarEventL
       
   602 // --------------------------------------------------------------------------
       
   603 //
       
   604 void CIRSearchResultsView::OfferToolbarEventL ( TInt aCommand )
       
   605   	{
       
   606   	IRLOG_DEBUG( "CIRSearchResultsView::OfferToolbarEventL - Entering" );
       
   607     HandleCommandL(aCommand);
       
   608     IRLOG_DEBUG( "CIRSearchResultsView::OfferToolbarEventL - Exiting" );
       
   609   	}
       
   610 
       
   611 // ---------------------------------------------------------------------------
       
   612 // From class CAknView.
       
   613 // Foreground event handling function.
       
   614 // ---------------------------------------------------------------------------
       
   615 //
       
   616 void CIRSearchResultsView::HandleForegroundEventL( TBool aForeground )
       
   617     {
       
   618     IRLOG_DEBUG( "CIRSearchResultsView::HandleForegroundEventL - Entering" );
       
   619 	CIRBaseView::HandleForegroundEventL( aForeground );
       
   620 	if ( aForeground )
       
   621 		{
       
   622 		if ( iContainer )
       
   623 			{
       
   624 			MAknsSkinInstance * skin=AknsUtils::SkinInstance () ;
       
   625 			TRgb color;
       
   626 			TInt skinColor=AknsUtils::GetCachedColor(skin, color, KAknsIIDQsnTextColors,
       
   627 							                                      EAknsCIQsnTextColorsCG6 );
       
   628 			if(color.Gray2()!=0)
       
   629 				{
       
   630 				CreateAndSetToolbarL(R_IR_SEARCHRESULTS_WHITE_TOOLBAR);
       
   631 				}
       
   632 			else
       
   633 				{
       
   634 				CreateAndSetToolbarL(R_IR_SEARCHRESULTS_BLACK_TOOLBAR);	
       
   635 				}
       
   636 			if( AknLayoutUtils::PenEnabled() && Toolbar() )
       
   637 				{
       
   638 				Toolbar()->SetToolbarObserver( this );
       
   639 				}
       
   640 			ConstructToolbarL();
       
   641 			iContainer->DrawDeferred();
       
   642 			}
       
   643 		}
       
   644 	IRLOG_DEBUG( "CIRSearchResultsView::HandleForegroundEventL - Exiting" );
       
   645     }
       
   646 
       
   647 // ---------------------------------------------------------------------------
       
   648 // CIRSearchResultsView::AddToFavouritesL()
       
   649 // Adds the selected channel to favorites
       
   650 // ---------------------------------------------------------------------------
       
   651 //
       
   652 void CIRSearchResultsView::AddToFavouritesL(TInt aCurrentIndex,TInt aCommand)
       
   653 	{
       
   654 	IRLOG_DEBUG( "CIRSearchResultsView::AddToFavouritesL - Entering" );
       
   655 	//request isds for preset data to be added to favorites
       
   656 	iIsdsWrapper->IsdsPresetRequestL(this,aCurrentIndex,aCommand);
       
   657 	IRLOG_DEBUG( "CIRSearchResultsView::AddToFavouritesL - Exiting" );
       
   658 	}
       
   659 // ---------------------------------------------------------------------------
       
   660 // void CIRSearchResultsView::ResponseL()
       
   661 // Activates the Stations view after getting the IsdsResponse
       
   662 // ---------------------------------------------------------------------------
       
   663 //
       
   664 void CIRSearchResultsView::ResponseL(CIRIsdsPreset* /*aPreset*/)
       
   665 	{
       
   666     IRLOG_DEBUG( "CIRSearchResultsView::ResponseL() started." );
       
   667     ResetPendingRequests(EFalse);
       
   668 	if(iIsdsWrapper->iStationsData->Count())
       
   669 		{
       
   670 		if(iIsSearchAgain)
       
   671 			{
       
   672 			iIsSearchAgain = EFalse;
       
   673 			if(iContainer)
       
   674 				{
       
   675 		        AppUi()->RemoveFromViewStack( *this, iContainer );
       
   676 		        iContainer->MakeVisible( EFalse );
       
   677 		        delete iContainer;
       
   678 		        iContainer = NULL;
       
   679 				}
       
   680 	   		SetCurrentFocus(0);
       
   681 			SetCurrentTopItem(0);
       
   682 		    iContainer = CIRSearchResultsViewContainer::NewL(ClientRect(),*this);
       
   683 		    iContainer->CreateListBoxL();
       
   684 		    iContainer->ActivateL();
       
   685 		    iContainer->MakeVisible( ETrue );
       
   686 		    AppUi()->AddToViewStackL( *this, iContainer);
       
   687 		    SetStatusPaneTextL();
       
   688 	 		}
       
   689 		}
       
   690 	else
       
   691 		{
       
   692 		iIsdsWrapper->GetDialogLauncherInstance()->ShowInformationNoteL( R_IRAPP_RESULTS_NONE,ETrue );
       
   693 		iIsdsWrapper->iError = EFalse;
       
   694 		}
       
   695 	IRLOG_DEBUG( "CIRSearchResultsView::ResponseL() exiting." );
       
   696 	}
       
   697 
       
   698 // ---------------------------------------------------------------------------
       
   699 // void CIRSearchResultsView::PresetResponseL()
       
   700 // Called when Preset Data is received
       
   701 // Used to Listen to a channel with given preset.
       
   702 // ---------------------------------------------------------------------------
       
   703 //
       
   704 void CIRSearchResultsView::PresetResponseL(CIRIsdsPreset* aPreset)
       
   705 	{
       
   706 	IRLOG_DEBUG( "CIRSearchResultsView::PresetResponseL - Entering" );
       
   707 	ResetPendingRequests(EFalse);
       
   708 	if ( !iUi->CheckAndNotifyLowDiskSpaceL() )
       
   709 	if(!iNowPlayingWrapper->GetWhenUserCancelsIsdsBufferingWaitBar())
       
   710 		{
       
   711 		iNowPlayingWrapper->SetListenFromIsdsValue(ETrue);
       
   712 		iNowPlayingWrapper->ListenToChannelL(aPreset);
       
   713 		}
       
   714 	IRLOG_DEBUG( "CIRSearchResultsView::PresetResponseL - Exiting" );
       
   715 	}
       
   716 
       
   717 // ---------------------------------------------------------------------------
       
   718 // void CIRSearchResultsView::ErrorL()
       
   719 // Handles error Conditions
       
   720 // ---------------------------------------------------------------------------
       
   721 //
       
   722 void CIRSearchResultsView::ErrorL()
       
   723 	{
       
   724 	IRLOG_DEBUG( "CIRSearchResultsView::ErrorL - Entering" );
       
   725 	if(iIsdsWrapper->iDialogDismissed)
       
   726 		{
       
   727 		iIsdsWrapper->iDialogDismissed=EFalse;
       
   728 		return;
       
   729 		}
       
   730 	if(iIsdsWrapper->GetListenRequest())
       
   731 		{
       
   732 		iUi->GetPubSubManagerInstance()->PublishBufferingState(EIRStateBufferingError);
       
   733 		iNowPlayingWrapper->DestroyWaitDialogL();
       
   734 		iIsdsWrapper->SetListenRequest(EFalse);
       
   735 		}
       
   736 
       
   737 	if(iIsdsWrapper->iConnTimeOut)
       
   738 		{
       
   739 		iIsdsWrapper->iConnTimeOut = EFalse;
       
   740 		}
       
   741 	 if(iIsdsWrapper->iError)
       
   742 		{
       
   743 		if(iIsdsWrapper->GetDialogLauncherInstance())
       
   744 			{
       
   745 			iIsdsWrapper->GetDialogLauncherInstance()->ShowInformationNoteL( R_IRAPP_RESULTS_NONE,ETrue );
       
   746 			iIsdsWrapper->iError = EFalse;
       
   747 			}
       
   748 		}
       
   749 	IRLOG_DEBUG( "CIRSearchResultsView::ErrorL - Exiting" );
       
   750 	}
       
   751 
       
   752 // ---------------------------------------------------------------------------
       
   753 // void CIRSearchResultsView::ListenChannelL()
       
   754 // Request for listening to a channel
       
   755 // ---------------------------------------------------------------------------
       
   756 //
       
   757 
       
   758 void CIRSearchResultsView:: ListenChannelL(TInt aCurrentIndex)
       
   759  	{
       
   760 	IRLOG_DEBUG( "CIRSearchResultsView::ListenChannelL - Entering" );
       
   761  	iNowPlayingWrapper->SetView(ESearch);
       
   762  	iNowPlayingWrapper->SetWhenUserCancelsBufferingWaitBar(EFalse);
       
   763  	iNowPlayingWrapper->SetListenFromIsdsValue(EFalse);
       
   764  	iNowPlayingWrapper->SetWhenUserCancelsIsdsBufferingWaitBar(EFalse);
       
   765  	iNowPlayingWrapper->CreateWaitDialogL();
       
   766 	iUi->GetPubSubManagerInstance()->PublishBufferingState(EIRStateBufferingStart);
       
   767 
       
   768 	iIsdsWrapper->IsdsListenRequestL(this,aCurrentIndex);
       
   769 	IRLOG_DEBUG( "CIRSearchResultsView::ListenChannelL - Exiting" );
       
   770 	}
       
   771 
       
   772 
       
   773 void CIRSearchResultsView::ShowQueryDialogL(const TDesC& aTitle, TDes& aBuffer)
       
   774 	{
       
   775 	IRLOG_DEBUG( "CIRSearchResultsView::ShowQueryDialogL - Entering" );
       
   776 	CAknTextQueryDialog* Dialog =
       
   777 	CAknTextQueryDialog::NewL(aBuffer,CAknQueryDialog::ENoTone);
       
   778 	Dialog->PrepareLC(R_SEARCH_STRING_DIALOG);
       
   779 	Dialog->SetPromptL(aTitle);
       
   780 	//return Dialog->RunLD()
       
   781 	iSearchValue = Dialog->RunLD();
       
   782 
       
   783 	//Display a searching Progress Bar
       
   784 
       
   785 	if(	iSearchValue)
       
   786 		{
       
   787 		iUi->iSearchString = aBuffer;
       
   788 		if( iUi->VerifyNetworkConnectivityL() )
       
   789 			{
       
   790 			iRequestPending = ETrue;
       
   791 			}
       
   792 		else
       
   793 			{
       
   794 			iIsdsWrapper->IsdsSearchRequestL(this,aBuffer);
       
   795 			}
       
   796 		}
       
   797 	IRLOG_DEBUG( "CIRSearchResultsView::ShowQueryDialogL - Exiting" );
       
   798 	}
       
   799 
       
   800 // ---------------------------------------------------------------------------
       
   801 // CIRSearchResultsView::LogoRequestL()
       
   802 // called from the container
       
   803 // ---------------------------------------------------------------------------
       
   804 //
       
   805 void CIRSearchResultsView::LogoRequestL()
       
   806 	{
       
   807 	IRLOG_DEBUG( "CIRSearchResultsView::LogoRequestL - Entering" );
       
   808 	if(iContainer)
       
   809 		{
       
   810 		iUi->iIsdsWrapper->GetISDSInstance()->GetDataProvider()->GetHttpDataProvider()->
       
   811 		GetLogoDownloadEngine()->SendRequestL(iContainer->GetTempPreset(),this,
       
   812 									KLogosReqFrom,KLogosSize,KLogosSize);
       
   813 		}
       
   814 	IRLOG_DEBUG( "CIRSearchResultsView::LogoRequestL - Exiting" );
       
   815 	}
       
   816 
       
   817 
       
   818 
       
   819 // ---------------------------------------------------------------------------
       
   820 // CIRSearchResultsView::PresetLogoDownloadedL()
       
   821 // from base class MLogoDownloadObserver
       
   822 // ---------------------------------------------------------------------------
       
   823 //
       
   824 void CIRSearchResultsView::PresetLogoDownloadedL(CIRIsdsPreset* aPreset)
       
   825 	{
       
   826 	IRLOG_DEBUG( "CIRSearchResultsView::PresetLogoDownloadedL - Entering" );
       
   827 	if(iContainer)
       
   828 		{
       
   829 		iContainer->PresetLogoDownloadL(aPreset);
       
   830 		}
       
   831 	IRLOG_DEBUG( "CIRSearchResultsView::PresetLogoDownloadedL - Exiting" );
       
   832 	}
       
   833 
       
   834 
       
   835 // ---------------------------------------------------------------------------
       
   836 // CIRSearchResultsView::PresetLogoDownloadError()
       
   837 // from base class MLogoDownloadObserver
       
   838 // ---------------------------------------------------------------------------
       
   839 //
       
   840 void CIRSearchResultsView::PresetLogoDownloadError(CIRIsdsPreset* /*aPreset*/)
       
   841 	{
       
   842 	IRLOG_DEBUG( "CIRSearchResultsView::PresetLogoDownloadError " );
       
   843 	//call the API of search results view container
       
   844 	if(iContainer)
       
   845 		{
       
   846 		TRAP_IGNORE(iContainer->HandleLogoErrorL());
       
   847 		}
       
   848 	IRLOG_DEBUG( "CIRSearchResultsView::PresetLogoDownloadErrorL - Exiting" );
       
   849 	}
       
   850 
       
   851 
       
   852 void CIRSearchResultsView::AdRequestL()
       
   853 	{
       
   854 	IRLOG_DEBUG( "CIRSearchResultsView::AdRequestL - Entering" );
       
   855 	if(iContainer)
       
   856 		{
       
   857 		iUi->iIsdsWrapper->GetISDSInstance()->GetDataProvider()->GetHttpDataProvider()->
       
   858 		GetLogoDownloadEngine()->SendRequestL(iContainer->GetAdvPreset(),this);
       
   859 		}
       
   860 
       
   861 	IRLOG_DEBUG( "CIRSearchResultsView::AdRequestL - Exiting" );
       
   862 	}
       
   863 // ---------------------------------------------------------
       
   864 // CIRSearchResultsView::SetActualFilteredItemIndex ()
       
   865 // Sets the listen is from favourites or not
       
   866 // ---------------------------------------------------------
       
   867 //
       
   868 void CIRSearchResultsView::SetActualFilteredItemIndex(TInt aIndex)
       
   869 	{
       
   870 	IRLOG_DEBUG( "CIRSearchResultsView::SetListBoxMarkedCount - Entering." );
       
   871 	iIndex = aIndex;
       
   872 	IRLOG_DEBUG( "CIRSearchResultsView::SetListBoxMarkedCount - Exiting." );
       
   873 	}
       
   874 
       
   875 // ---------------------------------------------------------
       
   876 // CIRSearchResultsView::GetFilteredIndex ()
       
   877 // returns the iFilteredIndex
       
   878 // ---------------------------------------------------------
       
   879 //
       
   880 TInt CIRSearchResultsView::GetFilteredIndex()
       
   881 	{
       
   882 	IRLOG_DEBUG( "CIRSearchResultsView::GetFilteredIndex - Entering." );
       
   883 	IRLOG_DEBUG( "CIRSearchResultsView::GetFilteredIndex - Exiting." );
       
   884 	return iFilteredIndex;
       
   885 	}
       
   886 // ---------------------------------------------------------
       
   887 // CIRSearchResultsView::GetFirstLaunchFlag ()
       
   888 // returns whether is launching for the first time /coming from other view
       
   889 // which is activated from this view.
       
   890 // ---------------------------------------------------------
       
   891 //
       
   892 TBool CIRSearchResultsView::GetFirstLaunchFlag()
       
   893 	{
       
   894 	IRLOG_DEBUG( "CIRSearchResultsView::GetFirstLaunchFlag - Entering." );
       
   895 	IRLOG_DEBUG( "CIRSearchResultsView::GetFirstLaunchFlag - Exiting." );
       
   896 	return iFirstTimeLaunchFlag;
       
   897 	}
       
   898 // ---------------------------------------------------------------------------
       
   899 // void CIRSearchResultsView::SetToolbarItems()
       
   900 // Setting toolbar items when text is entered
       
   901 //  ---------------------------------------------------------------------------
       
   902 void CIRSearchResultsView:: SetToolbarItems()
       
   903 	{
       
   904 	IRLOG_DEBUG( "CIRSearchResultsView::SetToolbarItems - Entering" );
       
   905 	if(Toolbar())
       
   906 		{
       
   907 		if(iContainer)
       
   908 			{
       
   909 			Toolbar()->SetToolbarVisibility(ETrue, EFalse);
       
   910 			if(iContainer->GetSearchBoxPointer())
       
   911 				{
       
   912 				TInt currentIndex = iContainer->GetCurrentItemIndex();
       
   913 				TBuf<KFindStringLength> findstring ;
       
   914 				if(iContainer->GetSearchBoxPointer())
       
   915 					{
       
   916 					iContainer->GetSearchBoxPointer()->GetSearchText(findstring);
       
   917 					}
       
   918 				TInt filterModelCount = iContainer->GetFilterdModelPointer()->NumberOfItems();	
       
   919 				if(iContainer->GetSearchBoxPointer() && findstring.Length()!=0 
       
   920 				&& filterModelCount == 0)
       
   921 					{
       
   922 					Toolbar()->SetItemDimmed(EAddtoFavouritesCmd,ETrue,ETrue);
       
   923 					Toolbar()->SetItemDimmed(EListenCmd,ETrue,ETrue);
       
   924 					Toolbar()->SetItemDimmed(EAddStationManuallyCmd,ETrue,ETrue);
       
   925 					}
       
   926 				else
       
   927 					{
       
   928 					if (currentIndex == 0 && !iContainer->GetLogoNotSupported())  
       
   929 						{
       
   930 						if (iUi->iIsdsWrapper->GetBannerUrl())
       
   931 							{
       
   932 							Toolbar()->SetItemDimmed(EAddtoFavouritesCmd,ETrue,ETrue);
       
   933 							Toolbar()->SetItemDimmed(EListenCmd,ETrue,ETrue);
       
   934 							Toolbar()->SetItemDimmed(EAddStationManuallyCmd,ETrue,ETrue);
       
   935 							}
       
   936 						else
       
   937 							{
       
   938 							Toolbar()->SetItemDimmed(EAddtoFavouritesCmd,EFalse,ETrue);
       
   939 							Toolbar()->SetItemDimmed(EListenCmd,EFalse,ETrue);
       
   940 							Toolbar()->SetItemDimmed(EAddStationManuallyCmd,EFalse,ETrue);
       
   941 							}
       
   942 						}
       
   943 					else
       
   944 						{
       
   945 						Toolbar()->SetItemDimmed(EAddtoFavouritesCmd,EFalse,ETrue);
       
   946 						Toolbar()->SetItemDimmed(EListenCmd,EFalse,ETrue);
       
   947 						Toolbar()->SetItemDimmed(EAddStationManuallyCmd,EFalse,ETrue);
       
   948 						}
       
   949 					}
       
   950 				}
       
   951 			Toolbar()->DrawDeferred();	
       
   952 			}
       
   953 		}
       
   954 	IRLOG_DEBUG( "CIRSearchResultsView::SetToolbarItems - Exiting" );
       
   955 	}
       
   956 
       
   957 
       
   958 // ---------------------------------------------------------------------------
       
   959 //Notifies all observers whose network request is active
       
   960 // to reissue the request  
       
   961 //NotifyActiveNetworkObserversL()
       
   962 // ---------------------------------------------------------------------------
       
   963 
       
   964 void CIRSearchResultsView::NotifyActiveNetworkObserversL(TIRNetworkEvent aEvent)
       
   965 	{
       
   966 	IRLOG_DEBUG( "CIRSearchResultsView::NotifyActiveNetworkObserversL  - Entering." );
       
   967 	IRRDEBUG2("CIRSearchResultsView::NotifyActiveNetworkObserversL entering ", KNullDesC);
       
   968 
       
   969 	switch(aEvent)
       
   970 		{
       
   971 		case ENetworkConnectionDisconnected:
       
   972 			{
       
   973 			iNowPlayingWrapper->HandleNetworkDisconnected();
       
   974 			}
       
   975 			break;
       
   976 		case ENetworkConnectionEstablished:
       
   977 			{
       
   978 			if( !iUi->CheckAndNotifyLowDiskSpaceL() && iContainer)
       
   979 				{
       
   980 				if(iRequestPending || iUi->iNetworkController->IsHandingOverConnection())
       
   981 					{
       
   982 					if(iAddToFav)
       
   983 						{
       
   984 						iAddToFav = ETrue;
       
   985 						AddToFavouritesL(GetActualIndex(),EAddtoFavouritesCmd);
       
   986 						}
       
   987 					else if(iListenRequest)
       
   988 						{
       
   989 						iListenRequest=EFalse;
       
   990 						ListenChannelL(GetActualIndex());
       
   991 						}
       
   992 					else if(iSearchValue)
       
   993 						{
       
   994 						iSearchValue=ETrue;
       
   995 						iIsdsWrapper->IsdsSearchRequestL(this,iUi->iSearchString);
       
   996 						}
       
   997 					else
       
   998 						{
       
   999 							
       
  1000 						}
       
  1001 					}
       
  1002 				if(iUi->iNetworkController->IsHandingOverConnection())
       
  1003 					{
       
  1004 					ResetPendingRequests(EFalse);			
       
  1005 					}
       
  1006 
       
  1007 				}
       
  1008 			}
       
  1009 		}
       
  1010    	
       
  1011 	IRRDEBUG2("CIRSearchResultsView::NotifyActiveNetworkObserversL exiting ", KNullDesC);
       
  1012 		
       
  1013 	IRLOG_DEBUG( "CIRSearchResultsView::NotifyActiveNetworkObserversL  - Exiting." );
       
  1014 	}
       
  1015 	
       
  1016 	
       
  1017 	
       
  1018 // -----------------------------------------------------------------------------
       
  1019 // Notified by network controller when user cancels network connection, to reset 
       
  1020 // the pending requests  
       
  1021 // ResetPendingRequests()
       
  1022 // -----------------------------------------------------------------------------
       
  1023 void CIRSearchResultsView::ResetPendingRequests(TBool aValue)
       
  1024 	{
       
  1025 	iRequestPending = aValue;
       
  1026 	iListenRequest  = aValue;
       
  1027 	iAddToFav = aValue;	
       
  1028 	iSearchValue = aValue;	
       
  1029 	}
       
  1030 	
       
  1031 // ---------------------------------------------------------
       
  1032 // CIRSearchResultsView::HandleSystemEventL
       
  1033 // from base class MIRSystemEventObserver
       
  1034 // ---------------------------------------------------------
       
  1035 //
       
  1036 void CIRSearchResultsView::HandleSystemEventL(TIRSystemEventType aEventType)
       
  1037 	{
       
  1038 	IRLOG_DEBUG(" CIRSearchResultsView::HandleSystemEventL - Entering");
       
  1039 	
       
  1040 
       
  1041 	switch (aEventType)
       
  1042 		{
       
  1043 		case EIRCallActivated:
       
  1044 			{
       
  1045 			if( iUi->GetNetworkControllerInstance()->IdentifyConnectionType() != EWiFi )
       
  1046 				{
       
  1047 				if(iUi->iIsdsWrapper->iIsdsWaitDialog)
       
  1048 					{
       
  1049 					TRAP_IGNORE( iUi->iIsdsWrapper->DestroyWaitDialogL() );
       
  1050 					}
       
  1051 				if((!iCallRequestPending && iCommand==ESearchCmd) ||
       
  1052 				  (!iCallRequestPending && iCommand==EAddtoFavouritesCmd))
       
  1053 					{
       
  1054 					iUi->iIsdsWrapper->IsdsCancelRequest();
       
  1055 					iCallRequestPending = ETrue;
       
  1056 					}
       
  1057 				if(iUi->iIsdsWrapper->GetListenRequest())
       
  1058 					{
       
  1059 					iNowPlayingWrapper->DestroyWaitDialogL();
       
  1060 					iUi->iIsdsWrapper->SetListenRequest(EFalse);
       
  1061 					iUi->iIsdsWrapper->IsdsCancelRequest();
       
  1062 					}
       
  1063 				}
       
  1064 			break;
       
  1065 			}
       
  1066 		case EIRCallDeactivated:
       
  1067 			{
       
  1068 			if(iCallRequestPending && iCommand==ESearchCmd)
       
  1069 				{
       
  1070 				iCallRequestPending = EFalse;
       
  1071 				if(iSearchValue)
       
  1072 					{	
       
  1073 					iIsdsWrapper->IsdsSearchRequestL(this,iUi->iSearchString);
       
  1074 					}
       
  1075 				}
       
  1076 			 else if(iCallRequestPending && iCommand==EAddtoFavouritesCmd)
       
  1077 				{
       
  1078 				iCallRequestPending = EFalse;
       
  1079 				HandleCommandL( iCommand );
       
  1080 				}
       
  1081 			break;
       
  1082 			}
       
  1083 		default:
       
  1084 			{
       
  1085 			break;
       
  1086 			}
       
  1087 		}
       
  1088 	IRLOG_DEBUG( "CIRSearchResultsView::HandleSystemEventL - Exiting." );
       
  1089 	}