--- /dev/null
+// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 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
+//
+
+#include "HYDROGUI_DeleteDlg.h"
+
+#include <SUIT_MessageBox.h>
+
+#include <QTextEdit>
+#include <QVBoxLayout>
+#include <QLabel>
+#include <QPushButton>
+
+HYDROGUI_DeleteDlg::HYDROGUI_DeleteDlg( QWidget* theParent )
+: QtxDialog( theParent, false, true, QtxDialog::YesNo )
+{
+ setWindowTitle( tr( "DELETE_OBJECTS" ) );
+ setButtonPosition( Left, Yes );
+ setButtonPosition( Right, No );
+
+ QLabel* anIconLabelLabel = new QLabel( mainFrame() );
+ anIconLabelLabel->setPixmap( SUIT_MessageBox::standardIcon( QMessageBox::Question ) );
+ anIconLabelLabel->setScaledContents( false );
+ anIconLabelLabel->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
+
+ myObjectsLabel = new QLabel( tr( "CONFIRM_DELETION" ), mainFrame() );
+ myObjects = new QTextEdit( mainFrame() );
+ myObjects->setReadOnly( true );
+
+ QGridLayout* aLayout = new QGridLayout( mainFrame() );
+ aLayout->setMargin( 5 );
+ aLayout->setSpacing( 5 );
+ aLayout->addWidget( anIconLabelLabel, 0, 0 );
+ aLayout->addWidget( myObjectsLabel, 0, 1 );
+ aLayout->addWidget( myObjects, 1, 0, 1, 2 );
+
+ if ( QPushButton* aYesBtn = ::qobject_cast<QPushButton*>( button( Yes ) ) )
+ {
+ setFocusProxy( aYesBtn );
+ aYesBtn->setDefault( true );
+ }
+
+ setMinimumSize( 275, 250 );
+}
+
+HYDROGUI_DeleteDlg::~HYDROGUI_DeleteDlg()
+{
+}
+
+void HYDROGUI_DeleteDlg::setObjectsToRemove( const QStringList& theObjects )
+{
+ myObjectsLabel->setText( tr( "CONFIRM_DELETION" ).arg( theObjects.length() ) );
+
+ QStringList anObjects;
+
+ QStringListIterator anIter( theObjects );
+ while ( anIter.hasNext() )
+ {
+ QString anObject = anIter.next();
+ anObjects.append( anObject.prepend( "- " ) );
+ }
+
+ myObjects->setPlainText( anObjects.join( "\n" ) );
+}
--- /dev/null
+// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 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
+//
+
+#ifndef HYDROGUI_DeleteDlg_H
+#define HYDROGUI_DeleteDlg_H
+
+#include <QtxDialog.h>
+
+class QLabel;
+class QTextEdit;
+
+class HYDROGUI_DeleteDlg : public QtxDialog
+{
+ Q_OBJECT
+
+public:
+ HYDROGUI_DeleteDlg( QWidget* = 0 );
+ virtual ~HYDROGUI_DeleteDlg();
+
+public:
+
+ void setObjectsToRemove( const QStringList& theObjects );
+
+private:
+ QLabel* myObjectsLabel;
+ QTextEdit* myObjects;
+};
+
+#endif
#include "HYDROGUI_DeleteOp.h"
+#include "HYDROGUI_DeleteDlg.h"
#include "HYDROGUI_Module.h"
#include "HYDROGUI_Tool.h"
#include "HYDROGUI_UpdateFlags.h"
return;
}
- QString aNamesList = anObjNames.join( "\n" );
- int anAnswer = SUIT_MessageBox::question( module()->getApp()->desktop(),
- tr( "DELETE_OBJECTS" ),
- tr( "CONFIRM_DELETION" ).arg( aNamesList ),
- QMessageBox::Yes | QMessageBox::No,
- QMessageBox::No );
- if( anAnswer == QMessageBox::No )
+ HYDROGUI_DeleteDlg aDeleteDlg( module()->getApp()->desktop() );
+ aDeleteDlg.setObjectsToRemove( anObjNames );
+ if ( aDeleteDlg.exec() != HYDROGUI_DeleteDlg::Accepted )
{
abort();
return;
<source>DELETE_OBJECTS</source>
<translation>Delete objects</translation>
</message>
- <message>
- <source>CONFIRM_DELETION</source>
- <translation>Do you really want to delete following objects:
-%1 ?</translation>
- </message>
<message>
<source>DELETE_OBJECTS_IMPOSIBLE</source>
<translation>One or more selected objects can not be deleted separately from parent object.</translation>
<translation>Object "%1" is used for %2</translation>
</message>
</context>
-
+
+ <context>
+ <name>HYDROGUI_DeleteDlg</name>
+ <message>
+ <source>DELETE_OBJECTS</source>
+ <translation>Delete objects</translation>
+ </message>
+ <message>
+ <source>CONFIRM_DELETION</source>
+ <translation>Do you really want to delete %1 object(s)?</translation>
+ </message>
+ </context>
+
<context>
<name>HYDROGUI_ExportImageOp</name>
<message>