Revision: 201021 RCL_3
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Wed, 09 Jun 2010 09:42:10 +0300
branchRCL_3
changeset 27 4f2584af5a29
parent 22 9f3ff466f56b
child 31 04aa446da81c
Revision: 201021 Kit: 2010123
fmradio/fmradio/inc/fmradioappui.h
fmradio/fmradio/inc/fmradiochannellistview.h
fmradio/fmradio/src/fmradioalfvisualizer.cpp
fmradio/fmradio/src/fmradioappui.cpp
fmradio/fmradio/src/fmradiochannellistcontainer.cpp
fmradio/fmradioengine/data/fmradioengine.rss
fmradio/fmradioengine/inc/fmradioengine.h
fmradio/fmradioengine/src/fmradioengine.cpp
fmradio/loc/fmradio.loc
--- a/fmradio/fmradio/inc/fmradioappui.h	Tue May 25 12:42:49 2010 +0300
+++ b/fmradio/fmradio/inc/fmradioappui.h	Wed Jun 09 09:42:10 2010 +0300
@@ -550,11 +550,6 @@
         TFMRadioRegionSetting HandleRegionsAtStartUpL();
         
         /**
-        * Request tuner control from engine
-        */
-        void RequestTunerControl() const;
-
-        /**
         * Is offline profile activated when radio audio was disabled.
         * @return ETrue, if offline profile activated when radio 
         * audio was disabled. EFalse otherwise.
--- a/fmradio/fmradio/inc/fmradiochannellistview.h	Tue May 25 12:42:49 2010 +0300
+++ b/fmradio/fmradio/inc/fmradiochannellistview.h	Wed Jun 09 09:42:10 2010 +0300
@@ -204,6 +204,15 @@
          */
         void StopSeekL();
         
+        /**
+        * Interprets view's menu,softkey and other commands and acts 
+        * accordingly by calling the appropriate command handler 
+        * function for further action.
+        * @since 2.6
+        * @param aCommand the command to process
+        */
+        void HandleCommandL( TInt aCommand );
+        
      private: // Functions from base classes
         /**
         * Activate the channel list view
@@ -216,14 +225,6 @@
         */
         void DoDeactivate();
         /**
-        * Interprets view's menu,softkey and other commands and acts 
-        * accordingly by calling the appropriate command handler 
-        * function for further action.
-        * @since 2.6
-        * @param aCommand the command to process
-        */
-        void HandleCommandL( TInt aCommand );
-        /**
         * From MCoeControlObserver, control event observing. In this case,
         * the user selection from the list is reported by container class
         * and observed here.
--- a/fmradio/fmradio/src/fmradioalfvisualizer.cpp	Tue May 25 12:42:49 2010 +0300
+++ b/fmradio/fmradio/src/fmradioalfvisualizer.cpp	Wed Jun 09 09:42:10 2010 +0300
@@ -696,42 +696,60 @@
 // ----------------------------------------------------------------------------
 //
 TBool CFMRadioAlfVisualizer::OfferEventL( const TAlfEvent& aEvent )
-	{		
+    {
+    TBool keyHandled = EFalse;
+    
     if ( aEvent.IsKeyEvent() && AknLayoutUtils::PenEnabled() )
         {
         const TKeyEvent& kEvent = aEvent.KeyEvent();
-        if ( kEvent.iScanCode  == EStdKeyRightArrow ||
-            kEvent.iScanCode == EStdKeyLeftArrow ||
-            kEvent.iScanCode == EStdKeyUpArrow ||
-            kEvent.iScanCode == EStdKeyDownArrow )
+        
+        if ( kEvent.iCode == EKeyEnter || kEvent.iCode == EKeyOK )
+            {
+            iAppUi->ActivateLocalViewL( KFMRadioChannelListViewId );
+            keyHandled = ETrue;
+            }
+        
+        switch ( kEvent.iScanCode )
             {
-            iKeyScanCode = kEvent.iScanCode;
-
-            if ( aEvent.Code() == EEventKeyUp )
+            case EStdKeyRightArrow: // check arrow keys
+            case EStdKeyLeftArrow:
+            case EStdKeyUpArrow:
+            case EStdKeyDownArrow:
                 {
-                iLongPressTimer->Cancel();
-                if ( !iLongKeyTriggered )
+                iKeyScanCode = kEvent.iScanCode;
+    
+                if ( aEvent.Code() == EEventKeyUp )
                     {
-                    TriggerCommandL();
+                    iLongPressTimer->Cancel();
+                    if ( !iLongKeyTriggered )
+                        {
+                        TriggerCommandL();
+                        }
                     }
+                else if ( aEvent.Code() == EEventKeyDown )
+                    {
+                    iLongKeyTriggered = EFalse;
+                    // Start the long key press timer
+                    iLongPressTimer->Cancel();
+                    iLongPressTimer->Start( KFMRadioRockerLongPressDelay, 
+                                            0, 
+                                            TCallBack( CFMRadioAlfVisualizer::StaticLongPressCallBack, this ) );
+                    
+                    }
+                keyHandled = ETrue;
+                break;
                 }
-                else if ( aEvent.Code() == EEventKeyDown )
+            default:
                 {
-                iLongKeyTriggered = EFalse;
-                // Start the long key press timer
-                iLongPressTimer->Cancel();
-                iLongPressTimer->Start( KFMRadioRockerLongPressDelay, 
-                                        0, 
-                                        TCallBack( CFMRadioAlfVisualizer::StaticLongPressCallBack, this ) );
+                break;
                 }
-            return ETrue;
             }
         }
     if ( aEvent.IsPointerEvent() )
         {
         return CGestureControl::OfferEventL( aEvent );
         }
-    return EFalse;
+    return keyHandled;
     }
 
 // ---------------------------------------------------------------------------
@@ -1070,14 +1088,13 @@
 void CFMRadioAlfVisualizer::TriggerCommandL()
     {
     TVwsViewId viewId( KNullUid, KNullUid );
-    CAknViewAppUi* appUi = static_cast<CAknViewAppUi*>( CCoeEnv::Static()->AppUi() );
-    TInt err = appUi->GetActiveViewId( viewId );
+    TInt err = iAppUi->GetActiveViewId( viewId );
     RProcess process;
     TSecureId id = process.SecureId();
 
     if ( !err && viewId.iAppUid.iUid == id.iId )
         {
-        CAknView* view = appUi->View( viewId.iViewUid );
+        CAknView* view = iAppUi->View( viewId.iViewUid );
         if ( view )
             {
             // command to be generated
--- a/fmradio/fmradio/src/fmradioappui.cpp	Tue May 25 12:42:49 2010 +0300
+++ b/fmradio/fmradio/src/fmradioappui.cpp	Wed Jun 09 09:42:10 2010 +0300
@@ -1927,6 +1927,11 @@
         {
         TRAP_IGNORE( iLocalContinueOfflineQuery->DismissQueryL() );
         }
+    // Close activate offline query
+    if ( iLocalActivateOfflineQuery && iLocalActivateOfflineQuery->IsVisible() )
+        {
+        TRAP_IGNORE( iLocalActivateOfflineQuery->DismissQueryL() );
+        }
     }
 
 // ---------------------------------------------------------------------------
@@ -1969,7 +1974,7 @@
     TFMRadioRegionSetting region = HandleRegionsAtStartUpL();
     iRadioEngine->SetRegionIdL( region );
     HandlePendingViewActivationL();
-    RequestTunerControl();
+    iRadioEngine->RequestTunerControl();
     }
 
 // ---------------------------------------------------------------------------
@@ -2223,17 +2228,6 @@
     }
 
 // ---------------------------------------------------------------------------
-// CFMRadioAppUi::RequestTunerControl
-// request tuner control from engine
-// ---------------------------------------------------------------------------
-//    
-void CFMRadioAppUi::RequestTunerControl() const
-    {
-    FTRACE( FPrint( _L("CFMRadioAppUi::RequestTunerControl()")) );
-    iRadioEngine->RequestTunerControl();
-    }
-
-// ---------------------------------------------------------------------------
 // CFMRadioAppUi::NumberOfChannelsStored
 // return number of channels saved to the presets
 // ---------------------------------------------------------------------------
@@ -2354,11 +2348,11 @@
         TInt ret = iConnectHeadsetQuery->ExecuteLD( R_FMRADIO_CONNECT_HEADSET_NOTE, *noteTxt );
             
         CleanupStack::PopAndDestroy( noteTxt );
-        
+        FTRACE( FPrint( _L("CFMRadioAppUi::ShowConnectHeadsetDialogL() return value from dialog: %d"), ret ) );
         if ( iConnectHeadsetQuery )
             {
             iConnectHeadsetQuery = NULL;
-            if ( ret == EAknSoftkeyExit )
+            if ( ret == EAknSoftkeyExit || ret == EAknSoftkeyOk )
                 {
                 TApaTask task( iCoeEnv->WsSession() );
                 task.SetWgId( iCoeEnv->RootWin().Identifier() );
--- a/fmradio/fmradio/src/fmradiochannellistcontainer.cpp	Tue May 25 12:42:49 2010 +0300
+++ b/fmradio/fmradio/src/fmradiochannellistcontainer.cpp	Wed Jun 09 09:42:10 2010 +0300
@@ -281,44 +281,45 @@
 // ----------------------------------------------------
 //
 void CFMRadioChannelListContainer::RemoveChannelL( TInt aIndex )
-	{
-	if ( iChannelItemArray->Count() > 0 )
-		{
-		TInt presetIndex = iRadioEngine.GetPresetIndex();
-		
-		iChannelItemArray->Delete( aIndex );
-		iChannelList->HandleItemRemovalL();
-		iChannelList->UpdateScrollBarsL();
-		iChannelList->DrawDeferred();
-							
-		if ( iChannelItemArray->Count() > 0 )
-			{
-			ReIndexAllL();
-			
-			if ( presetIndex > aIndex )			    
-			    {
-			    // update engine settings also
-			    iRadioEngine.SetCurrentPresetIndex( presetIndex - 1 );
+    {
+    if ( iChannelItemArray->Count() > 0 )
+        {
+        TInt presetIndex = iRadioEngine.GetPresetIndex();
+        
+        iChannelItemArray->Delete( aIndex );
+        iChannelList->HandleItemRemovalL();
+        iChannelList->UpdateScrollBarsL();
+
+        if ( iChannelItemArray->Count() > 0 )
+            {
+            ReIndexAllL();
+            
+            if ( presetIndex > aIndex )			    
+                {
+                // update engine settings also
+                iRadioEngine.SetCurrentPresetIndex( presetIndex - 1 );
                 UpdateItemIconL( presetIndex - 1, KNowPlayingIconIndexChList );
                 }
-			else if ( presetIndex == aIndex  )
+            else if ( presetIndex == aIndex  )
                 {
                 iRadioEngine.TunePresetL( 0 );	
                 UpdateItemIconL( 0, KNowPlayingIconIndexChList );
                 }
-			else
-			    {
-			    // NOP
-			    }               
+            else
+                {
+                // NOP
+                }               
             iChannelList->SetCurrentItemIndex( 0 );
-			}
-		else
-		    {
-		    // The last item was deleted, tune to current frequency, out of preset mode
-		    iRadioEngine.Tune( iRadioEngine.GetTunedFrequency(), CRadioEngine::ERadioTunerMode );
-		    }
-		}
-	}
+            
+            }
+        else
+            {
+            // The last item was deleted, tune to current frequency, out of preset mode
+            iRadioEngine.Tune( iRadioEngine.GetTunedFrequency(), CRadioEngine::ERadioTunerMode );
+            }
+        iChannelList->DrawDeferred();
+        }
+    }
 
 // ----------------------------------------------------
 // CFMRadioChannelListContainer::AddChannel
@@ -578,60 +579,82 @@
 // ---------------------------------------------------------
 //
 TKeyResponse CFMRadioChannelListContainer::OfferKeyEventL( const TKeyEvent& aKeyEvent,
-														   TEventCode aType )
-	{
-	TKeyResponse response = EKeyWasNotConsumed;
+                                                           TEventCode aType )
+    {
+    TKeyResponse response = EKeyWasNotConsumed;
 
     switch ( aKeyEvent.iCode )
         {
-        case EKeyOK:
+        case EKeyBackspace:
             {
-            // msk, used to accept move action
+            if ( iChannelList->IsHighlightEnabled() && !iMoveAction )
+                {
+                iChannelView->HandleCommandL( EFMRadioCmdErase );
+                return EKeyWasConsumed;
+                }
+            break;
+            }
+        case EKeyOK: // accept both
+        case EKeyEnter:
+            {
+            // used to accept move action
             if ( iMoveAction )
                 {
                 iChannelView->MoveActionDoneL();
                 return EKeyWasConsumed;
                 }
+            else if ( iChannelList->IsHighlightEnabled() ) // change to main view
+                {
+                if ( iChannelView->CurrentlyPlayingChannel() ==
+                        CurrentlySelectedChannel() )
+                    {
+                    CFMRadioAppUi* appUi = static_cast<CFMRadioAppUi*>( iCoeEnv->AppUi() );
+                    appUi->ActivateLocalViewL( KFMRadioMainViewId );
+                    return EKeyWasConsumed;
+                    }
+                }
             break;
             }
         case EKeyLeftArrow:
         case EKeyRightArrow:
-        	{
+            {
             return EKeyWasNotConsumed;
-        	}
+            }
         case EKeyUpArrow:
-        	if ( iMoveAction )	
-        		{
+            if ( iMoveAction )	
+                {
                 iKeyMoveActivated = ETrue;
-        		MoveUpL();
-	            }
-        	else
-        		{
-        		response = iChannelList->OfferKeyEventL(aKeyEvent, aType);
-	            if (response == EKeyWasConsumed)
-	                {
-	                ReportEventL( MCoeControlObserver::EEventRequestFocus );
-	                }
-        		}
-        	return response;
+                MoveUpL();
+                response = EKeyWasConsumed;
+                }
+            else
+                {
+                response = iChannelList->OfferKeyEventL(aKeyEvent, aType);
+                if (response == EKeyWasConsumed)
+                    {
+                    ReportEventL( MCoeControlObserver::EEventRequestFocus );
+                    }
+                }
+            return response;
         case EKeyDownArrow:
-        	if ( iMoveAction )	
-        		{
+            if ( iMoveAction )	
+                {
                 iKeyMoveActivated = ETrue;
-        		MoveDownL();
-	            }
-        	else
-        		{
-        		response = iChannelList->OfferKeyEventL(aKeyEvent, aType);
-	            if (response == EKeyWasConsumed)
-	                {
-	                ReportEventL( MCoeControlObserver::EEventRequestFocus );
-	                }
-        		}
+                MoveDownL();
+                response = EKeyWasConsumed;
+                }
+            else
+                {
+                response = iChannelList->OfferKeyEventL(aKeyEvent, aType);
+                if (response == EKeyWasConsumed)
+                    {
+                    ReportEventL( MCoeControlObserver::EEventRequestFocus );
+                    }
+                }
             return response;
         default:
-			switch ( aKeyEvent.iScanCode ) //we need to use the scan code, because we need to process the event wrt the keyUp and keyDown action
-				{
+            switch ( aKeyEvent.iScanCode ) //we need to use the scan code, because we need to process the event wrt the keyUp and keyDown action
+                {
                 case EKeyboardKey1: // Timed key
                 case EKeyboardKey2: // Normal keys
                 case EKeyboardKey3:
@@ -642,12 +665,12 @@
                 case EKeyboardKey8:
                 case EKeyboardKey9:
                 case EKeyboardKey0:
-					return EKeyWasNotConsumed;
-				default:
-					break;
-				}
+                    return EKeyWasNotConsumed;
+                default:
+                    break;
+                }
             break;
-		}
+        }
     return iChannelList->OfferKeyEventL(aKeyEvent, aType);
     }
 
--- a/fmradio/fmradioengine/data/fmradioengine.rss	Tue May 25 12:42:49 2010 +0300
+++ b/fmradio/fmradioengine/data/fmradioengine.rss	Wed Jun 09 09:42:10 2010 +0300
@@ -39,21 +39,21 @@
 
 
 STRUCT RADIO_REGION
-	{
-	WORD id;
-	WORD stepsize;
-	LONG minfrequency;
-	LONG maxfrequency;
-	WORD decimalcount;
-	LTEXT countrycodes[] = {""};
-	LTEXT regionname;
-	LTEXT regionsettingname;
-	}
+    {
+    WORD id;
+    WORD stepsize;
+    LONG minfrequency;
+    LONG maxfrequency;
+    WORD decimalcount;
+    LTEXT countrycodes[] = {""};
+    LTEXT regionname;
+    LTEXT regionsettingname;
+    }
 
 STRUCT RADIO_REGION_ARRAY
-	{
-	LLINK regions[];
-	}
+    {
+    LLINK regions[];
+    }
 
 // ---------------------------------------------------------
 //
@@ -63,14 +63,14 @@
 // ---------------------------------------------------------
 //
 RESOURCE RADIO_REGION_ARRAY r_radio_regions_all
-	{
-	regions = 
-		{
-		r_radio_region_japan,
-		r_radio_region_america,
-		r_radio_region_default
-		};
-	}
+    {
+    regions = 
+        {
+        r_radio_region_america,
+        r_radio_region_japan,
+        r_radio_region_default
+        };
+    }
 
 // ---------------------------------------------------------
 //
@@ -80,14 +80,14 @@
 // ---------------------------------------------------------
 //
 RESOURCE RADIO_REGION_ARRAY r_radio_regions_without_japan
-	{
-	regions = 
-		{		
-		r_radio_region_america,
-		r_radio_region_default
-		};
-	}
-	
+    {
+    regions = 
+        {		
+        r_radio_region_america,
+        r_radio_region_default
+        };
+    }
+    
 // ---------------------------------------------------------
 //
 //    r_radio_region_japan
@@ -97,19 +97,19 @@
 // ---------------------------------------------------------
 //
 RESOURCE RADIO_REGION r_radio_region_japan
-	{
-	id = EFMRadioRegionJapan;
-	stepsize = 100;
-	minfrequency = 76000;
-	maxfrequency = 90000;
-	decimalcount = 1;
-	countrycodes = 
-		{
-		"440",
-		"441"
-		};
-	regionname = qtn_fmradio_reg_japan;
-	}
+    {
+    id = EFMRadioRegionJapan;
+    stepsize = 100;
+    minfrequency = 76000;
+    maxfrequency = 90000;
+    decimalcount = 1;
+    countrycodes = 
+        {
+        "440",
+        "441"
+        };
+    regionname = qtn_fmradio_reg_japan;
+    }
 
 // ---------------------------------------------------------
 //
@@ -120,56 +120,56 @@
 // ---------------------------------------------------------
 //
 RESOURCE RADIO_REGION r_radio_region_america
-	{
-	id = EFMRadioRegionAmerica;
-	stepsize = 200;
-	minfrequency = 88100;
-	maxfrequency = 107900;
-	decimalcount = 1;
-	countrycodes = 
-		{
-		"302",  // Canada
-		"310",  // USA
-		"311",  // USA
-		"312",  // USA
-		"313",  // USA
-		"314",  // USA
-		"315",  // USA
-		"316",  // USA
-		"332",  // USA
-		"334",  // Mexico
-		"338",  // Jamaica
-		"342",  // Barbados
-		"344",  // Antigua and Barbuda
-		"352",  // Grenada
-		"360",  // Saint Vincent and the Grenadines
-		"364",  // Bahamas
-		"366",  // Common Wealth of Dominica
-		"370",  // Dominican Republic
-		"372",  // Haiti
-		"374",  // Trinidad and Tobago
-		"368",  // Cuba
-		"702",  // Belize
-		"704",  // Guatemala
-		"706",  // El Salvador
-		"708",  // Honduras
-		"710",  // Nicaragua
-		"712",  // Costa Rica
-		"714",  // Panama
-		"716",  // Peru
-		"724",  // Brazil
-		"730",  // Chile
-		"732",  // Colombia
-		"734",  // Venezuela
-		"736",  // Bolivia
-		"738",  // Guyana
-		"740",  // Ecuador
-		"744",  // Paraguay
-		"746",  // Suriname
-		"748"   // Uruguay
-		};
-	regionname = qtn_fmradio_reg_america;
-	}
+    {
+    id = EFMRadioRegionAmerica;
+    stepsize = 200;
+    minfrequency = 88100;
+    maxfrequency = 107900;
+    decimalcount = 1;
+    countrycodes = 
+        {
+        "302",  // Canada
+        "310",  // USA
+        "311",  // USA
+        "312",  // USA
+        "313",  // USA
+        "314",  // USA
+        "315",  // USA
+        "316",  // USA
+        "332",  // USA
+        "334",  // Mexico
+        "338",  // Jamaica
+        "342",  // Barbados
+        "344",  // Antigua and Barbuda
+        "352",  // Grenada
+        "360",  // Saint Vincent and the Grenadines
+        "364",  // Bahamas
+        "366",  // Common Wealth of Dominica
+        "370",  // Dominican Republic
+        "372",  // Haiti
+        "374",  // Trinidad and Tobago
+        "368",  // Cuba
+        "702",  // Belize
+        "704",  // Guatemala
+        "706",  // El Salvador
+        "708",  // Honduras
+        "710",  // Nicaragua
+        "712",  // Costa Rica
+        "714",  // Panama
+        "716",  // Peru
+        "724",  // Brazil
+        "730",  // Chile
+        "732",  // Colombia
+        "734",  // Venezuela
+        "736",  // Bolivia
+        "738",  // Guyana
+        "740",  // Ecuador
+        "744",  // Paraguay
+        "746",  // Suriname
+        "748"   // Uruguay
+        };
+    regionname = qtn_fmradio_reg_america;
+    }
 
 // ---------------------------------------------------------
 //
@@ -179,11 +179,11 @@
 // ---------------------------------------------------------
 //
 RESOURCE RADIO_REGION r_radio_region_default
-	{
-	id = EFMRadioRegionDefault;
-	stepsize = 50;
-	minfrequency = 87500;
-	maxfrequency = 108000;
-	decimalcount = 2;
-	regionname = qtn_fmradio_reg_other;
-	}
+    {
+    id = EFMRadioRegionDefault;
+    stepsize = 50;
+    minfrequency = 87500;
+    maxfrequency = 108000;
+    decimalcount = 2;
+    regionname = qtn_fmradio_reg_other;
+    }
--- a/fmradio/fmradioengine/inc/fmradioengine.h	Tue May 25 12:42:49 2010 +0300
+++ b/fmradio/fmradioengine/inc/fmradioengine.h	Wed Jun 09 09:42:10 2010 +0300
@@ -27,7 +27,6 @@
 #include <RadioPlayerUtility.h>
 #include <RadioPresetUtility.h>
 #include <RadioFmPresetUtility.h>
-#include <etelmm.h>
 
 #include "fmradiosystemeventdetectorobserver.h"
 #include "fmradionetworkchangeobserver.h"
@@ -757,26 +756,29 @@
     void ConstructL();
     
     /**
-    * ConnectLineL
-    */
-    void ConnectLineL();
-
-    /**
      * Updates the frequency into settings and P&S
      * 
      * @param aFrequency The frequency to be set
      */
     void StoreAndPublishFrequency( TInt aFrequency );
     
-private:
-
-   //the internal radio engine states
-   enum TRadioEngineState
-       {
+    // internal radio engine states
+    enum TRadioEngineState
+        {
         EStateRadioOff,
         EStateRadioOn,
         };
-
+    
+    // internal state of the tuner control
+    enum TRadioTunerControlState
+        {
+        EStateRadioTunerControlUninitialized,
+        EStateRadioTunerControlOn,
+        EStateRadioTunerControlOff
+        };
+    
+private:
+   
     // The Radio Utility
     CRadioUtility* iRadioUtility; // own
     // The Tuner Utility
@@ -801,8 +803,6 @@
     CCentralRepositoryHandler* iCentralRepositoryHandler; // own
     // Used to provide async behavior in some callbacks
     CRadioStateHandler *iStateHandler;
-    // flag to indicate if auto resume is supported
-    TBool iAutoResume;
     // flag to indicate if a call is in progress
     TBool iInCall;
     // pointer to TRadioSettings
@@ -818,7 +818,7 @@
     // Indicates a request to initialized the radio is pending
     TBool iInitializeRadioRequestExists;
     // Indicates if the tuner control has been granted.
-    TBool iTunerControl;
+    TRadioTunerControlState iTunerControl;
     // High and low frequency of the current band.
     TInt iBottomFrequency;
     TInt iTopFrequency;
@@ -826,30 +826,18 @@
     TBool iFrequencySetByRdsAf;
     //Listens changes in network availability
     CFMRadioSystemEventDetector* iSystemEventDetector;
-   	// for fmradio engine resource file
+    // for fmradio engine resource file
     TInt iFMRadioEngineResourceOffset;
     //Listens changes in network ID and country code 
     CFMRadioMobileNetworkInfoListener* iNetworkInfoListener;
     //P&S interaction interface for FMRadio actions.
-	CFMRadioPubSub* iPubSub;
+    CFMRadioPubSub* iPubSub;
     // accessory observer
     CFMRadioAccessoryConnection* iHeadsetObserver;
-    // tel server session
-    RTelServer iTelServer;
-    // phone
-    RMobilePhone iPhone;
-	// line
-	RMobileLine iLine;
-	// tsy name
-	TFileName iTsyName;
-    // conrrectly constructer
-    TBool ilineConstructed;
     // for storing station name for method GetPresetNameL
-   	TStationName iStationName;
+    TStationName iStationName;
     // Local cache for tuning state so that it doesn't get published before should
-   	TFMRadioPSTuningState iTuningState;
-    // If last time audio is set to IHF with no headset connected.
-    TBool iHFOptionActivated;
+    TFMRadioPSTuningState iTuningState;
     };
 
 #endif  //FMRADIOENGINE_H
--- a/fmradio/fmradioengine/src/fmradioengine.cpp	Tue May 25 12:42:49 2010 +0300
+++ b/fmradio/fmradioengine/src/fmradioengine.cpp	Wed Jun 09 09:42:10 2010 +0300
@@ -21,9 +21,7 @@
 #include <AccMonitor.h>
 #include <bautils.h>
 #include <coemain.h>
-#include <ctsydomainpskeys.h>
 #include <data_caging_path_literals.hrh>
-#include <e32property.h>
 
 #include "fmradioengine.h"
 #include "fmradioenginestatechangecallback.h"
@@ -56,14 +54,12 @@
 CRadioEngine::CRadioEngine(
     MRadioEngineStateChangeCallback& aCallback)
     :
-    iAutoResume(EFalse),
-    iCurrentRadioState(EStateRadioOff),
-    iCallback(aCallback),
-    iTempFrequency(KDefaultRadioFrequency),
-    iTunePresetRequested(EFalse),
-    iInitializeRadioRequestExists(EFalse),
-    ilineConstructed( EFalse ),
-    iHFOptionActivated ( EFalse )
+    iCurrentRadioState( EStateRadioOff ),
+    iCallback( aCallback ),
+    iTempFrequency( KDefaultRadioFrequency ),
+    iTunePresetRequested( EFalse ),
+    iInitializeRadioRequestExists( EFalse ),
+    iTunerControl( EStateRadioTunerControlUninitialized )
     {
     }
 
@@ -75,9 +71,7 @@
 void CRadioEngine::ConstructL()
     {
     FTRACE(FPrint(_L("CRadioEngine::ConstructL()")));
-    
-    TRAP_IGNORE( ConnectLineL() );
-    
+        
     InitializeResourceLoadingL(); 
 
     iRadioSettings = new ( ELeave ) TRadioSettings;
@@ -98,6 +92,7 @@
 
     // Get a tuner utility
     iFmTunerUtility = &iRadioUtility->RadioFmTunerUtilityL( *this );
+    iFmTunerUtility->EnableTunerInOfflineMode( ETrue );
     
     // Get a player utility
     iPlayerUtility = &iRadioUtility->RadioPlayerUtilityL( *this );
@@ -134,16 +129,9 @@
     iTopFrequency = 0;
     iBottomFrequency = 0;
 
-    TInt callState = KErrUnknown;
-    RMobileCall::TMobileCallStatus linestatus;
-   	iLine.GetMobileLineStatus( linestatus );
-    RProperty::Get(KPSUidCtsyCallInformation, KCTsyCallState, callState);
-                
-    // check status from line
-    if ( linestatus != RMobileCall::EStatusIdle &&
-         linestatus != RMobileCall::EStatusUnknown )
+    if ( iSystemEventDetector->IsCallActive() )
         {
-        // Pre-empted due to phone call, start Call State Observer
+        // Pre-empted due to phone call
         iInCall = ETrue;
         }
     // accessory observer
@@ -173,39 +161,6 @@
 
     FTRACE(FPrint(_L("CRadioEngine::ConstructL() End ")));
     }
-    
-// ----------------------------------------------------
-// CRadioEngine::ConnectLineL
-// Connects etel server
-// ----------------------------------------------------
-//
-void CRadioEngine::ConnectLineL()
-	{
-	User::LeaveIfError( iTelServer.Connect() );
-
-	iTelServer.GetTsyName( 0, iTsyName );
-
-	User::LeaveIfError( iTelServer.LoadPhoneModule( iTsyName ) );
-	TInt numberOfPhones( 0 );
-	User::LeaveIfError( iTelServer.EnumeratePhones( numberOfPhones ) );
-
-	RTelServer::TPhoneInfo phoneInfo;
-
-	// Only possible thing to do is leave. We definately need phone.
-	User::LeaveIfError( iTelServer.GetPhoneInfo( 0, phoneInfo ) );
-	    
-	// Only possible thing to do is leave. We definately need phone.
-	User::LeaveIfError( iPhone.Open( iTelServer, phoneInfo.iName ));
-	
-
-	RPhone::TLineInfo lineInfo;
-	
-	User::LeaveIfError( iPhone.GetLineInfo( 0, lineInfo ) );
-	
-	User::LeaveIfError( iLine.Open( iPhone, lineInfo.iName ) );
-	
-	ilineConstructed = ETrue;
-	}
 
 // ----------------------------------------------------
 // CRadioEngine::NewL
@@ -284,14 +239,6 @@
         {
         CCoeEnv::Static()->DeleteResourceFile( iFMRadioEngineResourceOffset );
         }
-         
-	if ( ilineConstructed )
-		{	        
-		iLine.Close();
-	    iPhone.Close();
-	    iTelServer.UnloadPhoneModule( iTsyName );    
-	    iTelServer.Close();
-	    }
     }
 
 // ----------------------------------------------------
@@ -398,7 +345,7 @@
     iTempFrequency = aFrequency;
 
     iRadioSettings->SetRadioMode( aRadioMode );
-    if ( iTunerControl && iRadioSettings->IsHeadsetConnected() )
+    if ( iTunerControl == EStateRadioTunerControlOn && iRadioSettings->IsHeadsetConnected() )
         {
         iFmTunerUtility->SetFrequency( aFrequency );
         }
@@ -1023,45 +970,44 @@
 // CRadioEngine::MrftoRequestTunerControlComplete
 // ----------------------------------------------------
 //
-void CRadioEngine::MrftoRequestTunerControlComplete(
-    TInt aError )
+void CRadioEngine::MrftoRequestTunerControlComplete( TInt aError )
     {
     FTRACE(FPrint(_L("CRadioEngine::MrftoRequestTunerControlComplete() - Error = %d"), aError));
 
     if ( aError == KErrNone )
         {
-        iTunerControl = ETrue;
+        iTunerControl = EStateRadioTunerControlOn;
         // Headset must be connected
         iRadioSettings->SetHeadsetConnected();
         iFmTunerUtility->GetCapabilities( iTunerCaps );
-
         if( iTunerCaps.iTunerFunctions & TFmTunerCapabilities::ETunerRdsSupport )
-	        {
-	        TRAP_IGNORE( iRdsReceiver->InitL( *iRadioUtility, iPubSub ) )
-	        }
+            {
+            TRAP_IGNORE( iRdsReceiver->InitL( *iRadioUtility, iPubSub ) )
+            }
         
-		TFmRadioFrequencyRange japanFreqRange = EFmRangeJapan;
-		
-		if ( TunerFrequencyRangeForRegionId( RegionId() ) == japanFreqRange )
-			{
-			// region is Japan so we need to change the freq range from the default
-			iFmTunerUtility->SetFrequencyRange( japanFreqRange );		
-			}
-		else
-			{
-			// allready on correct freq range
-			HandleCallback(MRadioEngineStateChangeCallback::EFMRadioEventTunerReady, KErrNone );
-			}		        
+        TFmRadioFrequencyRange japanFreqRange = EFmRangeJapan;
+        if ( TunerFrequencyRangeForRegionId( RegionId() ) == japanFreqRange )
+            {
+            // region is Japan so we need to change the freq range from the default
+            iFmTunerUtility->SetFrequencyRange( japanFreqRange );
+            }
+        else
+            {
+            // allready on correct freq range
+            HandleCallback( MRadioEngineStateChangeCallback::EFMRadioEventTunerReady, KErrNone );
+            }
+        
         }
     else if ( aError == KFmRadioErrAntennaNotConnected )
         {
         FTRACE(FPrint(_L("CRadioEngine::MrftoRequestTunerControlComplete() - KFmRadioErrAntennaNotConnected")));
+        iTunerControl = EStateRadioTunerControlOff;
         iRadioSettings->SetHeadsetDisconnected();
         HandleCallback(MRadioEngineStateChangeCallback::EFMRadioEventHeadsetDisconnected, KErrNone );
         }
     else if ( aError == KErrAlreadyExists )
         {
-        iTunerControl = ETrue;
+        iTunerControl = EStateRadioTunerControlOn;
         // Headset must be connected
         iRadioSettings->SetHeadsetConnected();
         iFmTunerUtility->GetCapabilities( iTunerCaps );
@@ -1072,17 +1018,17 @@
         }
     else if ( aError == KFmRadioErrFmTransmitterActive )
         {
-        iTunerControl = EFalse;
+        iTunerControl = EStateRadioTunerControlOff;
         HandleCallback( MRadioEngineStateChangeCallback::EFMRadioEventFMTransmitterOn, KErrNone );
         }
     else if ( aError == KFmRadioErrOfflineMode )
         {
-        iTunerControl = EFalse;
+        iTunerControl = EStateRadioTunerControlOff;
         HandleCallback( MRadioEngineStateChangeCallback::EFMRadioEventFlightModeEnabled, KErrNone );
         }
     else
         {
-        //pass
+        iTunerControl = EStateRadioTunerControlOff;
         }
     }
 
@@ -1091,14 +1037,13 @@
 //
 // ----------------------------------------------------
 //
-void CRadioEngine::MrftoSetFrequencyRangeComplete(
-    TInt aError )
+void CRadioEngine::MrftoSetFrequencyRangeComplete( TInt aError )
     {
     if ( aError == KErrNone )
-    	{
-    	HandleCallback( MRadioEngineStateChangeCallback::EFMRadioEventTunerReady, KErrNone );
-    	}
-    	  	
+        {
+        HandleCallback( MRadioEngineStateChangeCallback::EFMRadioEventTunerReady, KErrNone );
+        }
+        
     FTRACE(FPrint(_L("CRadioEngine::MrftoSetFrequencyRangeComplete() - error = %d"), aError));
     }
 
@@ -1106,12 +1051,10 @@
 // CRadioEngine::MrftoSetFrequencyComplete
 // ----------------------------------------------------
 //
-void CRadioEngine::MrftoSetFrequencyComplete(
-    TInt aError )
+void CRadioEngine::MrftoSetFrequencyComplete( TInt aError )
     {
     FTRACE(FPrint(_L("CRadioEngine::MrftoSetFrequencyComplete() - aError = %d"), aError));
 
-
     if ( !aError )
         {
         iRdsReceiver->ClearRdsInformation();
@@ -1136,7 +1079,6 @@
         FTRACE(FPrint(_L("CRadioEngine::MrftoSetFrequencyComplete() - Sending event to UI")));
         HandleCallback( MRadioEngineStateChangeCallback::EFMRadioEventTune, aError );
         }
-
     }
 
 // ----------------------------------------------------
@@ -1200,7 +1142,7 @@
     if ( aActive )
         {
         // loses tuner control
-        iTunerControl = EFalse;
+        iTunerControl = EStateRadioTunerControlOff;
         }
     }
 
@@ -1216,7 +1158,7 @@
     FTRACE(FPrint(_L("CRadioEngine::MrftoAntennaStatusChange() - Antenna Status = %d"), aAttached));
     if ( aAttached )
         {
-        if ( !iTunerControl )
+        if ( iTunerControl == EStateRadioTunerControlOff )
             {
             iFmTunerUtility->RequestTunerControl();
             }
@@ -1238,18 +1180,17 @@
 // Called when offline mode status changes
 // ----------------------------------------------------
 //
-void CRadioEngine::MrftoOfflineModeStatusChange(
-    TBool aOfflineMode )
+void CRadioEngine::MrftoOfflineModeStatusChange( TBool aOfflineMode )
     {
     FTRACE(FPrint(_L("CRadioEngine::MrftoOfflineModeStatusChange() - Offline Mode = %d"), aOfflineMode));
 
-    if( aOfflineMode )
+    if ( aOfflineMode )
         {
         HandleFlightModeEnabled();
         }
     else
         {
-        if ( !iTunerControl )
+        if ( iTunerControl == EStateRadioTunerControlOff )
             {
             iFmTunerUtility->RequestTunerControl();
             }
@@ -1361,25 +1302,10 @@
                     ( aError == KErrNotReady ) ||
                     ( aError == KErrInUse ) )
                 {
-                TInt callState = KErrUnknown;
-                
-                RMobileCall::TMobileCallStatus linestatus;
-                
-                if ( ilineConstructed )
-					{
-                	iLine.GetMobileLineStatus( linestatus );
-                	}
-                FTRACE(FPrint(_L("CRadioEngine::MrpoStateChange() linestatus = %d"), linestatus));
-                
-                TInt err = RProperty::Get(KPSUidCtsyCallInformation, KCTsyCallState, callState);
-                FTRACE(FPrint(_L("CRadioEngine::MrpoStateChange() callState = %d"), callState));
-                                
-                // check status from line
-                if ( linestatus != RMobileCall::EStatusIdle &&
-                     linestatus != RMobileCall::EStatusUnknown ||
-                     iSystemEventDetector->IsCallActive() )
+                // check call status
+                if ( iSystemEventDetector->IsCallActive() )
                     {
-                    FTRACE(FPrint(_L("CRadioEngine::MrpoStateChange() EFMRadioEventCallStarted")  ) );
+                    FTRACE(FPrint(_L("CRadioEngine::MrpoStateChange() EFMRadioEventCallStarted") ) );
                     iInCall = ETrue;
                     ret = MRadioEngineStateChangeCallback::EFMRadioEventCallStarted;
                     }
@@ -1504,13 +1430,14 @@
 // -----------------------------------------------------------------------------
 //
 void CRadioEngine::AudioResourcesAvailableL()
-	{
-	FTRACE( FPrint( _L("CRadioEngine::AudioResourcesAvailableL()" ) ) );
-	if ( iPubSub && !iInCall && iTunerControl ) // if iPubSub exists, then the ConstructL has been successfully completed
-		{
-	    HandleCallback(MRadioEngineStateChangeCallback::EFMRadioEventAudioResourceAvailable, KErrNone );
-		}
-	}
+    {
+    FTRACE( FPrint( _L("CRadioEngine::AudioResourcesAvailableL()" ) ) );
+    // if iPubSub exists, then the ConstructL has been successfully completed
+    if ( iPubSub && !iInCall && iTunerControl == EStateRadioTunerControlOn ) 
+        {
+        HandleCallback(MRadioEngineStateChangeCallback::EFMRadioEventAudioResourceAvailable, KErrNone );
+        }
+    }
 
 // -----------------------------------------------------------------------------
 // CRadioEngine::AudioAutoResumeForbiddenL
@@ -1532,11 +1459,11 @@
 // -----------------------------------------------------------------------------
 //
 void CRadioEngine::CallActivatedCallbackL()
-	{
-	FTRACE( FPrint( _L("CRadioEngine::CallActivatedCallbackL()" ) ) );
-	// no implementation needed, CRadioEngine::MrpoStateChange handles call startup		
-	}
-	
+    {
+    FTRACE( FPrint( _L("CRadioEngine::CallActivatedCallbackL()" ) ) );
+    iInCall = ETrue;
+    }
+
 // -----------------------------------------------------------------------------
 // CRadioEngine::CallDeactivatedCallbackL
 // This callback notifies when call becomes deactive.
@@ -1827,11 +1754,14 @@
 // ----------------------------------------------------
 //
 EXPORT_C void CRadioEngine::RequestTunerControl() const
-	{
-	// Before first RequestTunerControl() call it is ok to enable offline mode without checking capabilities 
-    iFmTunerUtility->EnableTunerInOfflineMode( ETrue );
-    iFmTunerUtility->RequestTunerControl();	
-	}
+    {
+    FTRACE( FPrint( _L("CRadioEngine::RequestTunerControl()")) );
+    if ( iTunerControl == EStateRadioTunerControlUninitialized )
+        {
+        // first request for tuner control.
+        iFmTunerUtility->RequestTunerControl();
+        }
+    }
 
 // ----------------------------------------------------
 // CRadioEngine::DecimalCount
--- a/fmradio/loc/fmradio.loc	Tue May 25 12:42:49 2010 +0300
+++ b/fmradio/loc/fmradio.loc	Wed Jun 09 09:42:10 2010 +0300
@@ -375,9 +375,10 @@
 // d: %N is the station memory location and %U is the frequency.
 // d: Memory location number max value is 100.
 // d: Frequency is shown with one or two decimals, max length 6 characters.
+// d: there should be two spaces between %N. and %U. "%N.  %U MHz" 
 // l: area_fmrd2_info_pane_t1
 //
-#define qtn_fmradio_mem_location_freq    "%N. %U MHz"
+#define qtn_fmradio_mem_location_freq    "%N.  %U MHz"
 
 // d: String shown on the main pane.
 // d: %N is the station memory location and %U is station name.