Salome HOME
Join modifications from branch BR_DEBUG_3_2_0b1
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_FilterLibraryDlg.cxx
index c4ca04c3700328f0dc7709faa31141c1a512fa02..a131436a92f11e5bdb75f40e98ce168b60a6ec7b 100644 (file)
@@ -17,7 +17,7 @@
 //  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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 //
 //
@@ -34,6 +34,9 @@
 #include "SUIT_Session.h"
 #include "SUIT_Desktop.h"
 #include "SUIT_FileDlg.h"
+#include "SUIT_MessageBox.h"
+
+#include "LightApp_Application.h"
 
 // QT Includes
 #include <qapplication.h>
@@ -95,11 +98,11 @@ bool SMESHGUI_FilterLibraryDlg::Dialog::acceptData()
 // Purpose : Constructor
 //=======================================================================
 SMESHGUI_FilterLibraryDlg::SMESHGUI_FilterLibraryDlg (SMESHGUI* theModule,
-                                                     QWidget* parent,
+                                                      QWidget* parent,
                                                       const QValueList<int>& theTypes,
                                                       const int              theMode,
                                                       const char*            theName)
-     : QDialog( parent, theName, true, WStyle_Customize |
+     : QDialog( parent, theName, false, WStyle_Customize |
                 WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ),
      mySMESHGUI( theModule )
 {
@@ -111,7 +114,7 @@ SMESHGUI_FilterLibraryDlg::SMESHGUI_FilterLibraryDlg (SMESHGUI* theModule,
 // Purpose : Constructor
 //=======================================================================
 SMESHGUI_FilterLibraryDlg::SMESHGUI_FilterLibraryDlg (SMESHGUI* theModule,
-                                                     QWidget* parent,
+                                                      QWidget* parent,
                                                       const int   theType,
                                                       const int   theMode,
                                                       const char* theName)
@@ -144,6 +147,8 @@ void SMESHGUI_FilterLibraryDlg::construct (const QValueList<int>& theTypes,
 
   aDlgLay->setStretchFactor(myMainFrame, 1);
 
+  myHelpFileName = "selection_filter_library.htm";
+  
   Init(myTypes, myMode);
 }
 
@@ -244,11 +249,13 @@ QFrame* SMESHGUI_FilterLibraryDlg::createButtonFrame (QWidget* theParent)
 
   myButtons[ BTN_Cancel ] = new QPushButton(tr("SMESH_BUT_CANCEL"), aGrp);
   myButtons[ BTN_Close  ] = new QPushButton(tr("SMESH_BUT_CLOSE"), aGrp);
+  myButtons[ BTN_Help  ] = new QPushButton(tr("SMESH_BUT_HELP"), aGrp);
 
   connect(myButtons[ BTN_OK     ], SIGNAL(clicked()), SLOT(onOk()));
   connect(myButtons[ BTN_Cancel ], SIGNAL(clicked()), SLOT(onClose()));
   connect(myButtons[ BTN_Close  ], SIGNAL(clicked()), SLOT(onClose()));
   connect(myButtons[ BTN_Apply  ], SIGNAL(clicked()), SLOT(onApply()));
+  connect(myButtons[ BTN_Help   ], SIGNAL(clicked()), SLOT(onHelp()));
 
   QMap<int, QPushButton*>::iterator anIter;
   for (anIter = myButtons.begin(); anIter != myButtons.end(); ++anIter)
@@ -343,10 +350,6 @@ void SMESHGUI_FilterLibraryDlg::Init (const QValueList<int>& theTypes,
       myListBox->setCurrentItem(0);
   }
 
-  int x, y;
-  mySMESHGUI->DefineDlgPosition(this, x, y);
-  this->move(x, y);
-
   this->show();
 
   updateMainButtons();
@@ -465,6 +468,23 @@ void SMESHGUI_FilterLibraryDlg::onClose()
   reject();
 }
 
+//=================================================================================
+// function : onHelp()
+// purpose  :
+//=================================================================================
+void SMESHGUI_FilterLibraryDlg::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"));
+  }
+}
+
 //=======================================================================
 // name    : SMESHGUI_FilterLibraryDlg::onDeactivate
 // Purpose : SLOT called when dialog must be deativated
@@ -848,7 +868,6 @@ void SMESHGUI_FilterLibraryDlg::enableMainButtons()
 SMESH::Filter_ptr SMESHGUI_FilterLibraryDlg::createFilter(const int theType)
 {
   int n = myTable->NumRows(theType);
-  n = 0;
 
   SMESH::Filter::Criteria_var aCriteria = new SMESH::Filter::Criteria;
   aCriteria->length(n);
@@ -1041,7 +1060,7 @@ void SMESHGUI_FilterLibraryDlg::onDeleteBtnPressed()
                              tr("ERROR_OF_DELETING"), QMessageBox::Ok);
   } else {
     myCurrFilterName = "";
-    myCurrFilterName = -1;
+    myCurrFilter = -1;
     myListBox->removeItem(anIndex);
 
     if (anIndex >= 1)