Salome HOME
Merge improvements from SALOME_3 branch
[tools/install.git] / src / SALOME_InstallWizard.cxx
index df52630c313347e718eeb36bbd8207fd008ec2fe..437aa98431d4dab031f33b5ee9e53f9b744540de 100644 (file)
@@ -1183,15 +1183,19 @@ void SALOME_InstallWizard::checkProductPage()
   int totBin = 0, selBin = 0;
   MapProducts::Iterator itProd;
   for ( itProd = productsMap.begin(); itProd != productsMap.end(); ++itProd ) {
-    if ( itProd.data().getContext() == "salome sources" ) {
-      totSrc++;
-      if ( productsView->isSources( itProd.key() ) )
-       selSrc++;
-    }
-    if ( itProd.data().getContext() == "salome binaries" ) {
-      totBin++;
-      if ( productsView->isBinaries( itProd.key() ) )
-       selBin++;
+    bool srcctx = itProd.data().hasContext( "salome sources" );
+    bool binctx = itProd.data().hasContext( "salome binaries" );
+    if ( srcctx ) totSrc++;
+    if ( binctx ) totBin++;
+    if ( srcctx && !binctx && productsView->isSources( itProd.key() ) )
+      selSrc++;
+    if ( !srcctx && binctx && productsView->isBinaries( itProd.key() ) )
+      selBin++;
+    if ( srcctx && binctx && 
+        ( productsView->isSources( itProd.key() ) || 
+          productsView->isBinaries( itProd.key() ) ) ) {
+      selSrc++;
+      selBin++;
     }
   }
   selectSrcBtn->blockSignals( true );
@@ -1890,11 +1894,14 @@ void SALOME_InstallWizard::onProdBtn()
       checkBox->setState( QButton::On );
     MapProducts::Iterator itProd;
     for ( itProd = productsMap.begin(); itProd != productsMap.end(); ++itProd ) {
-      if ( itProd.data().getContext() == "salome sources" ) {
+      if ( itProd.data().hasContext( "salome sources" ) ) {
        if ( checkBox->state() == QButton::Off )
          productsView->setNone( itProd.key() );
-       else
+       else {
          productsView->setSources( itProd.key() );
+         if ( prerequisites->isChecked() )
+           setPrerequisites( itProd.key() );
+       }
       }
     }
   }
@@ -1904,11 +1911,14 @@ void SALOME_InstallWizard::onProdBtn()
       checkBox->setState( QButton::On );
     MapProducts::Iterator itProd;
     for ( itProd = productsMap.begin(); itProd != productsMap.end(); ++itProd ) {
-      if ( itProd.data().getContext() == "salome binaries" ) {
+      if ( itProd.data().hasContext( "salome binaries" ) ) {
        if ( checkBox->state() == QButton::Off )
          productsView->setNone( itProd.key() );
-       else
+       else {
          productsView->setBinaries( itProd.key() );
+         if ( prerequisites->isChecked() )
+           setPrerequisites( itProd.key() );
+       }
       }
     }
   }