Merge pull request #5741 from Lili1228/master
Manager: Allow whitespace and some special characters in machine crea…
This commit is contained in:
@@ -210,7 +210,13 @@ NameAndLocationPage(QWidget *parent)
|
|||||||
{
|
{
|
||||||
setTitle(tr("System name and location"));
|
setTitle(tr("System name and location"));
|
||||||
|
|
||||||
dirValidate = QRegularExpression(R"(^[^\\/:*?"<>|\s]+$)");
|
#if defined(_WIN32)
|
||||||
|
dirValidate = QRegularExpression(R"(^[^\\/:*?"<>|]+$)");
|
||||||
|
#elif defined(__APPLE__)
|
||||||
|
dirValidate = QRegularExpression(R"(^[^/:]+$)");
|
||||||
|
#else
|
||||||
|
dirValidate = QRegularExpression(R"(^[^/]+$)");
|
||||||
|
#endif
|
||||||
|
|
||||||
const auto topLabel = new QLabel(tr("Enter the name of the system and choose the location"));
|
const auto topLabel = new QLabel(tr("Enter the name of the system and choose the location"));
|
||||||
topLabel->setWordWrap(true);
|
topLabel->setWordWrap(true);
|
||||||
@@ -282,7 +288,7 @@ NameAndLocationPage::isComplete() const
|
|||||||
if (systemName->text().isEmpty()) {
|
if (systemName->text().isEmpty()) {
|
||||||
systemNameValidation->setText(tr("Please enter a system name"));
|
systemNameValidation->setText(tr("Please enter a system name"));
|
||||||
} else if (!systemName->text().contains(dirValidate)) {
|
} else if (!systemName->text().contains(dirValidate)) {
|
||||||
systemNameValidation->setText(tr("System name cannot contain a space or certain characters"));
|
systemNameValidation->setText(tr("System name cannot contain certain characters"));
|
||||||
} else if (const QDir newDir = QDir::cleanPath(systemLocation->text() + "/" + systemName->text()); newDir.exists()) {
|
} else if (const QDir newDir = QDir::cleanPath(systemLocation->text() + "/" + systemName->text()); newDir.exists()) {
|
||||||
systemNameValidation->setText(tr("System name already exists"));
|
systemNameValidation->setText(tr("System name already exists"));
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user