#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"));
+ myTitle = translate(theData->getProperty("title"));
myType = (theData->getProperty("type") == "save") ? WFS_SAVE : WFS_OPEN;
myDefaultPath = QString::fromStdString(theData->getProperty("path"));
{
}
-bool ModuleBase_WidgetFileSelector::storeValueCustom() const
+bool ModuleBase_WidgetFileSelector::storeValueCustom()
{
- // A rare case when plugin was not loaded.
+ // A rare case when plugin was not loaded.
if (!myFeature)
return false;
DataPtr aData = myFeature->data();
return true;
}
-bool ModuleBase_WidgetFileSelector::restoreValue()
+bool ModuleBase_WidgetFileSelector::restoreValueCustom()
{
- // A rare case when plugin was not loaded.
+ // A rare case when plugin was not loaded.
if (!myFeature)
return false;
DataPtr aData = myFeature->data();
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;
if (myType == WFS_SAVE)
aFileName = applyExtension(aFileName, mySelectedFilter);
myPathField->setText(aFileName);
+ emit focusOutWidget(this);
}
}
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);