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"
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"
msgstr "Polygon"
#Kind of Shape
msgid "GEOM_POLYGON"
msgstr "Polygon"
#Kind of Shape
msgid "GEOM_NORMAL"
msgstr "Normal direction"

View File

@ -1230,8 +1230,10 @@ bool GeometryGUI::activateModule( SUIT_Study* study )
// Reset actions accelerator keys
//action(111)->setAccel(QKeySequence(CTRL + Key_I)); // Import
//action(121)->setAccel(QKeySequence(CTRL + Key_E)); // Export
action(111)->setEnabled(true); // Import
action(121)->setEnabled(true); // Export
action(111)->setEnabled(true); // Import: CTRL + Key_I
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;
for ( it = myGUIMap.begin(); it != myGUIMap.end(); ++it )
@ -1290,8 +1292,10 @@ bool GeometryGUI::deactivateModule( SUIT_Study* study )
// Unset actions accelerator keys
//action(111)->setAccel(QKeySequence()); // Import
//action(121)->setAccel(QKeySequence()); // Export
action(111)->setEnabled(false); // Import
action(121)->setEnabled(false); // Export
action(111)->setEnabled(false); // Import: CTRL + Key_I
action(121)->setEnabled(false); // Export: CTRL + Key_E
action( 33)->setEnabled(false); // Delete: Key_Delete
action(901)->setEnabled(false); // Rename: Key_F2
myOCCSelectors.clear();
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
// 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()
{
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 ) {
LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
@ -195,28 +196,39 @@ void GEOMToolsGUI::OnRename()
return;
}
bool isAny = false; // is there any appropriate object selected
for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) {
Handle(SALOME_InteractiveObject) IObject = It.Value();
_PTR(SObject) obj ( aStudy->FindObjectID(IObject->getEntry()) );
_PTR(GenericAttribute) anAttr;
if ( obj ) {
if( obj->FindAttribute(anAttr, "AttributeName") ) {
if ( obj->FindAttribute(anAttr, "AttributeName") ) {
_PTR(AttributeName) aName (anAttr);
QString newName = LightApp_NameDlg::getName( app->desktop(), aName->Value().c_str() );
if ( !newName.isEmpty() ) {
aName->SetValue( newName.latin1() ); // rename the SObject
IObject->setName( newName.latin1() );// rename the InteractiveObject
// Rename the corresponding GEOM_Object
GEOM::GEOM_Object_var anObj = GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(obj));
if (!CORBA::is_nil( anObj ))
anObj->SetName( newName.latin1() );
(dynamic_cast<SalomeApp_Module*>(app->activeModule()))->updateObjBrowser( false );
}
GEOM::GEOM_Object_var anObj =
GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(obj));
if (!CORBA::is_nil(anObj)) {
isAny = true;
QString newName = LightApp_NameDlg::getName( app->desktop(), aName->Value().c_str() );
if (!newName.isEmpty()) {
aName->SetValue( newName.latin1() ); // rename the SObject
IObject->setName( newName.latin1() );// rename the InteractiveObject
anObj->SetName( newName.latin1() ); // Rename the corresponding GEOM_Object
(dynamic_cast<SalomeApp_Module*>(app->activeModule()))->updateObjBrowser( false );
}
} // if ( anObj )
} // if ( name attribute )
} // if ( obj )
} // iterator
if (!isAny) {
SUIT_MessageBox::warn1(app->desktop(),
QObject::tr("WRN_WARNING"),
QObject::tr("GEOM_WRN_NO_APPROPRIATE_SELECTION"),
QObject::tr("BUT_OK"));
return;
}
}
}
}