Salome HOME
Join modifications from branch OCC_debug_for_3_2_0b1
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_SingleEditDlg.cxx
index 3cf3f2b2f7b0b5294efbd74ce52e208bb236f7c7..26760c33357a8fc8c26882e3648ef130d161903b 100755 (executable)
 #include "SMDS_Mesh.hxx"
 
 #include "LightApp_SelectionMgr.h"
+#include "LightApp_Application.h"
 #include "SUIT_ResourceMgr.h"
 #include "SUIT_MessageBox.h"
 #include "SUIT_Desktop.h"
+#include "SUIT_Session.h"
 
 #include "SVTK_Selector.h"
 #include "SVTK_ViewWindow.h"
@@ -158,6 +160,7 @@ QFrame* SMESHGUI_SingleEditDlg::createButtonFrame (QWidget* theParent)
   myOkBtn     = new QPushButton(tr("SMESH_BUT_OK"   ), aFrame);
   myApplyBtn  = new QPushButton(tr("SMESH_BUT_APPLY"), aFrame);
   myCloseBtn  = new QPushButton(tr("SMESH_BUT_CLOSE"), aFrame);
+  myHelpBtn   = new QPushButton (tr("SMESH_BUT_HELP"), aFrame);
 
   QSpacerItem* aSpacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum);
 
@@ -167,6 +170,7 @@ QFrame* SMESHGUI_SingleEditDlg::createButtonFrame (QWidget* theParent)
   aLay->addWidget(myApplyBtn);
   aLay->addItem(aSpacer);
   aLay->addWidget(myCloseBtn);
+  aLay->addWidget(myHelpBtn);
 
   return aFrame;
 }
@@ -222,6 +226,7 @@ void SMESHGUI_SingleEditDlg::Init()
   connect(myOkBtn,    SIGNAL(clicked()), SLOT(onOk()));
   connect(myCloseBtn, SIGNAL(clicked()), SLOT(onClose()));
   connect(myApplyBtn, SIGNAL(clicked()), SLOT(onApply()));
+  connect(myHelpBtn,  SIGNAL(clicked()), SLOT(onHelp()));
 
   // selection and SMESHGUI
   connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), SLOT(onSelectionDone()));
@@ -268,6 +273,23 @@ void SMESHGUI_SingleEditDlg::onClose()
   reject();
 }
 
+//=================================================================================
+// function : onHelp()
+// purpose  :
+//=================================================================================
+void SMESHGUI_SingleEditDlg::onHelp()
+{
+  LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
+  if (app) 
+    app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName);
+  else {
+    SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"),
+                          QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
+                          arg(app->resourceMgr()->stringValue("ExternalBrowser", "application")).arg(myHelpFileName),
+                          QObject::tr("BUT_OK"));
+  }
+}
+
 //=======================================================================
 //function : findTriangles()
 //purpose  : find triangles sharing theNode1-theNode2 link
@@ -525,6 +547,7 @@ SMESHGUI_TrianglesInversionDlg
 : SMESHGUI_SingleEditDlg(theModule,theName)
 {
   setCaption(tr("CAPTION"));
+  myHelpFileName = "/files/diagonal_iversion_of_elements.htm";
 }
 
 SMESHGUI_TrianglesInversionDlg::~SMESHGUI_TrianglesInversionDlg()
@@ -549,6 +572,7 @@ SMESHGUI_UnionOfTwoTrianglesDlg
 : SMESHGUI_SingleEditDlg(theModule,theName)
 {
   setCaption(tr("CAPTION"));
+  myHelpFileName = "/files/uniting_two_triangles.htm";
 }
 
 SMESHGUI_UnionOfTwoTrianglesDlg::~SMESHGUI_UnionOfTwoTrianglesDlg()