Salome HOME
Join modifications from branch OCC_debug_for_3_2_0b1
[modules/visu.git] / src / VISUGUI / VisuGUI_VectorsDlg.cxx
index a5e2f2c590ea8845052d11f462a26f65b4c0c067..e16e94bc2aa9dff6477fb6a3cca0b557db986750 100644 (file)
 #include "VisuGUI_Tools.h"
 
 #include "VISU_Vectors_i.hh"
-
+#include "LightApp_Application.h"
 #include "SalomeApp_Module.h"
+
 #include "SUIT_Desktop.h"
+#include "SUIT_MessageBox.h"
+#include "SUIT_ResourceMgr.h"
+#include "SUIT_Session.h"
 
 #include <qlayout.h>
 #include <qcolordialog.h>
@@ -162,6 +166,9 @@ VisuGUI_VectorsDlg::VisuGUI_VectorsDlg (SalomeApp_Module* theModule)
   buttonCancel = new QPushButton( tr( "&Cancel" ) , GroupButtons, "buttonCancel" );
   buttonCancel->setAutoDefault( TRUE );
   GroupButtonsLayout->addWidget( buttonCancel, 0, 2 );
+  buttonHelp = new QPushButton( tr( "&Help" ) , GroupButtons, "buttonHelp" );
+  buttonHelp->setAutoDefault( TRUE );
+  GroupButtonsLayout->addWidget( buttonHelp, 0, 3 );
 
   // top layout
   aTabBox->addTab(aBox, "Vectors");
@@ -178,6 +185,7 @@ VisuGUI_VectorsDlg::VisuGUI_VectorsDlg (SalomeApp_Module* theModule)
   connect( UseMagn,      SIGNAL( clicked() ), this, SLOT( enableSetColor() ) );
   connect( buttonOk,     SIGNAL( clicked() ), this, SLOT( accept() ) );
   connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
+  connect( buttonHelp,   SIGNAL( clicked() ), this, SLOT( onHelp() ) );
   
   // default values
   UseMagn->setChecked( TRUE );
@@ -420,3 +428,19 @@ void VisuGUI_VectorsDlg::reject()
   myScalarPane->deletePreview();
   QDialog::reject();
 }
+
+void VisuGUI_VectorsDlg::onHelp()
+{
+  QString aHelpFileName = "/files/vectors_presentation.htm";
+  LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
+  if (app) {
+    VisuGUI* aVisuGUI = dynamic_cast<VisuGUI*>( app->activeModule() );
+    app->onHelpContextModule(aVisuGUI ? app->moduleName(aVisuGUI->moduleName()) : QString(""), aHelpFileName);
+  }
+  else {
+    SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"),
+                          QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
+                          arg(app->resourceMgr()->stringValue("ExternalBrowser", "application")).arg(aHelpFileName),
+                          QObject::tr("BUT_OK"));
+  }
+}