]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
Refs #90 - prohibit deletion of child objects
authornds <nds@opencascade.com>
Wed, 25 Dec 2013 11:57:33 +0000 (11:57 +0000)
committernds <nds@opencascade.com>
Wed, 25 Dec 2013 11:57:33 +0000 (11:57 +0000)
src/HYDROGUI/HYDROGUI_DeleteOp.cxx
src/HYDROGUI/resources/HYDROGUI_msg_en.ts

index da2cd3739a300c4b2c0dc1001bc9544ca57c5c91..8d55ce79def2d30e95395ec4ad2490f3ddb5fab7 100644 (file)
@@ -87,10 +87,29 @@ void HYDROGUI_DeleteOp::startOperation()
   QMap<QString,HYDROData_SequenceOfObjects> aBackObjects =
     HYDROGUI_Tool::GetObjectsBackReferences( module(), anObjNames );
 
+  QMap<QString,HYDROData_SequenceOfObjects>::const_iterator anIt = aBackObjects.begin(),
+                                                            aLast = aBackObjects.end();
+  QStringList aRefList;
+  for ( ; anIt != aLast; anIt++ ) {
+    QStringList aSeqList;
+    HYDROData_SequenceOfObjects::Iterator anIter( anIt.value() );
+    for ( ; anIter.More(); anIter.Next() )
+    {
+      Handle(HYDROData_Entity) anEntity = anIter.Value();
+      if ( anEntity.IsNull() )
+        continue;
+      aSeqList.append( QString( tr( "DELETE_OBJECT_NAME" ) ).arg( anEntity->GetName() ) );
+    }
+    aRefList.append( QString( tr( "DELETE_OBJECT_IS_USED_FOR" ) ).arg( anIt.key() )
+                                                          .arg( aSeqList.join( ", " ) ) );
+  }
+
+  //QString aNamesList = anObjNames.join( "\n" );
   if ( !aBackObjects.isEmpty() )
   {
     SUIT_MessageBox::critical( module()->getApp()->desktop(),
-                               tr( "DELETE_OBJECTS" ), tr( "DELETED_OBJECTS_HAS_BACKREFERENCES" ) );
+                               tr( "DELETE_OBJECTS" ),
+                               tr( "DELETED_OBJECTS_HAS_BACKREFERENCES" ).arg( aRefList.join( "\n" ) ) );
     abort();
     return;
   }
index 66f5699b6dab5346046bf7042461f11d205c7b54..36645c566b33117cfc5cf324da03d5a2611c842f 100644 (file)
@@ -337,7 +337,17 @@ All supported formats (*.brep *.iges *.igs *.step *.stp)</translation>
     <message>
       <source>DELETED_OBJECTS_HAS_BACKREFERENCES</source>
       <translation>One or more selected objects are used to create another ones.
-First remove objects which are created on their basis.</translation>
+First remove objects which are created on their basis.
+
+%1</translation>
+    </message>
+    <message>
+      <source>DELETE_OBJECT_NAME</source>
+      <translation>"%1"</translation>
+    </message>
+    <message>
+      <source>DELETE_OBJECT_IS_USED_FOR</source>
+      <translation>Object "%1" is used for %2</translation>
     </message>
   </context>