Salome HOME
#1658 New widget supporting nested option buttons
[modules/shaper.git] / src / ModuleBase / ModuleBase_WidgetFileSelector.cpp
index ee47d10c944c7cdcb58992f9c0617337fbb0b3d3..be91840732b4aaaea150a6ec468399a73ddff41c 100644 (file)
@@ -31,9 +31,8 @@
 #include <string>
 
 ModuleBase_WidgetFileSelector::ModuleBase_WidgetFileSelector(QWidget* theParent,
-                                                             const Config_WidgetAPI* theData,
-                                                             const std::string& theParentId)
-    : ModuleBase_ModelWidget(theParent, theData, theParentId)
+                                                             const Config_WidgetAPI* theData)
+: ModuleBase_ModelWidget(theParent, theData)
 {
   myTitle = QString::fromStdString(theData->getProperty("title"));
   myType = (theData->getProperty("type") == "save") ? WFS_SAVE : WFS_OPEN;
@@ -66,7 +65,7 @@ ModuleBase_WidgetFileSelector::~ModuleBase_WidgetFileSelector()
 {
 }
 
-bool ModuleBase_WidgetFileSelector::storeValueCustom() const
+bool ModuleBase_WidgetFileSelector::storeValueCustom()
 {
   // A rare case when plugin was not loaded. 
   if (!myFeature)
@@ -79,7 +78,7 @@ bool ModuleBase_WidgetFileSelector::storeValueCustom() const
   return true;
 }
 
-bool ModuleBase_WidgetFileSelector::restoreValue()
+bool ModuleBase_WidgetFileSelector::restoreValueCustom()
 {
   // A rare case when plugin was not loaded. 
   if (!myFeature)
@@ -88,7 +87,9 @@ bool ModuleBase_WidgetFileSelector::restoreValue()
   AttributeStringPtr aStringAttr = aData->string(attributeID());
 
   bool isBlocked = myPathField->blockSignals(true);
-  myPathField->setText(QString::fromStdString(aStringAttr->value()));
+  QString aNewText = QString::fromStdString(aStringAttr->value());
+  if( myPathField->text() != aNewText )
+    myPathField->setText( aNewText );
   myPathField->blockSignals(isBlocked);
 
   return true;
@@ -120,6 +121,7 @@ void ModuleBase_WidgetFileSelector::onPathSelectionBtn()
     if (myType == WFS_SAVE)
       aFileName = applyExtension(aFileName, mySelectedFilter);
     myPathField->setText(aFileName);
+    emit focusOutWidget(this);
   }
 }
 
@@ -162,12 +164,11 @@ QStringList ModuleBase_WidgetFileSelector::getValidatorFormats() const
   SessionPtr aMgr = ModelAPI_Session::get();
   ModelAPI_ValidatorsFactory* aFactory = aMgr->validators();
 
-  std::list<ModelAPI_Validator*> allValidators;
-  std::list<std::list<std::string> > allArguments;
-  aFactory->validators(myFeature->getKind(), myAttributeID, allValidators, allArguments);
+  ModelAPI_ValidatorsFactory::Validators allValidators;
+  aFactory->validators(myFeature->getKind(), myAttributeID, allValidators);
 
   QStringList aResult;
-  std::list<std::string> anArgumentList = allArguments.front();
+  std::list<std::string> anArgumentList = allValidators.front().second;
   std::list<std::string>::const_iterator it = anArgumentList.begin();
   for (; it != anArgumentList.end(); ++it) {
     QString aFormat = QString::fromStdString(*it);