From 3fe79f4eae3e7c661797b2df2c6d4438f12a51c3 Mon Sep 17 00:00:00 2001 From: akl Date: Thu, 25 Sep 2014 09:46:19 +0400 Subject: [PATCH] Manage of 'Connect' action availability. --- src/SalomeApp/SalomeApp_Application.cxx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/SalomeApp/SalomeApp_Application.cxx b/src/SalomeApp/SalomeApp_Application.cxx index 34ca54087..94b011d2a 100644 --- a/src/SalomeApp/SalomeApp_Application.cxx +++ b/src/SalomeApp/SalomeApp_Application.cxx @@ -584,6 +584,12 @@ void SalomeApp_Application::onParseMessage(const QString& aMessage) printf( "* Warning: SALOME is built without SIMAN support.\n" ); printf( "****************************************************************\n" ); #endif + } else if (aMessage.indexOf("studyCreated:") == 0) { + SUIT_MessageBox::warning( desktop(), + QObject::tr("WRN_WARNING"), + QObject::tr("Study was created on DS") ); + // Enable 'Connect' action + updateCommandsStatus(); } else if (aMessage.indexOf("studyClosed:") == 0) { /* aMessage also contains ID of the closed study, but as soon as SALOME is mono-study application for the moment, @@ -591,6 +597,10 @@ void SalomeApp_Application::onParseMessage(const QString& aMessage) //long aStudyId = aMessage.section(':', 1).toLong(); // Disconnect GUI from active study, because it was closed on DS side. closeActiveDoc( false ); + // Disable 'Connect' action + QAction* a = action( ConnectId ); + if( a ) + a->setEnabled( false ); } } @@ -812,7 +822,7 @@ void SalomeApp_Application::updateCommandsStatus() // Connect study menu a = action( ConnectId ); if( a ) - a->setEnabled( !activeStudy() ); + a->setEnabled( !activeStudy() && studyMgr()->GetOpenStudies().size() > 0 ); // Disconnect study menu a = action( DisconnectId ); -- 2.39.2