Salome HOME
Merge branch 'BR_1328' into BR_DEMO
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_ExportSinusXOp.cxx
index ef17ecdbbf53e91b8af34fce987920effd26e454..6d33a7b7c4a3e90e0c3a236fc257b50345325137 100644 (file)
 #include <HYDROData_Profile.h>
 #include <HYDROData_Entity.h>
 #include <HYDROGUI_ObjListBox.h>
-#include <QMessageBox>
+#include <HYDROGUI_Operation.h>
+#include "HYDROGUI_Module.h"
+#include <HYDROData_SinusX.h>
 
+#include <SUIT_FileDlg.h>
+#include <SUIT_MessageBox.h>
+#include <SUIT_Desktop.h>
+
+#include <LightApp_Application.h>
+#include <QApplication>
 
 HYDROGUI_ExportSinusXOp::HYDROGUI_ExportSinusXOp( HYDROGUI_Module* theModule )
 : HYDROGUI_Operation( theModule )
@@ -57,8 +65,17 @@ HYDROGUI_InputPanel* HYDROGUI_ExportSinusXOp::createInputPanel() const
 
 void HYDROGUI_ExportSinusXOp::onExportItems()
 {
+  QString aFilter( tr("SINUSX_FILTER") ); 
   HYDROGUI_ExportSinusXDlg* aPanel = ::qobject_cast<HYDROGUI_ExportSinusXDlg*>( inputPanel() );
   if ( !aPanel )
     return;
-  int T = aPanel->GetSelectedEntities().Size();
+  if (!aPanel->GetSelectedEntities().IsEmpty())
+  {
+    //Export selected items to SX file
+    QString aFileName = SUIT_FileDlg::getFileName( module()->getApp()->desktop(), "", aFilter, tr( "EXPORT_SINUSX" ), false );
+    HYDROData_SinusX anExporter;
+    anExporter.Export(aFileName, aPanel->GetSelectedEntities());
+  }
+  else
+    SUIT_MessageBox::warning(module()->getApp()->desktop(), tr( "EXPORT_SINUSX" ), tr( "NO_ENTITIES_TO_EXPORT"));
 }