Salome HOME
Fix a bug of config file for RedHat 9 - correct binaries distribution path
[tools/install.git] / src / SALOME_InstallWizard.cxx
index a0f3de5f34c01722b89a3a45048aec9019db0f4f..87fe009202beb1ffcceed957e8ca8b43a18cae7a 100644 (file)
@@ -1,10 +1,11 @@
 //  File      : SALOME_InstallWizard.cxx 
 //  Created   : Thu Dec 18 12:01:00 2002
 //  Author    : Vadim SANDLER
-//  Project   : PAL/SALOME
-//  Module    : InstallWizard
-//  Copyright : 2004 CEA
-//  $Header$ 
+//  Project   : SALOME
+//  Module    : Installation Wizard
+//  Copyright : 2004-2005 CEA
+
+#include "globals.h"
 
 #include "SALOME_InstallWizard.hxx"
 #include "SALOME_ProductsView.hxx"
@@ -33,6 +34,9 @@
 #include <qwhatsthis.h> 
 #include <qtooltip.h>
 #include <qfile.h>
+#include <qthread.h>
+#include <qwaitcondition.h>
+#include <qmutex.h>
 
 #ifdef WNT
 #include <iostream.h>
 #define max( x, y ) ( x ) > ( y ) ? ( x ) : ( y )
 #endif
 
-#define TEMPDIRNAME ( "/INSTALLWORK" + QString::number( getpid() ) )
+QString tmpDirName() { return QString(  "/INSTALLWORK" ) + QString::number( getpid() ); }
+#define TEMPDIRNAME tmpDirName()
+
+// ================================================================
+/*!
+ *  QProcessThread
+ *  Class for executing systen commands
+ */
+// ================================================================
+static QMutex myMutex(false);
+static QWaitCondition myWC;
+class QProcessThread: public QThread
+{
+  typedef QPtrList<QCheckListItem> ItemList;
+public:
+  QProcessThread( SALOME_InstallWizard* iw ) : QThread(), myWizard( iw ) { myItems.setAutoDelete( false ); }
+
+  void addCommand( QCheckListItem* item, const QString& cmd ) {
+    myItems.append( item );
+    myCommands.push_back( cmd );
+  }
+
+  bool hasCommands() const { return myCommands.count() > 0; }
+  void clearCommands()     { myCommands.clear(); myItems.clear(); }
+
+  virtual void run() {
+    while ( hasCommands() ) {
+      ___MESSAGE___( "QProcessThread::run - Processing command : " << myCommands[ 0 ].latin1() );
+      int result = system( myCommands[ 0 ] ) / 256; // return code is <errno> * 256 
+      ___MESSAGE___( "QProcessThread::run - Result : " << result );
+      QCheckListItem* item = myItems.first();
+      myCommands.pop_front();
+      myItems.removeFirst();
+      myMutex.lock();
+      SALOME_InstallWizard::postValidateEvent( myWizard, result, (void*)item );
+      if ( hasCommands() )
+       myWC.wait(&myMutex);
+      myMutex.unlock();
+    };
+  }
+
+private:
+  QStringList           myCommands;
+  ItemList              myItems;
+  SALOME_InstallWizard* myWizard;
+};
+
+// ================================================================
+/*!
+ *  WarnDialog
+ *  Warning dialog box
+ */
+// ================================================================
+class WarnDialog: public QDialog
+{
+  static WarnDialog* myDlg;
+  bool myCloseFlag;
+
+  WarnDialog( QWidget* parent ) 
+  : QDialog( parent, "WarnDialog", true, WDestructiveClose ) {
+    setCaption( tr( "Information" ) );
+    myCloseFlag = false;
+    QLabel* lab = new QLabel( tr( "Please, wait while checking native products configuration ..." ), this );
+    lab->setAlignment( AlignCenter );
+    lab->setFrameStyle( QFrame::Box | QFrame::Plain ); 
+    QVBoxLayout* l = new QVBoxLayout( this );
+    l->setMargin( 0 );
+    l->add( lab );
+    this->setFixedSize( lab->sizeHint().width()  + 50, 
+                       lab->sizeHint().height() * 5 );
+  }
+  void accept() { return; }
+  void reject() { return; }
+  void closeEvent( QCloseEvent* e) { if ( !myCloseFlag ) return; QDialog::closeEvent( e ); }
+  
+  ~WarnDialog() { myDlg = 0; }
+public:
+  static void showWarnDlg( QWidget* parent, bool show ) {
+    if ( show ) {
+      if ( !myDlg ) {
+       myDlg = new WarnDialog( parent );
+       QSize sh = myDlg->size();
+       myDlg->move( parent->x() + (parent->width()-sh.width())/2, 
+                    parent->y() + (parent->height()-sh.height())/2 );
+       myDlg->show();
+      }
+      myDlg->raise();
+      myDlg->setFocus();
+    }
+    else {
+      if ( myDlg ) {
+       myDlg->myCloseFlag = true;
+       myDlg->close();
+      }
+    }
+  }
+  static bool isWarnDlgShown() { return myDlg != 0; }
+};
+WarnDialog* WarnDialog::myDlg = 0;
 
 // ================================================================
 /*!
  *  Defines list of dependancies as string separated by space symbols
  */
 // ================================================================
-static QString DefineDependeces(MapProducts& theProductsMap) {
+static QString DefineDependeces(MapProducts& theProductsMap) 
+{
   QStringList aProducts;
   for ( MapProducts::Iterator mapIter = theProductsMap.begin(); mapIter != theProductsMap.end(); ++mapIter ) {
     QCheckListItem* item = mapIter.key();
@@ -95,7 +198,6 @@ static QString DefineDependeces(MapProducts& theProductsMap, QCheckListItem* pro
 // ================================================================
 static bool makeDir( const QString& theDir, QString& theCreated )
 {
-  theCreated = QString::null;
   if ( theDir.isEmpty() )
     return false;
   QString aDir = QDir::cleanDirPath( QFileInfo( theDir ).absFilePath() );
@@ -202,9 +304,7 @@ SALOME_InstallWizard::SALOME_InstallWizard(QString aXmlFileName)
   setLicense( tr( "All right reserved" ) );
   setOS( "" );
 
-#ifdef DEBUG
-  cout << "Config. file : " << xmlFileName << endl;
-#endif
+  ___MESSAGE___( "Config. file : " << xmlFileName );
 
   // xml reader
   QFile xmlfile(xmlFileName);
@@ -252,6 +352,9 @@ SALOME_InstallWizard::SALOME_InstallWizard(QString aXmlFileName)
   connect(shellProcess, SIGNAL( readyReadStderr() ), this, SLOT( readFromStderr() ) );
   connect(shellProcess, SIGNAL( processExited() ),   this, SLOT( productInstalled() ) );
   connect(shellProcess, SIGNAL( wroteToStdin() ),    this, SLOT( wroteToStdin() ) );
+
+  // create validation thread
+  myThread = new QProcessThread( this );
 }
 // ================================================================
 /*!
@@ -267,12 +370,11 @@ SALOME_InstallWizard::~SALOME_InstallWizard()
   if ( PID > 0 ) {
     script += QString::number( PID );
     script += " > /dev/null";
-#ifdef DEBUG
-    cout << "script: "<< script.latin1() << endl;
-#endif
+    ___MESSAGE___( "script: " << script.latin1() );
     if ( system( script.latin1() ) ) { 
     }
   }
+  delete myThread;
 }
 // ================================================================
 /*!
@@ -294,6 +396,10 @@ bool SALOME_InstallWizard::eventFilter( QObject* object, QEvent* event )
 // ================================================================
 void SALOME_InstallWizard::closeEvent( QCloseEvent* ce )
 {
+  if ( WarnDialog::isWarnDlgShown() ) {
+    ce->ignore();
+    return;
+  }
   if ( !exitConfirmed ) {
     if ( QMessageBox::information( this, 
                                   tr( "Exit" ), 
@@ -403,7 +509,7 @@ void SALOME_InstallWizard::setupProductsPage()
   QToolTip::add  ( tempBtn, tr( "Click this to browse temporary directory" ) );
   // create products list
   productsView = new ProductsView( moreBox );
-  productsView->setMinimumSize( 200, 180 );
+  productsView->setMinimumSize( 250, 180 );
   QWhatsThis::add( productsView, tr( "This view lists the products you wish to be installed" ) );
   QToolTip::add  ( productsView, tr( "This view lists the products you wish to be installed" ) );
   // products info box
@@ -609,6 +715,7 @@ void SALOME_InstallWizard::setupReadmePage()
   readme = new QTextEdit( readmePage );
   readme->setReadOnly( true );
   readme->setTextFormat( PlainText );
+  readme->setFont( QFont( "Fixed", 10 ) );
   readme->setUndoRedoEnabled ( false );
   QWhatsThis::add( readme, tr( "Displays README information" ) );
   QToolTip::add  ( readme, tr( "Displays README information" ) );
@@ -830,9 +937,7 @@ bool SALOME_InstallWizard::acceptData( const QString& pageTitle )
     script += fi.absFilePath();
     script += "' ";
     script += QString( "%1" ).arg( totSize );
-#ifdef DEBUG
-    cout << "script = " << script << endl;
-#endif
+    ___MESSAGE___( "script = " << script );
     if ( system( script ) ) {
       QMessageBox::critical( this, 
                              tr( "Out of space" ), 
@@ -854,7 +959,8 @@ bool SALOME_InstallWizard::acceptData( const QString& pageTitle )
        return false; 
       }
       else {
-       tempFolder->setText( "/tmp" );
+       tempDir = "/tmp";
+       tempFolder->setText( tempDir );
       }
     }
     QFileInfo fit( QDir::cleanDirPath( tempDir ) );
@@ -873,9 +979,7 @@ bool SALOME_InstallWizard::acceptData( const QString& pageTitle )
     tscript += fit.absFilePath();
     tscript += "' ";
     tscript += QString( "%1" ).arg( tempSize );
-#ifdef DEBUG
-    cout << "script = " << tscript << endl;
-#endif
+    ___MESSAGE___( "script = " << tscript );
     if ( system( tscript ) ) {
       QMessageBox::critical( this, 
                             tr( "Out of space" ), 
@@ -947,37 +1051,32 @@ bool SALOME_InstallWizard::acceptData( const QString& pageTitle )
     }
     QString tmpFolder = QDir::cleanDirPath( tempFolder->text().stripWhiteSpace() ) + TEMPDIRNAME;
     QString tgtFolder = QDir::cleanDirPath( targetFolder->text().stripWhiteSpace() );
-    for ( unsigned i = 0; i < natives.count(); i++ ) {
-      item = findItem( natives[ i ] );
-      if ( item ) {
-       QString script = "cd ./config_files/;" + item->text(2) + " try_native " +
-               QFileInfo( tmpFolder ).absFilePath() + " " + QDir::currentDirPath() + "/Products " + QFileInfo( tgtFolder ).absFilePath() + " " +
-               QUOTE(DefineDependeces(productsMap)) + " " + item->text(0);
+    myThread->clearCommands();
+    if ( natives.count() > 0 ) {
+      for ( unsigned i = 0; i < natives.count(); i++ ) {
+       item = findItem( natives[ i ] );
+       if ( item ) {
+         QString dependOn = productsMap[ item ].getDependancies().join(" ");
+         QString script = "cd ./config_files/;" + item->text(2) + " try_native " +
+                 QFileInfo( tmpFolder ).absFilePath() + " " + QDir::currentDirPath() + "/Products " + QFileInfo( tgtFolder ).absFilePath() + " " +
+                 QUOTE(dependOn) + " " + item->text(0);
 
-#ifdef DEBUG
-       cout << "1. Script : " << script << endl;
-#endif
-       if ( system( script ) ) {
+         myThread->addCommand( item, script );
+       }
+       else {
          QMessageBox::warning( this, 
                                tr( "Warning" ), 
-                               tr( "You don't have native %1 %2 installed").arg(item->text(0)).arg(item->text(1)), 
+                               tr( "%The product %1 %2 required for installation.\n"
+                                   "Please, add this product in config.xml file.").arg(item->text(0)).arg(item->text(1)),
                                QMessageBox::Ok, 
                                QMessageBox::NoButton, 
                                QMessageBox::NoButton );
-         productsView->setNone( item );
          return false;
        }
       }
-      else {
-       QMessageBox::warning( this, 
-                             tr( "Warning" ), 
-                             tr( "%The product %1 %2 required for installation.\n"
-                                 "Please, add this product in config.xml file.").arg(item->text(0)).arg(item->text(1)),
-                             QMessageBox::Ok, 
-                             QMessageBox::NoButton, 
-                             QMessageBox::NoButton );
-       return false;
-      }
+      WarnDialog::showWarnDlg( this, true );
+      myThread->start();
+      return true; // return in order to avoid default postValidateEvent() action
     }
   }
   return InstallWizard::acceptData( pageTitle );
@@ -1041,29 +1140,35 @@ void SALOME_InstallWizard::checkProductPage()
 }
 // ================================================================
 /*!
- *  SALOME_InstallWizard::setProductOn
+ *  SALOME_InstallWizard::setPrerequisites
  *  Sets the product and all products this one depends on to be checked ( recursively )
  */
 // ================================================================
-void SALOME_InstallWizard::setProductOn( QCheckListItem* item, int install )
+void SALOME_InstallWizard::setPrerequisites( QCheckListItem* item )
 {
   if ( !productsMap.contains( item ) )
     return;
-  if ( productsView->isNone( item ) ) {
-    if ( install == 1 )
-      productsView->setBinaries( item );
-    else if ( install == 0 )
-      productsView->setSources( item );
-    else if ( install == 2 )
-      productsView->setNative( item );
-  }
+  if ( productsView->isNone( item ) )
+    return;
   // get all prerequisites
   QStringList dependOn = productsMap[ item ].getDependancies();
   for ( int i = 0; i < (int)dependOn.count(); i++ ) {
     MapProducts::Iterator itProd;
     for ( itProd = productsMap.begin(); itProd != productsMap.end(); ++itProd ) {
-      if ( itProd.data().getName() == dependOn[ i ] )
-        setProductOn( itProd.key(), 1 );
+      if ( itProd.data().getName() == dependOn[ i ] ) {
+       if ( productsView->isNone( itProd.key() ) ) {
+         QString defMode = itProd.data().getDefault();
+         if ( defMode.isEmpty() )
+           defMode = tr( "install binaries" );
+         if ( defMode == tr( "install binaries" ) )
+           productsView->setBinaries( itProd.key() );
+         else if ( defMode == tr( "install sources" ) )
+           productsView->setSources( itProd.key() );
+         else if ( defMode == tr( "use native" ) )
+           productsView->setNative( itProd.key() );
+         setPrerequisites( itProd.key() );
+       }
+      }
     }
   }
 }
@@ -1078,9 +1183,7 @@ void SALOME_InstallWizard::launchScript()
   // try to find product being processed now
   QString prodProc = progressView->findStatus( Processing );
   if ( !prodProc.isNull() ) {
-#ifdef DEBUG
-    cout << "Found <Processing>: " << prodProc.latin1() << endl;
-#endif
+    ___MESSAGE___( "Found <Processing>: " );
 
     // if found - set status to "completed"
     progressView->setStatus( prodProc, Completed );
@@ -1091,15 +1194,12 @@ void SALOME_InstallWizard::launchScript()
   // else try to find next product which is not processed yet
   prodProc = progressView->findStatus( Waiting );
   if ( !prodProc.isNull() ) {
-#ifdef DEBUG
-    cout << "Found <Waiting>: " << prodProc.latin1() << endl;
-#endif
+    ___MESSAGE___( "Found <Waiting>: " << prodProc.latin1() );
     // if found - set status to "processed" and run script
     progressView->setStatus( prodProc, Processing );
     progressView->ensureVisible( prodProc );
 
     QCheckListItem* item = findItem( prodProc );
-    Dependancies dep = productsMap[ item ];
     // fill in script parameters
     shellProcess->clearArguments();
     // ... script name
@@ -1108,8 +1208,8 @@ void SALOME_InstallWizard::launchScript()
 
     // ... temp folder
     QString tmpFolder = QDir::cleanDirPath( tempFolder->text().stripWhiteSpace() ) + TEMPDIRNAME;
-    if( !tempFolder->isEnabled() )
-      tmpFolder = "/tmp";
+    //if( !tempFolder->isEnabled() )
+    //tmpFolder = "/tmp";
 
     // ... binaries ?
     if ( productsView->isBinaries( item ) ) {
@@ -1144,9 +1244,7 @@ void SALOME_InstallWizard::launchScript()
     
 
     QString depproducts = DefineDependeces(productsMap); 
-#ifdef DEBUG
-    cout << "Dependancies"<< depproducts.latin1() << endl;
-#endif
+    ___MESSAGE___( "Dependancies"<< depproducts.latin1() );
 
     shellProcess->addArgument( depproducts );
     // ... product name - currently instaled product
@@ -1155,25 +1253,45 @@ void SALOME_InstallWizard::launchScript()
     // run script
     if ( !shellProcess->start() ) {
       // error handling can be here
-#ifdef DEBUG
-      cout << "error" << endl;
-#endif
+      ___MESSAGE___( "error" );
     }
     return;
   }
-#ifdef DEBUG
-  cout << "All products have been installed successfully" << endl;
-#endif
-  // all products installed successfully
+  ___MESSAGE___( "All products have been installed successfully" );
+  // all products are installed successfully
+  QString workDir = QDir::cleanDirPath( QFileInfo( "./config_files/" ).absFilePath() );
+  MapProducts::Iterator mapIter;
+  ___MESSAGE___( "starting pick-up environment" );
+  for ( mapIter = productsMap.begin(); mapIter != productsMap.end(); ++mapIter ) {
+    QCheckListItem* item = mapIter.key();
+    Dependancies dep = mapIter.data();
+    QString depproducts = QUOTE( DefineDependeces(productsMap) ); 
+    if ( dep.pickUpEnvironment() ) {
+      ___MESSAGE___( "... for " << dep.getName() );
+      QString script;
+      script += "cd " + QUOTE( QFileInfo( QDir::cleanDirPath( "./config_files/" ) ).absFilePath() ) + "; ";
+      script += item->text(2) + " ";
+      script += "pickup_env ";
+      script += QUOTE( QFileInfo( QDir::cleanDirPath( tempFolder->text().stripWhiteSpace() ) + TEMPDIRNAME ).absFilePath() ) + " ";
+      script += QUOTE( QFileInfo( QDir::cleanDirPath( QDir::currentDirPath() + "/Products" ) ).absFilePath() ) + " ";
+      script += QUOTE( QFileInfo( QDir::cleanDirPath( targetFolder->text().stripWhiteSpace() ) ).absFilePath() ) + " ";
+      script += depproducts + " ";
+      script += item->text(0);
+      ___MESSAGE___( "... --> " << script.latin1() );
+      if ( system( script.latin1() ) ) { 
+       ___MESSAGE___( "ERROR" ); 
+      }
+    }
+  }
   // <Next> button
-  nextButton()->setEnabled( true );
+  setNextEnabled( true );
   nextButton()->setText( tr( "&Next >" ) );
   QWhatsThis::add( nextButton(), tr( "Moves to the next step of the installation procedure" ) );
   QToolTip::add  ( nextButton(), tr( "Moves to the next step of the installation procedure" ) );
   nextButton()->disconnect();
   connect( nextButton(), SIGNAL( clicked() ), this, SLOT( next() ) );
   // <Back> button
-  backButton()->setEnabled( true );
+  setBackEnabled( true );
   // script parameters
   passedParams->clear();
   passedParams->setEnabled( false );
@@ -1217,34 +1335,35 @@ void SALOME_InstallWizard::onMoreBtn()
 // ================================================================
 void SALOME_InstallWizard::onLaunchSalome()
 {
-  QCheckListItem* item = 0;
-  if ( ( item = findItem( "SalomePro-Bin" ) ) ) {
-    QFileInfo fi( targetFolder->text() + "/SalomePro-" + item->text(1) + "/salome" );
-    if ( fi.exists() ) {
-      QString script;
-      script += "cd " + targetFolder->text() + "/SalomePro-" + item->text(1) + "; ";
-      script += "source salome.csh; ";
-      //script += "cd bin; ";
-      //script += "runSalome > /dev/null";
-      script += "salome -g > /dev/null";
-      script = "(csh -c '" + script + "')";
-#ifdef DEBUG
-      cout << script.latin1() << endl;
-#endif
-      if ( system( script.latin1() ) ){
-       QMessageBox::warning( this, 
-                             tr( "Error" ), 
-                             tr( "Can't launch SALOME" ), 
-                             QMessageBox::Ok, 
-                             QMessageBox::NoButton,
-                             QMessageBox::NoButton );
+  QString msg = tr( "You don't have SALOME binaries installed in the %1 directory!" ).arg( targetFolder->text() );
+
+  QCheckListItem* item = findItem( "KERNEL-Bin" );
+  if ( item ) {
+    QFileInfo fi( targetFolder->text() + "/KERNEL_" + item->text(1) + "/bin/salome/runSalome" );
+    QFileInfo fienv( targetFolder->text() + "/KERNEL_" + item->text(1) + "/salome.csh" );
+    if ( fienv.exists() ) {
+      if ( fi.exists() ) {
+       QString script;
+       script += "cd " + targetFolder->text() + "/KERNEL_" + item->text(1) + "; ";
+       script += "source salome.csh; ";
+       script += "cd bin/salome; ";
+       script += "runSalome > /dev/null";
+       script = "(csh -c '" + script + "')";
+       ___MESSAGE___( "script: " << script.latin1() );
+       if ( !system( script.latin1() ) )
+         return;
+       else
+         msg = tr( "Can't launch SALOME." );
       }
-      return;
+      else
+       msg = tr( "Can't launch SALOME." ) + "\n" + tr( "runSalome file can not be found." );
     }
+    else
+      msg = tr( "Can't launch SALOME." ) + "\n" + tr( "Can't find environment file." );
   }
   QMessageBox::warning( this, 
                        tr( "Error" ), 
-                       tr( "You don't have SALOME binaries installed in the %1 directory!" ).arg( targetFolder->text() ), 
+                       msg,
                        QMessageBox::Ok, 
                        QMessageBox::NoButton,
                        QMessageBox::NoButton );
@@ -1291,9 +1410,7 @@ void SALOME_InstallWizard::abort()
 // ================================================================
 void SALOME_InstallWizard::reject()
 {
-#ifdef DEBUG
-  cout << "REJECTED" << endl;
-#endif
+  ___MESSAGE___( "REJECTED" );
   if ( !exitConfirmed ) {
     if ( QMessageBox::information( this, 
                                   tr( "Exit" ), 
@@ -1307,7 +1424,7 @@ void SALOME_InstallWizard::reject()
     }
     exitConfirmed = true;
   }
-  clean();
+  clean(true);
   InstallWizard::reject();
 }
 // ================================================================
@@ -1318,41 +1435,39 @@ void SALOME_InstallWizard::reject()
 // ================================================================
 void SALOME_InstallWizard::accept()
 {
-#ifdef DEBUG
-  cout << "ACCEPTED" << endl;
-#endif
-  clean();
+  ___MESSAGE___( "ACCEPTED" );
+  clean(true);
   InstallWizard::accept();
 }
 // ================================================================
 /*!
  *  SALOME_InstallWizard::clean
- *  Clears and removes temporary directory
+ *  Clears and (optionally) removes temporary directory
  */
 // ================================================================
-void SALOME_InstallWizard::clean()
+void SALOME_InstallWizard::clean(bool rmDir)
 {
+  WarnDialog::showWarnDlg( 0, false );
+  myThread->clearCommands();
+  myWC.wakeAll();
+  while ( myThread->running() );
   // VSR: first remove temporary files
   QString script = "cd ./config_files/; remove_tmp.sh '";
-  script += tempFolder->text().stripWhiteSpace();
+  script += tempFolder->text().stripWhiteSpace() + TEMPDIRNAME;
   script += "' ";
   script += QUOTE(DefineDependeces(productsMap));
   script += " > /dev/null";
-#ifdef DEBUG
-  cout << "script = " << script << endl;
-#endif
+  ___MESSAGE___( "script = " << script );
   if ( system( script.latin1() ) ) {
   }
   // VSR: then try to remove created temporary directory
   //script = "rm -rf " + QDir::cleanDirPath( tempFolder->text().stripWhiteSpace() ) + TEMPDIRNAME;
-  if ( !tmpCreated.isNull() ) {
+  if ( rmDir && !tmpCreated.isNull() ) {
     script = "rm -rf " + tmpCreated;
     script += " > /dev/null";
     if ( system( script.latin1() ) ) {
     }
-#ifdef DEBUG
-    cout << "script = " << script << endl;
-#endif
+    ___MESSAGE___( "script = " << script );
   }
 }
 // ================================================================
@@ -1398,22 +1513,21 @@ void SALOME_InstallWizard::pageChanged( const QString & mytitle)
       // reconnect Next button - to use it as Start button
       nextButton()->disconnect();
       connect( nextButton(), SIGNAL( clicked() ), this, SLOT( onStart() ) );
-      nextButton()->setEnabled( true );
+      setNextEnabled( true );
       // reconnect Cancel button to terminate process
       cancelButton()->disconnect();
       connect( cancelButton(), SIGNAL( clicked() ), this, SLOT( tryTerminate() ) );
     }
   }
   else if ( aPage == readmePage ) {
-    QCheckListItem* item = 0;
-    runSalomeBtn->setEnabled( ( item = findItem( "SalomePro-Bin" ) ) && 
-                             QFileInfo( targetFolder->text() + "/SalomePro-" + item->text(1) + "/salome" ).exists() );
+    QCheckListItem* item = findItem( "KERNEL-Bin" );
+    runSalomeBtn->setEnabled( item &&
+                             QFileInfo( targetFolder->text() + "/KERNEL_" + item->text(1) + "/bin/salome/runSalome" ).exists() &&
+                             QFileInfo( targetFolder->text() + "/KERNEL_" + item->text(1) + "/salome.csh" ).exists() );
     finishButton()->setEnabled( true );
   }
   previousPage = aPage;
-#ifdef DEBUG
-  cout << "previousPage = " << previousPage << endl;
-#endif
+  ___MESSAGE___( "previousPage = " << previousPage );
 }
 // ================================================================
 /*!
@@ -1494,10 +1608,11 @@ void SALOME_InstallWizard::onStart()
   }
   // if something at all is selected
   if ( !toInstall.isEmpty() ) {
+    clean(false); // VSR 07/02/05 - bug fix: first we should clear temporary directory
     // disable <Next> button
-    nextButton()->setEnabled( false );
+    setNextEnabled( false );
     // disable <Back> button
-    backButton()->setEnabled ( false );
+    setBackEnabled( false );
     // enable script parameters line edit
     // VSR commented: 18/09/03: passedParams->setEnabled( true );
     // VSR commented: 18/09/03: passedParams->setFocus();
@@ -1541,20 +1656,14 @@ void SALOME_InstallWizard::onReturnPressed()
 */
 void SALOME_InstallWizard::productInstalled( )
 {
-#ifdef DEBUG
-  cout << "process exited" << endl;
-#endif
+  ___MESSAGE___( "process exited" );
   if ( shellProcess->normalExit() ) {
-#ifdef DEBUG
-    cout << "...normal exit" << endl;
-#endif
+    ___MESSAGE___( "...normal exit" );
     // normal exit - try to proceed installation further
     launchScript();
   }
   else {
-#ifdef DEBUG
-    cout << "...abnormal exit" << endl;
-#endif
+    ___MESSAGE___( "...abnormal exit" );
     // installation aborted
     abort();
     // clear script passed parameters lineedit
@@ -1562,14 +1671,14 @@ void SALOME_InstallWizard::productInstalled( )
     passedParams->setEnabled( false );
     QFont f = parametersLab->font(); f.setBold( false ); parametersLab->setFont( f );
     // enable <Next> button
-    nextButton()->setEnabled( true );
+    setNextEnabled( true );
     nextButton()->setText( tr( "&Next >" ) );
     QWhatsThis::add( nextButton(), tr( "Moves to the next step of the installation procedure" ) );
     QToolTip::add  ( nextButton(), tr( "Moves to the next step of the installation procedure" ) );
     nextButton()->disconnect();
     connect( nextButton(), SIGNAL( clicked() ), this, SLOT( next() ) );
     // enable <Back> button
-    backButton()->setEnabled( true );
+    setBackEnabled( true );
   }
 }
 // ================================================================
@@ -1636,6 +1745,9 @@ void SALOME_InstallWizard::onSelectionChanged()
   if ( !aItem->text(1).stripWhiteSpace().isEmpty() )
     text += tr( "Version" ) + ": " + aItem->text(1) + "<br>";
   text += "<br>";
+  if ( !dep.getDescription().isEmpty() ) {
+    text += "<i>" + dep.getDescription() + "</i><br><br>";
+  }
   text += tr( "User choice" ) + ": ";
   long totSize = 0, tempSize = 0;
   if ( productsView->isBinaries( aItem ) ) {
@@ -1675,12 +1787,7 @@ void SALOME_InstallWizard::onItemToggled( QCheckListItem* item )
       item = (QCheckListItem*)( item->parent() );
     if ( productsMap.contains( item ) ) {
       productsView->blockSignals( true );
-      if ( productsView->isNative( item ) )
-       setProductOn( item, 2 );
-      else if ( productsView->isBinaries( item ) )
-       setProductOn( item, 1 );
-      else if ( productsView->isSources( item ) )
-       setProductOn( item, 0 );
+      setPrerequisites( item );
       productsView->blockSignals( false );
     }
   }
@@ -1717,9 +1824,7 @@ void SALOME_InstallWizard::onProdBtn()
 // ================================================================
 void SALOME_InstallWizard::wroteToStdin( )
 {
-#ifdef DEBUG
-  cout << "Something was sent to stdin" << endl;
-#endif
+  ___MESSAGE___( "Something was sent to stdin" );
 }
 // ================================================================
 /*!
@@ -1729,9 +1834,7 @@ void SALOME_InstallWizard::wroteToStdin( )
 // ================================================================
 void SALOME_InstallWizard::readFromStdout( )
 {
-#ifdef DEBUG
-  cout << "Something was sent to stdout" << endl;
-#endif
+  ___MESSAGE___( "Something was sent to stdout" );
   while ( shellProcess->canReadLineStdout() ) {
     installInfo->append( QString( shellProcess->readLineStdout() ) );
     installInfo->scrollToBottom();
@@ -1750,9 +1853,7 @@ void SALOME_InstallWizard::readFromStdout( )
 // ================================================================
 void SALOME_InstallWizard::readFromStderr( )
 {
-#ifdef DEBUG
-  cout << "Something was sent to stderr" << endl;
-#endif
+  ___MESSAGE___( "Something was sent to stderr" );
   while ( shellProcess->canReadLineStderr() ) {
     installInfo->append( QString( shellProcess->readLineStderr() ) );
     installInfo->scrollToBottom();
@@ -1802,3 +1903,61 @@ void SALOME_InstallWizard::updateCaption()
                             tr( getIWName() ) + " - " +
                             tr( "Step %1 of %2").arg( QString::number( this->indexOf( aPage )+1 ) ).arg( QString::number( this->pageCount() ) ) );
 }
+
+// ================================================================
+/*!
+ *  SALOME_InstallWizard::processValidateEvent
+ *  Processes validation event (<val> is validation code)
+ */
+// ================================================================
+void SALOME_InstallWizard::processValidateEvent( const int val, void* data )
+{
+  QWidget* aPage = InstallWizard::currentPage();
+  if ( aPage != productsPage ) {
+    InstallWizard::processValidateEvent( val, data );
+    return;
+  }
+  myMutex.lock();
+  myMutex.unlock();
+  QCheckListItem* item = (QCheckListItem*)data;
+  if ( val > 0 ) {
+    if ( val == 2 ) {
+      WarnDialog::showWarnDlg( 0, false );
+      // when try_native returns 2 it means that native product version is higher than that is prerequisited
+      if ( QMessageBox::warning( this, 
+                                tr( "Warning" ), 
+                                tr( "You have newer version of %1 installed on your computer than that is required (%2).\nContinue?").arg(item->text(0)).arg(item->text(1)),
+                               QMessageBox::Yes, 
+                               QMessageBox::No, 
+                               QMessageBox::NoButton ) == QMessageBox::No ) {
+       myThread->clearCommands();
+       myWC.wakeAll();
+       setNextEnabled( true );
+       setBackEnabled( true );
+       return;
+      }
+      WarnDialog::showWarnDlg( this, true );
+    }
+    else {
+      WarnDialog::showWarnDlg( 0, false );
+      QMessageBox::warning( this, 
+                          tr( "Warning" ), 
+                          tr( "You don't have native %1 %2 installed").arg(item->text(0)).arg(item->text(1)), 
+                          QMessageBox::Ok, 
+                          QMessageBox::NoButton, 
+                          QMessageBox::NoButton );
+      myThread->clearCommands();
+      myWC.wakeAll();
+      setNextEnabled( true );
+      setBackEnabled( true );
+      productsView->setNone( item );
+      return;
+    }
+  }
+  if ( myThread->hasCommands() )
+    myWC.wakeAll();
+  else {
+    WarnDialog::showWarnDlg( 0, false );
+    InstallWizard::processValidateEvent( val, data );
+  }
+}