internetradio2.0/uisrc/irnowplayingview.cpp
changeset 0 09774dfdd46b
equal deleted inserted replaced
-1:000000000000 0:09774dfdd46b
       
     1 /*
       
     2 * Copyright (c)  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 
       
    19 /* ---------------------------------------------------------------------------
       
    20 *  Version history:
       
    21 *  Template version:
       
    22 *  <ccm_history>
       
    23 *
       
    24 *  Version: 18, Tue Mar 19 18:00:00 2008 by Rohit
       
    25 *  Ref:
       
    26 *  Implemented change request to display Byte Counter in KB till 0.1 MB, and in MB threrafter
       
    27 *
       
    28 *  </ccm_history>
       
    29 * ============================================================================
       
    30 */
       
    31 
       
    32 // INCLUDE FILES
       
    33 
       
    34 
       
    35 #include <aknviewappui.h>
       
    36 #include <alf/alfcontrolgroup.h>
       
    37 #include <alf/alfdisplay.h>
       
    38 #include <alf/alfenv.h>
       
    39 #include <alf/alfroster.h>
       
    40 #include <eikmenup.h>
       
    41 #include <eiklabel.h>
       
    42 #include <avkon.rsg>
       
    43 #include <aknnotewrappers.h>
       
    44 #include <internetradio.rsg>
       
    45 #include <data_caging_paths_strings.hrh>
       
    46 #include <mdaaudiosampleplayer.h>
       
    47 #include <stereowideningbase.h>
       
    48 #include <f32file.h> // for File operations
       
    49 #include <s32file.h> // for File operations
       
    50 #include <akntoolbar.h>
       
    51 #include <akntouchpane.h>
       
    52 #include <aknbutton.h>
       
    53 #include <eikcolib.h>
       
    54 /* no need to change to lower case */
       
    55 #include <AknsConstants.h>
       
    56 #include <hlplch.h>
       
    57 #ifdef MUSICSHOP_AVAILABLE
       
    58 #include <mpxfindinmusicshop.h> //For Find in Shop
       
    59 #include <mpxmusicplayerviewplugin.hrh>
       
    60 /* no need to change to lower case */
       
    61 #include <MusicWapCenRepKeys.h>
       
    62 #endif
       
    63 #include <apgcli.h> //For Find in Shop
       
    64 #include <e32des8.h>
       
    65 #include <stringloader.h>
       
    66 #include <internetradio.mbg>
       
    67 #include <aknwaitdialog.h>
       
    68 #include <math.h> 				// floor()
       
    69 
       
    70 #include <mpxviewplugin.h>
       
    71 #include <mpxviewplugin.hrh>
       
    72 
       
    73 
       
    74 #include <featmgr.h>//Fmtransmitter
       
    75 #include <features.hrh>
       
    76 
       
    77 
       
    78 #include "iraap.hlp.hrh"
       
    79 
       
    80 #include "irpubsubkeys.h"
       
    81 #include "irisdspreset.h"
       
    82 #include "irfavoritesdb.h"
       
    83 #include "irisdswrapper.h"
       
    84 #include "irisdspreset.h"
       
    85 #include "mlogodownloadobserver.h"
       
    86 #include "irlogodownloadengine.h"
       
    87 #include "irbaseview.h"
       
    88 #include "irnowplayingviewcontainer.h"
       
    89 #include "irnowplayingview.h"
       
    90 #include "irui.h"
       
    91 #include "ir.hrh"
       
    92 #include "ircommon.h"
       
    93 #include "irdebug.h"
       
    94 #include "irhistory.h"
       
    95 #include "irpreset.h"
       
    96 #include "irmetadata.h"
       
    97 #include "irsettings.h"
       
    98 #include "irstationlogocontrol.h"
       
    99 #include "irstationlogodata.h"
       
   100 #include "pspresetobserver.h"
       
   101 #include "irdataprovider.h"
       
   102 #include "irhttpdataprovider.h"
       
   103 #include "irstationinformationdata.h"
       
   104 #include "irstationinformationdisplay.h"
       
   105 #include "irradioidle.h"
       
   106 #include "irdialoglauncher.h"
       
   107 #include "irmediaclient.h"
       
   108 #include "irnowplayingwrapper.h"
       
   109 #include "irstationinfoview.h"
       
   110 #include "irpubsub.h"
       
   111 
       
   112 
       
   113 #include "irsystemeventcollector.h"
       
   114 #include <remconcoreapitarget.h>
       
   115 #include <remconinterfaceselector.h>
       
   116 #include "irnetworkcontroller.h"
       
   117 #include "msyncpresetobserver.h"	// MSyncPresetObserver
       
   118 
       
   119 _LIT( KIRMifFileName, "\\resource\\apps\\InternetRadio.mif" );
       
   120 
       
   121 const TInt KIRLogoArrayGranularity = 10; // Granularity for logo arrays
       
   122 const TInt KPresetNumbering = 4;//format 1-20.
       
   123 const TInt KOne =1;
       
   124 const TInt KSize =360;
       
   125 const TInt KMinVolume=0;
       
   126 const TInt KMaxVolumeRange=10;
       
   127 const TInt KMaxVolume=10;
       
   128 const TInt KWaitTimeInMicroSeconds = 100000;
       
   129 const TInt KMusicStoreURLSize = 512;
       
   130 
       
   131 // Constants for byte counter display
       
   132 const TInt KIRByteCounterDisplayThreshold1 = 10485760;	// 10 MB
       
   133 const TInt KIRByteCounterDisplayThreshold2 = 104857600;	// 100 MB
       
   134 const TInt KIRMBtoBytesConversion		   = 1048576;	// 1 MB
       
   135 
       
   136 //Literal Declaration
       
   137 _LIT(KConst1,"    ");
       
   138 //_LIT(KHiFn,"-")
       
   139 const TInt KTwo = 2;
       
   140 const TInt KChannelNameSize = 200;
       
   141 const TInt KTen=10;
       
   142 const TInt KHundred=100;
       
   143 const TUid KFmTxAppUid  = { 0x10282BEF };
       
   144 const TInt KDefault=-1;
       
   145 const TInt KDefaultValue=-2;
       
   146 //Static Variable Declaration
       
   147 TBool CIRNowPlayingView::iPlaying;
       
   148 
       
   149 #ifdef __IRA_FEATURE_EQUALIZER
       
   150 const TUint32 KMPXEqualizerViewImplementationId = 0x101FFC77;
       
   151 #endif
       
   152 
       
   153 // ==================== LOCAL FUNCTIONS ====================
       
   154 
       
   155 // ================= MEMBER FUNCTIONS =======================
       
   156 
       
   157 // ---------------------------------------------------------
       
   158 // CIRNowPlayingView::CIRNowPlayingView( CAlfEnv& aAlfEnv )
       
   159 // C++ default constructor can NOT contain any code, that
       
   160 // might leave.
       
   161 // ---------------------------------------------------------
       
   162 //
       
   163 CIRNowPlayingView::CIRNowPlayingView( CAlfEnv& aAlfEnv ):
       
   164 	iAlfEnv( aAlfEnv ), iToolbar(NULL), iStartUp(ETrue)
       
   165 	,iMPXFindInShop(NULL)
       
   166 #ifdef __IRA_FEATURE_EQUALIZER
       
   167 	, iMpxEqualizerViewPlugin(NULL)
       
   168 #endif // __IRA_FEATURE_EQUALIZER
       
   169 	{
       
   170 	IRLOG_DEBUG( "CIRNowPlayingView::CIRNowPlayingView" );
       
   171 	}
       
   172 // ---------------------------------------------------------
       
   173 // CIRNowPlayingView::ConstructL( )
       
   174 // EPOC default constructor can leave.
       
   175 // C++ default constructor can NOT contain any code, that
       
   176 // might leave.
       
   177 // ---------------------------------------------------------
       
   178 void CIRNowPlayingView::ConstructL()
       
   179 	{
       
   180 	IRLOG_DEBUG( "CIRNowPlayingView::ConstructL - Entering" );
       
   181 	CIRBaseView::ConstructL(R_IR_NOWPLAYING_VIEW );
       
   182 	EnableObserverL(EIRSystemEventObserver);
       
   183 	iIRSettings = CIRSettings::OpenL();
       
   184 	iIndex=0;
       
   185 	iRockerIndex=0;
       
   186 	iAlfEnv.AddActionObserverL( this );
       
   187 	iDefaultLogo=EFalse;
       
   188 
       
   189 	//For Find in Shop
       
   190 #ifdef __IRA_FEATURE_EQUALIZER
       
   191     if (FeatureManager::FeatureSupported( KFeatureIdEqualizer))
       
   192 		{
       
   193 #ifdef MUSICSHOP_AVAILABLE
       
   194 		TRAPD(error, iMPXFindInShop = CMPXFindInMShop::NewL());
       
   195 		if (error != KErrNotFound && error != KErrNone)
       
   196 			{
       
   197 			User::Leave(error);
       
   198 			}
       
   199 #endif
       
   200 		TRAPD(eqError, iMpxEqualizerViewPlugin = CMPXViewPlugin::NewL(
       
   201 					   TUid::Uid(KMPXEqualizerViewImplementationId), NULL));
       
   202 		if (eqError != KErrNotFound && eqError != KErrNone)
       
   203 			{
       
   204 			User::Leave(eqError);
       
   205 			}
       
   206 		}
       
   207 #endif // __IRA_FEATURE_EQUALIZER
       
   208 
       
   209     iVolPopup = CAknVolumePopup::NewL(NULL, ETrue);
       
   210     iVolPopup->SetObserver(this);
       
   211     iVolPopup->SetRange(KMinVolume,KMaxVolumeRange);
       
   212  	iVolPopup->SetValue(2);
       
   213 
       
   214     iUpdateLastplayed=ETrue;
       
   215     iSameUrl=EFalse;
       
   216     iEaualizerOn=EFalse;
       
   217     iCallActive=EFalse;
       
   218 
       
   219     iRequestPending = EFalse;
       
   220     iStationHasLogo=EFalse;
       
   221     iNextOrPrevRequest=EFalse;
       
   222     iVolumeMute=EFalse;
       
   223     // TO Do: need to check
       
   224     iNowPlayingWrapper->SetFavFocus(-1);
       
   225 	IRLOG_DEBUG( "CIRNowPlayingView::ConstructL - Exiting" );
       
   226 	}
       
   227 // ---------------------------------------------------------------------------
       
   228 // CIRNowPlayingView* CIRNowPlayingView::NewL( CAlfEnv& aEnv )
       
   229 // Two-phased constructor.
       
   230 // ---------------------------------------------------------------------------
       
   231 //
       
   232 CIRNowPlayingView* CIRNowPlayingView::NewL( CAlfEnv& aEnv)
       
   233 	{
       
   234 	IRLOG_DEBUG( "CIRNowPlayingView::NewL" );
       
   235 	CIRNowPlayingView* self = CIRNowPlayingView::NewLC(aEnv);
       
   236 	CleanupStack::Pop(self);
       
   237 	IRLOG_DEBUG( "CIRNowPlayingView::NewL - Exiting." );
       
   238 	return self;
       
   239 	}
       
   240 
       
   241 // ---------------------------------------------------------
       
   242 // CIRNowPlayingView::ConstructL( )
       
   243 // Two-phased constructor.
       
   244 // ---------------------------------------------------------
       
   245 CIRNowPlayingView* CIRNowPlayingView::NewLC( CAlfEnv& aAlfEnv )
       
   246 	{
       
   247 	IRLOG_DEBUG( "CIRNowPlayingView::NewLC - Entering" );
       
   248 	CIRNowPlayingView* self = new (ELeave) CIRNowPlayingView( aAlfEnv );
       
   249 	CleanupStack::PushL(self);
       
   250 	self->ConstructL();
       
   251 	IRLOG_DEBUG( "CIRNowPlayingView::NewLC - Exiting" );
       
   252 	return self;
       
   253 	}
       
   254 // ---------------------------------------------------------
       
   255 // CIRNowPlayingView::ConstructL( )
       
   256 // Destructor
       
   257 // ---------------------------------------------------------
       
   258 CIRNowPlayingView::~CIRNowPlayingView()
       
   259 	{
       
   260 	IRLOG_DEBUG( "CIRNowPlayingView::~CIRNowPlayingView - Entering" );
       
   261 	CAlfEnv* alfEnv = CAlfEnv::Static();
       
   262 	if( alfEnv )
       
   263 		{
       
   264 		alfEnv->PrimaryDisplay().Roster().Hide( alfEnv->ControlGroup( KIRNowPlayingViewID.iUid ) );
       
   265 		alfEnv->DeleteControlGroup( KIRNowPlayingViewID.iUid );
       
   266 		iContainer = NULL;
       
   267 		}
       
   268     if( alfEnv )
       
   269         {
       
   270         iAlfEnv.RemoveActionObserver( this );
       
   271         }
       
   272 	if ( iToolbar )
       
   273 		{
       
   274 		iToolbar->SetToolbarVisibility(EFalse, EFalse);
       
   275 		iToolbar->SetToolbarObserver( NULL );
       
   276 		}
       
   277 	if(iConnectionCleanupTimer)
       
   278 	{
       
   279 	iConnectionCleanupTimer->Cancel();
       
   280 	}
       
   281 	if(iConnectionCleanupTimer)
       
   282 	{
       
   283 	delete iConnectionCleanupTimer;
       
   284 	iConnectionCleanupTimer=NULL;
       
   285 	}
       
   286 	iMetadata.Close();
       
   287 	iBuffer.Close();
       
   288 
       
   289 #ifdef __IRA_FEATURE_EQUALIZER
       
   290 	if (iMpxEqualizerViewPlugin)
       
   291 		{
       
   292 		delete iMpxEqualizerViewPlugin;
       
   293 		iMpxEqualizerViewPlugin = NULL;
       
   294 		}
       
   295 #endif // __IRA_FEATURE_EQUALIZER
       
   296 
       
   297 #ifdef MUSICSHOP_AVAILABLE
       
   298 	if (iMPXFindInShop)
       
   299 		{
       
   300 		delete iMPXFindInShop;
       
   301 		iMPXFindInShop = NULL;
       
   302 		}
       
   303 #endif
       
   304 
       
   305 	if(plsData)
       
   306 		{
       
   307 		delete plsData;
       
   308 
       
   309 		}
       
   310     if(iIRSettings)
       
   311 		{
       
   312 		iIRSettings->Close();
       
   313 		iIRSettings = NULL;
       
   314 		}
       
   315     if(iVolPopup)
       
   316 	    {
       
   317 	    delete iVolPopup;
       
   318 	    iVolPopup=NULL;
       
   319 	    }
       
   320     if(iPrevPreset1)
       
   321 	    {
       
   322 	    delete iPrevPreset1;
       
   323 	    iPrevPreset1=NULL;
       
   324 	    }
       
   325     if(iCurrentPreset)
       
   326 	    {
       
   327 	    delete iCurrentPreset;
       
   328 	    iCurrentPreset=NULL;
       
   329 	    }
       
   330 	IRLOG_DEBUG( "CIRNowPlayingView::~CIRNowPlayingView - Exiting " );
       
   331 	}
       
   332 
       
   333 // ---------------------------------------------------------
       
   334 // CIRNowPlayingView::Id
       
   335 // ---------------------------------------------------------
       
   336 TUid CIRNowPlayingView::Id() const
       
   337 	{
       
   338 	IRLOG_DEBUG( "CIRNowPlayingView::Id" );
       
   339 	return KIRNowPlayingViewID;
       
   340 	}
       
   341 
       
   342 // ---------------------------------------------------------
       
   343 // CIRNowPlayingView::DoActivateL
       
   344 // ---------------------------------------------------------
       
   345 
       
   346 void CIRNowPlayingView::DoActivateL(const TVwsViewId& aPrevViewId, TUid aCustomMessageId,
       
   347 								    const TDesC8& aCustomMessage)
       
   348 	{
       
   349 	//IRLOG_DEBUG( "CIRNowPlayingView::DoActivateL - Entering" )
       
   350 	iFadeStyle=EIRFadeNoFade;
       
   351 	CIRBaseView::DoActivateL( aPrevViewId, aCustomMessageId, aCustomMessage );
       
   352     iAlfEnv.PrimaryDisplay().SetVisibleArea( ClientRect() );
       
   353 	iUpdateLastplayed=ETrue;
       
   354 	iUpdateStationName=ETrue;
       
   355 	iStationHasLogo=EFalse;
       
   356 	iShowBitrate=ETrue;
       
   357 
       
   358 	if(iNowPlayingWrapper->GetView()==ESearch||iNowPlayingWrapper->GetView()==EStations||
       
   359 	   iNowPlayingWrapper->GetView()==EBrowseByTopStations )
       
   360 		{
       
   361 		iStationsData=iIsdsWrapper->GetStationsData();
       
   362 		if(iStationsData->Count()==1)
       
   363 			{
       
   364 			iShowToolBar=EFalse;
       
   365 			}
       
   366 		else
       
   367 			{
       
   368 			iShowToolBar=ETrue;
       
   369 			}
       
   370 		}
       
   371 	else if(iNowPlayingWrapper->GetView()==EFav)
       
   372 		{
       
   373 		TInt presetCount=iUi->iFavPresets->iFavPresetList.Count();
       
   374 		if(presetCount==1||presetCount==0)
       
   375 			{
       
   376 			iShowToolBar=EFalse;
       
   377 			}
       
   378 		else
       
   379 			{
       
   380 			iShowToolBar=ETrue;
       
   381 			}
       
   382 		if(presetCount >= 1)
       
   383 			{
       
   384 			//fovorities list is not empty
       
   385 			TInt index = iUi->iFavPresets->SearchPreset(iNowPlayingWrapper->iNowPlayingPreset->
       
   386 						   GetId(),iNowPlayingWrapper->
       
   387 						   iNowPlayingPreset->UniqId());
       
   388 			if (index != KErrNotFound )
       
   389 				{
       
   390 				iNowPlayingWrapper->SetFavFocus(index+1) ;
       
   391 				}
       
   392 			else
       
   393 				{
       
   394 				iNowPlayingWrapper->SetFavFocus(-1) ;
       
   395 				}
       
   396 
       
   397 			}
       
   398 		}
       
   399 	else if(iNowPlayingWrapper->GetView()==ELastplayed||
       
   400 			iNowPlayingWrapper->GetView()==EHistoryView)
       
   401 		{
       
   402 		iShowToolBar=EFalse;
       
   403 		}
       
   404 	  else if(iNowPlayingWrapper->GetView()==EPls)
       
   405 		 {
       
   406 
       
   407           TInt plslist=(iUi->iURLs.Count()) / KTwo ;
       
   408 		  if(plslist==1 || plslist==0 || !iUi->GetListenFromSecondPls())
       
   409 			{
       
   410 			iShowToolBar=EFalse;
       
   411 			}
       
   412 		else
       
   413 			{
       
   414 			iShowToolBar=ETrue;
       
   415 			}
       
   416 		 }
       
   417   	    // TO Do: need to check
       
   418 	if(iNowPlayingWrapper->GetView()!=EFav)
       
   419 		{
       
   420 		iNowPlayingWrapper->SetFavFocus(-1) ;
       
   421 		}
       
   422 	ConstructToolbarL();
       
   423 	CIRUi* ui = reinterpret_cast<CIRUi*>( AppUi() );
       
   424 	ui->iPresentViewID = KIRNowPlayingViewID;
       
   425 	SetTitleL( R_IRAPP_NOWPLAYING_TITLE );
       
   426 	if( !iContainer )
       
   427 		{
       
   428 		iAlfEnv.NewControlGroupL( KIRNowPlayingViewID.iUid );
       
   429 		iContainer = CIRNowPlayingViewContainer::NewL( iAlfEnv,this );
       
   430 		}
       
   431 		iUi->iFavPresets->AddObserver( *this );
       
   432 		iPrevPreset1=CIRIsdsPreset::NewL();
       
   433 		iCurrentPreset=CIRIsdsPreset::NewL();
       
   434 		iUpdateStationName=ETrue;
       
   435 		iContainer->StationLogoControl().SetLogoControlObserver( *this );
       
   436 		OnViewActivationL();
       
   437 		GetLogoL();
       
   438 		iAlfEnv.PrimaryDisplay().Roster().ShowL( iAlfEnv.ControlGroup( KIRNowPlayingViewID.iUid ));
       
   439 		Cba()->AddCommandSetToStackL( R_AVKON_SOFTKEYS_OPTIONS_BACK);
       
   440 		iFadeStyle=EIRFadeNoFade;
       
   441 	if(iCallActive)
       
   442 		{
       
   443 		ConstructToolbarL();
       
   444 		iFadeStyle=EIRFadeUnknown;
       
   445 		DrawViewL(iStationHasLogo);
       
   446 		DisplaylogoL();
       
   447 		}
       
   448 
       
   449 	iIsOn = ETrue;
       
   450 	iHasBeenActivated = ETrue;
       
   451 	IRLOG_DEBUG( "CIRNowPlayingView::DoActivateL - Exiting" );
       
   452 	}
       
   453 
       
   454 // ---------------------------------------------------------
       
   455 // CIRNowPlayingView::DoDeactivate
       
   456 // ---------------------------------------------------------
       
   457 //
       
   458 void CIRNowPlayingView::DoDeactivate()
       
   459 	{
       
   460 	IRLOG_DEBUG( "CIRNowPlayingView::DoDeactivate Entering" );
       
   461 	CAlfEnv* alfEnv = CAlfEnv::Static();
       
   462 	if( alfEnv )
       
   463 		{
       
   464 		alfEnv->PrimaryDisplay().Roster().Hide( alfEnv->ControlGroup( KIRNowPlayingViewID.iUid ) );
       
   465 		TRAP_IGNORE( iContainer->RadioIdle().HandleCommandL( EShutdown ) )
       
   466 		alfEnv->DeleteControlGroup( KIRNowPlayingViewID.iUid );
       
   467 		iContainer = NULL;
       
   468 		}
       
   469 	 iUi->iFavPresets->RemoveObserver( *this );
       
   470    	if ( iToolbar )
       
   471 		{
       
   472 		iToolbar->SetToolbarVisibility(EFalse, EFalse);
       
   473 		iToolbar->SetToolbarObserver( NULL );
       
   474 		}
       
   475 	if(iConnectionCleanupTimer)
       
   476 		{
       
   477 		iConnectionCleanupTimer->Cancel();
       
   478 		}
       
   479 	if(iConnectionCleanupTimer)
       
   480 		{
       
   481 		delete iConnectionCleanupTimer;
       
   482 		iConnectionCleanupTimer=NULL;
       
   483 		}
       
   484 	iMetadata.Close();
       
   485 	iBuffer.Close();
       
   486    	iPrecount=0;
       
   487 	iPresetValue=0;
       
   488 	if(iPrevPreset1)
       
   489 	    {
       
   490 	    delete iPrevPreset1;
       
   491 	    iPrevPreset1=NULL;
       
   492 	    }
       
   493     if(iCurrentPreset)
       
   494 	    {
       
   495 	    delete iCurrentPreset;
       
   496 	    iCurrentPreset=NULL;
       
   497 	    }
       
   498 
       
   499 	if(iNowPlayingWrapper->iPlaying)
       
   500 		{
       
   501 		 iUpdateLastplayed=ETrue;
       
   502 		}
       
   503 	else
       
   504 		{
       
   505 		iUpdateLastplayed=EFalse;
       
   506 		}
       
   507 	iShowToolBar=EFalse;
       
   508 	iStartUp=ETrue;
       
   509 	iRockerIndex=0;
       
   510 	iIndex=0;
       
   511 	if(iPlaying)
       
   512 		{
       
   513 		iNowPlayingWrapper->SetMedadataForErrotrConditions(EFalse);
       
   514 		}
       
   515 	else
       
   516 		{
       
   517 		iNowPlayingWrapper->SetMedadataForErrotrConditions(ETrue);
       
   518 		}
       
   519 	iNowPlayingWrapper->SetMarquee(EFalse);
       
   520 	IRLOG_DEBUG( "CIRNowPlayingView::DoDeactivate Exiting" );
       
   521 	}
       
   522 
       
   523 // ---------------------------------------------------------
       
   524 // CIRNowPlayingView::HandleCommandL
       
   525 // ---------------------------------------------------------
       
   526 //
       
   527 void CIRNowPlayingView::HandleCommandL(TInt aCommand)
       
   528 	{
       
   529 	IRLOG_DEBUG( "CIRNowPlayingView::HandleCommandL Activating" );
       
   530 	switch (aCommand)
       
   531 		{
       
   532 		case EStationDetailsCmd:
       
   533 			{
       
   534 			if( !iUi->CheckAndNotifyLowDiskSpaceL() )
       
   535 				{
       
   536 				iUi->iStationInfoView->SetStationPresetL( iNowPlayingWrapper->iNowPlayingPreset );
       
   537 				AppUi()->ActivateLocalViewL(KIRStationInfoViewId);
       
   538 				}
       
   539 			break;
       
   540 			}
       
   541 		case EAddtoStationsCmd:
       
   542 			{
       
   543 			if( !iUi->CheckAndNotifyLowDiskSpaceL() )
       
   544 				{
       
   545 				AddStationsL();
       
   546 				}
       
   547 			}
       
   548 		break;
       
   549 		case EIRCmdStepNextPreset:
       
   550 			{
       
   551 			if( iUi->CheckAndNotifyLowDiskSpaceL() )
       
   552 				{
       
   553 				break;
       
   554 				}
       
   555 			iCommandId=EIRCmdStepNextPreset;
       
   556 			iPresetCount=iRockerIndex;
       
   557 			iRockerIndex++;
       
   558 
       
   559 			if(iNowPlayingWrapper->GetView()==EFav)
       
   560 				{
       
   561 				iNowPlayingWrapper->SetView(EFav);
       
   562 
       
   563 				if( iRockerIndex == (iUi->iFavPresets->iFavPresetList.Count()) )
       
   564 					{
       
   565 					iRockerIndex = 0;
       
   566 					}
       
   567 				iFadeStyle=EIRFadeRightToLeft;
       
   568 				if( iUi->VerifyNetworkConnectivityL() )
       
   569 					{
       
   570 					 iNextOrPrevRequest=ETrue;
       
   571 					}
       
   572 					else
       
   573 					{
       
   574 					ConnectToPresetL();
       
   575 					//StartTimerL()
       
   576 					}
       
   577 				break;
       
   578 				}
       
   579 			else if(iNowPlayingWrapper->GetView()==ESearch||
       
   580 					iNowPlayingWrapper->GetView()==EStations ||
       
   581 					iNowPlayingWrapper->GetView()==EBrowseByTopStations )
       
   582 				{
       
   583 				//iNowPlayingWrapper->SetView(ESearch)
       
   584 				iNowPlayingWrapper->SetListenFromIsdsValue(EFalse);
       
   585 				iNowPlayingWrapper->SetWhenUserCancelsBufferingWaitBar(EFalse);
       
   586 				iFadeStyle=EIRFadeRightToLeft;
       
   587 				if(iIsdsWrapper->GetBannerUrl())
       
   588 				{
       
   589 				 if(iRockerIndex>iStationsData->Count())
       
   590 				 {
       
   591 				 iRockerIndex = 1;
       
   592 				 }
       
   593 				 if( iUi->VerifyNetworkConnectivityL() )
       
   594 					{
       
   595 					 iNextOrPrevRequest=ETrue;
       
   596 					}
       
   597 					else
       
   598 					{
       
   599 					ConnectToPresetL();
       
   600 					}
       
   601 				break;
       
   602 				}
       
   603 				else
       
   604 				{
       
   605 				if(iRockerIndex>=iStationsData->Count())
       
   606 					{
       
   607 					iRockerIndex = 0;
       
   608 					}
       
   609 				if( iUi->VerifyNetworkConnectivityL() )
       
   610 					{
       
   611 					 iNextOrPrevRequest=ETrue;
       
   612 					}
       
   613 				else
       
   614 					{
       
   615 					ConnectToPresetL();
       
   616 					}
       
   617 				break;
       
   618 				}
       
   619 				}
       
   620 			else if(iNowPlayingWrapper->GetView()==EPls)
       
   621 				{
       
   622 				iNowPlayingWrapper->SetView(EPls);
       
   623                 TInt plslist=(iUi->iURLs.Count()) / KTwo ;
       
   624 				if(iRockerIndex==plslist)
       
   625 					{
       
   626 					iRockerIndex = 0;
       
   627 
       
   628 					}
       
   629 				iFadeStyle=EIRFadeRightToLeft;
       
   630 				if( iUi->VerifyNetworkConnectivityL() )
       
   631 					{
       
   632 					 iNextOrPrevRequest=ETrue;
       
   633 					}
       
   634 					else
       
   635 					{
       
   636 					ConnectToPresetL();
       
   637 					StartTimerL();
       
   638 					}
       
   639 				}
       
   640 				break;
       
   641 			}
       
   642 		case EIRCmdStepPrevPreset:
       
   643 			{
       
   644 			if ( iUi->CheckAndNotifyLowDiskSpaceL() )
       
   645 				{
       
   646 				break;
       
   647 				}
       
   648 			iCommandId=EIRCmdStepPrevPreset;
       
   649 			iPresetCount=iRockerIndex;
       
   650 			iRockerIndex--;
       
   651 			if(iNowPlayingWrapper->GetView()==EFav)
       
   652 				{
       
   653 				iNowPlayingWrapper->SetView(EFav);
       
   654 				if(iRockerIndex < 0)
       
   655 					{
       
   656 					iRockerIndex = (iUi->iFavPresets->iFavPresetList.Count()) - 1;
       
   657 					}
       
   658 				iFadeStyle=EIRFadeLeftToRight;
       
   659 				if( iUi->VerifyNetworkConnectivityL() )
       
   660 					{
       
   661 					 iNextOrPrevRequest=ETrue;
       
   662 					}
       
   663 					else
       
   664 					{
       
   665 					ConnectToPresetL();
       
   666 					//StartTimerL()
       
   667 					}
       
   668 				}
       
   669 			else if(iNowPlayingWrapper->GetView()==ESearch||
       
   670 					iNowPlayingWrapper->GetView()==EStations ||
       
   671 					iNowPlayingWrapper->GetView()==EBrowseByTopStations )
       
   672 				{
       
   673 				//iNowPlayingWrapper->SetView(ESearch)
       
   674 				iNowPlayingWrapper->SetListenFromIsdsValue(EFalse);
       
   675 				iNowPlayingWrapper->SetWhenUserCancelsBufferingWaitBar(EFalse);
       
   676 				iFadeStyle=EIRFadeLeftToRight;
       
   677 				if(iIsdsWrapper->GetBannerUrl())
       
   678 					{
       
   679 					 if(iRockerIndex==0)
       
   680 						 {
       
   681 						 iRockerIndex=iStationsData->Count();
       
   682 						 }
       
   683 					 if( iUi->VerifyNetworkConnectivityL() )
       
   684 						{
       
   685 						iNextOrPrevRequest=ETrue;
       
   686 						}
       
   687 					else
       
   688 						{
       
   689 						ConnectToPresetL();
       
   690 						}
       
   691 					break;
       
   692 					}
       
   693 				else
       
   694 				{
       
   695 				if(iRockerIndex< 0)
       
   696 					{
       
   697 					iRockerIndex =(iStationsData->Count())-1 ;
       
   698 					}
       
   699 				if( iUi->VerifyNetworkConnectivityL() )
       
   700 					{
       
   701 					iNextOrPrevRequest=ETrue;
       
   702 					}
       
   703 				else
       
   704 					{
       
   705 					ConnectToPresetL();
       
   706 					}
       
   707 				break;
       
   708 				}
       
   709 				}
       
   710 
       
   711 			else if(iNowPlayingWrapper->GetView()==EPls)
       
   712 				{
       
   713 				iNowPlayingWrapper->SetView(EPls);
       
   714 				if(iRockerIndex< 0)
       
   715 					{
       
   716                     TInt plslist=(iUi->iURLs.Count()) / KTwo ;
       
   717 					iRockerIndex =plslist-1;
       
   718 					}
       
   719 				iFadeStyle=EIRFadeLeftToRight;
       
   720 				if( iUi->VerifyNetworkConnectivityL() )
       
   721 					{
       
   722 					 iNextOrPrevRequest=ETrue;
       
   723 					}
       
   724 					else
       
   725 					{
       
   726 					ConnectToPresetL();
       
   727 					StartTimerL();
       
   728 					}
       
   729 				}
       
   730 			break;
       
   731 			}
       
   732 		case EIRCmdPlay:
       
   733 		case EPlayCmd:
       
   734 			{
       
   735 			if ( iUi->CheckAndNotifyLowDiskSpaceL() )
       
   736 				{
       
   737 				break;
       
   738 				}
       
   739 
       
   740 			if( iContainer )
       
   741 				{
       
   742 				if( iUi->VerifyNetworkConnectivityL() )
       
   743 					{
       
   744 					iRequestPending = ETrue;
       
   745 					break;
       
   746 					}
       
   747 				else
       
   748 					{
       
   749 					PlayAndStopControlL();
       
   750 					}
       
   751 				}
       
   752 			}
       
   753 		break;
       
   754 		case EIRCmdStop:
       
   755 		case EStopCmd:
       
   756 			{
       
   757 			if( iContainer )
       
   758 				{
       
   759 				iShowBitrate=ETrue;
       
   760 				PlayAndStopControlL();
       
   761 				}
       
   762 			}
       
   763 		break;
       
   764 		case EFmRecOrPhone:
       
   765 			{
       
   766 			if ( !iUi->CheckAndNotifyLowDiskSpaceL() )
       
   767 				{
       
   768 				LaunchFMTransmitterL();
       
   769 				}
       
   770 			}
       
   771 		break;
       
   772 
       
   773 		case EGotoMusicStore:
       
   774 		case EFindInShop:
       
   775 			{
       
   776 			if ( iUi->CheckAndNotifyLowDiskSpaceL() )
       
   777 				{
       
   778 				break;
       
   779 				}
       
   780 
       
   781 		    _LIT(KLaunchStr, "launch");
       
   782 		    _LIT(KFindStr, "find");
       
   783 
       
   784 		    if(aCommand == EGotoMusicStore)
       
   785 			    {
       
   786 				DoFindInMusicShopL(iNowPlayingWrapper->MetaData().Song(),
       
   787 			                     iNowPlayingWrapper->MetaData().Artist(),
       
   788 			                     KNullDesC,EFalse);
       
   789 				iNowPlayingWrapper->UpdateNmsLogEventsL(KLaunchStr);
       
   790 			    }
       
   791 			else if(aCommand == EFindInShop)
       
   792 				{
       
   793 				DoFindInMusicShopL(iNowPlayingWrapper->MetaData().Song(),
       
   794 			                     iNowPlayingWrapper->MetaData().Artist(),
       
   795 			                     KNullDesC,ETrue);
       
   796 				/**
       
   797 				 * Increment the FindInMusicStore count by one
       
   798 				 */
       
   799 				iUi->FindInMusicStoreCounter();
       
   800 
       
   801 
       
   802 
       
   803 
       
   804 
       
   805 
       
   806 
       
   807 				iNowPlayingWrapper->UpdateNmsLogEventsL(KFindStr);
       
   808 				}
       
   809 			}
       
   810 		break;
       
   811 
       
   812 		case  EStereoMode:
       
   813 			{
       
   814 			iIsOn = ETrue;
       
   815 			break;
       
   816 			}
       
   817 		case EOnCmd:
       
   818 			{
       
   819 			iIsOn=ETrue;
       
   820 			iDs=EOnCmd;
       
   821 			iStereoMode = 1;
       
   822 			iIRSettings->SetStereoModeL(iStereoMode);
       
   823 			GetStereoModeL();
       
   824 			DynInitMenuPaneL(R_NOW_SUBMENU,iMenuPane);
       
   825 			break;
       
   826 			}
       
   827 		case EOffCmd:
       
   828 			{
       
   829 			iIsOn=ETrue;
       
   830 			iDs=EOffCmd;
       
   831 			iStereoMode = 0;
       
   832 			iIRSettings->SetStereoModeL(iStereoMode);
       
   833 			GetStereoModeL();
       
   834 			DynInitMenuPaneL(R_NOW_SUBMENU,iMenuPane);
       
   835 			break;
       
   836 			}
       
   837 		case EEqualizer:
       
   838 			{
       
   839 			if ( iUi->CheckAndNotifyLowDiskSpaceL() )
       
   840 				{
       
   841 				break;
       
   842 				}
       
   843 
       
   844 			iToolbar->SetToolbarVisibility(EFalse, EFalse);
       
   845 			iEaualizerOn=ETrue;
       
   846 
       
   847 #ifdef __IRA_FEATURE_EQUALIZER
       
   848 			if (iMpxEqualizerViewPlugin)
       
   849 				{
       
   850 				iMpxEqualizerViewPlugin->ActivateViewL();
       
   851 				}
       
   852 #endif
       
   853 
       
   854 		    iEaualizerOn=EFalse;
       
   855 			iToolbar->SetToolbarVisibility(ETrue, EFalse);
       
   856 			}
       
   857 		break;
       
   858 		case EHistory:
       
   859 			{
       
   860 			_LIT8(KNull,"");
       
   861 			AppUi()->ActivateLocalViewL( KIRHistoryListViewId ,KNowPlayingLaunch,KNull);
       
   862 			break;
       
   863 			}
       
   864 		case ESettingsCmd:
       
   865 			{
       
   866 			AppUi()->ActivateLocalViewL(KIRSettingsViewId);
       
   867 			break;
       
   868 			}
       
   869 		case EHelpCmd:
       
   870 			{
       
   871 			if ( iUi->CheckAndNotifyLowDiskSpaceL() )
       
   872 				{
       
   873 				break;
       
   874 				}
       
   875 
       
   876 			TCoeHelpContext context = HelpContext();
       
   877             // Launch help app with help context of the view.
       
   878             CArrayFix<TCoeHelpContext>* array = new( ELeave ) CArrayFixFlat<TCoeHelpContext>( 1 );
       
   879             array->AppendL( context );
       
   880             // Launch help application with help context of this view.
       
   881             // It must be verified that the ownership of the help context array is transfered.
       
   882             // Remember to verify also CIRSettingsViewBase help application launch.
       
   883             HlpLauncher::LaunchHelpApplicationL( iEikonEnv->WsSession(), array );
       
   884 			break;
       
   885 			}
       
   886 		case EIRCmdVolumeControl:
       
   887 			{
       
   888 				if(iVolPopup)
       
   889 					{
       
   890 						if(iVolumeMute)
       
   891 							{
       
   892 							iVolumeBarValue=0;
       
   893 							}
       
   894 						else
       
   895 							{
       
   896 							iVolumeBarValue=iUi->iIRSettings->GetVolumeSetting();
       
   897 							}
       
   898 					iVolPopup->SetValue(2);
       
   899 					if(iVolumeMute)
       
   900 						{
       
   901 						TInt index = iNowPlayingWrapper->GetMediaClientInstance()->MaxVolume()/KMaxVolume;
       
   902 						TInt volume = index*iVolumeBarValue;
       
   903 						iNowPlayingWrapper->GetMediaClientInstance()->SetVolume(volume);
       
   904 						}
       
   905 					else
       
   906 						{
       
   907 						iNowPlayingWrapper->SetVolumeL(iVolumeBarValue);
       
   908 						}
       
   909 					if(!iVolPopup->IsFocused())
       
   910 					iVolPopup->ShowVolumePopupL();
       
   911 					}
       
   912 
       
   913 			}
       
   914 		break;
       
   915 		case EGotoMainView:
       
   916 		{
       
   917 		_LIT8(KNull,"");
       
   918 		AppUi()->ActivateLocalViewL( KIRMainChoiceViewID,KMainViewLaunch , KNull);
       
   919 		break;
       
   920 		}
       
   921 		case EAknSoftkeyBack:
       
   922 			{
       
   923 			if((iUi->GetPlsSaved().Count()) &&
       
   924 			   (iUi->GetListenFromPls()) &&
       
   925 			    iUi->GetListenFromSecondPls())
       
   926 				{
       
   927 				if(iUi->GetPlsSaved()[iRockerIndex]==0)
       
   928 					{
       
   929 					RBuf sumvalue;
       
   930 					HBufC* textResource = StringLoader::LoadLC(R_IRAPP_NOTE_POPUP_SAVE );
       
   931 					sumvalue.Create(*textResource);
       
   932 					CIRDialogLauncher* queryNote = CIRDialogLauncher::NewL();
       
   933 					CleanupStack::PushL( queryNote );
       
   934 					TInt dlgValue;
       
   935 					queryNote->ShowQueryDialogDeletionL(sumvalue,dlgValue);
       
   936 					if(dlgValue)
       
   937 						{
       
   938 						AddStationsL();
       
   939 						}
       
   940 					CleanupStack::PopAndDestroy( queryNote );
       
   941 					CleanupStack::PopAndDestroy( textResource );
       
   942 					sumvalue.Close();
       
   943 					}
       
   944 				}
       
   945 			CIRBaseView::HandleCommandL(aCommand);
       
   946 			}
       
   947 		default:
       
   948 			{
       
   949 			CIRBaseView::HandleCommandL(aCommand);
       
   950 			break;
       
   951 			}
       
   952 		}
       
   953 	IRLOG_DEBUG( "CIRNowPlayingView::HandleCommandL Exiting" );
       
   954 	}
       
   955 
       
   956 // ---------------------------------------------------------
       
   957 // CIRNowPlayingView::UpdateStationNameL()
       
   958 // This function updates station name
       
   959 // ---------------------------------------------------------
       
   960 //
       
   961 void CIRNowPlayingView::UpdateStationNameL(TIRFadeStyle /*aFadeStyle*/)
       
   962 	{
       
   963 
       
   964 	IRLOG_DEBUG( "CIRNowPlayingView::UpdateStationNameL Activating" );
       
   965 
       
   966 
       
   967 	if(iContainer)
       
   968 		{
       
   969 		CIRUi* ui = reinterpret_cast<CIRUi*>( iCoeEnv->AppUi() );
       
   970 	 if(iUpdateLastplayed)
       
   971 	 {
       
   972 
       
   973 		if(iNowPlayingWrapper->iNowPlayingPreset)
       
   974 		{
       
   975 		// store the last played station
       
   976 		*ui->iLastPlayed->iLastPlayedStation = *iNowPlayingWrapper->iNowPlayingPreset;
       
   977 		TRAPD(err,ui->iLastPlayed->CommitLastPlayedChannelL());
       
   978 		TInt error=KErrNone;
       
   979 		if(err != KErrNone)
       
   980 			{
       
   981 			error = ui->iLastPlayed->RemoveLastPlayedFile();
       
   982 			User::Leave(error);
       
   983 			}
       
   984 		}
       
   985 	 }
       
   986 
       
   987 	 if(iUpdateStationName)
       
   988 	 {
       
   989 		// Check whether the currently playing station is from fav db to enable
       
   990 		// switching/browsing b/w channels that are there in fav db &
       
   991 		// enable the left & right rocker keys accordingly
       
   992 		if(iNowPlayingWrapper->GetView()==EFav)
       
   993 			{
       
   994 			if(ui->iFavPresets->iFavPresetList.Count() >= 1)
       
   995 				{
       
   996 				//fovorities list is not empty
       
   997 				TInt index = ui->iFavPresets->SearchPreset(iNowPlayingWrapper->iNowPlayingPreset->
       
   998 														   GetId(),iNowPlayingWrapper->
       
   999 														   iNowPlayingPreset->UniqId());
       
  1000 				if (index != KErrNotFound )
       
  1001 					{
       
  1002 					//if there are contents in favorites
       
  1003 					iIndex = index;
       
  1004 					iRockerIndex = iIndex;
       
  1005 					//assigning the preset
       
  1006 					ui->iFavPresets->iFavPresetList[iIndex]->CopyPresetData(*iNowPlayingWrapper->
       
  1007 																			 iNowPlayingPreset);
       
  1008 					iBuffer.Close();
       
  1009 					iBuffer.Create(iNowPlayingWrapper->iNowPlayingPreset->GetName().Length()+
       
  1010 								   KPresetNumbering);
       
  1011 					iBuffer.Append(iNowPlayingWrapper->iNowPlayingPreset->GetName());
       
  1012 					}
       
  1013 				else
       
  1014 					{
       
  1015 					iIndex = KErrNotFound;
       
  1016 					iBuffer.Close();
       
  1017 					iBuffer.Create(iNowPlayingWrapper->iNowPlayingPreset->GetName().Length()+
       
  1018 								   KPresetNumbering);
       
  1019 					iBuffer.Append(iNowPlayingWrapper->iNowPlayingPreset->GetName());
       
  1020 					}
       
  1021 				}
       
  1022 			}
       
  1023 		else if(iNowPlayingWrapper->GetView()==ESearch||iNowPlayingWrapper->GetView()==EStations ||
       
  1024 				iNowPlayingWrapper->GetView()==EBrowseByTopStations )
       
  1025 			{
       
  1026 			iRockerIndex = (iIsdsWrapper->GetCurrentPlayingIndex());
       
  1027 			iBuffer.Close();
       
  1028 			iBuffer.Create(iNowPlayingWrapper->iNowPlayingPreset->GetName().Length()+
       
  1029 						   KPresetNumbering);
       
  1030 			iBuffer.Append(iNowPlayingWrapper->iNowPlayingPreset->GetName());
       
  1031 			}
       
  1032 		else if(iNowPlayingWrapper->GetView()==ELastplayed||
       
  1033 				iNowPlayingWrapper->GetView()==EHistoryView ||iNowPlayingWrapper->GetView()==EPls)
       
  1034 			{
       
  1035 			 if(iNowPlayingWrapper->GetView()==ELastplayed)
       
  1036 				{
       
  1037 				TInt index = ui->iFavPresets->SearchPreset(iNowPlayingWrapper->
       
  1038 				iNowPlayingPreset->GetId(),iNowPlayingWrapper->iNowPlayingPreset->UniqId());
       
  1039 				if (index != KErrNotFound )
       
  1040 				{
       
  1041 						iIndex=index;
       
  1042 						iRockerIndex = iIndex;
       
  1043 
       
  1044 				}
       
  1045 				else if(iNowPlayingWrapper->iNowPlayingPreset->GetChannelType()==0)
       
  1046 					{
       
  1047 					iIndex=1;
       
  1048 					iRockerIndex = iIndex;
       
  1049 					}
       
  1050 				else
       
  1051 					{
       
  1052 					iIndex=1;
       
  1053 					iRockerIndex = iIndex;
       
  1054 					}
       
  1055 				}
       
  1056 			else if(iNowPlayingWrapper->GetView()==EPls)
       
  1057 				{
       
  1058 				iIndex=	iUi->GetPlsIndex();
       
  1059 				iRockerIndex = iIndex;
       
  1060 				}
       
  1061 			else if(iNowPlayingWrapper->GetView()==EHistoryView)
       
  1062 				{
       
  1063 				iIndex=1;
       
  1064 				iRockerIndex = iIndex;
       
  1065 				}
       
  1066 
       
  1067 			iBuffer.Close();
       
  1068 			iBuffer.Create(iNowPlayingWrapper->iNowPlayingPreset->GetName().Length()+
       
  1069 						   KPresetNumbering);
       
  1070 			iBuffer.Append(iNowPlayingWrapper->iNowPlayingPreset->GetName());
       
  1071 			}
       
  1072 	 }
       
  1073 		}
       
  1074 
       
  1075 	IRLOG_DEBUG( "CIRNowPlayingView::UpdateStationNameL Exiting" );
       
  1076 	}
       
  1077 
       
  1078 // ---------------------------------------------------------
       
  1079 // CIRNowPlayingView::UpdateStationLogosL
       
  1080 // ---------------------------------------------------------
       
  1081 void CIRNowPlayingView::UpdateStationLogosL()
       
  1082 	{
       
  1083 	IRLOG_DEBUG( "CIRNowPlayingView::UpdateStationLogosL Activating" );
       
  1084 	TBool upLoadLogo=EFalse;
       
  1085 	if( iContainer )
       
  1086 		{
       
  1087 		RArray<TInt> idArray( KIRLogoArrayGranularity );
       
  1088 		CleanupClosePushL( idArray );
       
  1089 		CPtrC8Array* dataArray = new (ELeave) CPtrC8Array( KIRLogoArrayGranularity );
       
  1090 		CleanupStack::PushL( dataArray );
       
  1091 		if(iNowPlayingWrapper->GetView()==EFav||iNowPlayingWrapper->GetView()==ELastplayed
       
  1092 			||iNowPlayingWrapper->GetView()==EHistoryView||
       
  1093 		   	iNowPlayingWrapper->GetView()==EPls )
       
  1094 			{
       
  1095 			if(iPresetValue==0||iNowPlayingWrapper->GetView()==ELastplayed)
       
  1096 				{
       
  1097 					if(iCurrentPreset->GetLogoData() != KNullDesC8 )
       
  1098 						{
       
  1099 						dataArray->AppendL(iCurrentPreset->GetLogoData() );
       
  1100 						idArray.AppendL( iRockerIndex);
       
  1101 						iContainer->StationLogoControl().SetLogosL( idArray, *dataArray );
       
  1102 						iPresetValue++;
       
  1103 						}
       
  1104 
       
  1105 				}
       
  1106 			else
       
  1107 				{
       
  1108 				if(iPrevPreset1->GetLogoData() != KNullDesC8 && !iDefaultLogo)
       
  1109 					{
       
  1110 					dataArray->AppendL(iPrevPreset1->GetLogoData() );
       
  1111 					idArray.AppendL( iPresetCount );
       
  1112 					}
       
  1113 				if(iCurrentPreset->GetLogoData() != KNullDesC8 )
       
  1114 					{
       
  1115 					 	 upLoadLogo=ETrue;
       
  1116 					dataArray->AppendL(iCurrentPreset->GetLogoData() );
       
  1117 					idArray.AppendL(iRockerIndex);
       
  1118 					}
       
  1119 				if(upLoadLogo)
       
  1120 				iContainer->StationLogoControl().SetLogosL( idArray, *dataArray );
       
  1121 				iDefaultLogo=EFalse;
       
  1122 				}
       
  1123 			}
       
  1124 		if(iNowPlayingWrapper->GetView()==ESearch||iNowPlayingWrapper->GetView()==EStations
       
  1125 			 ||iNowPlayingWrapper->GetView()==EBrowseByTopStations )
       
  1126 			{
       
  1127 			if(iPresetValue==0)
       
  1128 				{
       
  1129 				if(iCurrentPreset->GetLogoData() != KNullDesC8 )
       
  1130 					{
       
  1131 					dataArray->AppendL(iCurrentPreset->GetLogoData() );
       
  1132 					idArray.AppendL(iLogoIndex);
       
  1133 					iContainer->StationLogoControl().SetLogosL( idArray, *dataArray );
       
  1134 					iPresetValue++;
       
  1135 					}
       
  1136 				}
       
  1137 			else
       
  1138 				{
       
  1139 				if(iPrevPreset1->GetLogoData() != KNullDesC8 && !iDefaultLogo)
       
  1140 					{
       
  1141 					 upLoadLogo=ETrue;
       
  1142 					dataArray->AppendL(iPrevPreset1->GetLogoData() );
       
  1143 					idArray.AppendL(iPresetCount);
       
  1144 					}
       
  1145 				if(iCurrentPreset->GetLogoData() != KNullDesC8 )
       
  1146 					{
       
  1147 					 upLoadLogo=ETrue;
       
  1148 					dataArray->AppendL(iCurrentPreset->GetLogoData() );
       
  1149 					idArray.AppendL(iLogoIndex );
       
  1150 					}
       
  1151 				iContainer->StationLogoControl().SetLogosL( idArray, *dataArray );
       
  1152 				iDefaultLogo=EFalse;
       
  1153 				}
       
  1154 			}
       
  1155 		CleanupStack::PopAndDestroy( dataArray );
       
  1156 		CleanupStack::PopAndDestroy( &idArray );
       
  1157 		}
       
  1158 	IRLOG_DEBUG( "CIRNowPlayingView::UpdateStationLogosL Exiting" );
       
  1159 	}
       
  1160 
       
  1161 // ---------------------------------------------------------------------------
       
  1162 // CIRNowPlayingView::DisplayBitrate
       
  1163 // Displays the song name on to the screen
       
  1164 // ---------------------------------------------------------------------------
       
  1165 //
       
  1166 void CIRNowPlayingView::DisplayBitrate(const TDesC& aBitrate) const
       
  1167 	{
       
  1168 	IRLOG_DEBUG( "CIRNowPlayingView::DisplaySongNameL - Entering" );
       
  1169 	if( iContainer )
       
  1170 		{
       
  1171 		TRAP_IGNORE(iContainer->SetBitrateL( aBitrate));
       
  1172 		if(iNowPlayingWrapper->iPlaying || !iShowBitrate)
       
  1173 			{
       
  1174 			if(iBitrateIndex)
       
  1175 				{
       
  1176 				if ( iContainer->RadioIdle().State() == CIRRadioIdle::ERunning )
       
  1177 					{
       
  1178 					iContainer->RadioIdle().UpdateRadioIdleContent( aBitrate,
       
  1179 					iBitrateIndex );
       
  1180 					}
       
  1181 
       
  1182 				}
       
  1183 			}
       
  1184 			else
       
  1185 			{
       
  1186 			if(iBitrateIndex)
       
  1187 				{
       
  1188 				if ( iContainer->RadioIdle().State() == CIRRadioIdle::ERunning )
       
  1189 					{
       
  1190 					iContainer->RadioIdle().UpdateRadioIdleContent( iBuffer,
       
  1191 					iBitrateIndex );
       
  1192 					}
       
  1193 
       
  1194 				}
       
  1195 			}
       
  1196 		}
       
  1197 	IRLOG_DEBUG( "CIRNowPlayingView::DisplaySongNameL - Exiting." );
       
  1198 	}
       
  1199 // ---------------------------------------------------------------------------
       
  1200 // CIRNowPlayingView::DisplaySongArtistNameL
       
  1201 // Displays the song name on to the screen
       
  1202 // ---------------------------------------------------------------------------
       
  1203 //
       
  1204 void CIRNowPlayingView::DisplaySongArtistNameL(const TDesC& aSongName,const TDesC& aArtistName)
       
  1205 	{
       
  1206 	IRLOG_DEBUG( "CIRNowPlayingView::DisplayArtistNameL - Entering " );
       
  1207 	if(aSongName==KNullDesC &&	aArtistName==KNullDesC )
       
  1208 		{
       
  1209 		iNowPlayingWrapper->SetMedadataForErrotrConditions(ETrue);
       
  1210 		DisplaySongArtistNameL(KConst1,KConst1);
       
  1211 		return;
       
  1212 		}
       
  1213 	if(aSongName!=KNullDesC && (!iNowPlayingWrapper->GetMedadataForErrotrConditions())
       
  1214 	&&	aArtistName!=KNullDesC)
       
  1215 		{
       
  1216 		CDesCArray* strings = new ( ELeave ) CDesCArrayFlat( 2 );
       
  1217 		CleanupStack::PushL( strings );
       
  1218 		if(iNowPlayingWrapper->GetMarquee())
       
  1219 			{
       
  1220 			strings->AppendL(  aArtistName);
       
  1221 			strings->AppendL( aSongName );
       
  1222 			}
       
  1223 		else
       
  1224 			{
       
  1225 			strings->AppendL( aSongName );
       
  1226 			strings->AppendL(  aArtistName);
       
  1227 			}
       
  1228 		iNowPlayingWrapper->SetMedadataForErrotrConditions(EFalse);
       
  1229 		HBufC* text = StringLoader::LoadLC( R_IR_NOW_ARTIST_SONG, *strings );
       
  1230 		iMetadata.Close();
       
  1231 		iMetadata.Create(text->Length());
       
  1232 		iMetadata.Copy(*text);
       
  1233 		CleanupStack::PopAndDestroy( 2, strings );
       
  1234 		}
       
  1235 	else
       
  1236 		{
       
  1237 		iMetadata.Close();
       
  1238 		iMetadata.Create(aSongName.Length()+aArtistName.Length()+KTwo);
       
  1239 		if(aSongName!=KNullDesC)
       
  1240 			{
       
  1241 			iMetadata.Append(aSongName);
       
  1242 			}
       
  1243 		if(aArtistName!=KNullDesC)
       
  1244 			{
       
  1245 			iMetadata.Append(aArtistName);
       
  1246 			}
       
  1247 		}
       
  1248 	if(iNowPlayingWrapper->GetMarquee())
       
  1249 		{
       
  1250 		TRAP_IGNORE( iContainer->StationInformationDisplay().RdsDataReceivedL( iMetadata ) );
       
  1251 		if ( iContainer->RadioIdle().State() == CIRRadioIdle::ERunning )
       
  1252 			{
       
  1253 			iContainer->RadioIdle().UpdateRadioIdleContent( iMetadata,
       
  1254 			iMetadataIndex );
       
  1255 			}
       
  1256 		}
       
  1257 
       
  1258 	IRLOG_DEBUG( "CIRNowPlayingView::DisplayArtistNameL - Exiting" );
       
  1259 }
       
  1260 
       
  1261 // ---------------------------------------------------------------------------
       
  1262 // CIRNowPlayingView::DisplayByteCounter
       
  1263 // Formats byte counter bytes for display
       
  1264 // For example, Byte counter is indicated in the following formats:
       
  1265 //   0.00 to 9.99 MB
       
  1266 //   10.0 to 99.9 MB
       
  1267 //   100 MB and more
       
  1268 // ---------------------------------------------------------------------------
       
  1269 //
       
  1270 void CIRNowPlayingView::DisplayByteCounterL(TReal32  total_bytes)
       
  1271 	{
       
  1272 	IRLOG_DEBUG( "CIRNowPlayingView::DisplayByteCounter Activating" );
       
  1273 
       
  1274 	TReal32 totalMB = total_bytes / KIRMBtoBytesConversion;
       
  1275 
       
  1276 	// required for byte counter in deciaml format
       
  1277 	CArrayFix<TInt>* byteCtr_nums = new (ELeave) CArrayFixFlat<TInt>( KTwo );
       
  1278 	CleanupStack::PushL( byteCtr_nums );
       
  1279 
       
  1280 	HBufC* text = NULL;
       
  1281 	if( total_bytes < KIRByteCounterDisplayThreshold1 )
       
  1282 		{
       
  1283 		TInt wholeMB = floor(totalMB);
       
  1284 		TInt fractionMB = (totalMB - wholeMB) * KHundred;
       
  1285 		byteCtr_nums->AppendL( wholeMB );
       
  1286 		byteCtr_nums->AppendL( fractionMB );
       
  1287 		text = StringLoader::LoadLC( R_IRAPP_NOWPLAYING_BYTECOUNTER_DECI, *byteCtr_nums );
       
  1288 
       
  1289 		if( fractionMB < KTen )
       
  1290 			{
       
  1291 			RBuf buff;
       
  1292 			buff.CreateL( *text, text->Length()+1 );
       
  1293 			TInt insertPos = KTwo;
       
  1294 			while(wholeMB >= KTen)
       
  1295 				{
       
  1296 				++insertPos;
       
  1297 				wholeMB /= KTen;
       
  1298 				}
       
  1299 			_LIT( KZero, "0" );
       
  1300 			buff.Insert( insertPos, KZero );
       
  1301 			CleanupStack::PopAndDestroy( text );
       
  1302 			text = HBufC::NewLC( buff.Length() );
       
  1303 			*text = buff;
       
  1304 			buff.Close();
       
  1305 			}
       
  1306 		}
       
  1307 	else if( total_bytes >= KIRByteCounterDisplayThreshold1 &&
       
  1308 			  total_bytes < KIRByteCounterDisplayThreshold2 )
       
  1309 		{
       
  1310 		TInt wholeMB = floor(totalMB);
       
  1311 		TInt fractionMB = (totalMB - wholeMB) * KTen;
       
  1312 		byteCtr_nums->AppendL( wholeMB );
       
  1313 		byteCtr_nums->AppendL( fractionMB );
       
  1314 		text = StringLoader::LoadLC( R_IRAPP_NOWPLAYING_BYTECOUNTER_DECI, *byteCtr_nums );
       
  1315 		}
       
  1316 	else
       
  1317 		{
       
  1318 		text = StringLoader::LoadLC( R_IRAPP_NOWPLAYING_BYTECOUNTER, totalMB );
       
  1319 		}
       
  1320 
       
  1321 	if( iContainer )
       
  1322 		{
       
  1323 		iContainer->SetByteCounterL( *text );
       
  1324 		}
       
  1325 	CleanupStack::PopAndDestroy( text );
       
  1326 	CleanupStack::PopAndDestroy( byteCtr_nums );
       
  1327 
       
  1328 	IRLOG_DEBUG( "CIRNowPlayingView::DisplayByteCounter - Exiting" );
       
  1329 	}
       
  1330 
       
  1331 
       
  1332 //
       
  1333 // ---------------------------------------------------------------------------
       
  1334 // CIRNowPlayingView::OnViewActivationL
       
  1335 // Displays the song name on to the screen
       
  1336 // ---------------------------------------------------------------------------
       
  1337 //
       
  1338 void CIRNowPlayingView::OnViewActivationL()
       
  1339 	{
       
  1340 	IRLOG_DEBUG( "CIRNowPlayingView::OnViewActivationL - Entering" );
       
  1341 	UpdateStationNameL(iFadeStyle);
       
  1342 	if(iNowPlayingWrapper->MetaData().Artist().Length()
       
  1343 		&& iNowPlayingWrapper->MetaData().Song().Length() )
       
  1344 		{
       
  1345 		iNowPlayingWrapper->SetMedadataForErrotrConditions(EFalse);
       
  1346 		}
       
  1347     DisplaySongArtistNameL(iNowPlayingWrapper->MetaData().Artist(),
       
  1348     					   iNowPlayingWrapper->MetaData().Song());
       
  1349 	IRLOG_DEBUG( "CIRNowPlayingView::OnViewActivationL - Exiting." );
       
  1350 	}
       
  1351 
       
  1352  // -----------------------------------------------------------------------------
       
  1353 // ConnectToPresetL()
       
  1354 // Function called to connect to any channel after the timer expires
       
  1355 // ------------------------------------------------------------------------------
       
  1356 //
       
  1357 void CIRNowPlayingView::ConnectToPresetL()
       
  1358 	{
       
  1359 	IRLOG_DEBUG( "CIRNowPlayingView::ConnectToPresetL - Entering" );
       
  1360 	iSameUrl=EFalse;
       
  1361 	if(iStereoEffect)
       
  1362 		{
       
  1363 		if(iStereoEffect->IsEnabled())
       
  1364 			{
       
  1365 			iStereoEffect->DisableL();
       
  1366 			}
       
  1367 		}
       
  1368 	if(iNowPlayingWrapper->GetView()==EFav)
       
  1369 		{
       
  1370 			iNowPlayingWrapper->SetConnectToServerState(ETrue);
       
  1371 			iIndex=iRockerIndex;
       
  1372 			//connected from saved preset
       
  1373 			iNowPlayingWrapper->SetCurrentConnectionSource(EIRPresetIsds);
       
  1374 			if(iUi->iFavPresets->iFavPresetList.Count() >= 1)
       
  1375 				{
       
  1376 				if(iUi->iFavPresets->iFavPresetList[iRockerIndex]->
       
  1377 					GetChannelType() == CIRIsdsPreset::EIsdsPreset)
       
  1378 					{
       
  1379 					// Sync Favourite Isds preset
       
  1380 					SyncPresetL(iUi->iFavPresets->iFavPresetList[iRockerIndex]->GetId(),
       
  1381 					iUi->iFavPresets->iFavPresetList[iRockerIndex]->GetLastModifiedTime());
       
  1382 					}
       
  1383 				else
       
  1384 					{
       
  1385 					// TO Do: need to check
       
  1386 
       
  1387 					iNowPlayingWrapper->SetFavFocus(iRockerIndex+1);
       
  1388 					// Connect to Favourite User-defined preset
       
  1389 					iUi->iFavPresets->iFavPresetList[iRockerIndex]->
       
  1390 						CopyPresetData(*iNowPlayingWrapper->iNowPlayingPreset);
       
  1391 					iNowPlayingWrapper->ConnectToChannelL(*iNowPlayingWrapper->iNowPlayingPreset);
       
  1392 					StartTimerL();
       
  1393 					}
       
  1394 				}
       
  1395 			}
       
  1396 	else  if(iNowPlayingWrapper->GetView()==ESearch|| iNowPlayingWrapper->GetView()==EStations ||
       
  1397 	iNowPlayingWrapper->GetView()==EBrowseByTopStations )
       
  1398 		{
       
  1399 	       if(iRockerIndex >=0 && iRockerIndex <=iStationsData->Count())
       
  1400 	       {
       
  1401 
       
  1402 		 	iNowPlayingWrapper->SetWhenUserCancelsBufferingWaitBar(EFalse);
       
  1403 		 	iNowPlayingWrapper->SetListenFromIsdsValue(EFalse);
       
  1404 		    iNowPlayingWrapper->CreateWaitDialogL();
       
  1405 			iUi->GetPubSubManagerInstance()->PublishBufferingState(EIRStateBufferingStart);
       
  1406 
       
  1407 			iIsdsWrapper->IsdsListenRequestL(this,iRockerIndex);
       
  1408 	       }
       
  1409 		}
       
  1410 	else if(iNowPlayingWrapper->GetView()==EPls)
       
  1411 		{
       
  1412 		iIndex=iRockerIndex;
       
  1413 		ListenFromPlsL();
       
  1414 		}
       
  1415 	else
       
  1416 		{
       
  1417 		// if browsing to same channel that we were and
       
  1418 		// playback were stopped, need to try to restart it
       
  1419 		if( !iNowPlayingWrapper->iPlaying )
       
  1420 			{
       
  1421 			TRAP_IGNORE( PlayAndStopControlL() );
       
  1422 			}
       
  1423 		}
       
  1424 	IRLOG_DEBUG( "CIRNowPlayingView::DisplayByteCounter Exiting" );
       
  1425 }
       
  1426 
       
  1427 
       
  1428 // ---------------------------------------------------------------------------
       
  1429 // CIRNowPlayingView::PlayAndStopControlL()
       
  1430 // Used to stop & play the station
       
  1431 // ---------------------------------------------------------------------------
       
  1432 //
       
  1433 void CIRNowPlayingView::PlayAndStopControlL()
       
  1434 	{
       
  1435 	IRLOG_DEBUG( "CIRNowPlayingView::StopAndPlayControlL - Entering" );
       
  1436 	CIRUi* ui = reinterpret_cast<CIRUi*>( iCoeEnv->AppUi() );
       
  1437 	iNowPlayingWrapper->PlayAndStopL();
       
  1438 	IRLOG_DEBUG( "CIRNowPlayingView::StopAndPlayControlL - Exiting." );
       
  1439 	}
       
  1440 // ---------------------------------------------------------------------------
       
  1441 // CIRNowPlayingView::DynInitMenuPaneL
       
  1442 // Dynamically handles menu pane.
       
  1443 // From class MEikMenuObserver.
       
  1444 // Itialiases the items on the menu.
       
  1445 // ---------------------------------------------------------------------------
       
  1446 void CIRNowPlayingView::DynInitMenuPaneL(TInt aResourceId,
       
  1447 		CEikMenuPane* aMenuPane)
       
  1448 	{
       
  1449 	IRLOG_DEBUG( "CIRNowPlayingView::DynInitMenuPaneL - Entering " );
       
  1450 	iMenuPane=aMenuPane;
       
  1451 	if(aResourceId == R_IR_MENU_NOWPLAYING )
       
  1452 		{
       
  1453 		if(!iContainer)
       
  1454 			{
       
  1455  			aMenuPane->SetItemDimmed(EGotoMainView,ETrue);
       
  1456 			aMenuPane->SetItemDimmed(EStationDetailsCmd,ETrue);
       
  1457 			aMenuPane->SetItemDimmed(EFmRecOrPhone,ETrue);
       
  1458 			aMenuPane->SetItemDimmed(EAddtoStationsCmd,ETrue);
       
  1459 			aMenuPane->SetItemDimmed(EStereoMode,ETrue);
       
  1460 			aMenuPane->SetItemDimmed(EEqualizer,ETrue);
       
  1461 			aMenuPane->SetItemDimmed(EHistory,ETrue);
       
  1462 			aMenuPane->SetItemDimmed(EFindInShop,ETrue);
       
  1463             aMenuPane->SetItemDimmed(EGotoMusicStore, ETrue);
       
  1464 			aMenuPane->SetItemDimmed(ESettingsCmd,ETrue);
       
  1465 			aMenuPane->SetItemDimmed(EHelpCmd,ETrue);
       
  1466 			aMenuPane->SetItemDimmed(EExitCmd,ETrue);
       
  1467 			}
       
  1468 		else
       
  1469 			{
       
  1470 
       
  1471 			 if(iUi->GetPlsActiavted() && iUi->GetListenFromPls())
       
  1472 				{
       
  1473 				aMenuPane->SetItemDimmed(EGotoMainView,EFalse);
       
  1474 				}
       
  1475 			else
       
  1476 				{
       
  1477 				 aMenuPane->SetItemDimmed(EGotoMainView,ETrue);
       
  1478 				}
       
  1479 			#ifdef FF_FMTX
       
  1480 
       
  1481 				aMenuPane->SetItemDimmed(EFmRecOrPhone,EFalse);
       
  1482 			#else
       
  1483 
       
  1484 				aMenuPane->SetItemDimmed(EFmRecOrPhone,ETrue);
       
  1485 		     #endif
       
  1486 
       
  1487 #ifdef __IRA_FEATURE_EQUALIZER
       
  1488 			/**
       
  1489 			 * Activate "FindInShop" or "Goto MusicStore" only if iMpxFindInShop
       
  1490 			 * object is succcessfully created. Show "FindInShop" option for
       
  1491 			 * isds presets which has MetaData and MusicStoreEnalbed status as true.
       
  1492 			 * Otherwise show "Goto MusicStore".
       
  1493 			 */
       
  1494 			if (iMPXFindInShop)
       
  1495 				{
       
  1496 				if (iNowPlayingWrapper->iNowPlayingPreset->
       
  1497 				             GetChannelType() == CIRIsdsPreset::EIsdsPreset)
       
  1498 					{
       
  1499 					if (IsMetaData() && MusciStoreEnabledStatus() )
       
  1500 						{
       
  1501 						aMenuPane->SetItemDimmed(EFindInShop,EFalse);
       
  1502 						aMenuPane->SetItemDimmed(EGotoMusicStore, ETrue);
       
  1503 						}
       
  1504 					else
       
  1505 						{
       
  1506 					    aMenuPane->SetItemDimmed(EFindInShop,ETrue);
       
  1507 					    aMenuPane->SetItemDimmed(EGotoMusicStore, EFalse);
       
  1508 						}
       
  1509 					}
       
  1510 				else //preset is UserDefined
       
  1511 					{
       
  1512 					aMenuPane->SetItemDimmed(EFindInShop,ETrue);
       
  1513 					aMenuPane->SetItemDimmed(EGotoMusicStore, EFalse);
       
  1514 					}
       
  1515 				}
       
  1516 			else
       
  1517 #endif // __IRA_FEATURE_EQUALIZER
       
  1518 				{
       
  1519 				aMenuPane->SetItemDimmed(EFindInShop,ETrue);
       
  1520 				aMenuPane->SetItemDimmed(EGotoMusicStore, ETrue);
       
  1521 				}
       
  1522 
       
  1523 #ifdef __IRA_FEATURE_EQUALIZER
       
  1524 			if (iMpxEqualizerViewPlugin)
       
  1525 				{
       
  1526 				aMenuPane->SetItemDimmed(EEqualizer,EFalse);
       
  1527 				}
       
  1528 			else
       
  1529 #endif // __IRA_FEATURE_EQUALIZER
       
  1530 				{
       
  1531 				aMenuPane->SetItemDimmed(EEqualizer,ETrue);
       
  1532 				}
       
  1533 			}
       
  1534 		}
       
  1535 	if(aResourceId==R_NOW_SUBMENU)
       
  1536 		{
       
  1537 		if(iDs==EOnCmd)
       
  1538 			{
       
  1539 			aMenuPane->SetItemButtonState( EOnCmd,
       
  1540 			iIsOn?
       
  1541 			EEikMenuItemSymbolOn:
       
  1542 			EEikMenuItemSymbolIndeterminate );
       
  1543 			}
       
  1544 		if(iDs==EOffCmd)
       
  1545 			{
       
  1546 			aMenuPane->SetItemButtonState( EOffCmd,
       
  1547 			iIsOn?
       
  1548 			EEikMenuItemSymbolOn:
       
  1549 			EEikMenuItemSymbolIndeterminate );
       
  1550 			}
       
  1551 		}
       
  1552 	IRLOG_DEBUG( "CIRNowPlayingView::DynInitMenuPaneL - Exiting." );
       
  1553 	}
       
  1554 
       
  1555 // ---------------------------------------------------------
       
  1556 // CIRNowPlayingView::HandlePresetChangedL
       
  1557 // ---------------------------------------------------------
       
  1558 void CIRNowPlayingView::HandlePresetChangedL( TInt /*aId*/, TUid /*aDataHandler*/,
       
  1559 											  MPSPresetObserver::TPSReason /*aReason*/ )
       
  1560 	{
       
  1561 	IRLOG_DEBUG( "CIRNowPlayingView::HandlePresetChangedL - Entering." );
       
  1562 	if(iContainer)
       
  1563 	{
       
  1564 	if(iNowPlayingWrapper->GetView()==EFav)
       
  1565 		{
       
  1566 		TInt presetCount=iUi->iFavPresets->iFavPresetList.Count();
       
  1567 		if(presetCount==1||presetCount==0)
       
  1568 			{
       
  1569 			iShowToolBar=EFalse;
       
  1570 			}
       
  1571 		else
       
  1572 			{
       
  1573 			iShowToolBar=ETrue;
       
  1574 			}
       
  1575 		}
       
  1576 	ConstructToolbarL();
       
  1577 }
       
  1578 
       
  1579 	IRLOG_DEBUG( "CIRNowPlayingView::HandlePresetChangedL - Exiting." );
       
  1580 	}
       
  1581 
       
  1582 // ---------------------------------------------------------------------------
       
  1583 // CIRNowPlayingView::AddStationsL()
       
  1584 // Saves the currently playing station into fav DB
       
  1585 // ---------------------------------------------------------------------------
       
  1586 void CIRNowPlayingView::AddStationsL()
       
  1587 	{
       
  1588 	IRLOG_DEBUG( "CIRNowPlayingView::AddStationsL - Entering" );
       
  1589 	CIRUi* ui = reinterpret_cast<CIRUi*>( iCoeEnv->AppUi() );
       
  1590 	TInt returnVal;
       
  1591 	ui->iFavPresets->AddPresetL(*(iNowPlayingWrapper->iNowPlayingPreset),returnVal);
       
  1592 	if(returnVal==KErrNoMemory)
       
  1593 		{
       
  1594 		iIsdsWrapper->GetDialogLauncherInstance()->ShowErrorNoteL(R_IRAPP_ADDFAVOURITES_ERROR,ETrue);
       
  1595 		return;
       
  1596 		}
       
  1597 	else
       
  1598 		{
       
  1599 		if(iUi->iFavPresets->iFavPresetList.Count() == KPresetsArrayMaxLength)
       
  1600 			{
       
  1601 			iIsdsWrapper->GetDialogLauncherInstance()->ShowErrorNoteL
       
  1602 					(R_IRAPP_ADDFAVOURITES_ERROR,ETrue);
       
  1603 			return;
       
  1604 			}
       
  1605 		else
       
  1606 			{
       
  1607 			RBuf channel;
       
  1608 			HBufC* textResource = StringLoader::LoadLC(R_IRAPP_STATIONS_POPUP_SAVED,
       
  1609 													   iNowPlayingWrapper->iNowPlayingPreset->
       
  1610 													   GetName());
       
  1611 			channel.Create(*textResource);
       
  1612 			iIsdsWrapper->GetDialogLauncherInstance()->ShowConfirmationNoteL( channel,ETrue );
       
  1613 			CleanupStack::PopAndDestroy(textResource);
       
  1614 			channel.Close();
       
  1615 			}
       
  1616 		if(iUi->GetListenFromPls() && iUi->GetPlsSaved().Count())
       
  1617 			{
       
  1618 			iUi->GetPlsSaved()[iRockerIndex]=1;
       
  1619 			}
       
  1620 		}
       
  1621 	IRLOG_DEBUG( "CIRNowPlayingView::AddStationsL - Exiting." );
       
  1622 	}
       
  1623 
       
  1624 // CIRNowPlayingView::PresetLogoDownloadedL()
       
  1625 //----------------------------------------------------------------------------
       
  1626 // ---------------------------------------------------------------------------
       
  1627 //
       
  1628 void CIRNowPlayingView::PresetLogoDownloadedL(CIRIsdsPreset* aPreset)
       
  1629 	{
       
  1630 	IRLOG_DEBUG( "CIRNowPlayingView::PresetLogoDownloadedL - Entering" );
       
  1631 	TInt Iindex=KDefaultValue;
       
  1632 	TInt LogoDownloadedIndex=KDefault;
       
  1633 	/*if(iNowPlayingWrapper->iPlaying)
       
  1634 		{
       
  1635 		Iindex=aPreset->GetId();
       
  1636 		LogoDownloadedIndex=iNowPlayingWrapper->iNowPlayingPreset->GetId();
       
  1637 		if(Iindex==LogoDownloadedIndex && aPreset->GetLogoData().Length())
       
  1638 			{
       
  1639 			iNowPlayingWrapper->iNowPlayingPreset->SetLogoData(aPreset->GetLogoData());
       
  1640 			UpdateLastplayedL();
       
  1641 			}
       
  1642 		}*/
       
  1643 	if(iContainer)
       
  1644 	{
       
  1645 	if(iNowPlayingWrapper->GetView()==EFav)
       
  1646 		{
       
  1647 		Iindex = iUi->iFavPresets->SearchPreset(iNowPlayingWrapper->iNowPlayingPreset->
       
  1648 				   GetId(),iNowPlayingWrapper->
       
  1649 				   iNowPlayingPreset->UniqId());
       
  1650 		LogoDownloadedIndex= iUi->iFavPresets->SearchPreset(aPreset->GetId()
       
  1651 					   ,aPreset->UniqId());
       
  1652 		}
       
  1653 	else if(iNowPlayingWrapper->GetView()==EStations
       
  1654 	   || iNowPlayingWrapper->GetView()==EBrowseByTopStations
       
  1655 	   ||iNowPlayingWrapper->GetView()==ESearch)
       
  1656 		{
       
  1657 		Iindex=aPreset->GetId();
       
  1658 		LogoDownloadedIndex=iNowPlayingWrapper->iNowPlayingPreset->GetId();
       
  1659 		}
       
  1660 	else
       
  1661 		{
       
  1662 		Iindex=0;
       
  1663 		LogoDownloadedIndex=0;
       
  1664 		}
       
  1665 	if(LogoDownloadedIndex==Iindex)
       
  1666 	{
       
  1667 		iStationHasLogo=ETrue;
       
  1668 		if(iPrecount==0||iNowPlayingWrapper->GetView()==ELastplayed)
       
  1669 			{
       
  1670 			iDefaultLogo=EFalse;
       
  1671 			if(aPreset->GetLogoData() != KNullDesC8 )
       
  1672 				{
       
  1673 				*iCurrentPreset=*aPreset;
       
  1674 				iPrecount++;
       
  1675 				}
       
  1676 			}
       
  1677 	else
       
  1678 		{
       
  1679 		if(!iDefaultLogo)
       
  1680 			{
       
  1681 			*iPrevPreset1=*iCurrentPreset;
       
  1682 			}
       
  1683 		*iCurrentPreset=*aPreset;
       
  1684 		}
       
  1685 
       
  1686 	if ( iUi->CheckAndNotifyLowDiskSpaceL() )
       
  1687 		{
       
  1688 		return;
       
  1689 		}
       
  1690 
       
  1691 	if(iNowPlayingWrapper->GetView()==EHistoryView||iNowPlayingWrapper->GetView()==ESearch
       
  1692 	   || iNowPlayingWrapper->GetView()==EFav||iNowPlayingWrapper->GetView()==EStations
       
  1693 	   || iNowPlayingWrapper->GetView()==EBrowseByTopStations
       
  1694 	   ||iNowPlayingWrapper->GetView()==ELastplayed||iNowPlayingWrapper->GetView()==EPls)
       
  1695 			{
       
  1696 			UpdateStationLogosL();
       
  1697 			DisplaylogoL();
       
  1698 			}
       
  1699 	}
       
  1700 	IRLOG_DEBUG( "CIRNowPlayingView::PresetLogoDownloadedL - Exiting" );
       
  1701 	}
       
  1702 	}
       
  1703 
       
  1704 
       
  1705 // CIRNowPlayingView::PresetLogoDownloadError()
       
  1706 //----------------------------------------------------------------------------
       
  1707 // ---------------------------------------------------------------------------
       
  1708 //
       
  1709 void CIRNowPlayingView::PresetLogoDownloadError(CIRIsdsPreset* /*aPreset*/)
       
  1710 	{
       
  1711 	IRLOG_DEBUG( "CIRNowPlayingView::PresetLogoDownloadErrorL");
       
  1712 	//TO Do:implementation need to done for handling Media animation
       
  1713 	iStationHasLogo=EFalse;
       
  1714 	//TRAP_IGNORE(DrawViewL(iStationHasLogo))
       
  1715 	}
       
  1716 
       
  1717 // ---------------------------------------------------------------------------
       
  1718 // CIRNowPlayingView::ConstructToolbarL
       
  1719 // Simulate user pressing play immediately when came into this view.
       
  1720 // ---------------------------------------------------------------------------
       
  1721 //
       
  1722 void CIRNowPlayingView::ConstructToolbarL()
       
  1723 	{
       
  1724 	IRLOG_DEBUG( "CIRNowPlayingView::ConstructToolbarL - Entering" );
       
  1725 	TInt bitmapId;
       
  1726 	TInt maskId;
       
  1727 	if ( AknLayoutUtils::PenEnabled() )
       
  1728 		{
       
  1729 		iToolbar = this->Toolbar();
       
  1730 		if ( iToolbar )
       
  1731 			{
       
  1732 			iToolbar->SetToolbarObserver( this );
       
  1733 			if(iToolbar)
       
  1734 				{
       
  1735 
       
  1736 				bitmapId=iUi->ChooseToolBarBitmaps(EMbmInternetradioQgn_indi_tb_previous,
       
  1737 				EMbmInternetradioQgn_indi_tb_previous_white);
       
  1738 
       
  1739 				maskId=iUi->ChooseToolBarMaskId(EMbmInternetradioQgn_indi_tb_previous_mask,
       
  1740 				EMbmInternetradioQgn_indi_tb_previous_white_mask);
       
  1741 
       
  1742 				// There are no presets or the only preset is active
       
  1743 				HBufC* previousToolTipText =
       
  1744 				CCoeEnv::Static()->AllocReadResourceLC(R_IR_NOW_TOOLTIP_PREVIOUS);
       
  1745 				CAknButton*  	 button1 = CAknButton::NewL(KIRMifFileName,bitmapId,
       
  1746 				maskId,0,0,bitmapId,maskId,bitmapId,maskId,KNullDesC ,
       
  1747 				*previousToolTipText,0,0,KAknsIIDNone,KAknsIIDNone,KAknsIIDNone,KAknsIIDNone);
       
  1748 
       
  1749 				CleanupStack::PopAndDestroy(previousToolTipText);
       
  1750 				CleanupStack::PushL(button1);
       
  1751 				iToolbar->AddItemL( button1, EAknCtButton, EIRCmdStepPrevPreset, 0, 0 );
       
  1752 				CleanupStack::Pop(button1);
       
  1753 
       
  1754 				if(!iNowPlayingWrapper->iPlaying)
       
  1755 					{
       
  1756 					bitmapId=iUi->ChooseToolBarBitmaps(EMbmInternetradioQgn_indi_tb_play,
       
  1757 					EMbmInternetradioQgn_indi_tb_play_white);
       
  1758 
       
  1759 					maskId=iUi->ChooseToolBarMaskId(EMbmInternetradioQgn_indi_tb_play_mask,
       
  1760 					EMbmInternetradioQgn_indi_tb_play_white_mask);
       
  1761 
       
  1762 					HBufC* playToolTipText = CCoeEnv::Static()->AllocReadResourceLC( R_IR_NOW_TOOLTIP_PLAY);
       
  1763 					CAknButton*    button2 = CAknButton::NewL(KIRMifFileName,bitmapId,
       
  1764 					maskId,0,0,bitmapId,maskId,bitmapId,maskId,KNullDesC ,
       
  1765 					*playToolTipText,0,0,KAknsIIDNone,KAknsIIDNone,KAknsIIDNone,KAknsIIDNone);
       
  1766 
       
  1767 					CleanupStack::PopAndDestroy(playToolTipText);
       
  1768 					CleanupStack::PushL(button2);
       
  1769 					iToolbar->AddItemL(button2, EAknCtButton, EIRCmdPlay, 0, 1 );
       
  1770 					CleanupStack::Pop(button2);
       
  1771 					}
       
  1772 				else
       
  1773 					{
       
  1774 
       
  1775 					bitmapId=iUi->ChooseToolBarBitmaps(EMbmInternetradioQgn_indi_tb_stop,
       
  1776 					EMbmInternetradioQgn_indi_tb_stop_white);
       
  1777 
       
  1778 					maskId=iUi->ChooseToolBarMaskId(EMbmInternetradioQgn_indi_tb_stop_mask,
       
  1779 					EMbmInternetradioQgn_indi_tb_stop_white_mask);
       
  1780 
       
  1781 					HBufC* stopToolTipText = CCoeEnv::Static()->AllocReadResourceLC( R_IR_NOW_TOOLTIP_STOP);
       
  1782 					CAknButton*    button2 = CAknButton::NewL(KIRMifFileName,bitmapId,
       
  1783 					maskId,0,0,bitmapId,maskId,bitmapId,maskId,KNullDesC
       
  1784 					,*stopToolTipText,0,0,KAknsIIDNone,KAknsIIDNone,KAknsIIDNone,KAknsIIDNone);
       
  1785 
       
  1786 					CleanupStack::PopAndDestroy(stopToolTipText);
       
  1787 					CleanupStack::PushL(button2);
       
  1788 					iToolbar->AddItemL(button2, EAknCtButton, EIRCmdStop, 0, 1 );
       
  1789 					CleanupStack::Pop(button2);
       
  1790 					}
       
  1791 
       
  1792 
       
  1793 				bitmapId=iUi->ChooseToolBarBitmaps(EMbmInternetradioQgn_indi_tb_next,
       
  1794 				EMbmInternetradioQgn_indi_tb_next_white);
       
  1795 
       
  1796 				maskId=iUi->ChooseToolBarMaskId(EMbmInternetradioQgn_indi_tb_next_mask,
       
  1797 				EMbmInternetradioQgn_indi_tb_next_white_mask);
       
  1798 
       
  1799 				HBufC* nextToolTipText1 = CCoeEnv::Static()->AllocReadResourceLC(R_IR_NOW_TOOLTIP_NEXT);
       
  1800 				CAknButton*   button3 = CAknButton::NewL(KIRMifFileName,bitmapId,
       
  1801 				maskId,	0,0,bitmapId,maskId,bitmapId,maskId,KNullDesC ,
       
  1802 				*nextToolTipText1,0,0,KAknsIIDNone,KAknsIIDNone,KAknsIIDNone,KAknsIIDNone);
       
  1803 
       
  1804 				CleanupStack::PopAndDestroy(nextToolTipText1);
       
  1805 				CleanupStack::PushL(button3);
       
  1806 				iToolbar->AddItemL(button3, EAknCtButton, EIRCmdStepNextPreset, 0, 2 );
       
  1807 				CleanupStack::Pop(button3);
       
  1808 
       
  1809 				// Take toolbar control event handling from touch pane.
       
  1810 				// Events need to be forwarded to touch pane manually.
       
  1811 				iToolbar->SetToolbarVisibility(ETrue, EFalse);
       
  1812 				}
       
  1813 			if(!iShowToolBar)
       
  1814 				{
       
  1815 				iToolbar->SetItemDimmed(EIRCmdStepNextPreset,ETrue,ETrue);
       
  1816 				iToolbar->SetItemDimmed(EIRCmdStepPrevPreset,ETrue,ETrue);
       
  1817 				}
       
  1818 			if(iUi->IsCallActive())
       
  1819 				{
       
  1820 				if(!iNowPlayingWrapper->iPlaying)
       
  1821 					{
       
  1822 					iToolbar->SetItemDimmed(EIRCmdPlay,ETrue,ETrue);
       
  1823 					}
       
  1824 				else
       
  1825 					{
       
  1826 					iToolbar->SetItemDimmed(EIRCmdStop,ETrue,ETrue);
       
  1827 					}
       
  1828 				}
       
  1829 
       
  1830 			}
       
  1831 		}
       
  1832 	IRLOG_DEBUG( "CIRNowPlayingView::ConstructToolbarL - Exiting" );
       
  1833 	}
       
  1834 
       
  1835 
       
  1836 // --------------------------------------------------------------------------
       
  1837 // CIRNowPlayingView::OfferToolbarEventL
       
  1838 // --------------------------------------------------------------------------
       
  1839 //
       
  1840 void CIRNowPlayingView::OfferToolbarEventL( TInt aCommand )
       
  1841 	{
       
  1842 	IRLOG_DEBUG( "CIRNowPlayingView::OfferToolbarEventL - Entering" );
       
  1843 	HandleCommandL(aCommand);
       
  1844 	IRLOG_DEBUG( "CIRNowPlayingView::OfferToolbarEventL - Exiting" );
       
  1845 	}
       
  1846 // ---------------------------------------------------------------------------
       
  1847 // CIRNowPlayingView::Displaylogo
       
  1848 // Simulate user pressing play immediately when came into this view.
       
  1849 // ---------------------------------------------------------------------------
       
  1850 //
       
  1851 void CIRNowPlayingView::DisplaylogoL()
       
  1852 	{
       
  1853 	IRLOG_DEBUG( "CIRNowPlayingView::DisplaylogoL - Entering" );
       
  1854 	if(iContainer)
       
  1855 		{
       
  1856 		iStationHasLogo=ETrue;
       
  1857 		if(iNowPlayingWrapper->GetView()==EFav||iNowPlayingWrapper->GetView()==ESearch
       
  1858 		||iNowPlayingWrapper->GetView()==EStations
       
  1859 		|| iNowPlayingWrapper->GetView()==EBrowseByTopStations
       
  1860 		|| iNowPlayingWrapper->GetView()==EPls)
       
  1861 			{
       
  1862 			iStationHasLogo=iContainer->StationLogoControl().SwitchToLogoL( iLogoIndex );
       
  1863 			}
       
  1864 	else if(iNowPlayingWrapper->GetView()==ELastplayed
       
  1865 	||iNowPlayingWrapper->GetView()==EHistoryView)
       
  1866 		{
       
  1867 		iStationHasLogo=iContainer->StationLogoControl().SwitchToLogoL( iIndex );
       
  1868 		}
       
  1869 
       
  1870 		}
       
  1871 	IRLOG_DEBUG( "CIRNowPlayingView::DisplaylogoL - Exiting" );
       
  1872 	}
       
  1873 
       
  1874 // ---------------------------------------------------------------------------
       
  1875 // From MIRLogoControlObserver.
       
  1876 // CIRNowPlayingView::LogoReadyForDisplayL
       
  1877 // ---------------------------------------------------------------------------
       
  1878 //
       
  1879 void CIRNowPlayingView::LogoReadyForDisplayL()
       
  1880     {
       
  1881     IRLOG_DEBUG( " CIRNowPlayingView::LogoReadyForDisplayL " );
       
  1882     if ( iContainer->RadioIdle().State() != CIRRadioIdle::EStopped )
       
  1883         {
       
  1884         iContainer->RadioIdle().HandleCommandL( EShutdown );
       
  1885         }
       
  1886     }
       
  1887 
       
  1888 // ---------------------------------------------------------------------------
       
  1889 // From MIRLogoControlObserver.
       
  1890 // CIRNowPlayingView::LogoConversionFailedL
       
  1891 // ---------------------------------------------------------------------------
       
  1892 //
       
  1893 void CIRNowPlayingView::LogoConversionFailedL()
       
  1894     {
       
  1895     IRLOG_DEBUG( "CIRNowPlayingView::LogoConversionFailedL " );
       
  1896     if ( iContainer->RadioIdle().State() == CIRRadioIdle::EStopped )
       
  1897         {
       
  1898         iContainer->RadioIdle().HandleCommandL( EStartup );
       
  1899         }
       
  1900     }
       
  1901 
       
  1902 // ---------------------------------------------------------------------------
       
  1903 // CIRNowPlayingView::GetLogo
       
  1904 // Simulate user pressing play immediately when came into this view.
       
  1905 // ---------------------------------------------------------------------------
       
  1906 //
       
  1907 void CIRNowPlayingView::GetLogoL()
       
  1908 	{
       
  1909 	IRLOG_DEBUG( "CIRNowPlayingView::GetLogoL - Entering" );
       
  1910 	if(iContainer)
       
  1911 	{
       
  1912 	iLogoIndex=iRockerIndex;
       
  1913 	if(iNowPlayingWrapper->iNowPlayingPreset->GetImgUrl().Length() != 0)
       
  1914 		{
       
  1915 		iUi->iIsdsWrapper->GetISDSInstance()->GetDataProvider()->GetHttpDataProvider()->
       
  1916 		GetLogoDownloadEngine()->SendRequestL(iNowPlayingWrapper->iNowPlayingPreset,
       
  1917 						this,KTwo,KSize,KSize);
       
  1918 		}
       
  1919 
       
  1920 	else
       
  1921 		{
       
  1922 		iStationHasLogo=EFalse;
       
  1923 		iDefaultLogo=ETrue;
       
  1924 		}
       
  1925 
       
  1926 	}
       
  1927 	IRLOG_DEBUG( "CIRNowPlayingView::GetLogoL - Exiting" );
       
  1928 
       
  1929 	}
       
  1930 // ---------------------------------------------------------
       
  1931 // CIRNowPlayingView::HandleForegroundEventL
       
  1932 // ---------------------------------------------------------
       
  1933 //
       
  1934 void CIRNowPlayingView::HandleForegroundEventL(TBool aForeground)
       
  1935 	{
       
  1936 	IRLOG_DEBUG2(" *** S60InternetRadio -- CIRNowPlayingView::HandleForegroundEventL(%d)",aForeground);
       
  1937 
       
  1938 	CIRBaseView::HandleForegroundEventL(aForeground);
       
  1939 
       
  1940     if (aForeground)
       
  1941         {
       
  1942 		if (iStartUp)
       
  1943 			{
       
  1944 			CIRUi* appUi = static_cast<CIRUi*>( AppUi() );
       
  1945 
       
  1946 			iStartUp = EFalse;
       
  1947 			if(appUi->SystemEventCollector().IsNetworkCoverage())
       
  1948 				{
       
  1949 				HandleSystemEventL(EIRNetworkCoverageUp);
       
  1950 				}
       
  1951 			else
       
  1952 			{
       
  1953 			HandleSystemEventL(EIRNetworkCoverageDown);
       
  1954 			}
       
  1955 			if(!iEaualizerOn)
       
  1956 				{
       
  1957 				if(iContainer && !iCallActive)
       
  1958 					{
       
  1959 					iFadeStyle=EIRFadeUnknown;
       
  1960 			delete iConnectionCleanupTimer;
       
  1961 			iConnectionCleanupTimer = NULL;
       
  1962         TRAPD( err, iConnectionCleanupTimer = CPeriodic::NewL( CActive::EPriorityStandard ) )
       
  1963         if ( err == KErrNone )
       
  1964             {
       
  1965             iConnectionCleanupTimer->Start( KWaitTimeInMicroSeconds, 0,
       
  1966             			 TCallBack( StaticConnectionCleanupCallback, this ) );
       
  1967             }
       
  1968 					}
       
  1969 				}
       
  1970 			}
       
  1971 		else
       
  1972 		{
       
  1973 		if(!iEaualizerOn)
       
  1974 			{
       
  1975 			if(	iContainer && !iCallActive)
       
  1976 				{
       
  1977 				if ( iContainer )
       
  1978 	                {
       
  1979 	                iContainer->LayoutControl();
       
  1980 	                }
       
  1981 				iFadeStyle=EIRFadeNoFade;
       
  1982 				DrawViewL(iStationHasLogo);
       
  1983 
       
  1984 				}
       
  1985 
       
  1986 			}
       
  1987 		}
       
  1988 		}
       
  1989 	else
       
  1990 		{
       
  1991 		if(iContainer)
       
  1992 			{
       
  1993 			CAlfEnv* env = CAlfEnv::Static();
       
  1994 			if ( env )
       
  1995 				{
       
  1996 				iContainer->RadioIdle().HandleCommandL( EShutdown );
       
  1997 				}
       
  1998 			}
       
  1999 
       
  2000 		/*if(iContainer)
       
  2001 			{
       
  2002 			if(iVolPopup->IsVisible())
       
  2003 				{
       
  2004 				iVolPopup->CloseVolumePopup();
       
  2005 				}
       
  2006 			}*/
       
  2007 		}
       
  2008 }
       
  2009 
       
  2010 // ---------------------------------------------------------
       
  2011 // CIRNowPlayingView::Draw
       
  2012 // ---------------------------------------------------------
       
  2013 //
       
  2014 void CIRNowPlayingView::DrawViewL( TBool aLogoStatus )
       
  2015 	{
       
  2016 	IRLOG_DEBUG( "CIRNowPlayingView::DrawViewL - Entering" );
       
  2017 	if(iContainer)
       
  2018 	{
       
  2019 	if(iBuffer!=KNullDesC)
       
  2020 		{
       
  2021 			CIRStationInformationData* data = CIRStationInformationData::NewL( *iCoeEnv );
       
  2022 			CleanupStack::PushL( data );
       
  2023 			CIRStationInformationDisplay& display = iContainer->StationInformationDisplay();
       
  2024 			data->SetFadeDirectionality( iFadeStyle );
       
  2025 			data->SetNameL(iBuffer);
       
  2026 			if(iMetadata!=KNullDesC)
       
  2027 				{
       
  2028 				data->SetRdsPsNameL(iMetadata);
       
  2029 				}
       
  2030 			if(iNowPlayingWrapper->GetView()==EFav)
       
  2031 			{
       
  2032 			if(iIndex>=0)
       
  2033 			data->SetIndexL(iIndex);
       
  2034 			}
       
  2035 		RBuf bitrate;
       
  2036 		bitrate.CleanupClosePushL();
       
  2037 	if(iShowBitrate || iNowPlayingWrapper->iPlaying)
       
  2038 		{
       
  2039 		TInt bitRate(0);
       
  2040 		RProperty::Get ( KUidActiveInternetRadioApp, KIRPSBitrate, bitRate );
       
  2041 		HBufC* BitRate = StringLoader::LoadLC(R_IRAPP_NOWPLAYING_BITRATE, bitRate);
       
  2042 		bitrate.Create(BitRate->Length());
       
  2043 		bitrate.Copy(*BitRate);
       
  2044 		CleanupStack::PopAndDestroy(BitRate);
       
  2045 		DisplayBitrate(bitrate);
       
  2046 		}
       
  2047 	///displaying the byte counter///////
       
  2048 	iUi->UpdateNowPlayingByteCounter();
       
  2049 	iContainer->StationLogoControl().SetLogoFadeStyle( iFadeStyle );
       
  2050 		if( iFadeStyle == EIRFadeNoFade
       
  2051 		&& iContainer->RadioIdle().State() != CIRRadioIdle::EStopped )
       
  2052 			{
       
  2053 			if(iNowPlayingWrapper->iPlaying)
       
  2054 				{
       
  2055 				iContainer->RadioIdle().UpdateRadioIdleContent( bitrate,iBitrateIndex  );
       
  2056 				}
       
  2057 			else
       
  2058 				{
       
  2059 				iContainer->RadioIdle().UpdateRadioIdleContent( data->Name(),iBitrateIndex );
       
  2060 				}
       
  2061 			iContainer->RadioIdle().UpdateRadioIdleContent( data->Name(),	iNameIndex  );
       
  2062 			iContainer->RadioIdle().UpdateRadioIdleContent( data->Name(),iNameIndex1 );
       
  2063 			iContainer->RadioIdle().UpdateRadioIdleContent( data->RdsPsName(),iMetadataIndex  ); // Rds
       
  2064 			if(iNowPlayingWrapper->iNowPlayingPreset->GetGenreName().Length())
       
  2065 				{
       
  2066 				iContainer->RadioIdle().UpdateRadioIdleContent(
       
  2067 				iNowPlayingWrapper->iNowPlayingPreset->GetGenreName(),iPSNameIndex );
       
  2068 				}
       
  2069 			else
       
  2070 				{
       
  2071 				iContainer->RadioIdle().UpdateRadioIdleContent( data->Name(),iPSNameIndex); // PS name, updated later
       
  2072 				}
       
  2073 			}
       
  2074 		else
       
  2075 			{
       
  2076 			switch ( iFadeStyle )
       
  2077 				{
       
  2078 				case EIRFadeLeftToRight:
       
  2079 				iContainer->RadioIdle().SetIdleFadeStyle( CIRRadioIdle::EFadeRight );
       
  2080 				break;
       
  2081 				case EIRFadeRightToLeft:
       
  2082 				iContainer->RadioIdle().SetIdleFadeStyle( CIRRadioIdle::EFadeLeft );
       
  2083 				break;
       
  2084 				case EIRFadeNoFade:
       
  2085 				iContainer->RadioIdle().SetIdleFadeStyle( CIRRadioIdle::EFadeStyleNone );
       
  2086 				break;
       
  2087 				default:
       
  2088 				break;
       
  2089 				}
       
  2090 			if(!aLogoStatus)
       
  2091 				{
       
  2092 				iContainer->StationLogoControl().FadeOutLogo(iRockerIndex);
       
  2093 				}
       
  2094 			if ( iContainer->RadioIdle().State() != CIRRadioIdle::EStopped )
       
  2095 				{
       
  2096 				iContainer->RadioIdle().HandleCommandL( EShutdown );
       
  2097 				}
       
  2098 			// Tuned to new station which has no logo, set data and start radio idle.
       
  2099 			/*lint -save -e744 (Info -- Boolean within 'left side of && within if' always evaluates to True)*/
       
  2100 			iContainer->RadioIdle().HandleCommandL( EResetContent );
       
  2101 			if ( !aLogoStatus )
       
  2102 			/*lint -restore*/
       
  2103 				{
       
  2104 
       
  2105 				if(iNowPlayingWrapper->iPlaying)
       
  2106 					{
       
  2107 					iBitrateIndex = iContainer->RadioIdle().AddRadioIdleContentL( bitrate );
       
  2108 					}
       
  2109 				else
       
  2110 					{
       
  2111 					iBitrateIndex=iContainer->RadioIdle().AddRadioIdleContentL( data->Name() );
       
  2112 					}
       
  2113 				iNameIndex = iContainer->RadioIdle().AddRadioIdleContentL( data->Name() );
       
  2114 				iNameIndex1=iContainer->RadioIdle().AddRadioIdleContentL( data->Name() );
       
  2115 				iMetadataIndex = iContainer->RadioIdle().AddRadioIdleContentL( data->RdsPsName() ); // Rds
       
  2116 				if(iNowPlayingWrapper->iNowPlayingPreset->GetGenreName().Length())
       
  2117 					{
       
  2118 					iPSNameIndex = iContainer->RadioIdle().AddRadioIdleContentL(
       
  2119 					iNowPlayingWrapper->iNowPlayingPreset->GetGenreName());
       
  2120 					}
       
  2121 				else
       
  2122 					{
       
  2123 					iPSNameIndex = iContainer->RadioIdle().AddRadioIdleContentL( data->Name()); // PS name, updated later
       
  2124 					}
       
  2125 				}
       
  2126 
       
  2127 			}
       
  2128        if ( !aLogoStatus && iContainer->RadioIdle().State() == CIRRadioIdle::EStopped )
       
  2129 	       {
       
  2130 	       iContainer->RadioIdle().HandleCommandL( EStartup );
       
  2131 	       }
       
  2132        else if(aLogoStatus)
       
  2133 	       {
       
  2134 	       DisplaylogoL();
       
  2135 	       }
       
  2136 		display.SetDisplayedDataL( *data );
       
  2137 		CleanupStack::PopAndDestroy(&bitrate);
       
  2138 		CleanupStack::PopAndDestroy( data );
       
  2139 		iStationHasLogo=aLogoStatus;
       
  2140 		}
       
  2141 		}
       
  2142 	IRLOG_DEBUG( "CIRNowPlayingView::DrawViewL - Exiting" );
       
  2143 	}
       
  2144 // ---------------------------------------------------------------------------
       
  2145 // void CIRNowPlayingView::StartTimerL()
       
  2146 // ---------------------------------------------------------------------------
       
  2147 //
       
  2148 void CIRNowPlayingView::StartTimerL()
       
  2149 	{
       
  2150 	IRLOG_DEBUG( "CIRNowPlayingView::StartTimerL - Entering" );
       
  2151 	iBuffer.Close();
       
  2152 	iBuffer.Create(iNowPlayingWrapper->iNowPlayingPreset->GetName().Length()+ KPresetNumbering);
       
  2153 	iBuffer.Append(iNowPlayingWrapper->iNowPlayingPreset->GetName());
       
  2154 	if(!iSameUrl)
       
  2155 		{
       
  2156 		iNowPlayingWrapper->SetMarquee(EFalse);
       
  2157 		iNowPlayingWrapper->SetMedadataForErrotrConditions(ETrue);
       
  2158 		DisplaySongArtistNameL(KConst1,KConst1);
       
  2159 		//iNowPlayingWrapper->SetMetadataL()
       
  2160 		}
       
  2161 	iSameUrl=EFalse;
       
  2162 	iStationHasLogo=EFalse;
       
  2163 
       
  2164 	DrawViewL(iStationHasLogo);
       
  2165 	GetLogoL();
       
  2166 	IRLOG_DEBUG( "CIRNowPlayingView::StartTimerL - Exiting" );
       
  2167 	}
       
  2168 // ---------------------------------------------------------------------------
       
  2169 // void CIRNowPlayingView::ReFreshView()
       
  2170 // ---------------------------------------------------------------------------
       
  2171 //
       
  2172 void CIRNowPlayingView::ReFreshViewL()
       
  2173 	{
       
  2174 	IRLOG_DEBUG( "CIRNowPlayingView::ReFreshViewL - Entering" );
       
  2175 	if ( iContainer )
       
  2176 		{
       
  2177         DrawViewL(iStationHasLogo);
       
  2178 		}
       
  2179 	IRLOG_DEBUG( "CIRNowPlayingView::ReFreshView - Exiting." );
       
  2180 	}
       
  2181 // ---------------------------------------------------------------------------
       
  2182 // void CIRNowPlayingView::ResponseL()
       
  2183 // ---------------------------------------------------------------------------
       
  2184 //
       
  2185 void CIRNowPlayingView::ResponseL(CIRIsdsPreset* /*aPreset*/)
       
  2186 	{
       
  2187 	IRLOG_DEBUG( "CIRNowPlayingView::ResponseL " );
       
  2188 	//TO DO :: The line can be removed in future written to fix
       
  2189 	// Code Scanner ERROR
       
  2190 		return;
       
  2191 	//no implementation
       
  2192 	}
       
  2193 // ---------------------------------------------------------------------------
       
  2194 // void CIRNowPlayingView::PresetResponseL()
       
  2195 //Callback To Receive ISDS Preset
       
  2196 // ---------------------------------------------------------------------------
       
  2197 //
       
  2198 void CIRNowPlayingView::PresetResponseL(CIRIsdsPreset* aPreset)
       
  2199 	{
       
  2200 	IRLOG_DEBUG( "CIRNowPlayingView::PresetResponseL - Entering" );
       
  2201 
       
  2202 	if ( !iUi->CheckAndNotifyLowDiskSpaceL() )
       
  2203 		{
       
  2204 		// TO Do
       
  2205 		// Check the condition in If
       
  2206 		//!iNowPlayingWrapper->GetWhenUserCancelsIsdsBufferingWaitBar()
       
  2207 			iNowPlayingWrapper->SetListenFromIsdsValue(ETrue);
       
  2208 			iNowPlayingWrapper->ListenToChannelL(aPreset);
       
  2209 			StartTimerL();
       
  2210 		}
       
  2211 	IRLOG_DEBUG( "CIRNowPlayingView::PresetResponseL - Exiting" );
       
  2212 	}
       
  2213 // ---------------------------------------------------------------------------
       
  2214 // void CIRNowPlayingView::SetsameUrlFlag()
       
  2215 //For displaing the metadata
       
  2216 // ---------------------------------------------------------------------------
       
  2217 //
       
  2218 void CIRNowPlayingView::SetsameUrlFlag(TBool aSameUrl)
       
  2219 	{
       
  2220 	IRLOG_DEBUG( "CIRNowPlayingView::SetsameUrlFlag - Entering" );
       
  2221 	iSameUrl=aSameUrl;
       
  2222 	IRLOG_DEBUG( "CIRNowPlayingView::SetsameUrlFlag - Exiting" );
       
  2223 	}
       
  2224 // ---------------------------------------------------------------------------
       
  2225 // void CIRNowPlayingView::SetsameUrlFlag()
       
  2226 //For displaing the metadata
       
  2227 // ---------------------------------------------------------------------------
       
  2228 //
       
  2229 TInt CIRNowPlayingView::GetsameUrlFlag()
       
  2230 	{
       
  2231 	IRLOG_DEBUG( "CIRNowPlayingView::SetsameUrlFlag - Entering" );
       
  2232 	IRLOG_DEBUG( "CIRNowPlayingView::SetsameUrlFlag - Exiting" );
       
  2233 	return iSameUrl;
       
  2234 	}
       
  2235 
       
  2236 // ---------------------------------------------------------------------------
       
  2237 // void CIRNowPlayingView::ErrorL()
       
  2238 // ---------------------------------------------------------------------------
       
  2239 //
       
  2240 void CIRNowPlayingView::ErrorL()
       
  2241 	{
       
  2242 	IRLOG_DEBUG( "CIRNowPlayingView::ErrorL - Entering" );
       
  2243 	if(iIsdsWrapper->GetListenRequest())
       
  2244 		{
       
  2245 		iRockerIndex=iPresetCount;
       
  2246 		iUi->GetPubSubManagerInstance()->PublishBufferingState(EIRStateBufferingError);
       
  2247 		iNowPlayingWrapper->DestroyWaitDialogL();
       
  2248 		iIsdsWrapper->SetListenRequest(EFalse);
       
  2249 		}
       
  2250 	if(iIsdsWrapper->iConnTimeOut)
       
  2251 		{
       
  2252 		iIsdsWrapper->iConnTimeOut = EFalse;
       
  2253 		}
       
  2254 	if(iIsdsWrapper->iDialogDismissed)
       
  2255 		{
       
  2256 		iIsdsWrapper->iDialogDismissed=EFalse;
       
  2257 		iRockerIndex=iPresetCount;
       
  2258 		}
       
  2259 	if(iUi->iNowPlayingWrapper->iSyncPreset)
       
  2260 		{
       
  2261 		iRockerIndex=iPresetCount;
       
  2262 		iNowPlayingWrapper->DestroyWaitDialogL();
       
  2263 		iUi->iNowPlayingWrapper->iSyncPreset=EFalse;
       
  2264 		}
       
  2265 	//TO DO :: The line can be removed in future nad written to fix
       
  2266 	// Code Scanner ERROR
       
  2267       IRLOG_DEBUG( "CIRNowPlayingView::ErrorL - Exiting" );
       
  2268       return;
       
  2269 	}
       
  2270 // ---------------------------------------------------------------------------
       
  2271 // void CIRNowPlayingView::GetStereoModeL()
       
  2272 // Used Getting the status of Stereo Mode
       
  2273 // ---------------------------------------------------------------------------
       
  2274 //
       
  2275 void CIRNowPlayingView::GetStereoModeL()
       
  2276 	{
       
  2277 	IRLOG_DEBUG( "CIRNowPlayingView::GetStereoModeL - Entering" );
       
  2278 	iStereoMode=iIRSettings->GetStereoMode();
       
  2279 	if(iStereoMode)
       
  2280 		{
       
  2281 		iDs=EOnCmd;
       
  2282 
       
  2283 		//Used for later in implementing Stereo mode Functionality
       
  2284 
       
  2285 		if(!iStereoEffect)  // If stereo widening is ON and not constructed
       
  2286 				{
       
  2287 				TUint stereoLevel = KHundred;
       
  2288 				// cmdUtil ownership passed into new object
       
  2289 				TRAPD(error,iStereoEffect = CStereoWidening::NewL(
       
  2290 				*(iNowPlayingWrapper->GetMediaClientInstance()->GetPlayerInstance()),EFalse, stereoLevel));
       
  2291 				if(error)
       
  2292 					{
       
  2293 					iStereoEffect = NULL;
       
  2294 					User::Leave(KErrNotSupported);
       
  2295 					}
       
  2296 				}
       
  2297 		if(iNowPlayingWrapper->iPlaying)
       
  2298 			{
       
  2299 			iStereoEffect->EnableL();
       
  2300 			TUint8 level = KHundred;
       
  2301 			iStereoEffect->SetStereoWideningLevelL( level );
       
  2302 			iStereoEffect->ApplyL();
       
  2303 			}
       
  2304 		}
       
  2305 	else
       
  2306 		{
       
  2307 		iDs=EOffCmd;
       
  2308 
       
  2309 		//For future use
       
  2310 		//Used for later in implementing Stereo mode Functionality
       
  2311 
       
  2312 		if (iStereoEffect)   // If audio effects was not on, then no need to disable
       
  2313 			{
       
  2314 			if(iNowPlayingWrapper->iPlaying)
       
  2315 				{
       
  2316 				iStereoEffect->DisableL();
       
  2317 				}
       
  2318 			}
       
  2319 
       
  2320 		}
       
  2321 
       
  2322 	IRLOG_DEBUG( "CIRNowPlayingView::GetStereoModeL - Exiting" );
       
  2323 }
       
  2324 
       
  2325 // ---------------------------------------------------------------------------
       
  2326 // void CIRNowPlayingView::LaunchMusicShopL()
       
  2327 // ---------------------------------------------------------------------------
       
  2328 //
       
  2329 void CIRNowPlayingView::LaunchMusicShopL()
       
  2330 	{
       
  2331 #ifdef MUSICSHOP_AVAILABLE
       
  2332 	  IRLOG_DEBUG( "Entered CIRNowPlayingView::LaunchMusicShopL - Entering" );
       
  2333 
       
  2334 	  TApaTaskList tasList( iCoeEnv->WsSession() );
       
  2335 	  TApaTask task = tasList.FindApp( KUidMusicStore );
       
  2336 
       
  2337 	  if ( task.Exists() )
       
  2338 		  {
       
  2339 		  task.BringToForeground();
       
  2340 		  }
       
  2341 	  else
       
  2342 		{
       
  2343 		RApaLsSession session;
       
  2344 		if ( KErrNone == session.Connect() )
       
  2345 			{
       
  2346 			CleanupClosePushL( session );
       
  2347 			TThreadId threadId;
       
  2348 			session.CreateDocument( KNullDesC, KUidMusicStore, threadId );
       
  2349 			CleanupStack::PopAndDestroy(&session);
       
  2350 			}
       
  2351 		}
       
  2352 	  IRLOG_DEBUG( "Leaving CIRNowPlayingView::LaunchMusicShopL - Exiting" );
       
  2353 #endif
       
  2354 	}
       
  2355 
       
  2356 // ---------------------------------------------------------------------------
       
  2357 // void CIRNowPlayingView::DoFindInMusicShopL()
       
  2358 // ---------------------------------------------------------------------------
       
  2359 //
       
  2360 void CIRNowPlayingView::DoFindInMusicShopL( const TDesC& aSongName,
       
  2361                                             const TDesC& aArtistName,
       
  2362                                             const TDesC& aAlbumName,
       
  2363                                             TBool aMusicFlag )
       
  2364 	{
       
  2365 	IRLOG_DEBUG( "Entered CIRNowPlayingView::DoFindInMusicShopL - Entering" );
       
  2366 #ifdef MUSICSHOP_AVAILABLE
       
  2367 	HBufC* url = NULL;
       
  2368 #ifdef __IRA_FEATURE_EQUALIZER
       
  2369 	if(aMusicFlag && iMPXFindInShop)
       
  2370 		{
       
  2371 		//which means, create url for to FindInShop operation
       
  2372 		url = iMPXFindInShop->CreateSearchURLL( aSongName,
       
  2373 	                                  aArtistName,
       
  2374 	                                  aAlbumName,
       
  2375 	                                  KNullDesC,     // Composer - Not used
       
  2376 	                                  KNullDesC );   // Genre - Not used
       
  2377 		CleanupStack::PushL(url);   // the pointer will be poped
       
  2378 		}
       
  2379 	else
       
  2380 #endif // __IRA_FEATURE_EQUALIZER
       
  2381 		{
       
  2382 		//which means, crate url for to GotoMusicStore operation
       
  2383 		url = CentralRepositoryStringValueL(KCRUidMusicShopSettings,KMusicShopURI);
       
  2384 		CleanupStack::PushL(url);   // the pointer will be poped
       
  2385 		}
       
  2386 
       
  2387 	RProperty::Set( KUidMusicStore,
       
  2388 	          KMShopCategoryId,
       
  2389 	          KFindInMShopKeyValid );  // Set Key to Valid
       
  2390 
       
  2391 	RProperty::Set( KUidMusicStore,
       
  2392 	          KMShopCategoryName,
       
  2393 	          *url );
       
  2394 	LaunchMusicShopL();
       
  2395 	if(url)
       
  2396 		{
       
  2397 		CleanupStack::PopAndDestroy(url);
       
  2398 		}
       
  2399 
       
  2400 	REComSession::FinalClose();
       
  2401 #else
       
  2402     if(aSongName.Length() > 0 || aArtistName.Length() > 0 || aAlbumName.Length() > 0
       
  2403         || aMusicFlag)
       
  2404     {
       
  2405         // do nothing, just remove build warnings.
       
  2406     }
       
  2407 #endif
       
  2408 	IRLOG_DEBUG( "Leaving CIRNowPlayingView::DoFindInMusicShopL - Exiting" );
       
  2409 	}
       
  2410 
       
  2411 // ---------------------------------------------------------------------------
       
  2412 // CIRNowPlayingView::CentralRepositoryStringValueL
       
  2413 // Retrievs the string from Central Repository for the specified key and cen rep uid
       
  2414 // Transfers the ownership of the returned HBufC object
       
  2415 // The caller must takecare of deleting the returned object*
       
  2416 // ---------------------------------------------------------------------------
       
  2417 //
       
  2418 HBufC* CIRNowPlayingView::CentralRepositoryStringValueL(
       
  2419 	const TUid& aRepositoryUid, TUint32 aKey ) const
       
  2420 	{
       
  2421 	IRLOG_DEBUG( "CIRNetworkController::CentralRepositoryStringValueL- Entering" );
       
  2422 	CRepository* pRepository = CRepository::NewL( aRepositoryUid );
       
  2423 	CleanupStack::PushL( pRepository );
       
  2424 
       
  2425 	TInt length = KMusicStoreURLSize;
       
  2426 	HBufC* valueString = HBufC::NewLC( length );
       
  2427 	TInt error( KErrTooBig );
       
  2428 	do
       
  2429 		{
       
  2430 		TPtr ptr = valueString->Des();
       
  2431 		error = pRepository->Get( aKey, ptr );
       
  2432 		if ( error == KErrTooBig )
       
  2433 			{
       
  2434 			CleanupStack::PopAndDestroy( valueString );
       
  2435 			length = KTwo * length;
       
  2436 			valueString = HBufC::NewLC( length );
       
  2437 			}
       
  2438 		} while ( error == KErrTooBig );
       
  2439 
       
  2440 	if ( error )
       
  2441 		{
       
  2442 		TPtr ptr = valueString->Des();
       
  2443 		ptr.Copy( KNullDesC() );
       
  2444 		}
       
  2445 
       
  2446 	CleanupStack::Pop( valueString );
       
  2447 	CleanupStack::PopAndDestroy( pRepository );
       
  2448 	IRLOG_DEBUG( "CIRNetworkController::CentralRepositoryStringValueL - Exiting." );
       
  2449 	return valueString;
       
  2450 	}
       
  2451 
       
  2452 
       
  2453 
       
  2454 // ---------------------------------------------------------------------------
       
  2455 // void CIRNowPlayingView::ListenFromPls()
       
  2456 // ---------------------------------------------------------------------------
       
  2457 //
       
  2458 void CIRNowPlayingView::ListenFromPlsL()
       
  2459 	{
       
  2460 	IRLOG_DEBUG( " CIRNowPlayingView::ListenFromPlsL - Entering" );
       
  2461 	TInt ListBoxIndex =iRockerIndex;
       
  2462 	TInt UrlIndex = (ListBoxIndex * KTwo);
       
  2463 
       
  2464 	CIRIsdsPreset* preset = CIRIsdsPreset::NewL();
       
  2465 	CleanupStack::PushL( preset );
       
  2466 
       
  2467 	//copy channel name
       
  2468 	TBuf<KChannelNameSize> channelName;
       
  2469 	if(UrlIndex>=0 && UrlIndex <iUi->iURLs.Count())
       
  2470 		{
       
  2471 		channelName.Copy(*( iUi->iURLs[UrlIndex+1]));
       
  2472 		}
       
  2473 	preset->SetName(channelName);
       
  2474 	preset->SetChannelType(0);
       
  2475 	channelName.Zero();
       
  2476 	//copy channel url
       
  2477 	channelName.Copy(*( iUi->iURLs[UrlIndex] ) );
       
  2478 	_LIT(KServerName,"NA");
       
  2479 
       
  2480 	//set station information to NA
       
  2481 	preset->SetUrlL(KServerName,channelName,0);
       
  2482 	preset->SetUrlCount();
       
  2483 
       
  2484 
       
  2485 		// Set the channel as last played and currently playing
       
  2486 *iNowPlayingWrapper->iNowPlayingPreset = *preset;
       
  2487 	CleanupStack::PopAndDestroy( preset );
       
  2488 
       
  2489 	//connecting to server
       
  2490 	iNowPlayingWrapper->SetCurrentConnectionSource(EIRAdhocExternal);
       
  2491 	iNowPlayingWrapper->ConnectToChannelL(*iNowPlayingWrapper->iNowPlayingPreset);
       
  2492 
       
  2493 
       
  2494 	IRLOG_DEBUG( "Leaving CIRNowPlayingView::ListenFromPlsL - Exiting" );
       
  2495 	}
       
  2496 
       
  2497 // ---------------------------------------------------------------------------
       
  2498 // void CIRNowPlayingView::HandleControlEventL()
       
  2499 // ---------------------------------------------------------------------------
       
  2500 //
       
  2501 
       
  2502 void CIRNowPlayingView ::HandleControlEventL( CCoeControl* aControl, TCoeEvent aEventType )
       
  2503 	{
       
  2504 	IRLOG_DEBUG( " CIRNowPlayingView::HandleControlEventL - Entering" );
       
  2505 	if( AknLayoutUtils::PenEnabled() )
       
  2506 		{
       
  2507 		if(aEventType==EEventStateChanged)
       
  2508 			{
       
  2509 			if(aControl==iVolPopup)
       
  2510 				{
       
  2511 				iSettingsValue=iIRSettings->GetVolumeSetting();
       
  2512 				iVolumeBarValue=iVolPopup->Value();
       
  2513 				if(iVolumeBarValue<iSettingsValue)
       
  2514 					{
       
  2515 						TInt diff=iSettingsValue-iVolumeBarValue;
       
  2516 						if(diff>1 && (iVolumeBarValue==0 ))
       
  2517 							{
       
  2518 							TInt index = iNowPlayingWrapper->GetMediaClientInstance()->MaxVolume()/KMaxVolume;
       
  2519 							TInt volume = index*iVolumeBarValue;
       
  2520 							iVolumeMute=ETrue;
       
  2521 							iNowPlayingWrapper->GetMediaClientInstance()->SetVolume(volume);
       
  2522 							}
       
  2523 						else
       
  2524 							{
       
  2525 							if(iVolumeMute)
       
  2526 								{
       
  2527 								iVolPopup->SetValue(2);
       
  2528 								iVolumeBarValue=iVolPopup->Value();
       
  2529 								}
       
  2530 							iVolumeMute=EFalse;
       
  2531 							iNowPlayingWrapper->SetVolumeL(iVolumeBarValue);
       
  2532 							}
       
  2533 					}
       
  2534 				else
       
  2535 					{
       
  2536 					if(iVolumeMute)
       
  2537 						{
       
  2538 						iVolPopup->SetValue(2);
       
  2539 						iVolumeBarValue=iVolPopup->Value();
       
  2540 						}
       
  2541 					iNowPlayingWrapper->SetVolumeL(iVolumeBarValue);
       
  2542 					iVolumeMute=EFalse;
       
  2543 					}
       
  2544 				}
       
  2545 			}
       
  2546 		}
       
  2547 	IRLOG_DEBUG( "Leaving CIRNowPlayingView::HandleControlEventL - Exiting" );
       
  2548 	}
       
  2549 
       
  2550 // ---------------------------------------------------------------------------
       
  2551 // void CIRNowPlayingView::SetLastPlayedValue()
       
  2552 // ---------------------------------------------------------------------------
       
  2553 //
       
  2554 
       
  2555 void CIRNowPlayingView::SetLastPlayedValue(TInt aLastPlayed)
       
  2556 	{
       
  2557 	IRLOG_DEBUG( " CIRNowPlayingView::SetLastPlayedValue - Entering" );
       
  2558 	iUpdateLastplayed=aLastPlayed;
       
  2559 	IRLOG_DEBUG( " CIRNowPlayingView::SetLastPlayedValue - Exiting" );
       
  2560 	}
       
  2561 // ---------------------------------------------------------------------------
       
  2562 // void CIRNowPlayingView::SetStationNameFlag()
       
  2563 // ---------------------------------------------------------------------------
       
  2564 //
       
  2565 
       
  2566 void CIRNowPlayingView::SetStationNameFlag(TInt aUpdateStationName)
       
  2567 	{
       
  2568 	IRLOG_DEBUG( " CIRNowPlayingView::SetStationNameFlag - Entering" );
       
  2569 	iUpdateStationName=aUpdateStationName;
       
  2570 	IRLOG_DEBUG( "Leaving CIRNowPlayingView::SetStationNameFlag - Exiting" );
       
  2571 	}
       
  2572 
       
  2573 
       
  2574 // ---------------------------------------------------------
       
  2575 // CIRNowPlayingView::HandleSystemEventL
       
  2576 // ---------------------------------------------------------
       
  2577 //
       
  2578 void CIRNowPlayingView::HandleSystemEventL(TIRSystemEventType aEventType)
       
  2579 	{
       
  2580 	IRLOG_DEBUG(" CIRNowPlayingView::::HandleSystemEventL - Entering");
       
  2581 
       
  2582 	CIRUi* appUi = static_cast<CIRUi*>(AppUi());
       
  2583 	switch (aEventType)
       
  2584 		{
       
  2585 		case EIRNetworkCoverageUp:
       
  2586 			{
       
  2587 			break;
       
  2588 			}
       
  2589 		case EIRNetworkCoverageDown:
       
  2590 			{
       
  2591 			break;
       
  2592 			}
       
  2593 		case EIRCallActivated:
       
  2594 			{
       
  2595 			iCallActive=ETrue;
       
  2596 			if( appUi->ActiveView() == KIRNowPlayingViewID )
       
  2597 				{
       
  2598 				ConstructToolbarL();
       
  2599 				}
       
  2600 				iUi->HandleCallActiveL(aEventType);
       
  2601 
       
  2602 			break;
       
  2603 			}
       
  2604 		case EIRCallDeactivated:
       
  2605 			{
       
  2606 				iCallActive=EFalse;
       
  2607 				iUi->HandleCallActiveL(aEventType);
       
  2608 			break;
       
  2609 			}
       
  2610 		default:
       
  2611 			{
       
  2612 			break;
       
  2613 			}
       
  2614 		}
       
  2615 	IRLOG_DEBUG( "CIRNowPlayingView::HandleSystemEventL - Exiting." );
       
  2616 	return;
       
  2617 	}
       
  2618 // ---------------------------------------------------------------------------
       
  2619 // void CIRNowPlayingView::SetPlayingValue()
       
  2620 // ---------------------------------------------------------------------------
       
  2621 //
       
  2622 
       
  2623 void CIRNowPlayingView::SetPlayingValue(TInt aPlaying)
       
  2624 	{
       
  2625 	IRLOG_DEBUG( " CIRNowPlayingView::SetLastPlayedValue - Entering" );
       
  2626 	iPlaying=aPlaying;
       
  2627 	IRLOG_DEBUG( " CIRNowPlayingView::SetLastPlayedValue - Exiting" );
       
  2628 	}
       
  2629 
       
  2630 // ---------------------------------------------------------------------------
       
  2631 // void CIRNowPlayingView::HandleMediaKeys()
       
  2632 // function handles the hardware media keys
       
  2633 // ---------------------------------------------------------------------------
       
  2634 //
       
  2635 
       
  2636 void CIRNowPlayingView::HandleMediaKeysL(TRemConCoreApiOperationId aOperationId,
       
  2637 				TRemConCoreApiButtonAction aButtonAct)
       
  2638 	{
       
  2639 	switch(aOperationId)
       
  2640 		{
       
  2641 		case ERemConCoreApiVolumeUp:
       
  2642 			{
       
  2643 			TInt volume=iIRSettings->GetVolumeSetting();
       
  2644 			if(volume==KMaxVolume)
       
  2645 				{
       
  2646 				if(!iVolPopup->IsFocused())
       
  2647 				iVolPopup->ShowVolumePopupL();
       
  2648 				}
       
  2649 			else if(volume==KMinVolume && !iVolumeMute)
       
  2650 				{
       
  2651 				iVolPopup->SetValue(KMinVolume+(KMaxVolume/KMaxVolumeRange));
       
  2652 				if(!iVolPopup->IsFocused())
       
  2653 				iVolPopup->ShowVolumePopupL();
       
  2654 				iNowPlayingWrapper->SetVolumeL(iVolPopup->Value());
       
  2655 				}
       
  2656 			else
       
  2657 				{
       
  2658 				switch(aButtonAct)
       
  2659 					{
       
  2660 					case ERemConCoreApiButtonPress:
       
  2661 					case ERemConCoreApiButtonClick:
       
  2662 						{
       
  2663 						iVolumeMute=EFalse;
       
  2664 						iVolPopup->SetValue(2);
       
  2665 						if(!iVolPopup->IsFocused())
       
  2666 						iVolPopup->ShowVolumePopupL();
       
  2667 						iNowPlayingWrapper->SetVolumeL(iVolPopup->Value());
       
  2668 						}
       
  2669 					break;
       
  2670 					case ERemConCoreApiButtonRelease:
       
  2671 						{
       
  2672 
       
  2673 						}
       
  2674 					break;
       
  2675 					}
       
  2676 				}
       
  2677 
       
  2678 
       
  2679 			}
       
  2680 		break;
       
  2681 		case ERemConCoreApiVolumeDown:
       
  2682 			{
       
  2683 			TInt volume=iIRSettings->GetVolumeSetting();
       
  2684 
       
  2685 			if(volume==KMinVolume && !iVolumeMute)
       
  2686 				{
       
  2687 				if(!iVolPopup->IsFocused())
       
  2688 				iVolPopup->ShowVolumePopupL();
       
  2689 				}
       
  2690 			else if(volume==KMaxVolume)
       
  2691 				{
       
  2692 				iVolPopup->SetValue(KMaxVolume-(KMaxVolume/KMaxVolumeRange));
       
  2693 				if(!iVolPopup->IsFocused())
       
  2694 				iVolPopup->ShowVolumePopupL();
       
  2695 				iNowPlayingWrapper->SetVolumeL(iVolPopup->Value());
       
  2696 				}
       
  2697 			else
       
  2698 				{
       
  2699 				switch(aButtonAct)
       
  2700 					{
       
  2701 					case ERemConCoreApiButtonPress:
       
  2702 					case ERemConCoreApiButtonClick:
       
  2703 						{
       
  2704 						iVolumeMute=EFalse;
       
  2705 						TInt volume=iIRSettings->GetVolumeSetting();
       
  2706                         TInt value =volume - (KMaxVolume/KMaxVolumeRange);
       
  2707 							if(value==0)
       
  2708 								{
       
  2709 								iVolumeMute=EFalse;
       
  2710 								}
       
  2711 							iVolPopup->SetValue(2);
       
  2712 							if(!iVolPopup->IsFocused())
       
  2713 							iVolPopup->ShowVolumePopupL();
       
  2714 							iNowPlayingWrapper->SetVolumeL(iVolPopup->Value());
       
  2715 						}
       
  2716 					break;
       
  2717 					case ERemConCoreApiButtonRelease:
       
  2718 						{
       
  2719 
       
  2720 						}
       
  2721 					break;
       
  2722 					}
       
  2723 				}
       
  2724 
       
  2725 
       
  2726 			}
       
  2727 			break;
       
  2728 		}
       
  2729 	}
       
  2730 // ---------------------------------------------------------------------------
       
  2731 // void CIRNowPlayingView::SetVolumePopUpValue()
       
  2732 // ---------------------------------------------------------------------------
       
  2733 //
       
  2734 
       
  2735 void CIRNowPlayingView::SetVolumePopUpValue(TInt aValue)
       
  2736 	{
       
  2737 	IRLOG_DEBUG( " CIRNowPlayingView::SetVolumePopUpValue - Entering" );
       
  2738 
       
  2739 	  iVolPopup->SetValue(aValue);
       
  2740 	IRLOG_DEBUG( " CIRNowPlayingView::SetVolumePopUpValue - Exiting" );
       
  2741 	}
       
  2742 
       
  2743 	// ---------------------------------------------------------------------------
       
  2744 // void CIRNowPlayingView::GetVolumePopUpValue()
       
  2745 // ---------------------------------------------------------------------------
       
  2746 //
       
  2747 
       
  2748 TInt CIRNowPlayingView::GetVolumePopUpValue()
       
  2749 	{
       
  2750 	IRLOG_DEBUG( " CIRNowPlayingView::GetVolumePopUpValue - Entering" );
       
  2751 
       
  2752 	IRLOG_DEBUG( " CIRNowPlayingView::GetVolumePopUpValue - Exiting" );
       
  2753      return iVolPopup->Value();
       
  2754 	}
       
  2755 
       
  2756 // ---------------------------------------------------------------------------
       
  2757 // From class CBaseView.
       
  2758 // Returns help context for this view.
       
  2759 
       
  2760 // ---------------------------------------------------------------------------
       
  2761 //
       
  2762 TCoeHelpContext CIRNowPlayingView::HelpContext() const
       
  2763     {
       
  2764     return TCoeHelpContext( KIRMCVUid, KIR_HELP_NOW );
       
  2765     }
       
  2766 
       
  2767 
       
  2768 // ---------------------------------------------------------------------------
       
  2769 // void CIRNowPlayingView::LaunchFMTransmitterL()
       
  2770 // Launch FM Transmitter application
       
  2771 // ---------------------------------------------------------------------------
       
  2772 //
       
  2773 void CIRNowPlayingView::LaunchFMTransmitterL()
       
  2774     {
       
  2775     IRLOG_DEBUG( "CIRNowPlayingView::LaunchFMTransmitterL - Entering" );
       
  2776 
       
  2777     if ( FeatureManager::FeatureSupported( KFeatureIdFmtx ) )
       
  2778         {
       
  2779         TApaTaskList tasList( iCoeEnv->WsSession() );
       
  2780         TApaTask task = tasList.FindApp( KFmTxAppUid );
       
  2781         if ( task.Exists() )
       
  2782             {
       
  2783             task.BringToForeground();
       
  2784             }
       
  2785         else
       
  2786             {
       
  2787             RProcess process;
       
  2788             TApaAppInfo appInfo;
       
  2789             RApaLsSession session;
       
  2790             if ( KErrNone == session.Connect() )
       
  2791                 {
       
  2792                 CleanupClosePushL( session );
       
  2793                 TThreadId threadId;
       
  2794                 session.CreateDocument( KNullDesC, KFmTxAppUid, threadId );
       
  2795                 CleanupStack::PopAndDestroy(&session);
       
  2796                 }
       
  2797             }
       
  2798         }
       
  2799 	IRLOG_DEBUG( "CIRNowPlayingView::LaunchFMTransmitterL - Exiting" );
       
  2800     }
       
  2801 // ---------------------------------------------------------------------------
       
  2802 // void CIRNowPlayingView::DeleteSteroEffect()
       
  2803 // Destroys the Stereo Effect Corresponing the Player
       
  2804 // ---------------------------------------------------------------------------
       
  2805 //
       
  2806 void CIRNowPlayingView::DeleteSteroEffect(TBool /*aStereo*/)
       
  2807 {
       
  2808 IRLOG_DEBUG( "CIRNowPlayingView::DeleteSteroEffect - Entering" );
       
  2809 
       
  2810 	if(iStereoEffect)
       
  2811 	{
       
  2812 		delete iStereoEffect;
       
  2813 		iStereoEffect=NULL;
       
  2814 
       
  2815 	}
       
  2816 IRLOG_DEBUG( "CIRNowPlayingView::DeleteSteroEffect - Exiting" );
       
  2817 
       
  2818 }
       
  2819 // ---------------------------------------------------------------------------
       
  2820 // void CIRNowPlayingView::DisableVolumePopup()
       
  2821 // Disbale the volumepopup when it is Active
       
  2822 // ---------------------------------------------------------------------------
       
  2823 //
       
  2824 void CIRNowPlayingView::DisablePlayer()
       
  2825 	{
       
  2826 	IRLOG_DEBUG( "CIRNowPlayingView::DisablePlayer - Entering" );
       
  2827 	if(iUi->IsCallActive() )
       
  2828 		{
       
  2829 		if(iUi->GetCurrentNetworkType().Compare(KWiFi)==0)
       
  2830 			{
       
  2831 			iNowPlayingWrapper->StopPlayer();
       
  2832 			iNowPlayingWrapper->DoPlayingStateChanged(EFalse);
       
  2833 			iUi->SetPlayStateWhileCall(ETrue);
       
  2834 			}
       
  2835 		}
       
  2836 	IRLOG_DEBUG( "CIRNowPlayingView::DisablePlayer - Exiting" );
       
  2837 	}
       
  2838 
       
  2839 // ---------------------------------------------------------
       
  2840 // From class MAlfActionObserver.
       
  2841 // CIRNowPlayingView::HandleActionL
       
  2842 // ---------------------------------------------------------
       
  2843 //
       
  2844 void CIRNowPlayingView::HandleActionL( const TAlfActionCommand& aActionCommand )
       
  2845     {
       
  2846 	IRLOG_DEBUG( "CIRNowPlayingView::HandleActionL - Entering" );
       
  2847 
       
  2848     if ( aActionCommand.Id() == KAlfActionIdDeviceLayoutChanged )
       
  2849         {
       
  2850         if ( iContainer )
       
  2851             {
       
  2852             iAlfEnv.PrimaryDisplay().SetVisibleArea( ClientRect() );
       
  2853             iContainer->LayoutControl();
       
  2854            	iFadeStyle=EIRFadeNoFade;
       
  2855           /*delete iConnectionCleanupTimer;
       
  2856 		iConnectionCleanupTimer = NULL;
       
  2857         TRAPD( err, iConnectionCleanupTimer = CPeriodic::NewL( CActive::EPriorityStandard ) )
       
  2858         if ( err == KErrNone )
       
  2859             {
       
  2860             iConnectionCleanupTimer->Start( KWaitTimeInMicroSeconds, 0,
       
  2861             			 TCallBack( StaticConnectionCleanupCallback, this ) );
       
  2862             }*/
       
  2863            	if(iStationHasLogo)
       
  2864 	           	{
       
  2865 	           	DisplaylogoL();
       
  2866 	           	}
       
  2867 			DrawViewL(iStationHasLogo);
       
  2868             }
       
  2869         }
       
  2870     else if ( aActionCommand.Id() == KAlfActionIdSkinChanged )
       
  2871     	{
       
  2872     	 if ( iContainer )
       
  2873     		{
       
  2874     		// Update radio idle skin color
       
  2875     	    MAknsSkinInstance* skin = AknsUtils::SkinInstance();
       
  2876     	    if ( skin )
       
  2877     	    	{
       
  2878     	    	TRgb textColor; // text color when not highlighted
       
  2879     	    	AknsUtils::GetCachedColor( skin, textColor, KAknsIIDQsnTextColors,
       
  2880     	    								 EAknsCIQsnTextColorsCG6 );
       
  2881     	    	TRgb highlightColor; // text color when highlighted
       
  2882     	    	AknsUtils::GetCachedColor( skin, highlightColor, KAknsIIDQsnTextColors,
       
  2883     	    				 EAknsCIQsnTextColorsCG10 );
       
  2884     	    	iContainer->RadioIdle().SetPrimaryColor( textColor );
       
  2885     	    	iContainer->RadioIdle().SetSecondaryColor( highlightColor );
       
  2886 	           	iFadeStyle=EIRFadeNoFade;
       
  2887 	           	ConstructToolbarL();
       
  2888 	           	if(iStationHasLogo)
       
  2889 	           		{
       
  2890 	           		DisplaylogoL();
       
  2891 	           		}
       
  2892 				DrawViewL(iStationHasLogo);
       
  2893     	    	}
       
  2894     		}
       
  2895 
       
  2896     	}
       
  2897     else
       
  2898     	{
       
  2899     	}
       
  2900     }
       
  2901  // ---------------------------------------------------------
       
  2902 // void CIRNowPlayingView::SetBitrate()
       
  2903 // Sets The Bitrates Value
       
  2904 // ---------------------------------------------------------
       
  2905 //
       
  2906 void CIRNowPlayingView::SetBitrate(TInt aError)
       
  2907 {
       
  2908 IRLOG_DEBUG( "CIRNowPlayingView::SetBitrate - Entering" );
       
  2909 
       
  2910 	if(iContainer)
       
  2911 	{
       
  2912    	TInt bitRate(0);
       
  2913 	if(!aError)
       
  2914 		{
       
  2915 		iShowBitrate=ETrue;
       
  2916 		RProperty::Get ( KUidActiveInternetRadioApp, KIRPSBitrate, bitRate );
       
  2917 		}
       
  2918 	else
       
  2919 		{
       
  2920 		iShowBitrate=EFalse;
       
  2921 		}
       
  2922 	RBuf bitrate;
       
  2923 	HBufC* BitRate=NULL;
       
  2924 	TRAPD(err,BitRate= StringLoader::LoadL(R_IRAPP_NOWPLAYING_BITRATE, bitRate);)
       
  2925 	if(err==KErrNone)
       
  2926 		{
       
  2927 		bitrate.Create(BitRate->Length());
       
  2928 		bitrate.Copy(*BitRate);
       
  2929 		DisplayBitrate(bitrate);
       
  2930 		bitrate.Close();
       
  2931 		}
       
  2932 	delete BitRate;
       
  2933 	}
       
  2934 
       
  2935 IRLOG_DEBUG( "CIRNowPlayingView::SetBitrate - Exiting " );
       
  2936 }
       
  2937 
       
  2938 // ---------------------------------------------------------
       
  2939 // CIRNowPlayingView::IsMetaData()
       
  2940 // returns true if there is meta data
       
  2941 // ---------------------------------------------------------
       
  2942 TBool CIRNowPlayingView::IsMetaData()
       
  2943 	{
       
  2944 	IRLOG_DEBUG( "CIRNowPlayingView::IsMetaData - Entered " );
       
  2945 	TBool retVal = ETrue;
       
  2946 
       
  2947 	if( iNowPlayingWrapper->MetaData().Song().Length() <= KOne &&
       
  2948 	    iNowPlayingWrapper->MetaData().Artist().Length() <= KOne )
       
  2949 		{
       
  2950 		retVal = EFalse;
       
  2951 		}
       
  2952 	IRLOG_DEBUG( "CIRNowPlayingView::IsMetaData - Leaving " );
       
  2953 	return retVal;
       
  2954 	}
       
  2955 
       
  2956 // ---------------------------------------------------------
       
  2957 // CIRNowPlayingView::MusciStoreEnabledStatus()
       
  2958 // returns true if music store enabled status is "yes"
       
  2959 // ---------------------------------------------------------
       
  2960 TBool CIRNowPlayingView::MusciStoreEnabledStatus()
       
  2961     {
       
  2962 	IRLOG_DEBUG( "CIRNowPlayingView::MusciStoreEnabledStatus - Entered " );
       
  2963 	_LIT(KMusicStoreEnabled, "yes");
       
  2964 	TBool retVal = EFalse;
       
  2965 
       
  2966 	if (iNowPlayingWrapper->iNowPlayingPreset->
       
  2967 		      GetMusicStoreStatus().CompareF(KMusicStoreEnabled)==0 )
       
  2968 		{
       
  2969 		retVal = ETrue;
       
  2970 		}
       
  2971 	IRLOG_DEBUG( "CIRNowPlayingView::MusciStoreEnabledStatus - Leaving " );
       
  2972 	return retVal;
       
  2973     }
       
  2974 
       
  2975 // ---------------------------------------------------------------------------
       
  2976 // void CIRNowPlayingView::SetLogoStatus()
       
  2977 // Sets the Value of Request Pendind While Checking For Network
       
  2978 // ---------------------------------------------------------------------------
       
  2979 //
       
  2980 void CIRNowPlayingView::SetRequestPendingWhenNoNetWork(TBool aRequestPending)
       
  2981 {
       
  2982 IRLOG_DEBUG( "CIRLogoTimer::SetLogoStatus - Entering" );
       
  2983 iRequestPending=aRequestPending;
       
  2984 IRLOG_DEBUG( "CIRLogoTimer::SetLogoStatus - Exiting" );
       
  2985 }
       
  2986 // ---------------------------------------------------------------------------
       
  2987 // void CIRNowPlayingView::SetLogoStatus()
       
  2988 // Return the Request Pending Value
       
  2989 // ---------------------------------------------------------------------------
       
  2990 //
       
  2991 TBool CIRNowPlayingView::GetRequestPending()
       
  2992 {
       
  2993 IRLOG_DEBUG( "CIRLogoTimer::SetLogoStatus - Entering" );
       
  2994 IRLOG_DEBUG( "CIRLogoTimer::SetLogoStatus - Exiting" );
       
  2995 return iRequestPending;
       
  2996 }
       
  2997 // ---------------------------------------------------------------------------
       
  2998 // void CIRNowPlayingView::SetLogoStatus()
       
  2999 // Sets the Value of Request Pendind While Checking For Network
       
  3000 // ---------------------------------------------------------------------------
       
  3001 //
       
  3002 void CIRNowPlayingView::SetRequestPendingWhenNoNetWorkForNextOrPrev(TBool aRequestPending)
       
  3003 {
       
  3004 IRLOG_DEBUG( "CIRLogoTimer::SetLogoStatus - Entering" );
       
  3005 iNextOrPrevRequest=aRequestPending;
       
  3006 IRLOG_DEBUG( "CIRLogoTimer::SetLogoStatus - Exiting" );
       
  3007 }
       
  3008 // ---------------------------------------------------------------------------
       
  3009 // void CIRNowPlayingView::SetLogoStatus()
       
  3010 // Return the Request Pending Value
       
  3011 // ---------------------------------------------------------------------------
       
  3012 //
       
  3013 TBool CIRNowPlayingView::GetRequestPendingForNextOrPreV()
       
  3014 {
       
  3015 IRLOG_DEBUG( "CIRLogoTimer::SetLogoStatus - Entering" );
       
  3016 IRLOG_DEBUG( "CIRLogoTimer::SetLogoStatus - Exiting" );
       
  3017 return iNextOrPrevRequest;
       
  3018 }
       
  3019 // ---------------------------------------------------------------------------
       
  3020 // SetRockerIndex()
       
  3021 // Sets the Current Playing Index
       
  3022 // ---------------------------------------------------------------------------
       
  3023 //
       
  3024 
       
  3025 void CIRNowPlayingView::SetRockerIndex(TInt aRockerIndex  )
       
  3026 	{
       
  3027 
       
  3028 	IRLOG_DEBUG( "CIRNowPlayingView::SetRockerIndex - Entering" );
       
  3029 	iRockerIndex=aRockerIndex;
       
  3030 	IRLOG_DEBUG( "CIRNowPlayingView::SetRockerIndex - exiting" );
       
  3031 	}
       
  3032 // ---------------------------------------------------------------------------
       
  3033 // GetRockerIndex()
       
  3034 // Returns The current Playing Index
       
  3035 // ---------------------------------------------------------------------------
       
  3036 //
       
  3037 
       
  3038 TInt CIRNowPlayingView::GetRockerIndex( )
       
  3039 	{
       
  3040 
       
  3041 	IRLOG_DEBUG( "CIRNowPlayingView::GetRockerIndex - Entering" );
       
  3042 	IRLOG_DEBUG( "CIRNowPlayingView::GetRockerIndex - exiting" );
       
  3043 	return iRockerIndex;
       
  3044 	}
       
  3045 
       
  3046 // ---------------------------------------------------------------------------
       
  3047 // SavePreviousIndex()
       
  3048 // Sets the Current Playing Index
       
  3049 // ---------------------------------------------------------------------------
       
  3050 //
       
  3051 
       
  3052 void CIRNowPlayingView::SavePreviousIndex(TInt aPresetCount  )
       
  3053 	{
       
  3054 
       
  3055 	IRLOG_DEBUG( "CIRNowPlayingView::SavePreviousIndex - Entering" );
       
  3056 	iPresetCount=aPresetCount;
       
  3057 	IRLOG_DEBUG( "CIRNowPlayingView::SavePreviousIndex - exiting" );
       
  3058 	}
       
  3059 // ---------------------------------------------------------------------------
       
  3060 // GetPreviousIndex()
       
  3061 // Returns The Previous  Index
       
  3062 // ---------------------------------------------------------------------------
       
  3063 //
       
  3064 
       
  3065 TInt CIRNowPlayingView::GetPreviousIndex( )
       
  3066 	{
       
  3067 
       
  3068 	IRLOG_DEBUG( "CIRNowPlayingView::GetPreviousIndexex - Entering" );
       
  3069 	IRLOG_DEBUG( "CIRNowPlayingView::GetPreviousIndex - exiting" );
       
  3070 	return iPresetCount;
       
  3071 	}
       
  3072 // ---------------------------------------------------------------------------
       
  3073 // IsVolumeMuted()
       
  3074 // Returns whether volume is Muted
       
  3075 // ---------------------------------------------------------------------------
       
  3076 //
       
  3077 
       
  3078 TBool CIRNowPlayingView::IsVolumeMuted( )
       
  3079 	{
       
  3080 	IRLOG_DEBUG( "CIRNowPlayingView::IsVolumeMuted - Entering" );
       
  3081 	IRLOG_DEBUG( "CIRNowPlayingView::IsVolumeMuted - exiting" );
       
  3082 	return iVolumeMute;
       
  3083 	}
       
  3084 // ---------------------------------------------------------------------------
       
  3085 // CIRNowPlayingView::MrccatoCommand()
       
  3086 // This is call back function which observes hardware key events
       
  3087 // ---------------------------------------------------------------------------
       
  3088 //
       
  3089 void CIRNowPlayingView::MrccatoCommand(TRemConCoreApiOperationId aOperationId,
       
  3090     TRemConCoreApiButtonAction aButtonAct)
       
  3091     {
       
  3092     IRLOG_INFO3( "CIRNowPlayingView::MrccatoCommand(aOperationId=%d, aButtonAct=%d)", aOperationId, aButtonAct );
       
  3093 
       
  3094 
       
  3095     switch( aOperationId )
       
  3096         {
       
  3097         case ERemConCoreApiPausePlayFunction:
       
  3098             if( iNowPlayingWrapper->iPlaying )
       
  3099                 {
       
  3100                 MrccatoCommand( ERemConCoreApiPause, aButtonAct );
       
  3101                 }
       
  3102             else
       
  3103                 {
       
  3104                 // Note that ERemConCoreApiPlaybackSpeedForward is just any value,
       
  3105                 // it's not used by MrccatoPlay implementation in this class.
       
  3106                 MrccatoPlay( ERemConCoreApiPlaybackSpeedForward, aButtonAct );
       
  3107                 }
       
  3108             break;
       
  3109         case ERemConCoreApiPause:               // -fall through
       
  3110         case ERemConCoreApiStop:
       
  3111             if( aButtonAct == ERemConCoreApiButtonClick )
       
  3112                 {
       
  3113                 if( iNowPlayingWrapper->iPlaying)
       
  3114                     {
       
  3115                         TRAP_IGNORE( PlayAndStopControlL() )
       
  3116                         }
       
  3117                 }
       
  3118 
       
  3119             break;
       
  3120         case ERemConCoreApiForward:
       
  3121             if( aButtonAct == ERemConCoreApiButtonClick )
       
  3122                 {
       
  3123                 if(iContainer)
       
  3124 	                {
       
  3125 	                TRAP_IGNORE(HandleCommandL(EIRCmdStepNextPreset);)
       
  3126 	                }
       
  3127                 }
       
  3128             break;
       
  3129         case ERemConCoreApiBackward:
       
  3130             if( aButtonAct == ERemConCoreApiButtonClick )
       
  3131                 {
       
  3132                 if(iContainer)
       
  3133 	                {
       
  3134 	               TRAP_IGNORE(HandleCommandL(EIRCmdStepPrevPreset);)
       
  3135 	                }
       
  3136                 }
       
  3137 
       
  3138             break;
       
  3139         default:
       
  3140             break;
       
  3141         }
       
  3142 
       
  3143     IRLOG_DEBUG( "CIRNowPlayingView::MrccatoCommand - Exiting." );
       
  3144     }
       
  3145 
       
  3146 // ---------------------------------------------------------
       
  3147 // CIRNowPlayingView::MrccatoPlay()
       
  3148 // ---------------------------------------------------------
       
  3149 //
       
  3150 void CIRNowPlayingView::MrccatoPlay(TRemConCoreApiPlaybackSpeed IRDEBUGVAR(aSpeed),
       
  3151 				 TRemConCoreApiButtonAction aButtonAct)
       
  3152     {
       
  3153     IRLOG_INFO3( "CIRNowPlayingView::MrccatoPlay(aSpeed=%d, aButtonAct=%d)", aSpeed, aButtonAct );
       
  3154 
       
  3155 
       
  3156     if( aButtonAct == ERemConCoreApiButtonClick )
       
  3157         {
       
  3158         if( !iNowPlayingWrapper->iPlaying )
       
  3159             {
       
  3160              if(iContainer)
       
  3161 	             {
       
  3162 				 TRAP_IGNORE(PlayAndStopControlL();)
       
  3163 	             }
       
  3164             }
       
  3165         }
       
  3166 
       
  3167     IRLOG_DEBUG( "CIRNowPlayingView::MrccatoPlay - Exiting." );
       
  3168     }
       
  3169 
       
  3170 // -----------------------------------------------------------------------------
       
  3171 // CIRNowPlayingView::HasBeenActivated()
       
  3172 // ------------------------------------------------------------------------------
       
  3173 //
       
  3174 TBool CIRNowPlayingView::HasBeenActivated() const
       
  3175 	{
       
  3176 	return iHasBeenActivated;
       
  3177 	}
       
  3178 
       
  3179 // CIRNowPlayingView::GetCommandId()
       
  3180 // ------------------------------------------------------------------------------
       
  3181 //
       
  3182 TInt CIRNowPlayingView::GetCommandId()
       
  3183 {
       
  3184 
       
  3185 return iCommandId;
       
  3186 }
       
  3187 // ---------------------------------------------------------------------------
       
  3188 // void CIRNowPlayingView::UpdateLastplayed()
       
  3189 // To Update LastPlayed
       
  3190 // ---------------------------------------------------------------------------
       
  3191 //
       
  3192 void CIRNowPlayingView::UpdateLastplayedL()
       
  3193 {
       
  3194 	if(iNowPlayingWrapper->iNowPlayingPreset)
       
  3195 		{
       
  3196 		// store the last played station
       
  3197 		*iUi->iLastPlayed->iLastPlayedStation = *iNowPlayingWrapper->iNowPlayingPreset;
       
  3198 		TRAPD(err,iUi->iLastPlayed->CommitLastPlayedChannelL());
       
  3199 		TInt error=KErrNone;
       
  3200 		if(err != KErrNone)
       
  3201 			{
       
  3202 			error = iUi->iLastPlayed->RemoveLastPlayedFile();
       
  3203 			User::Leave(error);
       
  3204 			}
       
  3205 		}
       
  3206 }
       
  3207 // ---------------------------------------------------------------------------
       
  3208 // CIRNowPlayingView::SyncPresetL()
       
  3209 // ---------------------------------------------------------------------------
       
  3210 //
       
  3211 void CIRNowPlayingView::SyncPresetL(TInt aChid,const TDesC &aModifiedTime)
       
  3212     {
       
  3213     //sync state set to pending
       
  3214 	iUi->iNowPlayingWrapper->CreateWaitDialogL();
       
  3215 	iUi->GetPubSubManagerInstance()->PublishBufferingState(EIRStateBufferingStart);
       
  3216 
       
  3217 	iUi->iNowPlayingWrapper->iSyncPreset = ETrue;
       
  3218 	iIsdsWrapper->SetSyncPresetObserver( this,this );
       
  3219     iUi->iIsdsWrapper->GetISDSInstance()->SyncPresetL(aChid,aModifiedTime);
       
  3220     }
       
  3221 
       
  3222 // ------------------------------------------------------------------------
       
  3223 // from MSyncPresetObserver
       
  3224 // SyncPresetRemovedL()
       
  3225 // called back when the preset that is synced was removed from isds
       
  3226 // @param TInt,the preset id
       
  3227 // -----------------------------------------------------------------------
       
  3228 void CIRNowPlayingView::SyncPresetRemovedL(TInt /*aId*/)
       
  3229 	{
       
  3230 	IRLOG_DEBUG( "CIRNowPlayingView::SyncPresetRemovedL - Entering." );
       
  3231 	// TO Do: need to check
       
  3232 	iNowPlayingWrapper->SetFavFocus(iRockerIndex+1) ;
       
  3233 	iUi->iNowPlayingWrapper->iSyncPreset = EFalse;
       
  3234 
       
  3235 	// Connect to Favourite User-defined preset
       
  3236 	if(iUi->iFavPresets->iFavPresetList.Count() >= 1)
       
  3237 		{
       
  3238 		iUi->iFavPresets->iFavPresetList[iRockerIndex]->
       
  3239 			CopyPresetData(*iNowPlayingWrapper->iNowPlayingPreset);
       
  3240 		iNowPlayingWrapper->ConnectToChannelL(*iNowPlayingWrapper->iNowPlayingPreset);
       
  3241 		StartTimerL();
       
  3242 		}
       
  3243 	IRLOG_DEBUG( "CIRNowPlayingView::SyncPresetRemovedL - Entering." );
       
  3244 	}
       
  3245 
       
  3246 // -----------------------------------------------------------------------
       
  3247 // from MSyncPresetObserver
       
  3248 // SyncPresetChangedL()
       
  3249 // called back when the preset that is synced has been changed in the isds
       
  3250 // @param CIRIsdsPreset&,the new preset data
       
  3251 // ----------------------------------------------------------------------
       
  3252 void CIRNowPlayingView::SyncPresetChangedL(CIRIsdsPreset& /*aPreset*/)
       
  3253 	{
       
  3254 	IRLOG_DEBUG( "CIRNowPlayingView::SyncPresetChangedL - Entering." );
       
  3255 	iUi->iNowPlayingWrapper->iSyncPreset = EFalse;
       
  3256 	// TO Do: need to check
       
  3257 	iNowPlayingWrapper->SetFavFocus(iRockerIndex+1);
       
  3258 	// Connect to Favourite User-defined preset
       
  3259 	if(iUi->iFavPresets->iFavPresetList.Count() >= 1)
       
  3260 		{
       
  3261 		iUi->iFavPresets->iFavPresetList[iRockerIndex]->
       
  3262 			CopyPresetData(*iNowPlayingWrapper->iNowPlayingPreset);
       
  3263 		iNowPlayingWrapper->ConnectToChannelL(*iNowPlayingWrapper->iNowPlayingPreset);
       
  3264 		StartTimerL();
       
  3265 		}
       
  3266 
       
  3267 	IRLOG_DEBUG( "CIRNowPlayingView::SyncPresetChangedL - Entering." );
       
  3268 	}
       
  3269 
       
  3270 // -----------------------------------------------------------------------
       
  3271 // from MSyncPresetObserver
       
  3272 // SyncPresetNoChangeL()
       
  3273 // called back when the preset that is synced has not been changed
       
  3274 // -----------------------------------------------------------------------
       
  3275 void CIRNowPlayingView::SyncPresetNoChangeL()
       
  3276 	{
       
  3277 	IRLOG_DEBUG( "CIRNowPlayingView::SyncPresetNoChangeL - Entering." );
       
  3278 	iUi->iNowPlayingWrapper->iSyncPreset = EFalse;
       
  3279 	// TO Do: need to check
       
  3280 	iNowPlayingWrapper->SetFavFocus(iRockerIndex+1);
       
  3281 
       
  3282 	if(iUi->iFavPresets->iFavPresetList.Count() >= 1)
       
  3283 		{
       
  3284 		iUi->iFavPresets->iFavPresetList[iRockerIndex]->
       
  3285 			CopyPresetData(*iNowPlayingWrapper->iNowPlayingPreset);
       
  3286 		iNowPlayingWrapper->ConnectToChannelL(*iNowPlayingWrapper->iNowPlayingPreset);
       
  3287 		StartTimerL();
       
  3288 		}
       
  3289 
       
  3290 	IRLOG_DEBUG( "CIRNowPlayingView::SyncPresetNoChangeL - Entering." );
       
  3291 	}
       
  3292 // ---------------------------------------------------------------------------
       
  3293 // CIRNowPlayingView::StaticConnectionCleanupCallback
       
  3294 // ---------------------------------------------------------------------------
       
  3295 //
       
  3296 TInt CIRNowPlayingView::StaticConnectionCleanupCallback( TAny* aSelfPtr )
       
  3297 	{
       
  3298 	CIRNowPlayingView* self = reinterpret_cast<CIRNowPlayingView*>( aSelfPtr );
       
  3299 
       
  3300 	 if(self)
       
  3301 		 {
       
  3302 		delete self->iConnectionCleanupTimer;
       
  3303 		self->iConnectionCleanupTimer = NULL;
       
  3304 		TRAP_IGNORE(self->DrawViewL(self->iStationHasLogo);)
       
  3305 		 }
       
  3306 		return KErrNone;
       
  3307 	}