Revision: 201015 RCL_3 PDK_3.0.i
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Tue, 27 Apr 2010 16:38:14 +0300
branchRCL_3
changeset 9 0004e923f486
parent 8 f73067c3e563
child 11 97dcae98e602
Revision: 201015 Kit: 201017
fmradio/fmradio/src/fmradioappui.cpp
fmradio/fmradio/src/fmradiochannellistcontainer.cpp
fmradio/fmradio/src/fmradiochannellistview.cpp
fmradio/fmradio/src/fmradioscanlocalstationscontainer.cpp
fmradio/fmradiomcpplugin/src/fmradiomcpplugin.cpp
--- a/fmradio/fmradio/src/fmradioappui.cpp	Wed Apr 14 15:57:41 2010 +0300
+++ b/fmradio/fmradio/src/fmradioappui.cpp	Tue Apr 27 16:38:14 2010 +0300
@@ -431,15 +431,6 @@
 #endif
                 }
                 break;
-            case EFMRadioCmdScanLocalStationsViewActive:
-                iLayoutChangeObserver = iScanLocalStationsView;
-                break;
-            case EFMRadioCmdChannelListViewActive:
-                iLayoutChangeObserver = iChannelListView;
-                break;
-            case EFMRadioCmdMainViewActive:
-                iLayoutChangeObserver = iMainView;
-                break;
             default:
                 break;
             }
@@ -459,6 +450,15 @@
         }
     switch ( aCommand )
         {
+        case EFMRadioCmdScanLocalStationsViewActive:
+            iLayoutChangeObserver = iScanLocalStationsView;
+            break;
+        case EFMRadioCmdChannelListViewActive:
+            iLayoutChangeObserver = iChannelListView;
+            break;
+        case EFMRadioCmdMainViewActive:
+            iLayoutChangeObserver = iMainView;
+            break;
         case EAknSoftkeyExit:
         case EEikCmdExit:
         case EAknCmdExit:
--- a/fmradio/fmradio/src/fmradiochannellistcontainer.cpp	Wed Apr 14 15:57:41 2010 +0300
+++ b/fmradio/fmradio/src/fmradiochannellistcontainer.cpp	Tue Apr 27 16:38:14 2010 +0300
@@ -223,60 +223,57 @@
 // values specified
 // ----------------------------------------------------
 //
-void CFMRadioChannelListContainer::UpdateChannelListContentL( TInt aIndex, const TDesC& aChannelName, TInt aChannelFrequency )
-	{
+void CFMRadioChannelListContainer::UpdateChannelListContentL( TInt aIndex,
+        const TDesC& aChannelName,
+        TInt aChannelFrequency )
+    {
     TBuf<KLengthOfChannelItemString> textChannelItem;
     TBuf<KLengthOfChIndexStringChList> textChIndex;
     TBuf<KLengthOfChannelItemIconIndexString> textChIconIndex;
-
+    
     textChIndex.Format( KChIndexFormatChList, aIndex+1 ); // One over index
- 
+    
     textChIconIndex.Format( KChIconIndexFormatChList, KNowPlayingIconIndexChList );
+    
+    //Update to display Devnagari numbers for Text Index.
+    AknTextUtils::LanguageSpecificNumberConversion( textChIndex );
 
-	//Update to display Devnagari numbers for Text Index.
-   	AknTextUtils::LanguageSpecificNumberConversion( textChIndex );
-   	//
     textChannelItem.Append( textChIndex );
     textChannelItem.Append( KColumnListSeparator );
     textChannelItem.Append( aChannelName );
     textChannelItem.Append( KColumnListSeparator );
     
     if ( aChannelFrequency )
-		{
-		TReal frequency = static_cast<TReal>( aChannelFrequency / static_cast<TReal>( KHzConversionFactor ));
-		// Gets locale decimal separator automatically
-		TRealFormat format(KFrequencyMaxLength, iRadioEngine.DecimalCount() );
-		TBuf<30> frequencyString;
-		frequencyString.Num( frequency, format );
-
-		HBufC* stringHolder = StringLoader::LoadLC( R_QTN_FMRADIO_DOUBLE2_FREQ, frequencyString, iEikonEnv );
-		//Update for display of Hindi Devnagari Numbers
-		TPtr textItem2 = stringHolder->Des();
-   		AknTextUtils::LanguageSpecificNumberConversion(textItem2);
-		textChannelItem.Append( textItem2 );
-		CleanupStack::PopAndDestroy( stringHolder );
-		}
+        {
+        TReal frequency = static_cast<TReal>( aChannelFrequency / static_cast<TReal>( KHzConversionFactor ));
+        // Gets locale decimal separator automatically
+        TRealFormat format(KFrequencyMaxLength, iRadioEngine.DecimalCount() );
+        TBuf<30> frequencyString;
+        frequencyString.Num( frequency, format );
+    
+        HBufC* stringHolder = StringLoader::LoadLC( R_QTN_FMRADIO_DOUBLE2_FREQ, frequencyString, iEikonEnv );
+        //Update for display of Hindi Devnagari Numbers
+        TPtr textItem2 = stringHolder->Des();
+        AknTextUtils::LanguageSpecificNumberConversion(textItem2);
+        textChannelItem.Append( textItem2 );
+        CleanupStack::PopAndDestroy( stringHolder );
+        }
         
     // Set 'Now Playing' icon to the channel item
     textChannelItem.Append( KColumnListSeparator );
-        		 
+                 
     if ( iRadioEngine.GetPresetIndex() == aIndex )
-	    {	    
+        {
         textChannelItem.Append( textChIconIndex );
-	    }
+        }
     
-    if( iChannelItemArray->Count() > 0 )
-    	{
-	    iChannelItemArray->Delete( aIndex );
-	    iChannelList->HandleItemRemovalL();
-	    iChannelItemArray->InsertL( aIndex, textChannelItem );
-	    //iChannelItemArray->AppendL(  textChannelItem );
-	    
-	    iChannelList->HandleItemAdditionL(); // Update list
-	    iChannelList->UpdateScrollBarsL();
-		iChannelList->DrawDeferred();
-    	}
-	}
+    if ( aIndex < iChannelItemArray->Count() && aIndex >= 0 )
+        {
+        iChannelItemArray->Delete( aIndex );
+        iChannelItemArray->InsertL( aIndex, textChannelItem );
+        iChannelList->DrawDeferred();
+        }
+    }
 
 // ----------------------------------------------------
 // CFMRadioChannelListContainer::RemoveChannelL
@@ -416,11 +413,8 @@
         ptr.Append( textChIconIndex ); // Add icon index
         
         iChannelItemArray->Delete( aIndex );
-        iChannelList->HandleItemRemovalL();
         iChannelItemArray->InsertL( aIndex, *channelItem );
         CleanupStack::PopAndDestroy( channelItem );
-        iChannelList->HandleItemAdditionL(); // Update list
-        iChannelList->UpdateScrollBarsL();
         }
     // use draw now so that view is up to date during fast channel switching
     iChannelList->DrawNow();
@@ -447,10 +441,7 @@
             {
             ptr.Delete( ptr.Length() - iconIndexPtr.Length(), iconIndexPtr.Length() ); // Remove icon index		
             iChannelItemArray->Delete( index );
-            iChannelList->HandleItemRemovalL();
             iChannelItemArray->InsertL( index, *channelItem );
-            iChannelList->HandleItemAdditionL(); // Update list
-            iChannelList->UpdateScrollBarsL();
             }
         CleanupStack::PopAndDestroy( channelItem );
         }
--- a/fmradio/fmradio/src/fmradiochannellistview.cpp	Wed Apr 14 15:57:41 2010 +0300
+++ b/fmradio/fmradio/src/fmradiochannellistview.cpp	Tue Apr 27 16:38:14 2010 +0300
@@ -721,11 +721,13 @@
 // CFMRadioChannelListView::LayoutChangedL
 // ---------------------------------------------------------------------------
 //
-void CFMRadioChannelListView::LayoutChangedL(
-    TInt aType )
+void CFMRadioChannelListView::LayoutChangedL( TInt aType )
     {
-    iContainer->SetRect( ClientRect() );
-    iContainer->HandleResourceChange( aType );
+    if ( iContainer )
+        {
+        iContainer->SetRect( ClientRect() );
+        iContainer->HandleResourceChange( aType );
+        }
     }
 
 // ---------------------------------------------------------------------------------------------
--- a/fmradio/fmradio/src/fmradioscanlocalstationscontainer.cpp	Wed Apr 14 15:57:41 2010 +0300
+++ b/fmradio/fmradio/src/fmradioscanlocalstationscontainer.cpp	Tue Apr 27 16:38:14 2010 +0300
@@ -189,18 +189,19 @@
 // values specified
 // ----------------------------------------------------
 //
-void CFMRadioScanLocalStationsContainer::UpdateChannelListContentL( TInt aIndex, const TDesC& aInfoText, TInt aChannelFrequency, TBool aNowPlaying, TBool aInfoTextPlacement )
-	{
+void CFMRadioScanLocalStationsContainer::UpdateChannelListContentL( TInt aIndex,
+        const TDesC& aInfoText,
+        TInt aChannelFrequency,
+        TBool aNowPlaying,
+        TBool aInfoTextPlacement )
+    {
     TBuf<KLengthOfChannelItemString> textChannelItem;
     TBuf<KLengthOfChIndexStringChList> textChIndex;
     TBuf<KLengthOfChannelItemIconIndexString> textChIconIndex;
     
-    //textChIndex.Format( KChIndexFormatChList, aIndex+1 ); // One over index
     textChIndex.SetLength( 0 );
-        
+    
     textChIconIndex.Format( KChIconIndexFormatChList, KNowPlayingIconIndexChList ) ;
-	//Update to display Devnagari numbers for Text Index.
-   	//AknTextUtils::LanguageSpecificNumberConversion(textChIndex);
     textChannelItem.Append( textChIndex );
     textChannelItem.Append( KColumnListSeparator );
     
@@ -210,7 +211,7 @@
     TBuf<30> frequencyString;
     frequencyString.Num( frequency, format );
 
-    HBufC* listItemString = NULL;             
+    HBufC* listItemString = NULL;
     if ( aInfoTextPlacement ) // frequency and PS name
         {
         const TInt granularity = 2;
@@ -240,24 +241,24 @@
     textChannelItem.Append( KColumnListSeparator );
     
     if ( aNowPlaying )
-	    {	    
-    	textChannelItem.Append( textChIconIndex );	
-	    }
+        {
+        textChannelItem.Append( textChIconIndex );	
+        }
     
-    if( aIndex <= ( iChannelItemArray->Count() - 1 ) )
-    	{
-    	iChannelItemArray->Delete( aIndex );
-        iChannelList->HandleItemRemovalL();
+    if ( aIndex < iChannelItemArray->Count() && aIndex >= 0 )
+        {
+        iChannelItemArray->Delete( aIndex );
         iChannelItemArray->InsertL( aIndex, textChannelItem );
-    	}
+        }
     else
-    	{
+        {
         iChannelItemArray->AppendL( textChannelItem );
-    	}
-    iChannelList->HandleItemAdditionL(); // Update list
-    iChannelList->UpdateScrollBarsL();
-	iChannelList->DrawDeferred();
-	}
+        iChannelList->HandleItemAdditionL(); // Update list
+        iChannelList->UpdateScrollBarsL();
+        }
+
+    iChannelList->DrawDeferred();
+    }
 
 // --------------------------------------------------------------------------------
 // CFMRadioScanLocalStationsContainer::InsertScannedChannelToListL
--- a/fmradio/fmradiomcpplugin/src/fmradiomcpplugin.cpp	Wed Apr 14 15:57:41 2010 +0300
+++ b/fmradio/fmradiomcpplugin/src/fmradiomcpplugin.cpp	Tue Apr 27 16:38:14 2010 +0300
@@ -698,7 +698,8 @@
         switch( aMuteState )
             {
             case EFMRadioPSMuteStateOn:
-                if ( iEngine->ApplicationRunningState() != EFMRadioPSApplicationRunning )
+                if ( iEngine->ApplicationRunningState() != EFMRadioPSApplicationRunning ||
+                        iEngine->AntennaStatus() == EFMRadioPSHeadsetDisconnected )
                     {
                     UpdatePublishedToolBarL( KFMRadioUnmuteDimmed );
                     }
@@ -709,7 +710,8 @@
                 break;
             case EFMRadioPSMuteStateOff:
             case EFMRadioPSMuteStateUninitialized:
-                if ( iEngine->ApplicationRunningState() != EFMRadioPSApplicationRunning )
+                if ( iEngine->ApplicationRunningState() != EFMRadioPSApplicationRunning ||
+                        iEngine->AntennaStatus() == EFMRadioPSHeadsetDisconnected )
                     {
                     UpdatePublishedToolBarL( KFMRadioMuteDimmed );
                     }