forked from qt-creator/qt-creator
fix file name validation bug
This commit is contained in:
@@ -55,7 +55,8 @@ namespace Utils {
|
||||
#endif
|
||||
|
||||
// ------------------ PathValidatingLineEdit
|
||||
class PathValidatingLineEdit : public BaseValidatingLineEdit {
|
||||
class PathValidatingLineEdit : public BaseValidatingLineEdit
|
||||
{
|
||||
public:
|
||||
explicit PathValidatingLineEdit(PathChooser *chooser, QWidget *parent = 0);
|
||||
|
||||
@@ -79,7 +80,8 @@ bool PathValidatingLineEdit::validate(const QString &value, QString *errorMessag
|
||||
}
|
||||
|
||||
// ------------------ PathChooserPrivate
|
||||
struct PathChooserPrivate {
|
||||
struct PathChooserPrivate
|
||||
{
|
||||
PathChooserPrivate(PathChooser *chooser);
|
||||
|
||||
PathValidatingLineEdit *m_lineEdit;
|
||||
@@ -207,17 +209,19 @@ bool PathChooser::validatePath(const QString &path, QString *errorMessage)
|
||||
// Check expected kind
|
||||
switch (m_d->m_acceptingKind) {
|
||||
case PathChooser::Directory:
|
||||
if (!isDir)
|
||||
if (!isDir) {
|
||||
if (errorMessage)
|
||||
*errorMessage = tr("The path '%1' is not a directory.").arg(path);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
||||
case PathChooser::File:
|
||||
if (isDir)
|
||||
if (isDir) {
|
||||
if (errorMessage)
|
||||
*errorMessage = tr("The path '%1' is not a file.").arg(path);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
||||
case PathChooser::Command:
|
||||
|
||||
Reference in New Issue
Block a user