Salome HOME
This commit was generated by cvs2git to track changes on a CVS vendor
[modules/kernel.git] / src / SALOMEGUI / QAD_Desktop.cxx
index fc6cd157ce628de24d62d35e08be62f108bbf967..189665a8e367f45ae0dda69484e9b97d77557de6 100644 (file)
@@ -1,13 +1,29 @@
-using namespace std;
-//  File      : QAD_Desktop.cxx
-//  Created   : UI team, 02.10.00
-//  Descr     : Main desktop of QAD-based application
-
-//  Modified  : Mon Dec 03 13:40:28 2001
-//  Author    : Nicolas REJNERI
-//  Project   : SALOME
-//  Module    : SALOMEGUI
-//  Copyright : Open CASCADE 2001
+//  SALOME SALOMEGUI : implementation of desktop and GUI kernel
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
+// 
+//  This library is free software; you can redistribute it and/or 
+//  modify it under the terms of the GNU Lesser General Public 
+//  License as published by the Free Software Foundation; either 
+//  version 2.1 of the License. 
+// 
+//  This library is distributed in the hope that it will be useful, 
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+//  Lesser General Public License for more details. 
+// 
+//  You should have received a copy of the GNU Lesser General Public 
+//  License along with this library; if not, write to the Free Software 
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
+// 
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : QAD_Desktop.cxx
+//  Author : Nicolas REJNERI
+//  Module : SALOME
 //  $Header$
 
 /*!
@@ -70,6 +86,7 @@ using namespace std;
 #include <qiconset.h>
 #include <qfontdialog.h>
 #include <qlineedit.h>
+#include <qdatetime.h>
 
 #if QT_VERSION > 300
   #include <qlistbox.h>
@@ -81,6 +98,8 @@ using namespace std;
 #include <OSD_Function.hxx>
 #include <TCollection_AsciiString.hxx>
 
+static const char* SEPARATOR    = ":";
+
 extern "C"
 {
 # include <string.h>
@@ -171,7 +190,7 @@ myQueryClose( true )
   /* default background icon */
   QPixmap backgroundicon ( QAD_Desktop::getResourceManager()->loadPixmap( "CLIENT",
                                                                          tr("ICON_DESK_BACKGROUNDICON") ));
-  myToolBarAction.setAutoDelete( true );
+//myToolBarAction.setAutoDelete( true );
 
   /* default icon and title */
   QPixmap icon ( QAD_Desktop::getResourceManager()->loadPixmap( "CLIENT",
@@ -245,14 +264,27 @@ myQueryClose( true )
     /* find component icon */
     QString iconfile = strdup(list_composants[ind].moduleicone) ;
     QString modulename = strdup(list_composants[ind].modulename) ;
+    QString moduleusername = strdup(list_composants[ind].moduleusername) ;
+
+    //    MESSAGE ( " MODULE = " << modulename )
+    //    MESSAGE ( " MODULE icon = " << iconfile )
+    //    MESSAGE ( " MODULE username = " << moduleusername )
+
+    if ( mapComponentName.contains( moduleusername ) ) {
+      QMessageBox::warning( this, tr("WRN_WARNING"), QString( moduleusername + " is already associated with " + mapComponentName[moduleusername] + ".\nPlease, change the component username of " + modulename) , tr ("BUT_OK") );
+      continue;
+    }
+    mapComponentName.insert( moduleusername, modulename );
+      
     resDir = resMgr->findFile(iconfile,modulename) ;
     if (resDir)
       {
+       MESSAGE ( "resDir" << resDir )
        //resDir = QAD_Tools::addSlash(resDir) ;
        //QPixmap Icone(resDir+iconfile) ;
        QPixmap Icone( QAD_Tools::addSlash( resDir ) + iconfile );
        QToolButton * toolb = 
-         new QToolButton( QIconSet( Icone ), modulename, QString::null, this, 
+         new QToolButton( QIconSet( Icone ), moduleusername, QString::null, this, 
                           SLOT( onButtonActiveComponent () ),tbComponent );
        toolb->setToggleButton( true );
        myComponentButton.append(toolb);
@@ -265,7 +297,7 @@ myQueryClose( true )
       }
 
     if ( !QString(list_composants[ind].modulename).isEmpty() )
-      myCombo->insertItem( strdup(list_composants[ind].modulename) );
+      myCombo->insertItem( strdup(list_composants[ind].moduleusername) );
 
   }
 
@@ -278,6 +310,11 @@ myQueryClose( true )
   
   /* VSR 13/01/03 : installing global event filter for the application */
   qApp->installEventFilter( this );
+
+  /* init pseudo random numbers generator */
+  QTime cTime = QTime::currentTime();
+  int secs = cTime.second() + 1;
+  for ( int s = 0; s < secs; s++ ) random();
 }
 
 /*!
@@ -435,7 +472,7 @@ void QAD_Desktop::createActions()
     /* 'File' actions */
     /* new */
     QAD_ResourceMgr* rmgr = QAD_Desktop::getResourceManager();
-    QAction* fileNewAction = new QAction ( tr("TOT_DESK_FILE_NEW"),
+    QActionP* fileNewAction = new QActionP ( tr("TOT_DESK_FILE_NEW"),
                                           rmgr->loadPixmap( "QAD", tr("ICON_FILE_NEW") ) ,
                                           tr("MEN_DESK_FILE_NEW"), CTRL+Key_N, this );
     fileNewAction->setStatusTip ( tr("PRP_DESK_FILE_NEW") );
@@ -446,7 +483,7 @@ void QAD_Desktop::createActions()
     myStdActions.insert ( FileNewId, fileNewAction );
 
     /* open */
-    QAction* fileOpenAction = new QAction( tr("TOT_DESK_FILE_OPEN"), rmgr->loadPixmap( "QAD", tr("ICON_FILE_OPEN") ),
+    QActionP* fileOpenAction = new QActionP( tr("TOT_DESK_FILE_OPEN"), rmgr->loadPixmap( "QAD", tr("ICON_FILE_OPEN") ),
                                           tr("MEN_DESK_FILE_OPEN"), CTRL+Key_O, this );
     fileOpenAction->setStatusTip ( tr("PRP_DESK_FILE_OPEN") );
     fileOpenAction->setEnabled ( true );
@@ -456,7 +493,7 @@ void QAD_Desktop::createActions()
     myStdActions.insert ( FileOpenId, fileOpenAction );
 
     /* load */
-    QAction* fileLoadAction = new QAction( tr("TOT_DESK_FILE_LOAD"), rmgr->loadPixmap( "QAD", tr("ICON_FILE_LOAD") ),
+    QActionP* fileLoadAction = new QActionP( tr("TOT_DESK_FILE_LOAD"), rmgr->loadPixmap( "QAD", tr("ICON_FILE_LOAD") ),
                                           tr("MEN_DESK_FILE_LOAD"), CTRL+Key_L, this );
     fileLoadAction->setStatusTip ( tr("PRP_DESK_FILE_LOAD") );
     fileLoadAction->setEnabled ( true );
@@ -465,7 +502,7 @@ void QAD_Desktop::createActions()
     myStdActions.insert ( FileLoadId, fileLoadAction );
 
     /* close */
-    QAction* fileCloseAction = new QAction( "", rmgr->loadPixmap( "QAD", tr("ICON_FILE_CLOSE") ),
+    QActionP* fileCloseAction = new QActionP( "", rmgr->loadPixmap( "QAD", tr("ICON_FILE_CLOSE") ),
                                            tr("MEN_DESK_FILE_CLOSE"), CTRL+Key_W, this );
     fileCloseAction->setStatusTip ( tr("PRP_DESK_FILE_CLOSE") );
     QAD_ASSERT ( connect( fileCloseAction, SIGNAL( activated() ), this, SLOT( onCloseStudy() )));
@@ -476,7 +513,7 @@ void QAD_Desktop::createActions()
     myFilePopup.insertSeparator();
 
     /* save */
-    QAction* fileSaveAction = new QAction( tr("TOT_DESK_FILE_SAVE"), rmgr->loadPixmap( "QAD", tr("ICON_FILE_SAVE") ),
+    QActionP* fileSaveAction = new QActionP( tr("TOT_DESK_FILE_SAVE"), rmgr->loadPixmap( "QAD", tr("ICON_FILE_SAVE") ),
                                           tr("MEN_DESK_FILE_SAVE"), CTRL+Key_S, this );
     fileSaveAction->setStatusTip ( tr("PRP_DESK_FILE_SAVE") );
     QAD_ASSERT ( connect( fileSaveAction, SIGNAL( activated() ), this, SLOT( onSaveStudy() )));
@@ -485,7 +522,7 @@ void QAD_Desktop::createActions()
     myStdActions.insert ( FileSaveId, fileSaveAction );
 
     /* save as */
-    QAction* fileSaveAsAction = new QAction( "", tr("MEN_DESK_FILE_SAVEAS"), 0, this );
+    QActionP* fileSaveAsAction = new QActionP( "", tr("MEN_DESK_FILE_SAVEAS"), 0, this );
     fileSaveAsAction->setStatusTip ( tr("PRP_DESK_FILE_SAVEAS") );
     QAD_ASSERT ( connect( fileSaveAsAction, SIGNAL( activated() ),
                          this, SLOT( onSaveAsStudy() )));
@@ -497,7 +534,7 @@ void QAD_Desktop::createActions()
     myFilePopup.insertSeparator();
 
     // Study properties
-    QAction* filePropsAction = new QAction( "", QPixmap(), tr("MEN_DESK_FILE_PROPERTIES"), 0, this );
+    QActionP* filePropsAction = new QActionP( "", QPixmap(), tr("MEN_DESK_FILE_PROPERTIES"), 0, this );
     filePropsAction->setStatusTip ( tr("PRP_DESK_FILE_PROPERTIES") );
     filePropsAction->setEnabled(false);
     QAD_ASSERT ( connect( filePropsAction, SIGNAL( activated() ), this, SLOT( onStudyProperties() )));
@@ -512,7 +549,7 @@ void QAD_Desktop::createActions()
     myFilePos = myFilePopup.indexOf( id ) + 1;
 
     /* exit application */
-    QAction* exitAction = new QAction( "", tr("MEN_DESK_FILE_EXIT"),
+    QActionP* exitAction = new QActionP( "", tr("MEN_DESK_FILE_EXIT"),
                                       CTRL+Key_X, this );
     exitAction->setStatusTip ( tr("PRP_DESK_FILE_EXIT") );
     QAD_ASSERT ( connect( exitAction, SIGNAL( activated() ),
@@ -530,7 +567,7 @@ void QAD_Desktop::createActions()
                          this, SLOT(onToolBarPopupAboutToShow()) ));
 
     /* status bar */
-    QAction* viewStatusBarAction = new QAction( "",
+    QActionP* viewStatusBarAction = new QActionP( "",
                                                tr("MEN_DESK_VIEW_STATUSBAR"),
                                                0, this, 0, true );
     viewStatusBarAction->setStatusTip ( tr("PRP_DESK_VIEW_STATUSBAR") );
@@ -541,22 +578,22 @@ void QAD_Desktop::createActions()
 
 //    myViewPopup.insertItem( tr("MEN_DESK_SELECTION_MODE"), &mySelectionModePopup );
 
-    QAction* SelectionPointAction = new QAction( "", tr("MEN_DESK_SELECTION_POINT"), 0, this, 0, true  );
+    QActionP* SelectionPointAction = new QActionP( "", tr("MEN_DESK_SELECTION_POINT"), 0, this, 0, true  );
     QAD_ASSERT(connect( SelectionPointAction, SIGNAL(activated()), this, SLOT(onSelectionMode() )));
     SelectionPointAction->addTo( &mySelectionModePopup );
     myStdActions.insert( SelectionPointId, SelectionPointAction );
 
-    QAction* SelectionEdgeAction = new QAction( "", tr("MEN_DESK_SELECTION_EDGE"), 0, this, 0, true  );
+    QActionP* SelectionEdgeAction = new QActionP( "", tr("MEN_DESK_SELECTION_EDGE"), 0, this, 0, true  );
     QAD_ASSERT(connect( SelectionEdgeAction, SIGNAL(activated()), this, SLOT(onSelectionMode() )));
     SelectionEdgeAction->addTo( &mySelectionModePopup );
     myStdActions.insert( SelectionEdgeId, SelectionEdgeAction );
 
-    QAction* SelectionCellAction = new QAction( "", tr("MEN_DESK_SELECTION_CELL"), 0, this, 0, true  );
+    QActionP* SelectionCellAction = new QActionP( "", tr("MEN_DESK_SELECTION_CELL"), 0, this, 0, true  );
     QAD_ASSERT(connect( SelectionCellAction, SIGNAL(activated()), this, SLOT(onSelectionMode() )));
     SelectionCellAction->addTo( &mySelectionModePopup );
     myStdActions.insert( SelectionCellId, SelectionCellAction );
 
-    QAction* SelectionActorAction = new QAction( "", tr("MEN_DESK_SELECTION_ACTOR"), 0, this, 0, true );
+    QActionP* SelectionActorAction = new QActionP( "", tr("MEN_DESK_SELECTION_ACTOR"), 0, this, 0, true );
     QAD_ASSERT(connect( SelectionActorAction, SIGNAL(activated()), this, SLOT(onSelectionMode() )));
     SelectionActorAction->addTo( &mySelectionModePopup );
     myStdActions.insert( SelectionActorId, SelectionActorAction );
@@ -620,22 +657,22 @@ void QAD_Desktop::createActions()
     /* Viewer BackgroundColor */
     myPrefPopup.insertItem( tr("MEN_DESK_PREF_VIEWER"), &myViewerPopup );
     
-    QAction* viewerOCCAction = new QAction( "", tr("MEN_DESK_PREF_VIEWER_OCC"), 0, this );
+    QActionP* viewerOCCAction = new QActionP( "", tr("MEN_DESK_PREF_VIEWER_OCC"), 0, this );
     QAD_ASSERT(connect( viewerOCCAction, SIGNAL(activated()), this, SLOT(onViewerOCC() )));
     viewerOCCAction->addTo( &myViewerPopup );
     myStdActions.insert( PrefViewerOCCId, viewerOCCAction );
 
-    QAction* viewerVTKAction = new QAction( "", tr("MEN_DESK_PREF_VIEWER_VTK"), 0, this );
+    QActionP* viewerVTKAction = new QActionP( "", tr("MEN_DESK_PREF_VIEWER_VTK"), 0, this );
     QAD_ASSERT(connect( viewerVTKAction, SIGNAL(activated()), this, SLOT(onViewerVTK() )));
     viewerVTKAction->addTo( &myViewerPopup );
     myStdActions.insert( PrefViewerVTKId, viewerVTKAction );
 
-    QAction* graphSupervisorAction = new QAction( "", tr("MEN_DESK_PREF_GRAPH_SUPERVISOR"), 0, this );
+    QActionP* graphSupervisorAction = new QActionP( "", tr("MEN_DESK_PREF_GRAPH_SUPERVISOR"), 0, this );
     QAD_ASSERT(connect( graphSupervisorAction, SIGNAL(activated()), this, SLOT(onGraphSupervisor() )));
     graphSupervisorAction->addTo( &myViewerPopup );
     myStdActions.insert( PrefGraphSupervisorId, graphSupervisorAction );
 
-    QAction* viewerPlot2dAction = new QAction( "", tr("MEN_DESK_PREF_VIEWER_PLOT2D"), 0, this );
+    QActionP* viewerPlot2dAction = new QActionP( "", tr("MEN_DESK_PREF_VIEWER_PLOT2D"), 0, this );
     QAD_ASSERT(connect( viewerPlot2dAction, SIGNAL(activated()), this, SLOT(onPlot2d() )));
     viewerPlot2dAction->addTo( &myViewerPopup );
     myStdActions.insert( PrefViewerPlot2dId, viewerPlot2dAction );
@@ -648,48 +685,48 @@ void QAD_Desktop::createActions()
       aViewerValue = VIEW_VTK;
 
     myPrefPopup.insertItem( tr("MEN_DESK_PREF_DEFAULT_VIEWER"), &myDefaultViewer );
-    QActionGroup* myQAG = new QActionGroup ( this);
-    QAction* viewerOCCAction1 = new QAction( "", tr("MEN_DESK_PREF_VIEWER_OCC"), 0, this );
+    QActionPGroup* myQAG = new QActionPGroup ( this);
+    QActionP* viewerOCCAction1 = new QActionP( "", tr("MEN_DESK_PREF_VIEWER_OCC"), 0, this );
     viewerOCCAction1->setToggleAction ( true);
     viewerOCCAction1->setOn ( aViewerValue == VIEW_OCC );
     myQAG->insert( viewerOCCAction1 );
     myStdActions.insert( DefaultViewerOCCId, viewerOCCAction1 );
 
-    QAction* viewerVTKAction1 = new QAction( "", tr("MEN_DESK_PREF_VIEWER_VTK"), 0, this );
+    QActionP* viewerVTKAction1 = new QActionP( "", tr("MEN_DESK_PREF_VIEWER_VTK"), 0, this );
     viewerVTKAction1->setToggleAction ( true);
     viewerVTKAction1->setOn ( aViewerValue == VIEW_VTK );
     myQAG->insert( viewerVTKAction1 );
     myStdActions.insert( DefaultViewerVTKId, viewerVTKAction1 );
 
 /*    Remove Supervisor viewer from setting the background */
-//    QAction* graphSupervisorAction1 = new QAction( "", tr("MEN_DESK_PREF_GRAPH_SUPERVISOR"), 0, this );
+//    QActionP* graphSupervisorAction1 = new QActionP( "", tr("MEN_DESK_PREF_GRAPH_SUPERVISOR"), 0, this );
 //    graphSupervisorAction1->setToggleAction ( true);
 //    graphSupervisorAction1->setOn ( aViewerValue == VIEW_GRAPHSUPERV );
 //    myQAG->insert( graphSupervisorAction1 );
 //    myStdActions.insert( DefaultGraphSupervisorId, graphSupervisorAction1 );
 
-    QAction* viewerPlot2dAction1 = new QAction( "", tr("MEN_DESK_PREF_VIEWER_PLOT2D"), 0, this );
+    QActionP* viewerPlot2dAction1 = new QActionP( "", tr("MEN_DESK_PREF_VIEWER_PLOT2D"), 0, this );
     viewerPlot2dAction1->setToggleAction ( true);
     viewerPlot2dAction1->setOn ( aViewerValue == VIEW_PLOT2D );
     myQAG->insert( viewerPlot2dAction1 );
     myStdActions.insert( DefaultPlot2dId, viewerPlot2dAction1 );
 
     myQAG->addTo( &myDefaultViewer );
-    QAD_ASSERT(connect( myQAG, SIGNAL(selected(QAction * )), this, SLOT(onDefaultViewer(QAction *) )));
+    QAD_ASSERT(connect( myQAG, SIGNAL(selected(QActionP * )), this, SLOT(onDefaultViewer(QActionP *) )));
     //VRV: T2.5 - add default viewer
 
-    QAction* viewerTrihedronAction = new QAction( "", tr("MEN_DESK_PREF_VIEWER_TRIHEDRON"), 0, this );
+    QActionP* viewerTrihedronAction = new QActionP( "", tr("MEN_DESK_PREF_VIEWER_TRIHEDRON"), 0, this );
     QAD_ASSERT(connect( viewerTrihedronAction, SIGNAL(activated()), this, SLOT(onViewerTrihedron() )));
     viewerTrihedronAction->addTo( &myPrefPopup );
     myStdActions.insert( PrefViewerTrihedronId, viewerTrihedronAction );
 
-    QAction* consoleFontAction = new QAction( "", tr("MEN_DESK_PREF_CONSOLE_FONT"), 0, this );
+    QActionP* consoleFontAction = new QActionP( "", tr("MEN_DESK_PREF_CONSOLE_FONT"), 0, this );
     QAD_ASSERT(connect( consoleFontAction, SIGNAL(activated()), this, SLOT(onConsoleFontAction() )));
     consoleFontAction->addTo( &myPrefPopup );
     myStdActions.insert( PrefConsoleFontId, consoleFontAction );
 
     /* MultiFile save */
-    QAction* multiFileSaveAction = new QAction( "", tr("MEN_DESK_PREF_MULTI_FILE_SAVE"), 0, this, 0, true );
+    QActionP* multiFileSaveAction = new QActionP( "", tr("MEN_DESK_PREF_MULTI_FILE_SAVE"), 0, this, 0, true );
     QAD_ASSERT(connect( multiFileSaveAction, SIGNAL(activated()), this, SLOT(onMultiFileSave() )));
     multiFileSaveAction->setToggleAction( true );
     QString MultiSave = QAD_CONFIG->getSetting("Desktop:MultiFileSave");
@@ -697,12 +734,21 @@ void QAD_Desktop::createActions()
     multiFileSaveAction->addTo( &myPrefPopup );
     myStdActions.insert( PrefMultiFileSave, multiFileSaveAction );
 
+    /* ASCII save */
+    QActionP* ASCIISaveAction = new QActionP( "", tr("MEN_DESK_PREF_ASCII_SAVE"), 0, this, 0, true );
+    QAD_ASSERT(connect( ASCIISaveAction, SIGNAL(activated()), this, SLOT(onASCIISave() )));
+    ASCIISaveAction->setToggleAction( true );
+    QString ASCIISave = QAD_CONFIG->getSetting("Desktop:ASCIISave");
+    ASCIISaveAction->setOn( ASCIISave.compare( aTrueQString ) == 0 );
+    ASCIISaveAction->addTo( &myPrefPopup );
+    myStdActions.insert( PrefASCIISave, ASCIISaveAction );
+
     myPrefPopup.insertSeparator();
     
     /* BrowserPopup */
     myPrefPopup.insertItem( tr("MEN_DESK_PREF_OBJECTBROWSER"), &myObjBrowserPopup );
     
-    QAction* objectBrowserEntryAction = new QAction( "", tr("MEN_DESK_PREF_OBJECTBROWSER_ENTRY"), 0, this, 0, true );
+    QActionP* objectBrowserEntryAction = new QActionP( "", tr("MEN_DESK_PREF_OBJECTBROWSER_ENTRY"), 0, this, 0, true );
     QAD_ASSERT(connect( objectBrowserEntryAction, SIGNAL(activated()), this, SLOT(onObjectBrowser() )));
     objectBrowserEntryAction->setToggleAction(true);
     QString AddColumn = QAD_CONFIG->getSetting("ObjectBrowser:AddColumn");
@@ -715,7 +761,7 @@ void QAD_Desktop::createActions()
     objectBrowserEntryAction->addTo( &myObjBrowserPopup );
     myStdActions.insert( PrefObjectBrowserEntryId, objectBrowserEntryAction );
 
-    QAction* objectBrowserValueAction = new QAction( "", tr("MEN_DESK_PREF_OBJECTBROWSER_VALUE"), 0, this, 0, true );
+    QActionP* objectBrowserValueAction = new QActionP( "", tr("MEN_DESK_PREF_OBJECTBROWSER_VALUE"), 0, this, 0, true );
     QAD_ASSERT(connect( objectBrowserValueAction, SIGNAL(activated()), this, SLOT(onObjectBrowser() )));
     objectBrowserValueAction->setToggleAction(true);
     QString ValueColumn = QAD_CONFIG->getSetting("ObjectBrowser:ValueColumn");
@@ -728,7 +774,7 @@ void QAD_Desktop::createActions()
     objectBrowserValueAction->addTo( &myObjBrowserPopup );
     myStdActions.insert( PrefObjectBrowserValueId, objectBrowserValueAction );
 
-    QAction* objectBrowserIAPPAction = new QAction( "", tr("MEN_DESK_PREF_OBJECTBROWSER_IAPP"), 0, this, 0, true );
+    QActionP* objectBrowserIAPPAction = new QActionP( "", tr("MEN_DESK_PREF_OBJECTBROWSER_IAPP"), 0, this, 0, true );
     QAD_ASSERT(connect( objectBrowserIAPPAction, SIGNAL(activated()), this, SLOT(onObjectBrowser() )));
     objectBrowserIAPPAction->setToggleAction(true);
     QString showIAPP = QAD_CONFIG->getSetting("ObjectBrowser:IAPP");
@@ -742,7 +788,7 @@ void QAD_Desktop::createActions()
     myStdActions.insert( PrefObjectBrowserIAPPId, objectBrowserIAPPAction );
     
     /* Chronological sorting of shapes on the entry creation */
-    QAction* objectBrowserCHRONO_SORTAction = new QAction( "", tr("MEN_DESK_PREF_OBJECTBROWSER_CHRONO_SORT"), 0, this, 0, true );
+    QActionP* objectBrowserCHRONO_SORTAction = new QActionP( "", tr("MEN_DESK_PREF_OBJECTBROWSER_CHRONO_SORT"), 0, this, 0, true );
     QAD_ASSERT(connect( objectBrowserCHRONO_SORTAction, SIGNAL(activated()), this, SLOT(onObjectBrowser() )));
     objectBrowserCHRONO_SORTAction->setToggleAction(true);
     QString showSORT = QAD_CONFIG->getSetting("ObjectBrowser:CHRONO_SORT");
@@ -757,14 +803,14 @@ void QAD_Desktop::createActions()
     
     myPrefPopup.insertSeparator();
 
-    QAction* dirAction = new QAction( "", tr("MEN_DESK_PREF_DIRICTORIES"), 0, this );
+    QActionP* dirAction = new QActionP( "", tr("MEN_DESK_PREF_DIRICTORIES"), ALT+Key_D, this );
     QAD_ASSERT(connect( dirAction, SIGNAL(activated()), this, SLOT(onDirList() )));
     dirAction->addTo( &myPrefPopup );
     myStdActions.insert( PrefDirsId, dirAction );
     
     myPrefPopup.insertSeparator();
 
-    QAction* saveAction = new QAction( "", tr("MEN_DESK_PREF_SAVE"), 0, this );
+    QActionP* saveAction = new QActionP( "", tr("MEN_DESK_PREF_SAVE"), 0, this );
     QAD_ASSERT(connect( saveAction, SIGNAL(activated()), this, SLOT(onSavePref() )));
     saveAction->addTo( &myPrefPopup );
     myStdActions.insert( PrefSaveId, saveAction );
@@ -774,22 +820,22 @@ void QAD_Desktop::createActions()
     //NRI : SAL2214
     myWindowPopup.insertItem( tr("MEN_DESK_WINDOW_NEW3D"), &myNewViewPopup, WindowNew3dId );
     
-    QAction* viewOCCAction = new QAction( "", tr("MEN_DESK_VIEW_OCC"), 0, this );
+    QActionP* viewOCCAction = new QActionP( "", tr("MEN_DESK_VIEW_OCC"), ALT+Key_O, this );
     QAD_ASSERT(connect( viewOCCAction, SIGNAL(activated()), this, SLOT(onNewWindow3d() )));
     viewOCCAction->addTo( &myNewViewPopup );
     myStdActions.insert( ViewOCCId, viewOCCAction );
 
-    QAction* viewVTKAction = new QAction( "", tr("MEN_DESK_VIEW_VTK"), 0, this );
+    QActionP* viewVTKAction = new QActionP( "", tr("MEN_DESK_VIEW_VTK"), ALT+Key_K, this );
     QAD_ASSERT(connect( viewVTKAction, SIGNAL(activated()), this, SLOT(onNewWindow3d() )));
     viewVTKAction->addTo( &myNewViewPopup );
     myStdActions.insert( ViewVTKId, viewVTKAction );
 
-    QAction* viewPlot2dAction = new QAction( "", tr("MEN_DESK_VIEW_PLOT2D"), 0, this );
+    QActionP* viewPlot2dAction = new QActionP( "", tr("MEN_DESK_VIEW_PLOT2D"), ALT+Key_P, this );
     QAD_ASSERT(connect( viewPlot2dAction, SIGNAL(activated()), this, SLOT(onNewWindow3d() )));
     viewPlot2dAction->addTo( &myNewViewPopup );
     myStdActions.insert( ViewPlot2dId, viewPlot2dAction );
     
-    //  QAction* windowNew3dAction = new QAction( "",/* rmgr->loadPixmap( "QAD", tr("ICON_DESK_WINDOW_NEW3D") ), */
+    //  QActionP* windowNew3dAction = new QActionP( "",/* rmgr->loadPixmap( "QAD", tr("ICON_DESK_WINDOW_NEW3D") ), */
     /*tr("MEN_DESK_WINDOW_NEW3D"), 0, this );
       windowNew3dAction->addTo( &myWindowPopup );
       QAD_ASSERT( connect( windowNew3dAction, SIGNAL(activated()), this ,
@@ -800,7 +846,7 @@ void QAD_Desktop::createActions()
     //NRI : SAL2214
 
     /* cascaded */
-    QAction* windowCascadeAction = new QAction( "", rmgr->loadPixmap( "QAD", tr("ICON_DESK_WINDOW_CASCADE") ),
+    QActionP* windowCascadeAction = new QActionP( "", rmgr->loadPixmap( "QAD", tr("ICON_DESK_WINDOW_CASCADE") ),
                                                tr("MEN_DESK_WINDOW_CASCADE"), 0, this );
     windowCascadeAction->setStatusTip ( tr("PRP_DESK_WINDOW_CASCADE") );
     QAD_ASSERT( connect( windowCascadeAction, SIGNAL(activated()), this,
@@ -808,7 +854,7 @@ void QAD_Desktop::createActions()
     myStdActions.insert( WindowCascadeId, windowCascadeAction );
 
     /* tiled */
-    QAction* windowTileAction = new QAction( "", rmgr->loadPixmap( "QAD", tr("ICON_DESK_WINDOW_TILE") ),
+    QActionP* windowTileAction = new QActionP( "", rmgr->loadPixmap( "QAD", tr("ICON_DESK_WINDOW_TILE") ),
                                             tr("MEN_DESK_WINDOW_TILE"), 0, this );
     windowTileAction->setStatusTip ( tr("PRP_DESK_WINDOW_TILE") );
     QAD_ASSERT( connect( windowTileAction, SIGNAL(activated()), myWorkspace, SLOT( tile() )));
@@ -819,7 +865,7 @@ void QAD_Desktop::createActions()
     /* 'Help' actions
      */
     /* contents */
-    QAction* helpContentsAction = new QAction( "", tr("MEN_DESK_HELP_CONTENTS"), 0, this );
+    QActionP* helpContentsAction = new QActionP( "", tr("MEN_DESK_HELP_CONTENTS"), Key_F1, this );
     helpContentsAction->setStatusTip ( tr("PRP_DESK_HELP_CONTENTS") );
     QAD_ASSERT(connect( helpContentsAction, SIGNAL(activated()),
                        this, SLOT( onHelpContents() )));
@@ -827,14 +873,14 @@ void QAD_Desktop::createActions()
     myStdActions.insert( HelpContentsId , helpContentsAction );
 
     /* search */
-//    QAction* helpSearchAction = new QAction( "", tr("MEN_DESK_HELP_SEARCH"), 0, this );
+//    QActionP* helpSearchAction = new QActionP( "", tr("MEN_DESK_HELP_SEARCH"), 0, this );
 //    helpSearchAction->setStatusTip ( tr("PRP_DESK_HELP_SEARCH") );
 //    QAD_ASSERT( connect( helpSearchAction, SIGNAL(activated()), this, SLOT( onHelpSearch() )));
 //    helpSearchAction->addTo( &myHelpPopup );
 //    myStdActions.insert( HelpSearchId, helpSearchAction );
 
     /* What's This */
-//    QAction* helpWhatsThisAction = new QAction( "", tr("MEN_DESK_HELP_WHATSTHIS"), SHIFT+Key_F1, this );
+//    QActionP* helpWhatsThisAction = new QActionP( "", tr("MEN_DESK_HELP_WHATSTHIS"), SHIFT+Key_F1, this );
 //    helpWhatsThisAction->setStatusTip ( tr("PRP_DESK_HELP_WHATSTHIS" ));
 //    QAD_ASSERT( connect( helpWhatsThisAction, SIGNAL(activated()), this, SLOT( whatsThis() )));
 //    helpWhatsThisAction->addTo( &myHelpPopup );
@@ -845,7 +891,7 @@ void QAD_Desktop::createActions()
     myHelpPos = myHelpPopup.indexOf( id );
 
     /* about */
-    QAction* helpAboutAction = new QAction( "", tr("MEN_DESK_HELP_ABOUT"), 0, this );
+    QActionP* helpAboutAction = new QActionP( "", tr("MEN_DESK_HELP_ABOUT"), 0, this );
     helpAboutAction->setStatusTip ( tr("PRP_DESK_HELP_ABOUT") );
     QAD_ASSERT( connect( helpAboutAction, SIGNAL(activated()), this, SLOT( onHelpAbout() )));
     helpAboutAction->addTo( &myHelpPopup );
@@ -898,7 +944,8 @@ void QAD_Desktop::closeDesktop( bool forceClose )
 void QAD_Desktop::putInfo ( const QString& msg )
 {
   if ( myStatusBar )
-    myStatusBar->message ( msg );
+    //NRI : bug 1209. message is now displayed during 3000 ms
+    myStatusBar->message ( msg, 3000 );
 }
 
 /*!
@@ -1117,6 +1164,23 @@ Engines::Component_var QAD_Desktop::getEngine(const char *containerName,
   return eng._retn();
 }
 
+QString QAD_Desktop::getComponentName(const char *componentUserName)
+{
+  if ( mapComponentName.contains(componentUserName) )
+    return mapComponentName[ componentUserName ] ;
+  else
+    return "";
+}
+
+QString QAD_Desktop::getComponentUserName(const char *componentName)
+{
+  QMap<QString,QString>::Iterator it;
+  for( it = mapComponentName.begin(); it != mapComponentName.end(); ++it )
+    if (it.data() == componentName )
+      return it.key();
+  return "";
+}
+
 /*!
   gets application Help Window (and creates if necessary)
 */
@@ -1124,6 +1188,37 @@ QAD_HelpWindow* QAD_Desktop::getHelpWindow()
 {
   if (!myHelpWindow) {
     myHelpWindow = new QAD_HelpWindow();  
+    
+    QMap<QString,QString>::Iterator it;
+    for( it = mapComponentName.begin(); it != mapComponentName.end(); ++it ) {
+      QCString dir;
+      QString root;
+      
+      // look for index.html and set homeDir
+      // 1. $(MODULE_ROOT_DIR)/doc/index.html
+      // 2. $(MODULE_ROOT_DIR)/doc/html/index.html
+      // 3. $(MODULE_ROOT_DIR)/doc/html/html/index.html
+
+      if (dir = getenv( QString( it.data() + "_ROOT_DIR")) ) {
+       root = QAD_Tools::addSlash( QAD_Tools::addSlash(dir) + QAD_Tools::addSlash("share")  + QAD_Tools::addSlash("salome")  + "doc" );
+       if ( QFileInfo( root + "index.html" ).exists() ) {
+         helpContext( root + "index.html", "" );
+       }
+       else {
+         root = QAD_Tools::addSlash( root + "html" );
+         if ( QFileInfo( root + "index.html" ).exists() ) {
+           helpContext( root + "index.html", "" );
+         }
+         else {
+           root = QAD_Tools::addSlash( root + "html" );
+           if ( QFileInfo( root + "index.html" ).exists() ) {
+             helpContext( root + "index.html", "" );
+           }
+         }
+       }
+      }
+    }
+    
     connect(myHelpWindow, SIGNAL(helpWindowClosed()), this, SLOT(onHelpWindowClosed()));
   }
   return myHelpWindow;
@@ -1325,6 +1420,40 @@ void QAD_Desktop::onLoadStudy()
   putInfo ( tr("INF_READY") );
 }
 
+
+
+QAD_Study* QAD_Desktop::loadStudy(QString theStudyName) {
+  QString studyname("");
+
+  CORBA::Object_var obj = myNameService->Resolve("/myStudyManager");
+  SALOMEDS::StudyManager_var myStudyMgr = SALOMEDS::StudyManager::_narrow(obj);
+  ASSERT(! CORBA::is_nil(myStudyMgr));
+
+  SALOMEDS::ListOfOpenStudies_var List = myStudyMgr->GetOpenStudies();
+  for (unsigned int ind = 0; ind < List->length();ind++) {
+    if (theStudyName == QString(List[ind])) {
+      studyname = theStudyName;
+      break;
+    }
+  }
+  if (studyname == "") {
+    return NULL;
+  }
+  bool appFound = false;
+  for ( QAD_Application* app = myApps.first(); app; app = myApps.next() ) {
+    appFound = true;
+    QAD_Study* openStudy = app->loadStudy( studyname );
+    if (openStudy) {
+      //      if (myActiveApp == 0)
+      //myActiveApp = app;
+      return openStudy;
+    }
+    break;
+  }
+  return NULL;
+}
+
+
 /*!
     Opens the existing study.
     Displays select file dialog and calls corresponding function of
@@ -1415,7 +1544,7 @@ void QAD_Desktop::onOpenStudy()
                                      tr("BUT_OK") );
            } else if (myActiveComp != "") {
              QApplication::setOverrideCursor( Qt::waitCursor );
-             loadComponentData(myActiveComp);
+             loadComponentData(mapComponentName[myActiveComp]);
              openStudy->updateObjBrowser(true);
              QApplication::restoreOverrideCursor();
            }
@@ -1436,14 +1565,14 @@ void QAD_Desktop::onOpenStudy()
 bool QAD_Desktop::loadComponentData( const QString& compName )
 {
   // Open component's data in active study if any
-  MESSAGE("loadComponentData(): Opening component data")
+  MESSAGE("loadComponentData(): Opening " << compName << " component data ")
   if (!myActiveStudy) {
     MESSAGE("loadComponentData(): No active study exists")
     return false;
   }
 
   Engines::Component_var comp ;
-  if ( compName.compare("Supervision") == 0 ) {
+  if ( compName.compare("SUPERV") == 0 ) {
     comp = getEngine( "SuperVisionContainer", compName) ;
   }
   else {
@@ -1456,7 +1585,7 @@ bool QAD_Desktop::loadComponentData( const QString& compName )
   }
 
   SALOMEDS::Study_var aStudy = myActiveStudy->getStudyDocument();
-  SALOMEDS::SComponent_var SCO = SALOMEDS::SComponent::_narrow(aStudy->FindObject(compName));
+  SALOMEDS::SComponent_var SCO = SALOMEDS::SComponent::_narrow(aStudy->FindObject( getComponentUserName(compName) ));
           
   if (!SCO->_is_nil()) {
     if (!CORBA::is_nil(comp)) {
@@ -1675,7 +1804,7 @@ void QAD_Desktop::onCascade()
   QWidgetListIt it(wList);
 
   for(;it.current(); ++it)
-      it.current()->resize(0.8*w, 0.8*h);
+      it.current()->resize((int)(0.8*w), (int)(0.8*h));
 }
 
 /*!
@@ -1730,7 +1859,7 @@ void QAD_Desktop::onToolBarPopupAboutToShow()
 */
 void QAD_Desktop::onSelectionMode()
 {
-  const QAction* obj = (QAction*) sender();
+  const QActionP* obj = (QActionP*) sender();
   
   int SelectionMode = 4;
 
@@ -1844,7 +1973,7 @@ void QAD_Desktop::onNewWindow3d()
     }
     //VRV: T2.5 - add default viewer
   */
-  const QAction* obj = (QAction*) sender();
+  const QActionP* obj = (QActionP*) sender();
   if ( obj == myStdActions.at(ViewOCCId) ) {
     myActiveApp->getActiveStudy()->newWindow3d(QString(""),(ViewType)(0));
   } else if ( obj == myStdActions.at(ViewVTKId) ) {
@@ -1946,6 +2075,12 @@ void QAD_Desktop::updateActions()
 //    myPrefPopup.setEnabled ( myActiveStudy != NULL );
 
     mySelectionModePopup.setEnabled ( myActiveStudy != NULL );
+
+    // VSR ==> SAL2982
+    myStdActions.at( ViewOCCId )->setEnabled( myActiveStudy != NULL );
+    myStdActions.at( ViewVTKId )->setEnabled( myActiveStudy != NULL );
+    myStdActions.at( ViewPlot2dId )->setEnabled( myActiveStudy != NULL );
+    // VSR <== SAL2982
 }
 
 /*!
@@ -2106,7 +2241,7 @@ void QAD_Desktop::onOpenWith()
     if (SCO->FindAttribute(anAttr, "AttributeName")) {
       aName = SALOMEDS::AttributeName::_narrow(anAttr);
       name = aName->Value();
-      SALOME_ModuleCatalog::Acomponent_var Comp = myCatalogue->GetComponent( name );
+      SALOME_ModuleCatalog::Acomponent_var Comp = myCatalogue->GetComponent( mapComponentName[name] );
       if ( !Comp->_is_nil() ) {
        
        SALOME_ModuleCatalog::ListOfComponents_var list_type_composants =
@@ -2158,6 +2293,7 @@ void QAD_Desktop::onOpenWith()
 }
 
 typedef bool OneDim1(QAD_Desktop*);
+typedef bool OneDim2(QAD_Desktop*, char*);
 
 /*!
   Called to define settings of component.
@@ -2166,10 +2302,18 @@ void QAD_Desktop::setSettings()
 {
   if (!myActiveComp.isEmpty()) {
     OSD_Function osdF = mySharedLibrary.DlSymb("SetSettings");
-    if ( osdF != NULL ) {
-      OneDim1 (*f1) = (bool (*) (QAD_Desktop*)) osdF;
-      (*f1)(this);
-    }
+    if ( osdF != NULL )
+      if (_islibso)
+       {
+         OneDim1 (*f1) = (bool (*) (QAD_Desktop*)) osdF;
+         (*f1)(this);
+       }
+      else
+       {
+         QString Component =mapComponentName[myActiveComp];
+         OneDim2 (*f1) = (bool (*) (QAD_Desktop*, char*)) osdF;
+         (*f1)(this, (char*)Component.latin1());
+       }
   }
 }
 
@@ -2184,7 +2328,7 @@ bool QAD_Desktop::loadComponent(QString Component)
   QAD_ResourceMgr* resMgr = QAD_Desktop::createResourceManager();
   if ( resMgr ) {
     QString msg;
-    if (!resMgr->loadResources( Component + "GUI", msg ))
+    if (!resMgr->loadResources( Component, msg ))
       {
        //NRI   QCString errMsg;
        //      errMsg.sprintf( "Do not load all resources for module %sGUI.\n" ,
@@ -2198,14 +2342,14 @@ bool QAD_Desktop::loadComponent(QString Component)
   /* Parse xml file */
   myXmlHandler = new QAD_XmlHandler();
   myXmlHandler->setMainWindow(this);
-  if (!myXmlHandler->setComponent(resMgr->resources(Component + "GUI"))) return false;
+  if (!myXmlHandler->setComponent(resMgr->resources( Component ))) return false;
 
-  QString language = resMgr->language( Component + "GUI" );
+  QString language = resMgr->language( Component );
 
   QString ComponentXml = Component + "_" + language + ".xml";
   //ComponentXml = resMgr->resources(Component + "GUI") ;
   //ComponentXml = QAD_Tools::addSlash(ComponentXml) ;
-  ComponentXml = QAD_Tools::addSlash( resMgr->findFile( ComponentXml, Component + "GUI" ) ) + ComponentXml;
+  ComponentXml = QAD_Tools::addSlash( resMgr->findFile( ComponentXml, Component ) ) + ComponentXml;
   QFile file( ComponentXml );
 
   if ( !file.exists() || !file.open( IO_ReadOnly ) )  {
@@ -2243,44 +2387,67 @@ bool QAD_Desktop::loadComponent(QString Component)
     nbToolbars = myActiveMenus->getToolBarList().count();
   /* Open Shared Library */
   mySharedLibrary = OSD_SharedLibrary();
+  _islibso = false;
 
   QString ComponentLib;
-  QCString dir;
+  QCString libs;
   QFileInfo fileInfo ;
-  bool found = false;
-  if ( dir = getenv("SALOME_SITE_DIR")) {
-    dir = QAD_Tools::addSlash(dir) ;
-    dir = dir + "lib" ;
-    dir = QAD_Tools::addSlash(dir) ;
+  QString fileString ;
+  QString dir;
+
+  if ( libs = getenv("LD_LIBRARY_PATH")) {
+    //    MESSAGE ( " LD_LIBRARY_PATH : " << libs );
+    QStringList dirList = QStringList::split( SEPARATOR, libs, false ); // skip empty entries
+    for ( int i = dirList.count()-1; i >= 0; i-- ) {
+      dir = dirList[ i ];
 #ifdef WNT
-    dir = dir + "lib" + Component.latin1() + "GUI.dll" ;
+      fileString = QAD_Tools::addSlash( dir ) + "lib" + Component + "GUI.dll" ;
 #else
-    dir = dir + "lib" + Component.latin1() + "GUI.so" ;
+      fileString = QAD_Tools::addSlash( dir ) + "lib" + Component + "GUI.so" ;
 #endif
-    MESSAGE ( " GUI library = " << dir )
-    fileInfo.setFile(dir) ;
-    if (fileInfo.exists()) {
-      ComponentLib = fileInfo.fileName() ;
-      found = true;
+    
+      fileInfo.setFile(fileString) ;
+      if (fileInfo.exists()) {
+       //      MESSAGE ( " GUI library = " << fileString );
+       ComponentLib = fileInfo.fileName() ;
+       _islibso = true;
+       break;
+      }
     }
   }
-  
-  if ( (dir = getenv("SALOME_ROOT_DIR")) && !found ) {
-    dir = QAD_Tools::addSlash(dir) ;
-    dir = dir + "lib" ;
-    dir = QAD_Tools::addSlash(dir) ;
+
+  if (!_islibso) // component GUI could be in PyQt, use generic library
+    {
+      MESSAGE("GUI library not found, trying generic library for PyQt GUI");
+      bool found = false;
+      if (dir = getenv("KERNEL_ROOT_DIR"))
+       {
+         dir = QAD_Tools::addSlash(dir) ;
+         dir = dir + "lib" ;
+         dir = QAD_Tools::addSlash(dir) ;
+         dir = dir + "salome" ;
+         dir = QAD_Tools::addSlash(dir) ;
 #ifdef WNT
-    dir = dir + "lib" + Component.latin1() + "GUI.dll" ;
+         dir = dir + "libSalomePyQtcmodule.dll" ;
 #else
-    dir = dir + "lib" + Component.latin1() + "GUI.so" ;
+         dir = dir + "libSalomePyQtcmodule.so" ;
 #endif
-    MESSAGE ( " GUI library = " << dir )
-    fileInfo.setFile(dir) ;
-    if (fileInfo.exists()) {
-      ComponentLib = fileInfo.fileName() ;
-      found = true;
+         MESSAGE ( " GUI library = " << dir );
+         fileInfo.setFile(dir) ;
+         if (fileInfo.exists())
+           {
+             ComponentLib = fileInfo.fileName() ;
+             found = true;
+           }
+       }
+      if ( !found )
+       {
+         QMessageBox::critical( this,
+                                tr("ERR_ERROR"),
+                                tr("ERR_LIBGUI" ).arg(Component) );
+         return false;
+       }
     }
-  }
 
   mySharedLibrary.SetName(TCollection_AsciiString((char*)ComponentLib.latin1()).ToCString());
   ok = mySharedLibrary.DlOpen(OSD_RTLD_LAZY);
@@ -2294,10 +2461,19 @@ bool QAD_Desktop::loadComponent(QString Component)
 
   /* SETTINGS */
   OSD_Function osdF = mySharedLibrary.DlSymb("SetSettings");
-  if ( osdF != NULL ) {
-    OneDim1 (*f1) = (bool (*) (QAD_Desktop*)) osdF;
-    (*f1)(this);
-  }
+  if ( osdF != NULL )
+    if (_islibso)
+      {
+       OneDim1 (*f1) = (bool (*) (QAD_Desktop*)) osdF;
+       (*f1)(this);
+      }
+    else
+      {
+       OneDim2 (*f1) = (bool (*) (QAD_Desktop*, char*)) osdF;
+       (*f1)(this, (char*)Component.latin1());
+      }
+
+  
 
   /* COMPONENT INTERFACE */
   SALOME_ModuleCatalog::Acomponent_ptr aComponent =
@@ -2309,7 +2485,7 @@ bool QAD_Desktop::loadComponent(QString Component)
   }
 
   myActiveStudy->setMessage(QString("Component : ") +
-                           aComponent->componentname() + " created " );
+                           aComponent->componentusername() + " created " );
   myActiveStudy->setMessage(QString("Type : ") +
                            QString::number(aComponent->component_type()));
   myActiveStudy->setMessage(QString("Constraint : ") +
@@ -2401,6 +2577,8 @@ void QAD_Desktop::onDispatchTools(int id)
       dir = QAD_Tools::addSlash(dir) ;
       dir = dir + "lib" ;
       dir = QAD_Tools::addSlash(dir) ;
+      dir = dir + "salome" ;
+      dir = QAD_Tools::addSlash(dir) ;
 #ifdef WNT
       dir = dir + "libToolsGUI.dll" ;
 #else
@@ -2418,6 +2596,27 @@ void QAD_Desktop::onDispatchTools(int id)
       dir = QAD_Tools::addSlash(dir) ;
       dir = dir + "lib" ;
       dir = QAD_Tools::addSlash(dir) ;
+      dir = dir + "salome" ;
+      dir = QAD_Tools::addSlash(dir) ;
+#ifdef WNT
+      dir = dir + "libToolsGUI.dll" ;
+#else
+      dir = dir + "libToolsGUI.so" ;
+#endif
+      MESSAGE ( " GUI library = " << dir );
+      fileInfo.setFile(dir) ;
+      if (fileInfo.exists()) {
+       ToolsLib = fileInfo.fileName() ;
+       found = true;
+      }
+    }
+    
+    if ( (dir = getenv("KERNEL_ROOT_DIR")) && !found ) {
+      dir = QAD_Tools::addSlash(dir) ;
+      dir = dir + "lib" ;
+      dir = QAD_Tools::addSlash(dir) ;
+      dir = dir + "salome" ;
+      dir = QAD_Tools::addSlash(dir) ;
 #ifdef WNT
       dir = dir + "libToolsGUI.dll" ;
 #else
@@ -2438,6 +2637,8 @@ void QAD_Desktop::onDispatchTools(int id)
       dir = QAD_Tools::addSlash(dir) ;
       dir = dir + "lib" ;
       dir = QAD_Tools::addSlash(dir) ;
+      dir = dir + "salome" ;
+      dir = QAD_Tools::addSlash(dir) ;
       dir = dir + QAD_XmlHandler::_bibmap[ id ].latin1() ;
       MESSAGE ( " GUI library = " << dir );
       fileInfo.setFile(dir) ;
@@ -2451,6 +2652,23 @@ void QAD_Desktop::onDispatchTools(int id)
       dir = QAD_Tools::addSlash(dir) ;
       dir = dir + "lib" ;
       dir = QAD_Tools::addSlash(dir) ;
+      dir = dir + "salome" ;
+      dir = QAD_Tools::addSlash(dir) ;
+      dir = dir + QAD_XmlHandler::_bibmap[ id ].latin1() ;
+      MESSAGE ( " GUI library = " << dir );
+      fileInfo.setFile(dir) ;
+      if (fileInfo.exists()) {
+       ToolsLib = fileInfo.fileName() ;
+       found = true;
+      }
+    }
+    
+    if ( (dir = getenv("KERNEL_ROOT_DIR")) && !found ) {
+      dir = QAD_Tools::addSlash(dir) ;
+      dir = dir + "lib" ;
+      dir = QAD_Tools::addSlash(dir) ;
+      dir = dir + "salome" ;
+      dir = QAD_Tools::addSlash(dir) ;
       dir = dir + QAD_XmlHandler::_bibmap[ id ].latin1() ;
       MESSAGE ( " GUI library = " << dir );
       fileInfo.setFile(dir) ;
@@ -2519,7 +2737,8 @@ void QAD_Desktop::onComboActiveComponent( const QString & component, bool isLoad
       if (!myXmlHandler->myIdList.IsEmpty()) clearMenus();
       if ( myCombo->currentText() != component )
        myCombo->setCurrentText( component );
-      if (component.compare(QString("Salome"))!= 0) {
+      //NRI if (component.compare(QString("Salome"))!= 0) {
+      if (component.compare( getComponentUserName( "KERNEL" ) )!= 0) {
 //     QApplication::setOverrideCursor( Qt::waitCursor );
        myActiveComp = component;
 
@@ -2533,7 +2752,7 @@ void QAD_Desktop::onComboActiveComponent( const QString & component, bool isLoad
        }
 
        myActiveStudy->Selection( component );
-       if ( !loadComponent(component) ) {
+       if ( !loadComponent(mapComponentName[component]) ) {
          myCombo->setCurrentItem (0);
          for ( QToolButton* aButton=myComponentButton.first(); aButton; aButton=myComponentButton.next() ) {
            aButton->setOn(false);
@@ -2554,7 +2773,7 @@ void QAD_Desktop::onComboActiveComponent( const QString & component, bool isLoad
        }
 
        // Open new component's data in active study if any
-       if(isLoadData) loadComponentData(component);
+       if(isLoadData) loadComponentData(mapComponentName[component]);
 
        oldSel->Clear();
        myActiveStudy->updateObjBrowser(true);
@@ -2563,7 +2782,8 @@ void QAD_Desktop::onComboActiveComponent( const QString & component, bool isLoad
 
       } else {  // component == "Salome"
        myActiveComp = "";
-       myActiveStudy->Selection( "Salome" );
+       //NRI   myActiveStudy->Selection( "Salome" );
+       myActiveStudy->Selection( getComponentUserName( "KERNEL" ) );
        SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
        Sel->ClearIObjects();
        for ( QToolButton* aButton=myComponentButton.first(); aButton; aButton=myComponentButton.next() ) {
@@ -2924,7 +3144,7 @@ void QAD_Desktop::onViewerTrihedron()
       for ( QAD_Study* study = studies.first(); study; study = studies.next() )  {
        int nbSf = study->getStudyFramesCount();
        for ( int i = 0; i < nbSf; i++ ) {
-         study->getStudyFrame(i)->getRightFrame()->getViewFrame()->SetTrihedronSize(dim);
+         study->getStudyFrame(i)->getRightFrame()->getViewFrame()->SetTrihedronSize((int)dim);
        }
       }
     }
@@ -2974,7 +3194,7 @@ void QAD_Desktop::onSavePref()
 }
 
 //VRV: T2.5 - add default viewer
-void QAD_Desktop::onDefaultViewer(QAction * theAction)
+void QAD_Desktop::onDefaultViewer(QActionP * theAction)
 {
   int type = VIEW_TYPE_MAX;
   
@@ -3154,7 +3374,31 @@ void QAD_Desktop::helpSearch()
 /* Help Contents */
 void QAD_Desktop::helpContents()
 {
-  getHelpWindow()->contents();
+  if (myActiveComp == "")
+    myActiveComp = getComponentUserName( "KERNEL" ); //NRI "Salome";
+
+  QCString dir;
+  QString root;
+  if (dir = getenv( getComponentName( myActiveComp ) + "_ROOT_DIR")) {
+    root = QAD_Tools::addSlash( QAD_Tools::addSlash(dir) + QAD_Tools::addSlash("share")  + QAD_Tools::addSlash("salome")  + "doc" );
+    if ( QFileInfo( root + "index.html" ).exists() ) {
+      helpContext( root + "index.html", "" );
+    }
+    else {
+      root = QAD_Tools::addSlash( root + "html" );
+      if ( QFileInfo( root + "index.html" ).exists() ) {
+       helpContext( root + "index.html", "" );
+      }
+      else {
+       root = QAD_Tools::addSlash( root + "html" );
+       if ( QFileInfo( root + "index.html" ).exists() ) {
+         helpContext( root + "index.html", "" );
+       }
+      }
+    }
+  }
+  
+  //NRI getHelpWindow()->contents();
   getHelpWindow()->show();
   getHelpWindow()->raise();
   getHelpWindow()->setActiveWindow();
@@ -3178,6 +3422,15 @@ void QAD_Desktop::onMultiFileSave()
     QAD_CONFIG->addSetting( "Desktop:MultiFileSave", "false");
 }
 
+/* Preferences/ASCII Save */
+void QAD_Desktop::onASCIISave()
+{
+  if ( myStdActions.at( PrefASCIISave )->isOn() )
+    QAD_CONFIG->addSetting( "Desktop:ASCIISave", "true");
+  else
+    QAD_CONFIG->addSetting( "Desktop:ASCIISave", "false");
+}
+
 /*********************************************************************
 ** Class: AppSelectionDlg
 ** Descr: Dialog for the selection of the application when several