From f176a6f530264a71a73cf18b2f4f64c58995a3c7 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Tue, 2 Mar 2021 09:50:49 +0100 Subject: [PATCH] Wizards: Fix error message if project name is empty It showed "The project already exists" instead of "Name is empty". Probably broke with 8d1a592d1637b52e539695afdef7f5564f6d723b Fixes: QTCREATORBUG-25398 Change-Id: I0cbe5753d80bc30c93408886668e39278d99c97f Reviewed-by: Alessandro Portale --- src/libs/utils/projectintropage.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/libs/utils/projectintropage.cpp b/src/libs/utils/projectintropage.cpp index ac172f4078a..e5890ac2edf 100644 --- a/src/libs/utils/projectintropage.cpp +++ b/src/libs/utils/projectintropage.cpp @@ -165,16 +165,15 @@ bool ProjectIntroPage::validate() return false; } - // Name valid? Ignore 'DisplayingPlaceholderText' state. - bool nameValid = false; + // Name valid? switch (d->m_ui.nameLineEdit->state()) { case FancyLineEdit::Invalid: displayStatusMessage(InfoLabel::Error, d->m_ui.nameLineEdit->errorMessage()); return false; case FancyLineEdit::DisplayingPlaceholderText: - break; + displayStatusMessage(InfoLabel::Error, tr("Name is empty.")); + return false; case FancyLineEdit::Valid: - nameValid = true; break; } @@ -183,12 +182,12 @@ bool ProjectIntroPage::validate() + QDir::fromNativeSeparators(d->m_ui.nameLineEdit->text())); if (!projectDirFile.exists()) { // All happy hideStatusLabel(); - return nameValid; + return true; } if (projectDirFile.isDir()) { displayStatusMessage(InfoLabel::Warning, tr("The project already exists.")); - return nameValid; + return true; } // Not a directory, but something else, likely causing directory creation to fail displayStatusMessage(InfoLabel::Error, tr("A file with that name already exists."));