Index: trunk/BNS/bnswindow.cpp
===================================================================
--- trunk/BNS/bnswindow.cpp	(revision 2102)
+++ trunk/BNS/bnswindow.cpp	(revision 2138)
@@ -90,6 +90,4 @@
 
   bnsSettings settings;
-  QPalette palette;
-  QColor lightGray(230, 230, 230);
 
   QString fontString = settings.value("font").toString();
@@ -346,9 +344,5 @@
 
   connect(_proxyHostLineEdit, SIGNAL(textChanged(const QString &)),
-          this, SLOT(bnsText(const QString &)));
-  if (_proxyHostLineEdit->text().isEmpty()) {
-    _proxyPortLineEdit->setStyleSheet("background-color: lightGray");
-    _proxyPortLineEdit->setEnabled(false);
-  }
+          this, SLOT(slotBnsTextChanged()));
 
   // General Tab
@@ -393,11 +387,5 @@
 
   connect(_ephHostLineEdit, SIGNAL(textChanged(const QString &)),
-          this, SLOT(bnsText(const QString &)));
-  if (_ephHostLineEdit->text().isEmpty()) {
-    _ephPortLineEdit->setStyleSheet("background-color: lightGray");
-    _ephEchoLineEdit->setStyleSheet("background-color: lightGray");
-    _ephPortLineEdit->setEnabled(false);
-    _ephEchoLineEdit->setEnabled(false);
-  }
+          this, SLOT(slotBnsTextChanged()));
 
   // Clocks & Orbits Tab
@@ -421,9 +409,5 @@
 
   connect(_clkPortLineEdit, SIGNAL(textChanged(const QString &)),
-          this, SLOT(bnsText(const QString &)));
-  if (_clkPortLineEdit->text().isEmpty()) {
-    _inpEchoLineEdit->setStyleSheet("background-color: lightGray");
-    _inpEchoLineEdit->setEnabled(false);
-  }
+          this, SLOT(slotBnsTextChanged()));
 
   // Broadcast Corrections I Tab
@@ -459,23 +443,10 @@
 
   tab_cas1->setLayout(layout_cas1);
+
   connect(_refSys_1_ComboBox, SIGNAL(currentIndexChanged(const QString &)),
           this, SLOT(customTrafo(const QString)));
+
   connect(_outHost_1_LineEdit, SIGNAL(textChanged(const QString &)),
-          this, SLOT(bnsText(const QString &)));
-  if (_outHost_1_LineEdit->text().isEmpty()) {
-    _outPort_1_LineEdit->setStyleSheet("background-color: lightGray");
-    _mountpoint_1_LineEdit->setStyleSheet("background-color: lightGray");
-    _password_1_LineEdit->setStyleSheet("background-color: lightGray");
-    _outFile_1_LineEdit->setStyleSheet("background-color: lightGray");
-    _refSys_1_ComboBox->setStyleSheet("background-color: lightGray");
-    palette.setColor(_CoM_1_CheckBox->backgroundRole(), lightGray);
-    _CoM_1_CheckBox->setPalette(palette);
-    _outPort_1_LineEdit->setEnabled(false);
-    _mountpoint_1_LineEdit->setEnabled(false);
-    _password_1_LineEdit->setEnabled(false);
-    _outFile_1_LineEdit->setEnabled(false);
-    _refSys_1_ComboBox->setEnabled(false);
-    _CoM_1_CheckBox->setEnabled(false);
-  }
+          this, SLOT(slotBnsTextChanged()));
 
   // Broadcast Corrections II Tab
@@ -511,23 +482,10 @@
 
   tab_cas2->setLayout(layout_cas2);
+
   connect(_refSys_2_ComboBox, SIGNAL(currentIndexChanged(const QString &)),
           this, SLOT(customTrafo(const QString)));
+
   connect(_outHost_2_LineEdit, SIGNAL(textChanged(const QString &)),
-          this, SLOT(bnsText(const QString &)));
-  if (_outHost_2_LineEdit->text().isEmpty()) {
-    _outPort_2_LineEdit->setStyleSheet("background-color: lightGray");
-    _mountpoint_2_LineEdit->setStyleSheet("background-color: lightGray");
-    _password_2_LineEdit->setStyleSheet("background-color: lightGray");
-    _outFile_2_LineEdit->setStyleSheet("background-color: lightGray");
-    _refSys_2_ComboBox->setStyleSheet("background-color: lightGray");
-    palette.setColor(_CoM_2_CheckBox->backgroundRole(), lightGray);
-    _CoM_2_CheckBox->setPalette(palette);
-    _outPort_2_LineEdit->setEnabled(false);
-    _mountpoint_2_LineEdit->setEnabled(false);
-    _password_2_LineEdit->setEnabled(false);
-    _outFile_2_LineEdit->setEnabled(false);
-    _refSys_2_ComboBox->setEnabled(false);
-    _CoM_2_CheckBox->setEnabled(false);
-  }
+          this, SLOT(slotBnsTextChanged()));
 
   // Broadcast Corrections III Tab
@@ -563,23 +521,10 @@
 
   tab_cas3->setLayout(layout_cas3);
+
   connect(_refSys_3_ComboBox, SIGNAL(currentIndexChanged(const QString &)),
           this, SLOT(customTrafo(const QString)));
+
   connect(_outHost_3_LineEdit, SIGNAL(textChanged(const QString &)),
-          this, SLOT(bnsText(const QString &)));
-  if (_outHost_3_LineEdit->text().isEmpty()) {
-    _outPort_3_LineEdit->setStyleSheet("background-color: lightGray");
-    _mountpoint_3_LineEdit->setStyleSheet("background-color: lightGray");
-    _password_3_LineEdit->setStyleSheet("background-color: lightGray");
-    _outFile_3_LineEdit->setStyleSheet("background-color: lightGray");
-    _refSys_3_ComboBox->setStyleSheet("background-color: lightGray");
-    palette.setColor(_CoM_3_CheckBox->backgroundRole(), lightGray);
-    _CoM_3_CheckBox->setPalette(palette);
-    _outPort_3_LineEdit->setEnabled(false);
-    _mountpoint_3_LineEdit->setEnabled(false);
-    _password_3_LineEdit->setEnabled(false);
-    _outFile_3_LineEdit->setEnabled(false);
-    _refSys_3_ComboBox->setEnabled(false);
-    _CoM_3_CheckBox->setEnabled(false);
-  }
+          this, SLOT(slotBnsTextChanged()));
 
   // Broadcast Ephemerides
@@ -608,16 +553,7 @@
 
   tab_casEph->setLayout(layout_casEph);
+
   connect(_outHost_Eph_LineEdit, SIGNAL(textChanged(const QString &)),
-          this, SLOT(bnsText(const QString &)));
-  if (_outHost_Eph_LineEdit->text().isEmpty()) {
-    _outPort_Eph_LineEdit->setStyleSheet("background-color: lightGray");
-    _mountpoint_Eph_LineEdit->setStyleSheet("background-color: lightGray");
-    _password_Eph_LineEdit->setStyleSheet("background-color: lightGray");
-    _samplEphSpinBox->setStyleSheet("background-color: lightGray");
-    _outPort_Eph_LineEdit->setEnabled(false);
-    _mountpoint_Eph_LineEdit->setEnabled(false);
-    _password_Eph_LineEdit->setEnabled(false);
-    _samplEphSpinBox->setEnabled(false);
-  }
+          this, SLOT(slotBnsTextChanged()));
 
   // RINEX Clocks Tab
@@ -643,11 +579,5 @@
 
   connect(_rnxPathLineEdit, SIGNAL(textChanged(const QString &)),
-          this, SLOT(bnsText(const QString &)));
-  if (_rnxPathLineEdit->text().isEmpty()) {
-    _rnxIntrComboBox->setStyleSheet("background-color: lightGray");
-    _rnxSamplSpinBox->setStyleSheet("background-color: lightGray");
-    _rnxIntrComboBox->setEnabled(false);
-    _rnxSamplSpinBox->setEnabled(false);
-  }
+          this, SLOT(slotBnsTextChanged()));
 
   // SP3 Orbits Tab
@@ -673,11 +603,5 @@
 
   connect(_sp3PathLineEdit, SIGNAL(textChanged(const QString &)),
-          this, SLOT(bnsText(const QString &)));
-  if (_sp3PathLineEdit->text().isEmpty()) {
-    _sp3IntrComboBox->setStyleSheet("background-color: lightGray");
-    _sp3SamplSpinBox->setStyleSheet("background-color: lightGray");
-    _sp3IntrComboBox->setEnabled(false);
-    _sp3SamplSpinBox->setEnabled(false);
-  }
+          this, SLOT(slotBnsTextChanged()));
 
   tabs->setCurrentIndex(settings.value("startTab").toInt());
@@ -743,4 +667,8 @@
   _canvas->setLayout(mainLayout);
 
+  // Enable/Disable all Widgets
+  // --------------------------
+  slotBnsTextChanged();
+
   // Auto start
   // ----------
@@ -1006,21 +934,19 @@
 }
 
-//  Bns Text
-////////////////////////////////////////////////////////////////////////////
-void bnsWindow::bnsText(const QString &text){
-
-  bool isEmpty = text.isEmpty();
-
-  QPalette palette;
-  QColor lightGray(230, 230, 230);
-  QColor white(255, 255, 255);
+// Enable/Disable Widgets according to user input
+////////////////////////////////////////////////////////////////////////////
+void bnsWindow::slotBnsTextChanged(){
+
+  QPalette palette_white(QColor(255, 255, 255));
+  QPalette palette_gray(QColor(230, 230, 230));
 
   // Enable/disable Proxy Options
   // ----------------------------
-  if (tabs->currentIndex() == 0) {
-    if (!isEmpty) {
+  if (sender() == 0 || sender() == _proxyHostLineEdit) {
+    if (!_proxyHostLineEdit->text().isEmpty()) {
       _proxyPortLineEdit->setStyleSheet("background-color: white");
       _proxyPortLineEdit->setEnabled(true);
-    } else {
+    } 
+    else {
       _proxyPortLineEdit->setStyleSheet("background-color: lightGray");
       _proxyPortLineEdit->setEnabled(false);
@@ -1030,15 +956,16 @@
   // Enable/disable RINEX Ephemeris Options
   // --------------------------------------
-  if (tabs->currentIndex() == 2) {
-    if (!isEmpty) {
-    _ephPortLineEdit->setStyleSheet("background-color: white");
-    _ephEchoLineEdit->setStyleSheet("background-color: white");
-    _ephPortLineEdit->setEnabled(true);
-    _ephEchoLineEdit->setEnabled(true);
-    } else {
-    _ephPortLineEdit->setStyleSheet("background-color: lightGray");
-    _ephEchoLineEdit->setStyleSheet("background-color: lightGray");
-    _ephPortLineEdit->setEnabled(false);
-    _ephEchoLineEdit->setEnabled(false);
+  if (sender() == 0 || sender() == _ephHostLineEdit) {
+    if (!_ephHostLineEdit->text().isEmpty()) {
+      _ephPortLineEdit->setStyleSheet("background-color: white");
+      _ephEchoLineEdit->setStyleSheet("background-color: white");
+      _ephPortLineEdit->setEnabled(true);
+      _ephEchoLineEdit->setEnabled(true);
+    } 
+    else {
+      _ephPortLineEdit->setStyleSheet("background-color: lightGray");
+      _ephEchoLineEdit->setStyleSheet("background-color: lightGray");
+      _ephPortLineEdit->setEnabled(false);
+      _ephEchoLineEdit->setEnabled(false);
     }
   }
@@ -1046,11 +973,12 @@
   // Enable/disable Clocks & Orbits Options
   // --------------------------------------
-  if (tabs->currentIndex() == 3) {
-    if (!isEmpty) {
-    _inpEchoLineEdit->setStyleSheet("background-color: white");
-    _inpEchoLineEdit->setEnabled(true);
-    } else {
-    _inpEchoLineEdit->setStyleSheet("background-color: lightGray");
-    _inpEchoLineEdit->setEnabled(false);
+  if (sender() == 0 || sender() == _clkPortLineEdit) {
+    if (!_clkPortLineEdit->text().isEmpty()) {
+      _inpEchoLineEdit->setStyleSheet("background-color: white");
+      _inpEchoLineEdit->setEnabled(true);
+    } 
+    else {
+      _inpEchoLineEdit->setStyleSheet("background-color: lightGray");
+      _inpEchoLineEdit->setEnabled(false);
     }
   }
@@ -1058,6 +986,6 @@
   // Enable/disable  Broadcast Corrections I Options
   // -----------------------------------------------
-  if (tabs->currentIndex() == 4) {
-    if (!isEmpty) {
+  if (sender() == 0 || sender() == _outHost_1_LineEdit) {
+    if (!_outHost_1_LineEdit->text().isEmpty()) {
       _outPort_1_LineEdit->setStyleSheet("background-color: white");
       _mountpoint_1_LineEdit->setStyleSheet("background-color: white");
@@ -1065,6 +993,5 @@
       _outFile_1_LineEdit->setStyleSheet("background-color: white");
       _refSys_1_ComboBox->setStyleSheet("background-color: white");
-      palette.setColor(_CoM_1_CheckBox->backgroundRole(), white);
-      _CoM_1_CheckBox->setPalette(palette);
+      _CoM_1_CheckBox->setPalette(palette_white);
       _outPort_1_LineEdit->setEnabled(true);
       _mountpoint_1_LineEdit->setEnabled(true);
@@ -1073,5 +1000,6 @@
       _refSys_1_ComboBox->setEnabled(true);
       _CoM_1_CheckBox->setEnabled(true);
-    } else {
+    } 
+    else {
       _outPort_1_LineEdit->setStyleSheet("background-color: lightGray");
       _mountpoint_1_LineEdit->setStyleSheet("background-color: lightGray");
@@ -1079,6 +1007,5 @@
       _outFile_1_LineEdit->setStyleSheet("background-color: lightGray");
       _refSys_1_ComboBox->setStyleSheet("background-color: lightGray");
-      palette.setColor(_CoM_1_CheckBox->backgroundRole(), lightGray);
-      _CoM_1_CheckBox->setPalette(palette);
+      _CoM_1_CheckBox->setPalette(palette_gray);
       _outPort_1_LineEdit->setEnabled(false);
       _mountpoint_1_LineEdit->setEnabled(false);
@@ -1092,6 +1019,6 @@
   // Enable/disable Broadcast Corrections II Options
   // -----------------------------------------------
-  if (tabs->currentIndex() == 5) {
-    if (!isEmpty) {
+  if (sender() == 0 || sender() == _outHost_2_LineEdit) {
+    if (!_outHost_2_LineEdit->text().isEmpty()) {
       _outPort_2_LineEdit->setStyleSheet("background-color: white");
       _mountpoint_2_LineEdit->setStyleSheet("background-color: white");
@@ -1099,6 +1026,5 @@
       _outFile_2_LineEdit->setStyleSheet("background-color: white");
       _refSys_2_ComboBox->setStyleSheet("background-color: white");
-      palette.setColor(_CoM_2_CheckBox->backgroundRole(), white);
-      _CoM_2_CheckBox->setPalette(palette);
+      _CoM_2_CheckBox->setPalette(palette_white);
       _outPort_2_LineEdit->setEnabled(true);
       _mountpoint_2_LineEdit->setEnabled(true);
@@ -1107,5 +1033,6 @@
       _refSys_2_ComboBox->setEnabled(true);
       _CoM_2_CheckBox->setEnabled(true);
-    } else {
+    } 
+    else {
       _outPort_2_LineEdit->setStyleSheet("background-color: lightGray");
       _mountpoint_2_LineEdit->setStyleSheet("background-color: lightGray");
@@ -1113,6 +1040,5 @@
       _outFile_2_LineEdit->setStyleSheet("background-color: lightGray");
       _refSys_2_ComboBox->setStyleSheet("background-color: lightGray");
-      palette.setColor(_CoM_2_CheckBox->backgroundRole(), lightGray);
-      _CoM_2_CheckBox->setPalette(palette);
+      _CoM_2_CheckBox->setPalette(palette_gray);
       _outPort_2_LineEdit->setEnabled(false);
       _mountpoint_2_LineEdit->setEnabled(false);
@@ -1126,6 +1052,6 @@
   // Enable/disable Broadcast Corrections III Options
   // -----------------------------------------------
-  if (tabs->currentIndex() == 6) {
-    if (!isEmpty) {
+  if (sender() == 0 || sender() == _outHost_3_LineEdit) {
+    if (!_outHost_3_LineEdit->text().isEmpty()) {
       _outPort_3_LineEdit->setStyleSheet("background-color: white");
       _mountpoint_3_LineEdit->setStyleSheet("background-color: white");
@@ -1133,6 +1059,5 @@
       _outFile_3_LineEdit->setStyleSheet("background-color: white");
       _refSys_3_ComboBox->setStyleSheet("background-color: white");
-      palette.setColor(_CoM_3_CheckBox->backgroundRole(), white);
-      _CoM_3_CheckBox->setPalette(palette);
+      _CoM_3_CheckBox->setPalette(palette_white);
       _outPort_3_LineEdit->setEnabled(true);
       _mountpoint_3_LineEdit->setEnabled(true);
@@ -1141,5 +1066,6 @@
       _refSys_3_ComboBox->setEnabled(true);
       _CoM_3_CheckBox->setEnabled(true);
-    } else {
+    } 
+    else {
       _outPort_3_LineEdit->setStyleSheet("background-color: lightGray");
       _mountpoint_3_LineEdit->setStyleSheet("background-color: lightGray");
@@ -1147,6 +1073,5 @@
       _outFile_3_LineEdit->setStyleSheet("background-color: lightGray");
       _refSys_3_ComboBox->setStyleSheet("background-color: lightGray");
-      palette.setColor(_CoM_3_CheckBox->backgroundRole(), lightGray);
-      _CoM_3_CheckBox->setPalette(palette);
+      _CoM_3_CheckBox->setPalette(palette_gray);
       _outPort_3_LineEdit->setEnabled(false);
       _mountpoint_3_LineEdit->setEnabled(false);
@@ -1160,6 +1085,6 @@
   // Enable/disable Broadcast Ephemerides
   // ------------------------------------
-  if (tabs->currentIndex() == 7) {
-    if (!isEmpty) {
+  if (sender() == 0 || sender() == _outHost_Eph_LineEdit) {
+    if (!_outHost_Eph_LineEdit->text().isEmpty()) {
       _outPort_Eph_LineEdit->setStyleSheet("background-color: white");
       _mountpoint_Eph_LineEdit->setStyleSheet("background-color: white");
@@ -1170,5 +1095,6 @@
       _password_Eph_LineEdit->setEnabled(true);
       _samplEphSpinBox->setEnabled(true);
-    } else {
+    } 
+    else {
       _outPort_Eph_LineEdit->setStyleSheet("background-color: lightGray");
       _mountpoint_Eph_LineEdit->setStyleSheet("background-color: lightGray");
@@ -1184,11 +1110,12 @@
   // Enable/disable RINEX Clocks Options
   // -----------------------------------
-  if (tabs->currentIndex() == 8) {
-    if (!isEmpty) {
+  if (sender() == 0 || sender() == _rnxPathLineEdit) {
+    if (!_rnxPathLineEdit->text().isEmpty()) {
       _rnxIntrComboBox->setStyleSheet("background-color: white");
       _rnxSamplSpinBox->setStyleSheet("background-color: white");
       _rnxIntrComboBox->setEnabled(true);
       _rnxSamplSpinBox->setEnabled(true);
-    } else {
+    } 
+    else {
       _rnxIntrComboBox->setStyleSheet("background-color: lightGray");
       _rnxSamplSpinBox->setStyleSheet("background-color: lightGray");
@@ -1200,11 +1127,12 @@
   // Enable/disable SP3 Orbits Options
   // ---------------------------------
-  if (tabs->currentIndex() == 9) {
-    if (!isEmpty) {
+  if (sender() == 0 || sender() == _sp3PathLineEdit) {
+    if (!_sp3PathLineEdit->text().isEmpty()) {
       _sp3IntrComboBox->setStyleSheet("background-color: white");
       _sp3SamplSpinBox->setStyleSheet("background-color: white");
       _sp3IntrComboBox->setEnabled(true);
       _sp3SamplSpinBox->setEnabled(true);
-    } else {
+    } 
+    else {
       _sp3IntrComboBox->setStyleSheet("background-color: lightGray");
       _sp3SamplSpinBox->setStyleSheet("background-color: lightGray");
