From: dmv Date: Tue, 4 Dec 2007 14:04:05 +0000 (+0000) Subject: IPAL 17998 X-Git-Tag: V3_2_9rc2~2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=5ce47477fd0f5bab5cc15a17096f283cc86fa2d5;p=modules%2Fgeom.git IPAL 17998 --- diff --git a/src/GEOMBase/GEOMBase_aWarningDlg.cxx b/src/GEOMBase/GEOMBase_aWarningDlg.cxx new file mode 100644 index 000000000..ee936d9b7 --- /dev/null +++ b/src/GEOMBase/GEOMBase_aWarningDlg.cxx @@ -0,0 +1,119 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// +// +// File : GEOMBase_aWarningDlg.cxx +// Author : Dmitry Matveitchev +// Module : GEOM +// $Header: /home/server/cvs/GEOM/GEOM_SRC/src/GEOMBase/GEOMBase_aWarningDlg.cxx + +#include "GEOMBase_aWarningDlg.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifndef WNT +using namespace std; +#endif + +GEOMBase_aWarningDlg::GEOMBase_aWarningDlg( QWidget* parent, const char* name, const QString theText, int theNum ) + :QDialog( parent, name ) +{ + if(!name) + setName( "Warning" ); + resize(296, 150); + setCaption(name); /* appears on the title bar */ + setSizeGripEnabled(TRUE); + + QGridLayout* topLayout = new QGridLayout(this); + topLayout->setSpacing(6); + topLayout->setMargin(11); + + QGroupBox* mainGrp = new QGroupBox(this, "mainGrp"); + mainGrp->setColumnLayout(0, Qt::Vertical); + mainGrp->layout()->setSpacing(0); + mainGrp->layout()->setMargin(0); + + QGridLayout* mainGrpLayout = new QGridLayout(mainGrp->layout()); + mainGrpLayout->setAlignment(Qt::AlignTop); + mainGrpLayout ->setSpacing(6); + mainGrpLayout->setMargin(11); + topLayout->addWidget(mainGrp, 0, 0); + + + QScrollView* viewer = new QScrollView (mainGrp, "viewer"); + viewer->setResizePolicy( QScrollView::AutoOneFit ); + QLabel* TextLabel1 = new QLabel(viewer, "TextLabel1"); + TextLabel1->setText( QObject::tr( "GEOM_REALLY_DELETE" ).arg( theNum ).arg( theText ) ); + viewer->addChild(TextLabel1); + mainGrpLayout->addWidget(viewer, 0, 0); + + //Create Buttons + + QGroupBox* btnGrp = new QGroupBox(this, "btnGrp"); + btnGrp->setColumnLayout(0, Qt::Vertical); + btnGrp->layout()->setSpacing(0); + btnGrp->layout()->setMargin(0); + QGridLayout* btnGrpLayout = new QGridLayout(btnGrp->layout()); + btnGrpLayout->setAlignment(Qt::AlignTop); + btnGrpLayout->setSpacing(6); + btnGrpLayout->setMargin(11); + topLayout->addWidget(btnGrp, 1, 0); + + /* No button */ + myButtonOk = new QPushButton(btnGrp, "buttonOk"); + myButtonOk->setText(tr("GEOM_BUT_YES")); + myButtonOk->setAutoDefault(TRUE); + btnGrpLayout->addWidget(myButtonOk, 0, 0); + + btnGrpLayout->addItem(new QSpacerItem(5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 1); + + /* Yes button */ + myButtonCancel = new QPushButton(btnGrp, "buttonCancel"); + myButtonCancel->setText(tr("GEOM_BUT_NO")); + myButtonCancel->setAutoDefault(TRUE); + myButtonCancel->setDefault(TRUE); + btnGrpLayout->addWidget(myButtonCancel, 0, 2); + + /* signals and slots connections */ + connect(myButtonOk, SIGNAL(clicked()), this, SLOT(accept())); + connect(myButtonCancel, SIGNAL(clicked()), this, SLOT(reject())); +} + + +//====================================================================================== +// function : ~GEOMBase_aWarningDlg() destructor +// purpose : Destroys the object and frees any allocated resources +//====================================================================================== +GEOMBase_aWarningDlg::~GEOMBase_aWarningDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + + + diff --git a/src/GEOMBase/GEOMBase_aWarningDlg.h b/src/GEOMBase/GEOMBase_aWarningDlg.h new file mode 100644 index 000000000..6601062bb --- /dev/null +++ b/src/GEOMBase/GEOMBase_aWarningDlg.h @@ -0,0 +1,56 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// +// +// File : GEOMBase_aWarningDlg.h +// Author : Dmitry Matveitchev +// Module : GEOM +// $Header: /home/server/cvs/GEOM/GEOM_SRC/src/GEOMBase/GEOMBase_aWarningDlg.h + +#ifndef GEOMBase_aWarningDLG_H +#define GEOMBase_aWarningDLG_H + +#include +#include + +class QString; +class QPushButton; + +//================================================================================= +// class : GEOMBase_aWarningDlg +// purpose : +//================================================================================= +class GEOMBase_aWarningDlg : public QDialog +{ + Q_OBJECT + +public: + GEOMBase_aWarningDlg( QWidget* parent, const char* name, QString theText, int nb ); + ~GEOMBase_aWarningDlg(); + +private: + QPushButton* myButtonOk; + QPushButton* myButtonCancel; + +}; + +#endif diff --git a/src/GEOMBase/Makefile.in b/src/GEOMBase/Makefile.in index 2cdee829d..194074754 100644 --- a/src/GEOMBase/Makefile.in +++ b/src/GEOMBase/Makefile.in @@ -41,17 +41,19 @@ LIB = libGEOMBase.la EXPORT_HEADERS= GEOMBase.h \ GEOMBase_Skeleton.h \ GEOMBase_Helper.h \ + GEOMBase_aWarningDlg.h \ GEOM_Operation.h LIB_SRC = GEOMBase.cxx \ GEOMBase_Skeleton.cxx \ GEOMBase_aParameterDlg.cxx \ + GEOMBase_aWarningDlg.cxx \ GEOMBase_Helper.cxx \ GEOM_Operation.cxx -LIB_MOC = \ - GEOMBase_Skeleton.h \ - GEOMBase_aParameterDlg.h +LIB_MOC = GEOMBase_Skeleton.h \ + GEOMBase_aParameterDlg.h \ + GEOMBase_aWarningDlg.h LIB_CLIENT_IDL = SALOME_Exception.idl \ SALOMEDS.idl \ diff --git a/src/GEOMToolsGUI/GEOMToolsGUI.cxx b/src/GEOMToolsGUI/GEOMToolsGUI.cxx index 75e6d670b..8de1a33d4 100644 --- a/src/GEOMToolsGUI/GEOMToolsGUI.cxx +++ b/src/GEOMToolsGUI/GEOMToolsGUI.cxx @@ -31,6 +31,7 @@ #include "GeometryGUI.h" #include "GEOM_Actor.h" #include "GEOMBase.h" +#include "GEOMBase_aWarningDlg.h" #include "GEOM_Operation.h" #include "GEOM_Displayer.h" @@ -315,20 +316,22 @@ void GEOMToolsGUI::OnEditDelete() } // VSR 17/11/04: check if all objects selected belong to GEOM component <-- finish QString aNameList; - int nbSel = selected.Extent(); + int nbSel = 0; for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) { Handle(SALOME_InteractiveObject) io = It.Value(); - aNameList.append("\n - "); - aNameList.append(io->getName()); + QString aName = io->getName(); + if ( aName != "" && aName.ref(0) != '*') { + aNameList.append("\n - " + aName); + nbSel++; + } } - - if ( SUIT_MessageBox::warn2( app->desktop(), - QObject::tr( "GEOM_WRN_WARNING" ), - QObject::tr( "GEOM_REALLY_DELETE" ).arg( nbSel ).arg( aNameList ), - QObject::tr( "GEOM_BUT_YES" ), - QObject::tr( "GEOM_BUT_NO" ), 1, 0, 0 ) != 1 ) - return; + + GEOMBase_aWarningDlg* Dialog = new GEOMBase_aWarningDlg( app->desktop(), QObject::tr( "GEOM_WRN_WARNING" ), aNameList, nbSel); + int r = Dialog->exec(); + + if (!r) + return; // QAD_Operation* op = new SALOMEGUI_ImportOperation(.....); // op->start();