Salome HOME
bos #30440 [CEA 30439] new salome doesn't clean paraview view in FIELDS
[modules/med.git] / src / MEDCalc / gui / DatasourceController.cxx
index acfc18c719bafec5894ccea5a9e7e103bdc2030f..8f9ac3a779d36a93cdb1cd2310a0a1e966a8a870 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2020  CEA/DEN, EDF R&D
+// Copyright (C) 2007-2022  CEA/DEN, EDF R&D
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -75,7 +75,8 @@ void DatasourceController::createActions() {
   QString tooltip = tr("TIP_ADD_DATA_SOURCE");
   QString icon    = tr("ICO_DATASOURCE_ADD");
   int actionId;
-  actionId = _salomeModule->createStandardAction(label,this, SLOT(OnAddDatasource()),icon,tooltip);
+  actionId = _salomeModule->createStandardAction(label, this, SLOT(OnAddDatasource()),
+                                                 icon, tooltip, FIELDSOp::OpAddDataSource);
   _salomeModule->createTool(actionId, toolbarId);
 
   // This action has to be placed in the general file menu with the label "Import MED file"
@@ -233,7 +234,7 @@ void DatasourceController::OnExpandField()
 
   // Get the selected objects in the study (SObject)
   SALOME_StudyEditor::SObjectList* listOfSObject = _studyEditor->getSelectedObjects();
-  for (int i=0; i<listOfSObject->size(); i++) {
+  for (int i=0; i<(int)listOfSObject->size(); i++) {
     SALOMEDS::SObject_var soFieldseries = listOfSObject->at(i);
     std::string name(_studyEditor->getName(soFieldseries));
     if (soFieldseries->_is_nil() || name == "MEDCalc")
@@ -242,11 +243,11 @@ void DatasourceController::OnExpandField()
     // First retrieve the fieldseries id associated to this study object
     SALOMEDS::GenericAttribute_var anAttr;
     SALOMEDS::AttributeParameter_var aParam;
-    if ( soFieldseries->FindAttribute(anAttr,"AttributeParameter") ) {
-      aParam = SALOMEDS::AttributeParameter::_narrow(anAttr);
-      if (! aParam->IsSet(FIELD_SERIES_ID, PT_INTEGER))
-        return;
-    }
+    if ( !soFieldseries->FindAttribute(anAttr,"AttributeParameter") )
+      return;
+    aParam = SALOMEDS::AttributeParameter::_narrow(anAttr);
+    if (! aParam->IsSet(FIELD_SERIES_ID, PT_INTEGER))
+      return;
     long fieldseriesId = aParam->GetInt(FIELD_SERIES_ID);
     STDLOG("Expand the field timeseries "<<fieldseriesId);
 
@@ -296,11 +297,11 @@ void DatasourceController::OnUseInWorkspace() {
       return;
     SALOMEDS::GenericAttribute_var anAttr;
     SALOMEDS::AttributeParameter_var aParam;
-    if ( soField->FindAttribute(anAttr,"AttributeParameter") ) {
-      aParam = SALOMEDS::AttributeParameter::_narrow(anAttr);
-      if (! aParam->IsSet(IS_IN_WORKSPACE, PT_BOOLEAN))
-        return;
-    }
+    if ( !soField->FindAttribute(anAttr,"AttributeParameter") )
+      return;
+    aParam = SALOMEDS::AttributeParameter::_narrow(anAttr);
+    if (! aParam->IsSet(IS_IN_WORKSPACE, PT_BOOLEAN))
+      return;
     bool isInWorkspace = aParam->GetBool(IS_IN_WORKSPACE);
     if ( isInWorkspace ) {
       QMessageBox::warning(_salomeModule->getApp()->desktop(),
@@ -359,17 +360,17 @@ void DatasourceController::OnUseInWorkspace() {
   else {
     // In this case, we don't ask the user to specify an alias for
     // each item, we just import the whole set of items.
-    for (int i=0; i<listOfSObject->size(); i++) {
+    for (int i=0; i<(int)listOfSObject->size(); i++) {
       SALOMEDS::SObject_var soField = listOfSObject->at(i);
       if (soField->_is_nil())
         continue;
       SALOMEDS::GenericAttribute_var anAttr;
       SALOMEDS::AttributeParameter_var aParam;
-      if ( soField->FindAttribute(anAttr,"AttributeParameter") ) {
-        aParam = SALOMEDS::AttributeParameter::_narrow(anAttr);
-        if (! aParam->IsSet(IS_IN_WORKSPACE, PT_BOOLEAN))
-          return;
-      }
+      if ( !soField->FindAttribute(anAttr,"AttributeParameter") )
+        return;
+      aParam = SALOMEDS::AttributeParameter::_narrow(anAttr);
+      if (! aParam->IsSet(IS_IN_WORKSPACE, PT_BOOLEAN))
+        return;
       bool isInWorkspace = aParam->GetBool(IS_IN_WORKSPACE);
       if ( !isInWorkspace ) {
         if (! aParam->IsSet(FIELD_ID, PT_INTEGER))