]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
0020733: EDF 1304 ALL: Recently opened study moved
authordmv <dmv@opencascade.com>
Tue, 2 Mar 2010 08:43:51 +0000 (08:43 +0000)
committerdmv <dmv@opencascade.com>
Tue, 2 Mar 2010 08:43:51 +0000 (08:43 +0000)
src/SalomeApp/SalomeApp_Application.cxx
src/SalomeApp/resources/SalomeApp_msg_en.ts

index 41896b0b848bc6e54782420bc568b516b7027aa1..753f3a113f04573c61c02d43a74790ea07bff8e3 100644 (file)
@@ -973,29 +973,32 @@ int SalomeApp_Application::openChoice( const QString& aName )
 {
   int choice = LightApp_Application::openChoice( aName );
 
-  if ( choice == OpenNew ) // The document isn't already open.
-  {
-    bool exist = false;
-    std::vector<std::string> lst = studyMgr()->GetOpenStudies();
-    for ( uint i = 0; i < lst.size() && !exist; i++ )
-    {
-      if ( aName == QString( lst[i].c_str() ) )
-        exist = true;
-    }
-
-    // The document already exists in the study manager.
-    // Do you want to reload it?
-    if ( exist )
-    {
-      int answer = SUIT_MessageBox::question( desktop(), tr( "WRN_WARNING" ), tr( "QUE_DOC_ALREADYEXIST" ).arg( aName ),
-                                              SUIT_MessageBox::Yes | SUIT_MessageBox::No, SUIT_MessageBox::No );
-      if ( answer == SUIT_MessageBox::Yes )
-        choice = OpenRefresh;
-      else
-        choice = OpenCancel;
+  if ( QFileInfo( aName ).exists() ) {
+    if ( choice == OpenNew ) { // The document isn't already open.
+      bool exist = false;
+      std::vector<std::string> lst = studyMgr()->GetOpenStudies();
+      for ( uint i = 0; i < lst.size() && !exist; i++ ) {
+        if ( aName == QString( lst[i].c_str() ) )
+          exist = true;
+      }
+      // The document already exists in the study manager.
+      // Do you want to reload it?
+      if ( exist ) {
+        int answer = SUIT_MessageBox::question( desktop(), tr( "WRN_WARNING" ), tr( "QUE_DOC_ALREADYEXIST" ).arg( aName ),
+                                                SUIT_MessageBox::Yes | SUIT_MessageBox::No, SUIT_MessageBox::No );
+        if ( answer == SUIT_MessageBox::Yes )
+          choice = OpenRefresh;
+        else
+          choice = OpenCancel;
+      }
     }
+  } else { // file is not exist on disk
+    SUIT_MessageBox::warning( desktop(),
+                              QObject::tr("WRN_WARNING"),
+                              QObject::tr("WRN_FILE_NOT_EXIST").arg(aName.toLatin1().data()));
+    return false;
   }
-
+  
   return choice;
 }
 
index 0646238f98f29ada8c7c21d572b75537688cabf9..9654d27fa35a255af1b6ba66c646237d7920bbbf 100644 (file)
         <translation>Please enter correct file name.
 Python file must include only letters, digits and underscores and start from letter or underscore.</translation>
     </message>
+    <message>
+        <source>WRN_FILE_NOT_EXIST</source>
+        <translation>The file %1 dose not exist.</translation>
+    </message>
     <message>
         <source>CLOSE_LOCKED_STUDY</source>
         <translation>Close locked study?</translation>