From 119df108b1c53b6321d67344a9f94686202c4046 Mon Sep 17 00:00:00 2001 From: dmv Date: Tue, 2 Mar 2010 08:43:51 +0000 Subject: [PATCH] 0020733: EDF 1304 ALL: Recently opened study moved --- src/SalomeApp/SalomeApp_Application.cxx | 45 +++++++++++---------- src/SalomeApp/resources/SalomeApp_msg_en.ts | 4 ++ 2 files changed, 28 insertions(+), 21 deletions(-) diff --git a/src/SalomeApp/SalomeApp_Application.cxx b/src/SalomeApp/SalomeApp_Application.cxx index 41896b0b8..753f3a113 100644 --- a/src/SalomeApp/SalomeApp_Application.cxx +++ b/src/SalomeApp/SalomeApp_Application.cxx @@ -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 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 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; } diff --git a/src/SalomeApp/resources/SalomeApp_msg_en.ts b/src/SalomeApp/resources/SalomeApp_msg_en.ts index 0646238f9..9654d27fa 100644 --- a/src/SalomeApp/resources/SalomeApp_msg_en.ts +++ b/src/SalomeApp/resources/SalomeApp_msg_en.ts @@ -29,6 +29,10 @@ Please enter correct file name. Python file must include only letters, digits and underscores and start from letter or underscore. + + WRN_FILE_NOT_EXIST + The file %1 dose not exist. + CLOSE_LOCKED_STUDY Close locked study? -- 2.39.2