radiohswidget/src/radiohswidget.cpp
changeset 41 3a6b55c6390c
parent 33 11b6825f0862
child 48 e14766a36cdc
--- a/radiohswidget/src/radiohswidget.cpp	Tue Jul 06 14:16:27 2010 +0300
+++ b/radiohswidget/src/radiohswidget.cpp	Wed Aug 18 09:49:03 2010 +0300
@@ -209,6 +209,7 @@
             switch (status) {
             case RadioStatus::Playing:
                 LOG("Playing");
+                handleRadioStateChange(FmRadio::StateRunning);
                 break;
             case RadioStatus::Muted:
                 LOG("Muted");
@@ -240,11 +241,9 @@
             // TODO: Remove comment when localisation is working on device.
             //frequencyString = hbTrId("txt_fmradiohswidget_rad_list_l1_mhz").arg(freqString);
             bool frequencyCleared = false;
-            // If widget has some frequency information and new frequency
-            // differs from that
-            if (mRadioInformation.contains(Frequency)
-                && mRadioInformation[Frequency].compare(information.toString()) != 0) {
-                // Clear all infromation from widget because station has changed.
+
+            if (mRadioInformation.contains(Frequency)) {
+                // Clear all infromation.
                 clearRadioInformation();
                 frequencyCleared = true;
             }
@@ -254,6 +253,7 @@
             if (frequencyCleared || frequencyUpdated) {
                 // Information changed, update the UI.
                 changeInRadioInformation();
+                mFmRadioState = FmRadio::StateRunning;
             }
         }
         break;
@@ -339,6 +339,7 @@
         // Stop timer if it is running because radio is now running.
         mRadioServiceClient->startMonitoring(
             FmRadio::VisibiltyDoNotChange);
+        changeInRadioInformation();
         changePowerButtonOn(true);
         enableStationButtons();
         changeInformationAreaLayout(OneRow);
@@ -346,7 +347,6 @@
     case FmRadio::StateSeeking:
         LOG("FmRadio::StateSeeking");
         mFmRadioState = FmRadio::StateSeeking;
-        mFavoriteStationCount = FAVORITE_STATION_COUNT_UNDEFINED;
         mCurrentStationIsFavorite = false;
         enableStationButtons();
         changeInformationAreaLayout(Animation);
@@ -354,7 +354,6 @@
     case FmRadio::StateAntennaNotConnected:
         LOG("FmRadio::StateAntennaNotConnected");
         mFmRadioState = FmRadio::StateAntennaNotConnected;
-        mFavoriteStationCount = FAVORITE_STATION_COUNT_UNDEFINED;
         mCurrentStationIsFavorite = false;
         enableStationButtons();
         mInformationFirstRowLabel->setPlainText("");
@@ -909,7 +908,12 @@
 void RadioHsWidget::enableStationButtons()
 {
     LEVEL2(LOG_METHOD_ENTER);
-    if ((mFavoriteStationCount > 1) || (mFavoriteStationCount == 1
+    LOG_FORMAT("RadioHsWidget::enableStationButtons count: %d", mFavoriteStationCount);
+    if (mFmRadioState == FmRadio::StateAntennaNotConnected){
+        changeButtonToDisabled(Next);
+        changeButtonToDisabled(Previous);
+    }
+    else if ((mFavoriteStationCount > 1) || (mFavoriteStationCount == 1
         && !mCurrentStationIsFavorite)) {
         changeButtonToEnabled(Next);
         changeButtonToEnabled(Previous);
@@ -1081,7 +1085,7 @@
     // starting the radio is allowed in other profiles without asking a
     // permission.
     bool radioStartPermssion = true;
-    if (mProfileMonitor->isCurrentProfileOffline()) {
+    if (mProfileMonitor->isInOfflineMode()) {
         // Device is in offline profile, ask the user for permission to start
         HbDeviceMessageBox box(hbTrId(
             "txt_fmradiohswidget_rad_info_activate_radio_in_offline_mode_hs"),