From 2d9c4272f85f5eddef8f2f4d431f3331edf280a8 Mon Sep 17 00:00:00 2001 From: stv Date: Thu, 3 Apr 2008 07:09:59 +0000 Subject: [PATCH] IPAL19419 --- src/LightApp/LightApp_Application.cxx | 56 +-------------------------- 1 file changed, 2 insertions(+), 54 deletions(-) diff --git a/src/LightApp/LightApp_Application.cxx b/src/LightApp/LightApp_Application.cxx index 627fa3b3f..91b2c5422 100644 --- a/src/LightApp/LightApp_Application.cxx +++ b/src/LightApp/LightApp_Application.cxx @@ -727,63 +727,11 @@ void LightApp_Application::onOpenDoc() */ bool LightApp_Application::onOpenDoc( const QString& aName ) { -#ifdef SWITCH_OFF - bool isAlreadyOpen = false; - - // Look among opened studies - if (activeStudy()) { // at least one study is opened - SUIT_Session* aSession = SUIT_Session::session(); - QList aAppList = aSession->applications(); - QListIterator it (aAppList); - SUIT_Application* aApp = 0; - // iterate on all applications - while ( it.hasNext() && !isAlreadyOpen ) { - if ( !(aApp = it.next()) ) break; - if (aApp->activeStudy()->studyName() == aName) { - isAlreadyOpen = true; // Already opened, ask user what to do - - // The document ... is already open. - // Do you want to reload it? - int aAnswer = SUIT_MessageBox::question(desktop(), tr("WRN_WARNING"), - tr("QUE_DOC_ALREADYOPEN").arg(aName), - SUIT_MessageBox::Yes | SUIT_MessageBox::No, - SUIT_MessageBox::No ); - if (aAnswer == SUIT_MessageBox::Yes) { // reload - if (activeStudy()->studyName() == aName && aAppList.count() > 1) { - // Opened in THIS (active) application. - STD_Application* app1 = (STD_Application*)aAppList.at(0); - STD_Application* app2 = (STD_Application*)aAppList.at(1); - if (!app1 || !app2) { - // Error - return false; - } - if (app1->activeStudy()->studyName() == aName) { - // app1 is this application, we need another one - app1 = app2; - } - // Close document of this application. This application will be destroyed. - onCloseDoc(/*ask = */false); - // Open the file with another application, as this one will be destroyed. - return app1->onOpenDoc(aName); - } else { - // Opened in another application. - STD_Application* app = (STD_Application*)aApp; - if (app) - app->onCloseDoc(/*ask = */false); - } - } else { // do not reload - // OK, the study will not be reloaded, but we call - // CAM_Application::onOpenDoc( aName ) all the same. - // It will activate a desktop of the study . - } - } - } - } -#endif + // We should take mru action first because this application instance can be deleted later. + QtxMRUAction* mru = ::qobject_cast( action( MRUId ) ); bool res = CAM_Application::onOpenDoc( aName ); - QtxMRUAction* mru = ::qobject_cast( action( MRUId ) ); if ( mru ) { if ( res ) -- 2.39.2