From 59adfe12b6941289dbfc9ac04dec5118ec51ea7c Mon Sep 17 00:00:00 2001 From: nds Date: Mon, 9 Oct 2017 16:02:14 +0300 Subject: [PATCH] #2206 Avoid the ability to cancel the current sketch when saving --- src/SHAPERGUI/SHAPERGUI.cpp | 40 +++++++++++++++++++++++++++++++++++++ src/SHAPERGUI/SHAPERGUI.h | 6 ++++++ 2 files changed, 46 insertions(+) diff --git a/src/SHAPERGUI/SHAPERGUI.cpp b/src/SHAPERGUI/SHAPERGUI.cpp index c4580759f..42c1b5090 100644 --- a/src/SHAPERGUI/SHAPERGUI.cpp +++ b/src/SHAPERGUI/SHAPERGUI.cpp @@ -273,6 +273,17 @@ bool SHAPERGUI::activateModule(SUIT_Study* theStudy) // Postrrocessing for LoadScriptId to remove created(if it was created) SALOME Object Browser connect(getApp()->action(LightApp_Application::UserID+1), SIGNAL(triggered(bool)), this, SLOT(onScriptLoaded())); + + disconnect(getApp()->action(LightApp_Application::FileSaveId), SIGNAL(triggered(bool)), + getApp(), SLOT(onSaveDoc())); + disconnect(getApp()->action(LightApp_Application::FileSaveAsId), SIGNAL(triggered(bool)), + getApp(), SLOT(onSaveAsDoc())); + + connect(getApp()->action(LightApp_Application::FileSaveId), SIGNAL(triggered(bool)), + this, SLOT(onSaveDocByShaper())); + connect(getApp()->action(LightApp_Application::FileSaveAsId), SIGNAL(triggered(bool)), + this, SLOT(onSaveAsDocByShaper())); + return isDone; } @@ -321,6 +332,17 @@ bool SHAPERGUI::deactivateModule(SUIT_Study* theStudy) disconnect(getApp()->action(LightApp_Application::UserID+1), SIGNAL(triggered(bool)), this, SLOT(onScriptLoaded())); + disconnect(getApp()->action(LightApp_Application::FileSaveId), SIGNAL(triggered(bool)), + this, SLOT(onSaveDocByShaper())); + disconnect(getApp()->action(LightApp_Application::FileSaveAsId), SIGNAL(triggered(bool)), + this, SLOT(onSaveAsDocByShaper())); + + connect(getApp()->action(LightApp_Application::FileSaveId), SIGNAL(triggered(bool)), + getApp(), SLOT(onSaveDoc())); + connect(getApp()->action(LightApp_Application::FileSaveAsId), SIGNAL(triggered(bool)), + getApp(), SLOT(onSaveAsDoc())); + + return LightApp_Module::deactivateModule(theStudy); } @@ -388,6 +410,24 @@ void SHAPERGUI::onScriptLoaded() delete aBrowser; } +//****************************************************** +void SHAPERGUI::onSaveDocByShaper() +{ + if(!workshop()->operationMgr()->abortAllOperations(XGUI_OperationMgr::XGUI_InformationMessage)) + return; + + getApp()->onSaveDoc(); +} + +//****************************************************** +void SHAPERGUI::onSaveAsDocByShaper() +{ + if(!workshop()->operationMgr()->abortAllOperations(XGUI_OperationMgr::XGUI_InformationMessage)) + return; + + getApp()->onSaveAsDoc(); +} + //****************************************************** void SHAPERGUI::onUpdateCommandStatus() { diff --git a/src/SHAPERGUI/SHAPERGUI.h b/src/SHAPERGUI/SHAPERGUI.h index 1d6e4808f..ffe975ca2 100644 --- a/src/SHAPERGUI/SHAPERGUI.h +++ b/src/SHAPERGUI/SHAPERGUI.h @@ -182,6 +182,12 @@ Q_OBJECT /// Hide object browser if it was created during loading script void onScriptLoaded(); + /// Save application functionality with additional processing of aborting the current operation + void onSaveDocByShaper(); + + /// Save application functionality with additional processing of aborting the current operation + void onSaveAsDocByShaper(); + /// Obtains the current application and updates its actions void onUpdateCommandStatus(); -- 2.39.2