From: vsr Date: Fri, 26 Jun 2009 14:35:55 +0000 (+0000) Subject: Fix pb of File dialog (save to non-existing dir) X-Git-Tag: V5_1_2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=1317e5a146a623296b150839caf17c31eba8e393;p=modules%2Fgui.git Fix pb of File dialog (save to non-existing dir) --- diff --git a/src/SUIT/SUIT_FileValidator.cxx b/src/SUIT/SUIT_FileValidator.cxx index d2afda00e..ee6c3d2ed 100755 --- a/src/SUIT/SUIT_FileValidator.cxx +++ b/src/SUIT/SUIT_FileValidator.cxx @@ -66,7 +66,7 @@ bool SUIT_FileValidator::canOpen( const QString& fileName, bool checkPermission if ( checkPermission && !QFileInfo( fileName ).isReadable() ) { if ( parent() ) SUIT_MessageBox::critical( parent(), QObject::tr( "ERR_ERROR" ), - QObject::tr( "ERR_PERMISSION_DENIED" ).arg( fileName ) ); + QObject::tr( "ERR_OPEN_PERMISSION_DENIED" ).arg( fileName ) ); return false; } return true; @@ -105,6 +105,11 @@ bool SUIT_FileValidator::canSave( const QString& fileName, bool checkPermission } else { QString dirName = SUIT_Tools::dir( fileName ); + if ( !QFile::exists( dirName ) ) { + SUIT_MessageBox::critical( parent(), QObject::tr( "WRN_WARNING" ), + QObject::tr( "ERR_DIR_NOT_EXIST" ).arg( dirName ) ); + return false; + } if ( checkPermission && !QFileInfo( dirName ).isWritable() ) { if ( parent() ) SUIT_MessageBox::critical( parent(), QObject::tr( "ERR_ERROR" ), @@ -144,7 +149,7 @@ bool SUIT_FileValidator::canReadDir( const QString& dirName, bool checkPermissio if ( checkPermission && !info.isReadable() ) { if ( parent() ) SUIT_MessageBox::critical( parent(), QObject::tr( "ERR_ERROR" ), - QObject::tr( "ERR_PERMISSION_DENIED" ).arg( dirName ) ); + QObject::tr( "ERR_DIR_READ_PERMISSION_DENIED" ).arg( dirName ) ); return false; } return true; @@ -179,7 +184,7 @@ bool SUIT_FileValidator::canWriteDir( const QString& dirName, bool checkPermissi if ( checkPermission && !info.isWritable() ) { if ( parent() ) SUIT_MessageBox::critical( parent(), QObject::tr( "ERR_ERROR" ), - QObject::tr( "ERR_PERMISSION_DENIED" ).arg( dirName ) ); + QObject::tr( "ERR_DIR_WRITE_PERMISSION_DENIED" ).arg( dirName ) ); return false; } return true; diff --git a/src/SUIT/resources/SUIT_msg_en.ts b/src/SUIT/resources/SUIT_msg_en.ts index feb7e2a30..62cfc102a 100644 --- a/src/SUIT/resources/SUIT_msg_en.ts +++ b/src/SUIT/resources/SUIT_msg_en.ts @@ -76,6 +76,21 @@ Do you want to overwrite it ? ERR_PERMISSION_DENIED Can't save file "%1". +Permission denied. + + + ERR_OPEN_PERMISSION_DENIED + Can't open file "%1". +Permission denied. + + + ERR_DIR_READ_PERMISSION_DENIED + Can't read directory "%1". +Permission denied. + + + ERR_DIR_WRITE_PERMISSION_DENIED + Can't write directory "%1". Permission denied.