]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
NPAL19658: Deletion problem. Invalid actions were called by shortcuts.
authorjfa <jfa@opencascade.com>
Tue, 20 May 2008 07:38:50 +0000 (07:38 +0000)
committerjfa <jfa@opencascade.com>
Tue, 20 May 2008 07:38:50 +0000 (07:38 +0000)
src/GEOMGUI/GEOM_msg_en.po
src/GEOMGUI/GeometryGUI.cxx
src/GEOMToolsGUI/GEOMToolsGUI_1.cxx

index b82b694b619a660cd519aafbd4b8aeaec2ae4924..d234b7340eada4039312ddb6dff68c4794089a5f 100644 (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"
index b2351ada941d42be232704776eda063f12e45296..6061c3b791d69ebda28602b88a101a8dcac2ca03 100644 (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() );
index 1396305634a9dba53fa8652a3da2a69f401e6f2e..ba88ac9e0ca5d860166a5280dab1b00c54e9d7c6 100644 (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;
+        }
       }
     }
   }