From b5e930cabe6145b402a7e893b3fb5ec98b970764 Mon Sep 17 00:00:00 2001 From: Jay Rainey Date: Thu, 13 Mar 2014 12:15:19 +0000 Subject: [PATCH] Validate dataSelector. Refs #8938. - Although there is a dataSelector specific validator class (`UserInputValidator`), it is not possible to access it from `MantidQtCustomDialogs`. --- .../inc/MantidQtCustomDialogs/CatalogPublishDialog.h | 4 ++++ .../CustomDialogs/src/CatalogPublishDialog.cpp | 12 ++++++++++++ 2 files changed, 16 insertions(+) diff --git a/Code/Mantid/MantidQt/CustomDialogs/inc/MantidQtCustomDialogs/CatalogPublishDialog.h b/Code/Mantid/MantidQt/CustomDialogs/inc/MantidQtCustomDialogs/CatalogPublishDialog.h index b9f130c26f5f..f40e2a317e68 100644 --- a/Code/Mantid/MantidQt/CustomDialogs/inc/MantidQtCustomDialogs/CatalogPublishDialog.h +++ b/Code/Mantid/MantidQt/CustomDialogs/inc/MantidQtCustomDialogs/CatalogPublishDialog.h @@ -53,6 +53,10 @@ namespace MantidQt /// Set the "FileName" property when a file is selected from the file browser. void fileSelected(); + protected: + /// Overridden to enable dataselector validators + void accept(); + protected: /// The form generated by QT Designer. Ui::CatalogPublishDialog m_uiForm; diff --git a/Code/Mantid/MantidQt/CustomDialogs/src/CatalogPublishDialog.cpp b/Code/Mantid/MantidQt/CustomDialogs/src/CatalogPublishDialog.cpp index 863bcafccf9a..9c14282c891a 100644 --- a/Code/Mantid/MantidQt/CustomDialogs/src/CatalogPublishDialog.cpp +++ b/Code/Mantid/MantidQt/CustomDialogs/src/CatalogPublishDialog.cpp @@ -110,5 +110,17 @@ namespace MantidQt setPropertyValue("FileName", true); } + /** + * Overridden to enable dataselector validators. + */ + void CatalogPublishDialog::accept() + { + if (!m_uiForm.dataSelector->isValid()) + { + QMessageBox::critical(this,"Error in catalog publishing.",m_uiForm.dataSelector->getProblem()); + return; + } + AlgorithmDialog::accept(); + } } }