From: mzn Date: Mon, 29 Jun 2015 15:31:58 +0000 (+0300) Subject: refs #569: add warning if the user try to delete all tables X-Git-Tag: v1.4.2~10^2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=b4004b045ed278612105d2665bfcfffd854ab1fc;p=modules%2Fhydro.git refs #569: add warning if the user try to delete all tables --- diff --git a/src/HYDROGUI/HYDROGUI_DeleteOp.cxx b/src/HYDROGUI/HYDROGUI_DeleteOp.cxx index 1ef77793..83dd008a 100644 --- a/src/HYDROGUI/HYDROGUI_DeleteOp.cxx +++ b/src/HYDROGUI/HYDROGUI_DeleteOp.cxx @@ -24,12 +24,15 @@ #include "HYDROGUI_UpdateFlags.h" #include +#include #include #include #include +#include + HYDROGUI_DeleteOp::HYDROGUI_DeleteOp( HYDROGUI_Module* theModule ) : HYDROGUI_Operation( theModule ) { @@ -110,12 +113,32 @@ void HYDROGUI_DeleteOp::startOperation() return; } + QString aWarningMsg; + HYDROGUI_DeleteDlg aDeleteDlg( module()->getApp()->desktop() ); aDeleteDlg.setObjectsToRemove( anObjNames ); if ( aDeleteDlg.exec() != HYDROGUI_DeleteDlg::Accepted ) { abort(); return; + } else { + QStringList aTableNames = + HYDROGUI_Tool::FindExistingObjectsNames( doc(), KIND_STRICKLER_TABLE, false ); + aTableNames += anObjNames; + if ( aTableNames.toSet().size() == anObjNames.size() ) { + aWarningMsg = tr("DELETE_LAST_TABLE_WRN"); + } + } + + if ( !aWarningMsg.isEmpty() ) { + int anAnswer = SUIT_MessageBox::warning( module()->getApp()->desktop(), + tr("WARNING"), aWarningMsg, + QMessageBox::Yes | QMessageBox::No, + QMessageBox::No ); + if ( anAnswer != QMessageBox::Yes ) { + abort(); + return; + } } startDocOperation(); diff --git a/src/HYDROGUI/resources/HYDROGUI_msg_en.ts b/src/HYDROGUI/resources/HYDROGUI_msg_en.ts index e71fabb1..4cb49f6f 100644 --- a/src/HYDROGUI/resources/HYDROGUI_msg_en.ts +++ b/src/HYDROGUI/resources/HYDROGUI_msg_en.ts @@ -508,6 +508,16 @@ First remove objects which are created on their basis. DELETE_OBJECT_IS_USED_FOR Object "%1" is used for %2 + + DELETE_LAST_TABLE_WRN + You are about to delete all Strickler tables in the study. +After that the study will contain only the default Strickler table. +Do you want to continue? + + + WARNING + Warning +