NPAL19658: Deletion problem. Invalid actions were called by shortcuts.

This commit is contained in:
jfa 2008-05-20 07:38:50 +00:00
parent cf261e1cd3
commit a6b86fc40d
3 changed files with 37 additions and 21 deletions

View File

@ -245,6 +245,10 @@ msgstr "Warning"
msgid "GEOM_REALLY_DELETE" msgid "GEOM_REALLY_DELETE"
msgstr "Do you really want to delete this %1 object(s):" msgstr "Do you really want to delete this %1 object(s):"
#: GEOMToolsGUI_1.cxx
msgid "GEOM_WRN_NO_APPROPRIATE_SELECTION"
msgstr "No appropriate objects selected"
# #
#============================================================================== #==============================================================================
# #
@ -661,10 +665,6 @@ msgstr "Planar face"
msgid "GEOM_POLYGON" msgid "GEOM_POLYGON"
msgstr "Polygon" msgstr "Polygon"
#Kind of Shape
msgid "GEOM_POLYGON"
msgstr "Polygon"
#Kind of Shape #Kind of Shape
msgid "GEOM_NORMAL" msgid "GEOM_NORMAL"
msgstr "Normal direction" msgstr "Normal direction"

View File

@ -1230,8 +1230,10 @@ bool GeometryGUI::activateModule( SUIT_Study* study )
// Reset actions accelerator keys // Reset actions accelerator keys
//action(111)->setAccel(QKeySequence(CTRL + Key_I)); // Import //action(111)->setAccel(QKeySequence(CTRL + Key_I)); // Import
//action(121)->setAccel(QKeySequence(CTRL + Key_E)); // Export //action(121)->setAccel(QKeySequence(CTRL + Key_E)); // Export
action(111)->setEnabled(true); // Import action(111)->setEnabled(true); // Import: CTRL + Key_I
action(121)->setEnabled(true); // Export action(121)->setEnabled(true); // Export: CTRL + Key_E
action( 33)->setEnabled(true); // Delete: Key_Delete
action(901)->setEnabled(true); // Rename: Key_F2
GUIMap::Iterator it; GUIMap::Iterator it;
for ( it = myGUIMap.begin(); it != myGUIMap.end(); ++it ) for ( it = myGUIMap.begin(); it != myGUIMap.end(); ++it )
@ -1290,8 +1292,10 @@ bool GeometryGUI::deactivateModule( SUIT_Study* study )
// Unset actions accelerator keys // Unset actions accelerator keys
//action(111)->setAccel(QKeySequence()); // Import //action(111)->setAccel(QKeySequence()); // Import
//action(121)->setAccel(QKeySequence()); // Export //action(121)->setAccel(QKeySequence()); // Export
action(111)->setEnabled(false); // Import action(111)->setEnabled(false); // Import: CTRL + Key_I
action(121)->setEnabled(false); // Export action(121)->setEnabled(false); // Export: CTRL + Key_E
action( 33)->setEnabled(false); // Delete: Key_Delete
action(901)->setEnabled(false); // Rename: Key_F2
myOCCSelectors.clear(); myOCCSelectors.clear();
getApp()->selectionMgr()->setEnabled( true, OCCViewer_Viewer::Type() ); getApp()->selectionMgr()->setEnabled( true, OCCViewer_Viewer::Type() );

View File

@ -17,7 +17,7 @@
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
// //
// //
@ -177,7 +177,8 @@ void GEOMToolsGUI::OnSettingsStep()
void GEOMToolsGUI::OnRename() void GEOMToolsGUI::OnRename()
{ {
SALOME_ListIO selected; SALOME_ListIO selected;
SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() ); SalomeApp_Application* app =
dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
if ( app ) { if ( app ) {
LightApp_SelectionMgr* aSelMgr = app->selectionMgr(); LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() ); SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
@ -195,28 +196,39 @@ void GEOMToolsGUI::OnRename()
return; return;
} }
bool isAny = false; // is there any appropriate object selected
for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) { for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) {
Handle(SALOME_InteractiveObject) IObject = It.Value(); Handle(SALOME_InteractiveObject) IObject = It.Value();
_PTR(SObject) obj ( aStudy->FindObjectID(IObject->getEntry()) ); _PTR(SObject) obj ( aStudy->FindObjectID(IObject->getEntry()) );
_PTR(GenericAttribute) anAttr; _PTR(GenericAttribute) anAttr;
if ( obj ) { if ( obj ) {
if( obj->FindAttribute(anAttr, "AttributeName") ) { if ( obj->FindAttribute(anAttr, "AttributeName") ) {
_PTR(AttributeName) aName (anAttr); _PTR(AttributeName) aName (anAttr);
QString newName = LightApp_NameDlg::getName( app->desktop(), aName->Value().c_str() ); GEOM::GEOM_Object_var anObj =
if ( !newName.isEmpty() ) { GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(obj));
aName->SetValue( newName.latin1() ); // rename the SObject if (!CORBA::is_nil(anObj)) {
IObject->setName( newName.latin1() );// rename the InteractiveObject isAny = true;
// Rename the corresponding GEOM_Object QString newName = LightApp_NameDlg::getName( app->desktop(), aName->Value().c_str() );
GEOM::GEOM_Object_var anObj = GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(obj)); if (!newName.isEmpty()) {
if (!CORBA::is_nil( anObj )) aName->SetValue( newName.latin1() ); // rename the SObject
anObj->SetName( newName.latin1() ); IObject->setName( newName.latin1() );// rename the InteractiveObject
(dynamic_cast<SalomeApp_Module*>(app->activeModule()))->updateObjBrowser( false ); anObj->SetName( newName.latin1() ); // Rename the corresponding GEOM_Object
} (dynamic_cast<SalomeApp_Module*>(app->activeModule()))->updateObjBrowser( false );
}
} // if ( anObj )
} // if ( name attribute ) } // if ( name attribute )
} // if ( obj ) } // if ( obj )
} // iterator } // iterator
if (!isAny) {
SUIT_MessageBox::warn1(app->desktop(),
QObject::tr("WRN_WARNING"),
QObject::tr("GEOM_WRN_NO_APPROPRIATE_SELECTION"),
QObject::tr("BUT_OK"));
return;
}
} }
} }
} }