Salome HOME
Fix a bug of config file for RedHat 9 - correct binaries distribution path
[tools/install.git] / src / SALOME_InstallWizard.cxx
index 599b682292e8808d818846bf07eddbfca1200131..87fe009202beb1ffcceed957e8ca8b43a18cae7a 100644 (file)
@@ -1,30 +1,42 @@
 //  File      : SALOME_InstallWizard.cxx 
 //  Created   : Thu Dec 18 12:01:00 2002
 //  Author    : Vadim SANDLER
-//  Project   : SALOME Professional
-//  Module    : InstallWizard
-//  Copyright : 2003 CEA/DEN, EDF R&D
-//  $Header$ 
+//  Project   : SALOME
+//  Module    : Installation Wizard
+//  Copyright : 2004-2005 CEA
+
+#include "globals.h"
 
 #include "SALOME_InstallWizard.hxx"
+#include "SALOME_ProductsView.hxx"
+#include "SALOME_ProgressView.hxx"
+#include "SALOME_XmlHandler.hxx"
+#include "SALOME_HelpWindow.hxx"
+
 #include "icons.h"
 
-#include <qbuttongroup.h>
+#include <qlineedit.h>
+#include <qpushbutton.h>
+#include <qlistview.h>
+#include <qlabel.h>
+#include <qtextedit.h>
+#include <qtextbrowser.h>
+#include <qprocess.h>
+#include <qcheckbox.h>
+#include <qsplitter.h>
 #include <qlayout.h>
 #include <qfiledialog.h> 
 #include <qapplication.h>
-#include <qtextbrowser.h> 
-#include <qdesktopwidget.h> 
 #include <qfileinfo.h> 
 #include <qmessagebox.h> 
 #include <qtimer.h> 
-#include <qhbuttongroup.h>
-#include <qradiobutton.h> 
 #include <qvbox.h>
 #include <qwhatsthis.h> 
 #include <qtooltip.h>
 #include <qfile.h>
-#include <qxml.h>
+#include <qthread.h>
+#include <qwaitcondition.h>
+#include <qmutex.h>
 
 #ifdef WNT
 #include <iostream.h>
 #define max( x, y ) ( x ) > ( y ) ? ( x ) : ( y )
 #endif
 
-// ######################################## Globals ##############################################
+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();
+    };
+  }
 
-QString myVersion   = "1.2";
-QString myCaption   = QString("SALOME Professional %1 Installation Wizard").arg(myVersion);
-QString myCopyright = "Copyright (C) 2003 CEA/DEN, EDF R&D";
-QString myLicense   = "All right reserved";
-QString myOS        = "";
+private:
+  QStringList           myCommands;
+  ItemList              myItems;
+  SALOME_InstallWizard* myWizard;
+};
 
-#define TEMPDIRNAME ( "/INSTALLWORK" + QString::number( getpid() ) )
+// ================================================================
 /*!
-  Defines list of dependancies as string separated by space symbols
-*/
-static QString DefineDependeces(MapProducts& theProductsMap) {
+ *  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;
+
+// ================================================================
+/*!
+ *  DefineDependeces [ static ]
+ *  Defines list of dependancies as string separated by space symbols
+ */
+// ================================================================
+static QString DefineDependeces(MapProducts& theProductsMap) 
+{
   QStringList aProducts;
   for ( MapProducts::Iterator mapIter = theProductsMap.begin(); mapIter != theProductsMap.end(); ++mapIter ) {
     QCheckListItem* item = mapIter.key();
@@ -83,12 +190,14 @@ static QString DefineDependeces(MapProducts& theProductsMap, QCheckListItem* pro
 }
 =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= */
 
+// ================================================================
 /*!
-  Makes directory recursively, returns false if not succedes [ static ]
-*/
+ *  makeDir [ static ]
+ *  Makes directory recursively, returns false if not succedes
+ */
+// ================================================================
 static bool makeDir( const QString& theDir, QString& theCreated )
 {
-  theCreated = QString::null;
   if ( theDir.isEmpty() )
     return false;
   QString aDir = QDir::cleanDirPath( QFileInfo( theDir ).absFilePath() );
@@ -123,9 +232,12 @@ static bool makeDir( const QString& theDir, QString& theCreated )
   }
   return true;
 }
+// ================================================================
 /*!
-  Reads the file, returns false if can't open it
-*/
+ *  readFile [ static ]
+ *  Reads the file, returns false if can't open it
+ */
+// ================================================================
 static bool readFile( const QString& fileName, QString& text )
 {
   if ( QFile::exists( fileName ) ) {
@@ -143,166 +255,56 @@ static bool readFile( const QString& fileName, QString& text )
   }
   return false;
 }
-// ###################################### Progress View ###########################################
-
+// ================================================================
 /*!
-  Constructor of progress view's item
-  <parent>      - parent progress view
-  <productName> - full name of the product
-  <smbName>     - alias for he product used by the script
-  <status>      - initial status of the product, default is 'Waiting'
-*/
-ProgressViewItem::ProgressViewItem( ProgressView* parent, QString productName, const QString installType, const QString scriptName, Status status  ) 
-     : QListViewItem( parent, productName, installType ), myScript( scriptName )
-{
-  setStatus( status );
-}
-/*!
-  Sets new status for the item
-*/
-void ProgressViewItem::setStatus( Status status )
-{ 
-  myStatus = status; 
-  switch ( myStatus ) {
-  case Waiting:
-    setText( 2, "Waiting" );    break;
-  case Processing:
-    setText( 2, "Processing" ); break;
-  case Completed:
-    setText( 2, "Completed" );  break;
-  case Aborted:
-    setText( 2, "Aborted" );  break;
-  default:
-    break;
-  }
-  repaint(); 
-}
-/*!
-  Paints the cell of the list view item
-*/
-void ProgressViewItem::paintCell( QPainter* painter, const QColorGroup& cg, int column, int width, int align ) 
-{
-  QColorGroup acg( cg );
-  if ( column == 2 ) {
-    switch ( myStatus ) {
-    case Waiting:
-      acg.setColor( QColorGroup::Text, ( ( ProgressView* )listView() )->getWaitingColor() ); break;
-    case Processing:
-      acg.setColor( QColorGroup::Text, ( ( ProgressView* )listView() )->getProcessingColor() ); break;
-    case Completed:
-      acg.setColor( QColorGroup::Text, ( ( ProgressView* )listView() )->getCompletedColor() ); break;
-    case Aborted:
-      acg.setColor( QColorGroup::Text, ( ( ProgressView* )listView() )->getWaitingColor() ); break;
-    default:
-      break;
-    }
-  }
-  QListViewItem::paintCell( painter, acg, column, width, align );
-}
-/*!
-  Progress view's constructor
-*/
-ProgressView::ProgressView( QWidget* parent ) : QListView( parent ) 
+ *  hasSpace [ static ]
+ *  Checks if string contains spaces; used to check directory paths
+ */
+// ================================================================
+static bool hasSpace( const QString& dir )
 {
-  addColumn( tr( "Product" ) ); addColumn( tr( "Type" ) ); addColumn( tr( "Status" ) );
-  header()->hide();
-  setSelectionMode( QListView::NoSelection );
-  setSorting( -1 );
-  setResizeMode( QListView::AllColumns );
-  setFocusPolicy( QWidget::NoFocus );
-  setColors( QColor( "red" ), QColor( "orange" ), QColor( "green" ) );
-}
-/*!
-  Sets status colors
-*/
-void ProgressView::setColors( QColor wColor, QColor pColor, QColor cColor ) {
-  myWaitingColor    = wColor;
-  myProcessingColor = pColor;
-  myCompletedColor  = cColor;
-  repaint();
-}
-/*!
-  Adds product item
-*/
-void ProgressView::addProduct( const QString product, const QString type, const QString script ) {
-  QListViewItem* lastItem = this->lastItem();
-  ProgressViewItem* newItem = new ProgressViewItem( this, product, type, script );
-  if ( lastItem )
-    newItem->moveItem( lastItem );
-}
-/*!
-  Finds the first item with given status
-*/
-QString ProgressView::findStatus( Status status ) {
-  ProgressViewItem* item = ( ProgressViewItem* )firstChild();
-  while( item ) {
-    if ( item->getStatus() == status )
-      return item->getProduct();
-    item = ( ProgressViewItem* )( item->nextSibling() );
-  }
-  return QString::null;
-}
-/*!
-  Sets new status for the product item
-*/
-void ProgressView::setStatus( const QString product, Status status ) {
-  ProgressViewItem* item = findItem( product );
-  if ( item ) {
-    item->setStatus( status );
-    repaint();
-  }
-}
-/*!
-  Scrolls the view to make item visible if necessary
-*/
-void ProgressView::ensureVisible( const QString product )  {
-  ProgressViewItem* item = findItem( product );
-  if ( item ) {
-    ensureItemVisible( item );
-  }
-}
-/*!
-  Finds the item by the product name
-*/
-ProgressViewItem* ProgressView::findItem( const QString product ) {
-  ProgressViewItem* item = ( ProgressViewItem* )firstChild();
-  while( item ) {
-    if ( item->getProduct() == product )
-      return item;
-    item = ( ProgressViewItem* )( item->nextSibling() );
-  }
-  return 0;
-}
-/*!
-  Gets the product script
-*/
-QString ProgressView::getScript( const QString product ) {
-  ProgressViewItem* item = ( ProgressViewItem* )firstChild();
-  while( item ) {
-    if ( item->getProduct() == product )
-      return item->getScript();
-    item = ( ProgressViewItem* )( item->nextSibling() );
+  for ( int i = 0; i < (int)dir.length(); i++ ) {
+    if ( dir[ i ].isSpace() )
+      return true;
   }
-  return QString::null;
+  return false;
 }
 
-// ###################################### Install Wizard ###########################################
-
+// ================================================================
 /*!
-  Constructor
-*/
+ *  SALOME_InstallWizard::SALOME_InstallWizard
+ *  Constructor
+ */
+// ================================================================
 SALOME_InstallWizard::SALOME_InstallWizard(QString aXmlFileName)
-  : InstallWizard( qApp->desktop(), "SALOME_InstallWizard", false, 0 ), helpWindow( NULL ), moreMode( false ), previousPage( 0 ), exitConfirmed( false )
+     : InstallWizard( qApp->desktop(), "SALOME_InstallWizard", false, 0 ), 
+       helpWindow( NULL ), 
+       moreMode( false ), 
+       previousPage( 0 ), 
+       exitConfirmed( false )
 {
+  myIWName = tr( "Installation Wizard" );
   tmpCreated = QString::null;
-  // set xml file
   xmlFileName = aXmlFileName;
   QFont fnt = font(); fnt.setPointSize( 14 ); fnt.setBold( true );
   setTitleFont( fnt );
 
-#ifdef DEBUG
-  cout << "Config. file : " << xmlFileName << endl;
-#endif
+  // set icon
+  setIcon( QPixmap( ( const char** ) image0_data ) );
+  // enable sizegrip
+  setSizeGripEnabled( true );
+  
+  // add logo
+  addLogo( QPixmap( (const char**)image1_data ) );
+  
+  // set defaults
+  setVersion( "1.2" );
+  setCaption( tr( "PAL/SALOME %1" ).arg( myVersion ) );
+  setCopyright( tr( "Copyright (C) 2004 CEA" ) );
+  setLicense( tr( "All right reserved" ) );
+  setOS( "" );
+
+  ___MESSAGE___( "Config. file : " << xmlFileName );
 
   // xml reader
   QFile xmlfile(xmlFileName);
@@ -310,19 +312,13 @@ SALOME_InstallWizard::SALOME_InstallWizard(QString aXmlFileName)
     QXmlInputSource source( &xmlfile );
     QXmlSimpleReader reader;
 
-    StructureParser * handler = new StructureParser();
+    StructureParser* handler = new StructureParser( this );
     reader.setContentHandler( handler );
     reader.parse( source );  
   }
-  // set caption
-  setCaption( myCaption );
-  // set icon
-  setIcon( QPixmap( ( const char** ) image0_data ) );
-  // enable sizegrip
-  setSizeGripEnabled( true );
 
   // create instance of class for starting shell install script
-  shellProcess = new QProcess(this,"shellProcess");
+  shellProcess = new QProcess( this, "shellProcess" );
 
   // create introduction page
   setupIntroPage();
@@ -356,10 +352,16 @@ 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 );
 }
+// ================================================================
 /*!
-  Destructor
-*/
+ *  SALOME_InstallWizard::~SALOME_InstallWizard
+ *  Destructor
+ */
+// ================================================================
 SALOME_InstallWizard::~SALOME_InstallWizard()
 {
   shellProcess->kill(); // kill it for sure
@@ -368,33 +370,42 @@ 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;
 }
+// ================================================================
 /*!
-  Event filter, spies for Help window closing
-*/
+ *  SALOME_InstallWizard::eventFilter
+ *  Event filter, spies for Help window closing
+ */
+// ================================================================
 bool SALOME_InstallWizard::eventFilter( QObject* object, QEvent* event )
 {
   if ( object && object == helpWindow && event->type() == QEvent::Close )
     helpWindow = NULL;
   return InstallWizard::eventFilter( object, event );
 }
-/*! 
-  Close event handler
-*/
+// ================================================================
+/*!
+ *  SALOME_InstallWizard::closeEvent
+ *  Close event handler
+ */
+// ================================================================
 void SALOME_InstallWizard::closeEvent( QCloseEvent* ce )
 {
+  if ( WarnDialog::isWarnDlgShown() ) {
+    ce->ignore();
+    return;
+  }
   if ( !exitConfirmed ) {
     if ( QMessageBox::information( this, 
                                   tr( "Exit" ), 
-                                  tr( "Do you want to quit Installation Wizard?" ), 
-                                  tr( "Yes" ), 
-                                  tr( "No" ),
+                                  tr( "Do you want to quit %1?" ).arg( getIWName() ), 
+                                  tr( "&Yes" ), 
+                                  tr( "&No" ),
                                   QString::null,
                                   0,
                                   1 ) == 1 ) {
@@ -407,9 +418,12 @@ void SALOME_InstallWizard::closeEvent( QCloseEvent* ce )
     }
   }
 }
+// ================================================================
 /*!
-  Creates introduction page
-*/
+ *  SALOME_InstallWizard::setupIntroPage
+ *  Creates introduction page
+ */
+// ================================================================
 void SALOME_InstallWizard::setupIntroPage()
 {
   // create page
@@ -417,7 +431,7 @@ void SALOME_InstallWizard::setupIntroPage()
   QGridLayout* pageLayout = new QGridLayout( introPage ); 
   pageLayout->setMargin( 0 ); pageLayout->setSpacing( 6 );
   // create logo picture
-  QPixmap logo( (const char**)SALOMEPRO_Logo_xpm );
+  QPixmap logo( (const char**)SALOME_Logo_xpm );
   logoLab = new QLabel( introPage );
   logoLab->setPixmap( logo );
   logoLab->setScaledContents( false );
@@ -425,9 +439,9 @@ void SALOME_InstallWizard::setupIntroPage()
   logoLab->setAlignment( AlignCenter );
   // create version box
   QVBox* versionBox = new QVBox( introPage ); versionBox->setSpacing( 6 );
-  versionBox->setFrameStyle( QGroupBox::Panel | QGroupBox::Sunken );
+  versionBox->setFrameStyle( QVBox::Panel | QVBox::Sunken );
   QWidget* stretch1 = new QWidget( versionBox ); versionBox->setStretchFactor( stretch1, 5 );
-  versionLab = new QLabel( QString("Version %1").arg(myVersion), versionBox );
+  versionLab = new QLabel( QString("%1 %2").arg( tr( "Version" ) ).arg(myVersion), versionBox );
   versionLab->setAlignment( AlignCenter );
   copyrightLab = new QLabel( myCopyright, versionBox );
   copyrightLab->setAlignment( AlignCenter );
@@ -436,16 +450,16 @@ void SALOME_InstallWizard::setupIntroPage()
   QWidget* stretch2 = new QWidget( versionBox ); versionBox->setStretchFactor( stretch2, 5 );
   // create info box
   info = new QLabel( introPage );
-  info->setText( tr( "This program will install <b>SALOME Professional Version %1</b>."
+  info->setText( tr( "This program will install <b>%1</b>."
                      "<br><br>The wizard will also help you to install all products "
-                     "which are necessary for <b>SALOME PRO</b> platform and setup "
+                     "which are necessary for <b>%2</b> and setup "
                      "your environment.<br><br>Click <code>Cancel</code> button to abort "
                      "installation and quit. Click <code>Next</code> button to continue with the "
-                     "installation program.").arg(myVersion) );
-  info->setFrameStyle( QGroupBox::WinPanel | QGroupBox::Sunken );
+                     "installation program." ).arg( myCaption ).arg( myCaption ) );
+  info->setFrameStyle( QLabel::WinPanel | QLabel::Sunken );
   info->setMargin( 6 );
   info->setAlignment( WordBreak );
-  info->setMinimumSize( 250, 250 );
+  info->setMinimumWidth( 250 );
   QPalette pal = info->palette();
   pal.setColor( QColorGroup::Background, QApplication::palette().active().base() );
   info->setPalette( pal );
@@ -459,9 +473,12 @@ void SALOME_InstallWizard::setupIntroPage()
   // adding page
   addPage( introPage, tr( "Introduction" ) );
 }
+// ================================================================
 /*!
-  Creates products page
-*/
+ *  SALOME_InstallWizard::setupProductsPage
+ *  Creates products page
+ */
+// ================================================================
 void SALOME_InstallWizard::setupProductsPage()
 {
   // create page
@@ -491,8 +508,8 @@ void SALOME_InstallWizard::setupProductsPage()
   QWhatsThis::add( tempBtn, tr( "Click this to browse temporary directory" ) );
   QToolTip::add  ( tempBtn, tr( "Click this to browse temporary directory" ) );
   // create products list
-  productsView = new MyListView( moreBox );
-  productsView->setMinimumSize( 200, 180 );
+  productsView = new ProductsView( moreBox );
+  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
@@ -562,9 +579,8 @@ void SALOME_InstallWizard::setupProductsPage()
     QXmlInputSource source( &xmlfile );
     QXmlSimpleReader reader;
 
-    StructureParser * handler = new StructureParser();
-    handler->setWizard( this );
-    handler->setListView(productsView);
+    StructureParser* handler = new StructureParser( this );
+    handler->setProductsList(productsView);
     handler->setTargetDir(targetFolder);
     handler->setTempDir(tempFolder);
     reader.setContentHandler( handler );
@@ -573,13 +589,13 @@ void SALOME_InstallWizard::setupProductsPage()
   // set first item to be selected
   if ( productsView->childCount() > 0 ) {
     productsView->setSelected( productsView->firstChild(), true );
-    onSelectionChanged( productsView->firstChild() );
+    onSelectionChanged();
   }
   // adding page
   addPage( productsPage, tr( "Installation settings" ) );
   // connecting signals
-  connect( productsView, SIGNAL( selectionChanged( QListViewItem* ) ), 
-                                              this, SLOT( onSelectionChanged( QListViewItem* ) ) );
+  connect( productsView, SIGNAL( selectionChanged() ), 
+                                              this, SLOT( onSelectionChanged() ) );
   connect( productsView, SIGNAL( itemToggled( QCheckListItem* ) ), 
                                               this, SLOT( onItemToggled( QCheckListItem* ) ) );
   connect( unselectBtn,  SIGNAL( clicked() ), this, SLOT( onProdBtn() ) );
@@ -594,9 +610,12 @@ void SALOME_InstallWizard::setupProductsPage()
   // start on default - non-advanced - mode
   moreBox->hide();
 }
+// ================================================================
 /*!
-  Creates prestart page
-*/
+ *  SALOME_InstallWizard::setupCheckPage
+ *  Creates prestart page
+ */
+// ================================================================
 void SALOME_InstallWizard::setupCheckPage()
 {
   // create page
@@ -620,9 +639,12 @@ void SALOME_InstallWizard::setupCheckPage()
   // adding page
   addPage( prestartPage, tr( "Check your choice" ) );
 }
+// ================================================================
 /*!
-  Creates progress page
-*/
+ *  SALOME_InstallWizard::setupProgressPage
+ *  Creates progress page
+ */
+// ================================================================
 void SALOME_InstallWizard::setupProgressPage()
 {
   // create page
@@ -677,19 +699,23 @@ void SALOME_InstallWizard::setupProgressPage()
   // connect signals
   connect( passedParams, SIGNAL( returnPressed() ), this, SLOT( onReturnPressed() ) ) ;
 }
+// ================================================================
 /*!
-  Creates readme page
-*/
+ *  SALOME_InstallWizard::setupReadmePage
+ *  Creates readme page
+ */
+// ================================================================
 void SALOME_InstallWizard::setupReadmePage()
 {
   // create page
-  readmePage = new QWidget( this, "RedamePage" );
+  readmePage = new QWidget( this, "ReadmePage" );
   QVBoxLayout* pageLayout = new QVBoxLayout( readmePage ); 
   pageLayout->setMargin( 0 ); pageLayout->setSpacing( 6 );
   // README info text box
   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" ) );
@@ -715,13 +741,16 @@ void SALOME_InstallWizard::setupReadmePage()
   if ( readFile( readmeFile, text ) )
     readme->setText( text );
   else
-    readme->setText( "README file has not been found" );
+    readme->setText( tr( "README file has not been found" ) );
   // adding page
   addPage( readmePage, tr( "Finish installation" ) );
 }
+// ================================================================
 /*!
-  Displays choice info
-*/
+ *  SALOME_InstallWizard::showChoiceInfo
+ *  Displays choice info
+ */
+// ================================================================
 void SALOME_InstallWizard::showChoiceInfo()
 {
   choices->clear();
@@ -732,21 +761,20 @@ void SALOME_InstallWizard::showChoiceInfo()
   QString text;
 
   if ( !xmlFileName.isEmpty() ) {
-    text += tr( "Configuration file: <b>" ) + xmlFileName + "</b><br>";
+    text += tr( "Configuration file" )+ ": <b>" + xmlFileName + "</b><br>";
     text += "<br>";
   }
   if ( !myOS.isEmpty() ) {
-    text += tr( "Target platform: <b>" ) + myOS + "</b><br>";
+    text += tr( "Target platform" ) + ": <b>" + myOS + "</b><br>";
     text += "<br>";
   }
-  text += tr( "Products to be used:<ul>" );
+  text += tr( "Products to be used" ) + ":<ul>";
   QCheckListItem* item = (QCheckListItem*)( productsView->firstChild() );
   while( item ) {
     if ( productsMap.contains( item ) ) {
       if ( item->childCount() > 0 ) {
-        // Neither "SALOME binaries", no "SALOME sources"
         if ( productsView->isNative( item ) ) {
-          text += "<li><b>" + item->text() + "</b> as native<br>";
+          text += "<li><b>" + item->text() + "</b> " + tr( "as native" ) + "<br>";
           nbProd++;
         }
       }
@@ -754,26 +782,25 @@ void SALOME_InstallWizard::showChoiceInfo()
     item = (QCheckListItem*)( item->nextSibling() );
   }
   if ( nbProd == 0 ) {
-    text += "<li><b>none</b><br>";
+    text += "<li><b>" + tr( "none" ) + "</b><br>";
   }
   text += "</ul>";
-  text += tr( "Products to be installed:<ul>" );
+  nbProd = 0;
+  text += tr( "Products to be installed" ) + ":<ul>";
   item = (QCheckListItem*)( productsView->firstChild() );
   while( item ) {
     if ( productsMap.contains( item ) ) {
       if ( item->childCount() > 0 ) {
-        // Neither "SALOME binaries", no "SALOME sources"
         if ( productsView->isBinaries( item ) ) {
-          text += "<li><b>" + item->text() + "</b> as binaries<br>";
+          text += "<li><b>" + item->text() + "</b> " + tr( "as binaries" ) + "<br>";
           nbProd++;
         }
         else if ( productsView->isSources( item ) ) {
-          text+= "<li><b>" + item->text() + "</b> as sources<br>";
+          text+= "<li><b>" + item->text() + "</b> " + tr( "as sources" ) + "<br>";
           nbProd++;
         }
       }
       else if ( item->isOn() ) {
-        // "SALOME binaries" or "SALOME sources"
         text+= "<li><b>" + item->text() + "</b><br>";
         nbProd++;
       }
@@ -781,34 +808,26 @@ void SALOME_InstallWizard::showChoiceInfo()
     item = (QCheckListItem*)( item->nextSibling() );
   }
   if ( nbProd == 0 ) {
-    text += "<li><b>none</b><br>";
+    text += "<li><b>" + tr( "none" ) + "</b><br>";
   }
   text += "</ul>";
-  text += "Total disk space required: <b>" + QString::number( totSize ) + " Kb</b><br>" ;
-  text += "Space for temporary files required: <b>" + QString::number( tempSize ) + " Kb</b><br>" ;
+  text += tr( "Total disk space required:" ) + " <b>" + QString::number( totSize ) + " Kb</b><br>" ;
+  text += tr( "Space for temporary files required:" ) + " <b>" + QString::number( tempSize ) + " Kb</b><br>" ;
   text += "<br>";
-  text += "Target directory: <b>" + QDir::cleanDirPath( targetFolder->text().stripWhiteSpace() ) + "</b><br>";
+  text += tr( "Target directory:" ) + " <b>" + QDir::cleanDirPath( targetFolder->text().stripWhiteSpace() ) + "</b><br>";
   // VSR: Temporary folder is used always now and it is not necessary to disable it -->
   // if ( tempSize > 0 )
   // VSR: <----------------------------------------------------------------------------
-  text += "Temp directory: <b>" + QDir::cleanDirPath( tempFolder->text().stripWhiteSpace() ) + "</b><br>";
+  text += tr( "Temp directory:" ) + " <b>" + QDir::cleanDirPath( tempFolder->text().stripWhiteSpace() ) + "</b><br>";
   text += "<br>";
   choices->setText( text );
 }
+// ================================================================
 /*!
-  Checks if string contains spaces; used to check directory paths [ static ]
-*/
-static bool hasSpace( const QString& dir )
-{
-  for ( int i = 0; i < (int)dir.length(); i++ ) {
-    if ( dir[ i ].isSpace() )
-      return true;
-  }
-  return false;
-}
-/*!
-  Validates page when <Next> button is clicked
-*/
+ *  SALOME_InstallWizard::acceptData
+ *  Validates page when <Next> button is clicked
+ */
+// ================================================================
 bool SALOME_InstallWizard::acceptData( const QString& pageTitle )
 {
   QString tmpstr;
@@ -816,8 +835,8 @@ bool SALOME_InstallWizard::acceptData( const QString& pageTitle )
   if ( aPage == productsPage ) {
     // ########## check if any products are selected to be installed
     long totSize, tempSize;
-    checkSize( &totSize, &tempSize );
-    if ( totSize <= 0 ) {
+    bool anySelected = checkSize( &totSize, &tempSize );
+    if ( !anySelected ) {
       QMessageBox::warning( this, 
                             tr( "Warning" ), 
                             tr( "Select one or more products to install" ), 
@@ -918,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" ), 
@@ -942,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 ) );
@@ -961,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" ), 
@@ -984,7 +1000,7 @@ bool SALOME_InstallWizard::acceptData( const QString& pageTitle )
            if ( item->text(2).isEmpty() || item->text(2).isNull() ) {
              QMessageBox::warning( this, 
                                    tr( "Warning" ), 
-                                   tr( QString("You don't have a defined script for %1").arg(item->text(0))), 
+                                   tr( "You don't have a defined script for %1").arg(item->text(0)), 
                                    QMessageBox::Ok, 
                                    QMessageBox::NoButton, 
                                    QMessageBox::NoButton );
@@ -995,7 +1011,7 @@ bool SALOME_InstallWizard::acceptData( const QString& pageTitle )
              if ( !fi.exists() ) {
                QMessageBox::warning( this, 
                                      tr( "Warning" ),  
-                                           tr( QString("%1 required for %2 doesn't exist.").arg("./config_files/" + item->text(2)).arg(item->text(0))),  
+                                     tr( "%1 required for %2 doesn't exist.").arg("./config_files/" + item->text(2)).arg(item->text(0)),  
                                      QMessageBox::Ok, 
                                      QMessageBox::NoButton, 
                                      QMessageBox::NoButton );
@@ -1020,8 +1036,8 @@ bool SALOME_InstallWizard::acceptData( const QString& pageTitle )
              else {
                QMessageBox::warning( this, 
                                      tr( "Warning" ), 
-                                     tr( QString("%1 is required for %2 %3 installation.\n"
-                                                 "Please, add this product in config.xml file.").arg(dependOn[ i ]).arg(item->text(0)).arg(item->text(1))), 
+                                     tr( "%1 is required for %2 %3 installation.\n"
+                                         "Please, add this product in config.xml file.").arg(dependOn[ i ]).arg(item->text(0)).arg(item->text(1)), 
                                      QMessageBox::Ok, 
                                      QMessageBox::NoButton, 
                                      QMessageBox::NoButton );
@@ -1035,48 +1051,46 @@ 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( QString("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( QString("%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 );
 }
+// ================================================================
 /*!
-  Calculates disk space required for the installation
-*/
-void SALOME_InstallWizard::checkSize( long* totSize, long* tempSize )
+ *  SALOME_InstallWizard::checkSize
+ *  Calculates disk space required for the installation
+ */
+// ================================================================
+bool SALOME_InstallWizard::checkSize( long* totSize, long* tempSize )
 {
   long tots = 0, temps = 0;
-  int nativeProd = 0;
+  int nbSelected = 0;
 
   MapProducts::Iterator mapIter;
   for ( mapIter = productsMap.begin(); mapIter != productsMap.end(); ++mapIter ) {
@@ -1089,73 +1103,87 @@ void SALOME_InstallWizard::checkSize( long* totSize, long* tempSize )
       tots += dep.getSize(true);
       temps = max( temps, dep.getTempSize() );
     }
-    else if ( productsView->isNative( item ) ) {
-      nativeProd++;
-    }
+    if ( !productsView->isNone( item ) )
+      nbSelected++;
   }
  
-  requiredSize->setText( QString::number( tots )  + " Kb");
-  requiredTemp->setText( QString::number( temps ) + " Kb");
   if ( totSize )
     *totSize = tots;
   if ( tempSize )
     *tempSize = temps;
-  setNextEnabled( productsPage, (tots > 0) || (nativeProd > 0));
+  return ( nbSelected > 0 );
 }
+// ================================================================
 /*!
-  Enabled/disables "Next" button for the directory page
-*/
-void SALOME_InstallWizard::checkDirs()
+ *  SALOME_InstallWizard::checkProductPage
+ *  Checks products page validity (directories and products selection) and
+ *  enabled/disables "Next" button for the Products page
+ */
+// ================================================================
+void SALOME_InstallWizard::checkProductPage()
 {
-  // VSR: Temporary folder is used always now and it is not necessary to disable it -->
-  // get disk space required
-  //long totSize, tempSize;
-  //checkSize( &totSize, &tempSize );
-  // enable/disable temp directory controls
-  // tempFolder->setEnabled( tempSize > 0 );
-  // tempBtn->setEnabled( tempSize > 0 );
-  // VSR: <----------------------------------------------------------------------------
-  // get dirs
-  QString targetDir = targetFolder->text().stripWhiteSpace();
+  long tots = 0, temps = 0;
+
+  // check if any product is selected;
+  bool isAnyProductSelected = checkSize( &tots, &temps );
+  // check if target directory is valid
+  bool isTargetDirValid = !targetFolder->text().stripWhiteSpace().isEmpty();
+  // check if temp directory is valid
+  bool isTempDirValid = !moreMode || !tempFolder->text().stripWhiteSpace().isEmpty();
+
+  // update required size information
+  requiredSize->setText( QString::number( tots )  + " Kb");
+  requiredTemp->setText( QString::number( temps ) + " Kb");
+
   // enable/disable "Next" button
-  setNextEnabled( productsPage, !targetDir.isEmpty() );
+  setNextEnabled( productsPage, isAnyProductSelected && isTargetDirValid && isTempDirValid );
 }
+// ================================================================
 /*!
-  Sets the product and all products this one depends on to be checked ( recursively )
-*/
-void SALOME_InstallWizard::setProductOn( QCheckListItem* item, int install )
+ *  SALOME_InstallWizard::setPrerequisites
+ *  Sets the product and all products this one depends on to be checked ( recursively )
+ */
+// ================================================================
+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() );
+       }
+      }
     }
   }
 }
+// ================================================================
 /*!
-  Runs installation script
-*/
+ *  SALOME_InstallWizard::launchScript
+ *  Runs installation script
+ */
+// ================================================================
 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 );
@@ -1166,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
@@ -1183,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 ) ) {
@@ -1219,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
@@ -1230,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 );
@@ -1257,9 +1300,12 @@ void SALOME_InstallWizard::launchScript()
     showNormal();
   raise();
 }
+// ================================================================
 /*!
-  <More...> button slot
-*/
+ *  SALOME_InstallWizard::onMoreBtn
+ *  <More...> button slot
+ */
+// ================================================================
 void SALOME_InstallWizard::onMoreBtn()
 {
   if ( moreMode ) {
@@ -1279,47 +1325,55 @@ void SALOME_InstallWizard::onMoreBtn()
     resize( geometry().width(), 0 );
     qApp->processEvents();
   }
+  checkProductPage();
 }
+// ================================================================
 /*!
-  <Launch Salome> button slot
-*/
+ *  SALOME_InstallWizard::onLaunchSalome
+ *  <Launch Salome> button slot
+ */
+// ================================================================
 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 );
 }
+// ================================================================
 /*!
-  Searches product listview item with given symbolic name 
-*/
+ *  SALOME_InstallWizard::findItem
+ *  Searches product listview item with given symbolic name 
+ */
+// ================================================================
 QCheckListItem* SALOME_InstallWizard::findItem( const QString& sName )
 {
   MapProducts::Iterator mapIter;
@@ -1329,9 +1383,12 @@ QCheckListItem* SALOME_InstallWizard::findItem( const QString& sName )
   }
   return 0;
 }
+// ================================================================
 /*!
-  Sets progress state to Aborted
-*/
+ *  SALOME_InstallWizard::abort
+ *  Sets progress state to Aborted
+ */
+// ================================================================
 void SALOME_InstallWizard::abort()
 {
   QString prod = progressView->findStatus( Processing );
@@ -1345,20 +1402,21 @@ void SALOME_InstallWizard::abort()
     prod = progressView->findStatus( Waiting );
   }
 }
+// ================================================================
 /*!
-  Reject slot, clears temporary directory and closes application
-*/
+ *  SALOME_InstallWizard::reject
+ *  Reject slot, clears temporary directory and closes application
+ */
+// ================================================================
 void SALOME_InstallWizard::reject()
 {
-#ifdef DEBUG
-  cout << "REJECTED" << endl;
-#endif
+  ___MESSAGE___( "REJECTED" );
   if ( !exitConfirmed ) {
     if ( QMessageBox::information( this, 
                                   tr( "Exit" ), 
-                                  tr( "Do you want to quit Installation Wizard?" ), 
-                                  tr( "Yes" ), 
-                                  tr( "No" ),
+                                  tr( "Do you want to quit %1?" ).arg( getIWName() ), 
+                                  tr( "&Yes" ), 
+                                  tr( "&No" ),
                                   QString::null,
                                   0,
                                   1 ) == 1 ) {
@@ -1366,51 +1424,58 @@ void SALOME_InstallWizard::reject()
     }
     exitConfirmed = true;
   }
-  clean();
+  clean(true);
   InstallWizard::reject();
 }
+// ================================================================
 /*!
-  Accept slot, clears temporary directory and closes application
-*/
+ *  SALOME_InstallWizard::accept
+ *  Accept slot, clears temporary directory and closes application
+ */
+// ================================================================
 void SALOME_InstallWizard::accept()
 {
-#ifdef DEBUG
-  cout << "ACCEPTED" << endl;
-#endif
-  clean();
+  ___MESSAGE___( "ACCEPTED" );
+  clean(true);
   InstallWizard::accept();
 }
+// ================================================================
 /*!
-  Clears and removes temporary directory
-*/
-void SALOME_InstallWizard::clean()
+ *  SALOME_InstallWizard::clean
+ *  Clears and (optionally) removes temporary directory
+ */
+// ================================================================
+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 );
   }
 }
+// ================================================================
 /*!
-  Called when user moves from page to page
-*/
+ *  SALOME_InstallWizard::pageChanged
+ *  Called when user moves from page to page
+ */
+// ================================================================
 void SALOME_InstallWizard::pageChanged( const QString & mytitle)
 {
   nextButton()->setText( tr( "&Next >" ) );
@@ -1424,14 +1489,11 @@ void SALOME_InstallWizard::pageChanged( const QString & mytitle)
   QWidget* aPage = InstallWizard::page( mytitle );
   if ( !aPage )
     return;
-  setCaption( tr( myCaption ) + tr( " - Step ") + 
-             QString::number( this->indexOf( aPage )+1 ) + 
-             " of " +
-             QString::number( this->pageCount() ) );
+  updateCaption();
   if ( aPage == productsPage ) {
     // products page
-    checkSize();
-    checkDirs();
+    onSelectionChanged();
+    checkProductPage();
   }
   else if ( aPage == prestartPage ) {
     // prestart page
@@ -1445,36 +1507,38 @@ void SALOME_InstallWizard::pageChanged( const QString & mytitle)
       passedParams->clear();
       passedParams->setEnabled( false );
       QFont f = parametersLab->font(); f.setBold( false ); parametersLab->setFont( f );
-      nextButton()->setText( tr("&Start") );
+      nextButton()->setText( tr( "&Start" ) );
       QWhatsThis::add( nextButton(), tr( "Starts installation process" ) );
       QToolTip::add  ( nextButton(), tr( "Starts installation process" ) );
       // 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 );
 }
+// ================================================================
 /*!
-  Shows help window
-*/
+ *  SALOME_InstallWizard::helpClicked
+ *  Shows help window
+ */
+// ================================================================
 void SALOME_InstallWizard::helpClicked()
 {
   if ( helpWindow == NULL ) {
-    helpWindow = HelpWindow::openHelp();
+    helpWindow = HelpWindow::openHelp( this );
     if ( helpWindow ) {
       helpWindow->show();
       helpWindow->installEventFilter( this );
@@ -1490,9 +1554,12 @@ void SALOME_InstallWizard::helpClicked()
     helpWindow->setActiveWindow();
   }
 }
+// ================================================================
 /*!
-  Shows directory selection dialog
-*/
+ *  SALOME_InstallWizard::browseDirectory
+ *  Shows directory selection dialog
+ */
+// ================================================================
 void SALOME_InstallWizard::browseDirectory()
 {
   const QObject* theSender = sender();
@@ -1508,18 +1575,24 @@ void SALOME_InstallWizard::browseDirectory()
     theFolder->setText( typedDir );
     theFolder->end( false );
   }
-  checkDirs();
+  checkProductPage();
 }
+// ================================================================
 /*!
-  Called when directory path (target or temp) is changed
-*/
+ *  SALOME_InstallWizard::directoryChanged
+ *  Called when directory path (target or temp) is changed
+ */
+// ================================================================
 void SALOME_InstallWizard::directoryChanged( const QString& /*text*/ )
 {
-  checkDirs();
+  checkProductPage();
 }
+// ================================================================
 /*!
-  <Start> button's slot - runs installation
-*/
+ *  SALOME_InstallWizard::onStart
+ *  <Start> button's slot - runs installation
+ */
+// ================================================================
 void SALOME_InstallWizard::onStart()
 {
   // clear list of products to install ...
@@ -1535,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();
@@ -1547,22 +1621,25 @@ void SALOME_InstallWizard::onStart()
       item = findItem( toInstall[ i ] );
       QString type = "";
       if ( productsView->isBinaries( item ) )
-       type = "binaries";
+       type = tr( "binaries" );
       else if ( productsView->isSources( item ) )
-       type = "sources";
+       type = tr( "sources" );
       else if ( productsView->isNative( item ) )
-       type = "native";
+       type = tr( "native" );
       else 
-       type = "not install";
+       type = tr( "not install" );
       progressView->addProduct( item->text(0), type, item->text(2) );
     }
     // launch install script
     launchScript();
   }
 }
+// ================================================================
 /*!
-  Called when users tries to pass parameters for the script
-*/
+ *  SALOME_InstallWizard::onReturnPressed
+ *  Called when users tries to pass parameters for the script
+ */
+// ================================================================
 void SALOME_InstallWizard::onReturnPressed()
 {
   QString txt = passedParams->text();
@@ -1579,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
@@ -1600,27 +1671,30 @@ 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 );
   }
 }
+// ================================================================
 /*!
-  Slot, called when <Cancel> button is clicked during installation script running
-*/
+ *  SALOME_InstallWizard::tryTerminate
+ *  Slot, called when <Cancel> button is clicked during installation script running
+ */
+// ================================================================
 void SALOME_InstallWizard::tryTerminate()
 {
   if ( shellProcess->isRunning() ) {
     if ( QMessageBox::information( this, 
                                   tr( "Exit" ), 
-                                  tr( "Do you want to quit Installation Wizard?" ), 
-                                  tr( "Yes" ), 
-                                  tr( "No" ),
+                                  tr( "Do you want to quit %1?" ).arg( getIWName() ), 
+                                  tr( "&Yes" ), 
+                                  tr( "&No" ),
                                   QString::null,
                                   0,
                                   1 ) == 1 ) {
@@ -1638,52 +1712,74 @@ void SALOME_InstallWizard::tryTerminate()
     reject();
   }
 }
+// ================================================================
 /*!
-  Kills installation process and quits application
-*/
+ *  SALOME_InstallWizard::onCancel
+ *  Kills installation process and quits application
+ */
+// ================================================================
 void SALOME_InstallWizard::onCancel()
 {
   shellProcess->kill();
   reject();
 }
+// ================================================================
 /*!
-  Called when selection is changed in the products list view
-*/
-void SALOME_InstallWizard::onSelectionChanged( QListViewItem* item )
+ *  SALOME_InstallWizard::onSelectionChanged
+ *  Called when selection is changed in the products list view
+ */
+// ================================================================
+void SALOME_InstallWizard::onSelectionChanged()
 {
   productsInfo->clear();
+  QListViewItem* item = productsView->selectedItem();
+  if ( !item )
+    return;
   if ( item->parent() )
     item = item->parent();
   QCheckListItem* aItem = (QCheckListItem*)item;
   if ( !productsMap.contains( aItem ) )
     return;
   Dependancies dep = productsMap[ aItem ];
-  QString text = "<b>" + aItem->text(0) + "</b>";
-  text += "<br><br>";
+  QString text = "<b>" + aItem->text(0) + "</b>" + "<br>";
   if ( !aItem->text(1).stripWhiteSpace().isEmpty() )
-    text += "version: " + aItem->text(1) + "<br>";
-  if ( productsView->isBinaries( aItem ) )
-    text += "Disk space required: " + QString::number( dep.getSize() ) + " Kb";
-  else
-    text += "Disk space required: " + QString::number( dep.getSize(true) ) + " Kb";
-
+    text += tr( "Version" ) + ": " + aItem->text(1) + "<br>";
   text += "<br>";
-  text += "Disk space for tmp files required: " + QString::number( dep.getTempSize() ) + " Kb";
-  text += "<br><br>";
-  QString req =( dep.getDependancies().count() > 0 ? dep.getDependancies().join(", ") : QString( "none" ) );
-//    if ( item->depth() == 0 && item->childCount() == 0 ) {
-//      if ( dep.getName() == "salomedoc" )
-//        req = "none";          // SALOME docs
-//      else
-//        req = "all products";  // SALOME sources and binaries
-//    }
-  text +=  "Prerequisites: " + req;
+  if ( !dep.getDescription().isEmpty() ) {
+    text += "<i>" + dep.getDescription() + "</i><br><br>";
+  }
+  text += tr( "User choice" ) + ": ";
+  long totSize = 0, tempSize = 0;
+  if ( productsView->isBinaries( aItem ) ) {
+    text += "<b>" + tr( "install binaries" ) + "</b>" + "<br>";
+    totSize = dep.getSize();
+  }
+  else if ( productsView->isSources( aItem ) ) {
+    text += "<b>" + tr( "install sources" ) + "</b>" + "<br>";
+    totSize = dep.getSize( true );
+    tempSize = dep.getTempSize();
+  }
+  else if ( productsView->isNative( aItem ) ) {
+    text += "<b>" + tr( "use native" ) + "</b>" + "<br>";
+  }
+  else {
+    text += "<b>" + tr( "not install" ) + "</b>" + "<br>";
+  }
+  
+  text += tr( "Disk space required" ) + ": " + QString::number( totSize ) + " Kb<br>";
+  text += tr( "Disk space for tmp files required" ) + ": " + QString::number( tempSize ) + " Kb<br>";
+  text += "<br>";
+  QString req = ( dep.getDependancies().count() > 0 ? dep.getDependancies().join(", ") : tr( "none" ) );
+  text +=  tr( "Prerequisites" ) + ": " + req;
   productsInfo->setText( text );
 }
+// ================================================================
 /*!
-  Called when user checks/unchecks any product item
-  Recursively sets all prerequisites and updates "Next" button state
-*/
+ *  SALOME_InstallWizard::onItemToggled
+ *  Called when user checks/unchecks any product item
+ *  Recursively sets all prerequisites and updates "Next" button state
+ */
+// ================================================================
 void SALOME_InstallWizard::onItemToggled( QCheckListItem* item )
 {
   if ( prerequisites->isChecked() ) {
@@ -1691,21 +1787,20 @@ 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 );
     }
   }
-  checkSize();
+  onSelectionChanged();
+  checkProductPage();
 }
+// ================================================================
 /*!
-  This slot is called when user clicks one of <Select Sources>,
-  <Select Binaries>, <Unselect All> buttons ( products page )
-*/
+ *  SALOME_InstallWizard::onProdBtn
+ *  This slot is called when user clicks one of <Select Sources>,
+ *  <Select Binaries>, <Unselect All> buttons ( products page )
+ */
+// ================================================================
 void SALOME_InstallWizard::onProdBtn()
 {
   const QObject* snd = sender();
@@ -1718,25 +1813,28 @@ void SALOME_InstallWizard::onProdBtn()
     }
   }
   productsView->blockSignals( false );
-  checkSize();
+  onSelectionChanged();
+  checkProductPage();
 }
+// ================================================================
 /*!
-  QProcess slot: -->something was written to stdin
-*/
+ *  SALOME_InstallWizard::wroteToStdin
+ *  QProcess slot: -->something was written to stdin
+ */
+// ================================================================
 void SALOME_InstallWizard::wroteToStdin( )
 {
-#ifdef DEBUG
-  cout << "Something was sent to stdin" << endl;
-#endif
+  ___MESSAGE___( "Something was sent to stdin" );
 }
+// ================================================================
 /*!
-  QProcess slot: -->something was written to stdout
-*/
+ *  SALOME_InstallWizard::readFromStdout
+ *  QProcess slot: -->something was written to stdout
+ */
+// ================================================================
 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();
@@ -1747,14 +1845,15 @@ void SALOME_InstallWizard::readFromStdout( )
     installInfo->scrollToBottom();
   }
 }
+// ================================================================
 /*!
-  QProcess slot: -->something was written to stderr
-*/
+ *  SALOME_InstallWizard::readFromStderr
+ *  QProcess slot: -->something was written to stderr
+ */
+// ================================================================
 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();
@@ -1768,177 +1867,97 @@ void SALOME_InstallWizard::readFromStderr( )
   passedParams->setFocus();
   QFont f = parametersLab->font(); f.setBold( true ); parametersLab->setFont( f );
 }
+// ================================================================
 /*!
-  Sets dependancies for the product item
-*/
+ *  SALOME_InstallWizard::setDependancies
+ *  Sets dependancies for the product item
+ */
+// ================================================================
 void SALOME_InstallWizard::setDependancies( QCheckListItem* item, Dependancies dep)
 {
   productsMap[item] = dep;
 }
+// ================================================================
 /*!
-  Polishing of the widget - to set right initial size
-*/
+ *  SALOME_InstallWizard::polish
+ *  Polishing of the widget - to set right initial size
+ */
+// ================================================================
 void SALOME_InstallWizard::polish()
 {
   resize( 0, 0 );
   InstallWizard::polish();
 }
-
-// ###################################### Structure Parser ###########################################
-
-/*!
-  Constructor
-*/
-StructureParser::StructureParser()
-                : QXmlDefaultHandler()
-{
-  wizard = NULL;
-  tree = NULL;
-}
-/*!
-  Sets install wizard's main window
-*/
-void StructureParser::setWizard( SALOME_InstallWizard* awizard )
-{
-  wizard = awizard;
-}
-/*!
-  Sets products list view
-*/
-void StructureParser::setListView( MyListView * t )
-{
-  tree = t;
-}
-/*!
-  Sets temp directory widget
-*/
-void StructureParser::setTempDir( QLineEdit * dir )
-{
-  tempdir = dir;
-}
-/*!
-  Sets target directory widget
-*/
-void StructureParser::setTargetDir( QLineEdit * dir )
-{
-  targetdir = dir;
-}
-/*!
-  Begins parsing of the xml dom-element
-*/  
-bool StructureParser::startElement( const QString& ,
-                                    const QString& ,
-                                    const QString& qName,
-                                    const QXmlAttributes& attributes)
-{
-#ifdef DEBUG
-  cout << qName << endl;
-  cout << attributes.length() << endl;
-#endif
-  QCheckListItem * element;
-  if (( qName == "config" ) && ( attributes.length() > 0 ) ) {
-    if ( attributes.value( "version" ) )
-      myVersion = attributes.value( "version" ).stripWhiteSpace();
-    if ( attributes.value( "caption" ) && !myCaption.isEmpty() )
-      myCaption = QString(attributes.value( "caption" )).arg(myVersion).stripWhiteSpace();
-    if ( attributes.value( "copyright" ) )
-      myCopyright = attributes.value( "copyright" ).stripWhiteSpace();
-    if ( attributes.value( "license" ) )
-      myLicense = attributes.value( "license" ).stripWhiteSpace();
-    if ( attributes.value( "os" ) )
-      myOS = attributes.value( "os" ).stripWhiteSpace();
-
-#ifdef DEBUG
-    cout << myCaption << endl;
-    cout << myVersion << endl;
-    cout << myCopyright << endl;
-    cout << myLicense << endl;
-#endif
-  } else if (( qName == "product" ) && ( attributes.length() > 0 ) && tree && wizard ) {
-    if (attributes.value("disable") == "true" )
-      return true;
-    
-    QString install = attributes.value( "install" );
-    QStringList supported = QStringList::split(",", attributes.value("supported") );
-    QString script = attributes.value( "script" );
-    element = tree->addItem( attributes.value("name"), attributes.value("version"), install, supported, script );
-    if ( attributes.value("dependancies") == "" ) {
-      QStringList diskspace = QStringList::split(",",attributes.value("installdiskspace"));
-      if (diskspace.count() == 2)
-       wizard->setDependancies( element, 
-                                Dependancies( attributes.value("name"), QStringList(), 
-                                              diskspace[0].toInt(), 
-                                              diskspace[1].toInt(), 
-                                              attributes.value("temporarydiskspace").toInt()) );
-      else
-       wizard->setDependancies( element, 
-                                Dependancies( attributes.value("name"), QStringList(), 
-                                              diskspace[0].toInt(), 
-                                              diskspace[0].toInt(), 
-                                              attributes.value("temporarydiskspace").toInt()) );
-
-    } else {
-      QStringList diskspace = QStringList::split(",",attributes.value("installdiskspace"));
-      if (diskspace.count() == 2)
-       wizard->setDependancies( element, 
-                                Dependancies( attributes.value("name"), 
-                                              QStringList::split(",", attributes.value("dependancies") ), 
-                                              diskspace[0].toInt(), 
-                                              diskspace[1].toInt(), 
-                                              attributes.value("temporarydiskspace").toInt()) );
-      else
-       wizard->setDependancies( element, 
-                                Dependancies( attributes.value("name"), 
-                                              QStringList::split(",", attributes.value("dependancies") ), 
-                                              diskspace[0].toInt(), 
-                                              diskspace[0].toInt(),
-                                              attributes.value("temporarydiskspace").toInt()) );
-    }
-  } else if (( qName == "path" ) && ( attributes.length() > 0 ) && wizard ) {
-    targetdir->setText( attributes.value("targetdir") );
-    
-    if ( attributes.value("tempdir") == "" )
-      tempdir->setText( "/tmp" );
-    else
-      tempdir->setText( attributes.value("tempdir") );
-    }
-  return true;
-}
+// ================================================================
 /*!
-  Finishes parsing of the xml dom-element
-*/
-bool StructureParser::endElement( const QString&, const QString&,
-                                  const QString& )
+ *  SALOME_InstallWizard::updateCaption
+ *  Updates caption according to the current page number
+ */
+// ================================================================
+void SALOME_InstallWizard::updateCaption()
 {
-    return true;
+  QWidget* aPage = InstallWizard::currentPage();
+  if ( !aPage ) 
+    return;
+  InstallWizard::setCaption( tr( myCaption ) + " " +
+                            tr( getIWName() ) + " - " +
+                            tr( "Step %1 of %2").arg( QString::number( this->indexOf( aPage )+1 ) ).arg( QString::number( this->pageCount() ) ) );
 }
 
-// ###################################### Main ###########################################
-
+// ================================================================
 /*!
-  Program starts here
-*/
-int main( int argc, char **argv )
+ *  SALOME_InstallWizard::processValidateEvent
+ *  Processes validation event (<val> is validation code)
+ */
+// ================================================================
+void SALOME_InstallWizard::processValidateEvent( const int val, void* data )
 {
-  QApplication a( argc, argv );
-  QString xmlFileName( argc == 2 ? argv[1] : "config.xml" );
-  
-  int result = -1;
-  QFile xmlfile(xmlFileName);
-  if ( xmlfile.exists() ) {
-    SALOME_InstallWizard wizard(xmlFileName);
-    a.setMainWidget( &wizard );
-    wizard.show();
-    result = a.exec();
+  QWidget* aPage = InstallWizard::currentPage();
+  if ( aPage != productsPage ) {
+    InstallWizard::processValidateEvent( val, data );
+    return;
   }
-  else {
-    QMessageBox::critical( 0, 
-                          QObject::tr( "Error" ), 
-                          QObject::tr( "Can't open config file:\n%1\n\nQuitting...").arg( xmlFileName ), 
-                          QMessageBox::Ok,
+  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 );
   }
-  return result;
 }
-