[vlmc-devel] [PATCH 2/2] project name should not contain special characters

Hugo Beauzée-Luyssen hugo at beauzee.fr
Thu Mar 24 13:24:57 CET 2016


On 03/17/2016 10:55 AM, Sanket Markan wrote:
> problems may exist for instance adding / to project name make half of name a directory
> ---
>   src/Gui/wizard/GeneralPage.cpp | 9 +++++++++
>   1 file changed, 9 insertions(+)
>
> diff --git a/src/Gui/wizard/GeneralPage.cpp b/src/Gui/wizard/GeneralPage.cpp
> index da986ba..c1fc561 100644
> --- a/src/Gui/wizard/GeneralPage.cpp
> +++ b/src/Gui/wizard/GeneralPage.cpp
> @@ -87,6 +87,7 @@ GeneralPage::validatePage()
>       if ( m_valid == false )
>           return false;
>       const QString       &defaultProjectName = Project::unNamedProject;
> +    QString invalid_char = "/?:*\\|";
>       if ( ui.lineEditName->text().isEmpty() ||
>            ui.lineEditName->text() == defaultProjectName )
>       {
> @@ -95,6 +96,14 @@ GeneralPage::validatePage()
>           ui.lineEditName->setFocus();
>           return false;
>       }
> +    for ( int i = 0; i < invalid_char.length() ; ++i )
> +        if ( ui.lineEditName->text().contains( invalid_char[i] ) )
> +        {
> +            QMessageBox::information( this, tr( "Invalid project name" ),
> +                                      tr( "Special characters are not allowed" ) );
> +            ui.lineEditName->setFocus();
> +            return false;
> +        }
>
>       //Create the project directory in the workspace dir.
>       QString     projectPath = ui.lineEditName->text().replace( ' ', '_' );
>
Applied, thanks


More information about the Vlmc-devel mailing list