forked from qt-creator/qt-creator
Wizards: Fix error message if project name is empty
It showed "The project already exists" instead of "Name is empty".
Probably broke with 8d1a592d16
Fixes: QTCREATORBUG-25398
Change-Id: I0cbe5753d80bc30c93408886668e39278d99c97f
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
@@ -165,16 +165,15 @@ bool ProjectIntroPage::validate()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Name valid? Ignore 'DisplayingPlaceholderText' state.
|
// Name valid?
|
||||||
bool nameValid = false;
|
|
||||||
switch (d->m_ui.nameLineEdit->state()) {
|
switch (d->m_ui.nameLineEdit->state()) {
|
||||||
case FancyLineEdit::Invalid:
|
case FancyLineEdit::Invalid:
|
||||||
displayStatusMessage(InfoLabel::Error, d->m_ui.nameLineEdit->errorMessage());
|
displayStatusMessage(InfoLabel::Error, d->m_ui.nameLineEdit->errorMessage());
|
||||||
return false;
|
return false;
|
||||||
case FancyLineEdit::DisplayingPlaceholderText:
|
case FancyLineEdit::DisplayingPlaceholderText:
|
||||||
break;
|
displayStatusMessage(InfoLabel::Error, tr("Name is empty."));
|
||||||
|
return false;
|
||||||
case FancyLineEdit::Valid:
|
case FancyLineEdit::Valid:
|
||||||
nameValid = true;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -183,12 +182,12 @@ bool ProjectIntroPage::validate()
|
|||||||
+ QDir::fromNativeSeparators(d->m_ui.nameLineEdit->text()));
|
+ QDir::fromNativeSeparators(d->m_ui.nameLineEdit->text()));
|
||||||
if (!projectDirFile.exists()) { // All happy
|
if (!projectDirFile.exists()) { // All happy
|
||||||
hideStatusLabel();
|
hideStatusLabel();
|
||||||
return nameValid;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (projectDirFile.isDir()) {
|
if (projectDirFile.isDir()) {
|
||||||
displayStatusMessage(InfoLabel::Warning, tr("The project already exists."));
|
displayStatusMessage(InfoLabel::Warning, tr("The project already exists."));
|
||||||
return nameValid;
|
return true;
|
||||||
}
|
}
|
||||||
// Not a directory, but something else, likely causing directory creation to fail
|
// Not a directory, but something else, likely causing directory creation to fail
|
||||||
displayStatusMessage(InfoLabel::Error, tr("A file with that name already exists."));
|
displayStatusMessage(InfoLabel::Error, tr("A file with that name already exists."));
|
||||||
|
Reference in New Issue
Block a user