]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Fix pb of File dialog (save to non-existing dir) V5_1_2_BR V5_1_2 V5_1_2rc4 V5_1_2rc5
authorvsr <vsr@opencascade.com>
Fri, 26 Jun 2009 14:35:55 +0000 (14:35 +0000)
committervsr <vsr@opencascade.com>
Fri, 26 Jun 2009 14:35:55 +0000 (14:35 +0000)
src/SUIT/SUIT_FileValidator.cxx
src/SUIT/resources/SUIT_msg_en.ts

index d2afda00ed9c4f00d25d96294bfa3d0698eb7726..ee6c3d2ed447a45be1dd3e4bfd7872c831c6c866 100755 (executable)
@@ -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;
index feb7e2a3030e686b04cd5b8f1e981897cc61d36f..62cfc102ace632a460da51ff7ba9f7d56a00aa11 100644 (file)
@@ -76,6 +76,21 @@ Do you want to overwrite it ?</translation>
     <message>
         <source>ERR_PERMISSION_DENIED</source>
         <translation>Can&apos;t save file &quot;%1&quot;.
+Permission denied.</translation>
+    </message>
+    <message>
+        <source>ERR_OPEN_PERMISSION_DENIED</source>
+        <translation>Can&apos;t open file &quot;%1&quot;.
+Permission denied.</translation>
+    </message>
+    <message>
+        <source>ERR_DIR_READ_PERMISSION_DENIED</source>
+        <translation>Can&apos;t read directory &quot;%1&quot;.
+Permission denied.</translation>
+    </message>
+    <message>
+        <source>ERR_DIR_WRITE_PERMISSION_DENIED</source>
+        <translation>Can&apos;t write directory &quot;%1&quot;.
 Permission denied.</translation>
     </message>
     <message>