]> SALOME platform Git repositories - modules/superv.git/commitdiff
Salome HOME
Fix for bug IPAL12512 : It is possible create ports with equal names.
authormkr <mkr@opencascade.com>
Tue, 18 Jul 2006 11:54:58 +0000 (11:54 +0000)
committermkr <mkr@opencascade.com>
Tue, 18 Jul 2006 11:54:58 +0000 (11:54 +0000)
src/SUPERVGUI/SUPERVGUI_ManagePortsDlg.cxx

index 9e195eca1952e5adf51f7d88f141932187690043..c11d116732d3258e6fd43457daf21e5daa812c33 100644 (file)
@@ -652,6 +652,19 @@ bool isEditingItem( const QListBoxItem* item, const QListBox* theLB ) {
  * the last selected by user item in myInList or myOutList (myLastItem)
  */
 void SUPERVGUI_ManagePortsDlg::nameChanged( const QString& name ) {
+  // mkr: IPAL12512
+  if ( isEditingItem( myLastItem, myInList ) && myInList->findItem( QString( "%1 (%2)" ).arg( name ).arg( ((PortListItem*)myLastItem)->PortType ))
+       ||
+       isEditingItem( myLastItem, myOutList ) && myOutList->findItem( QString( "%1 (%2)" ).arg( name ).arg( ((PortListItem*)myLastItem)->PortType ))) {
+    disconnect( myNameEdt, SIGNAL(textChanged(const QString&)), this, SLOT(nameChanged(const QString&)));
+    
+    myNameEdt->setText( ((PortListItem*)myLastItem)->PortName );
+    
+    connect( myNameEdt, SIGNAL(textChanged(const QString&)), this, SLOT(nameChanged(const QString&)));
+    QMessageBox::warning( this, tr("ERROR"), tr("MSG_PORT_EXIST") );
+    return;
+  }
+  
   if ( isEditingItem( myLastItem, myInList ) || isEditingItem( myLastItem, myOutList ) ) {
     ((PortListItem*)myLastItem)->PortName = name;
     //myLastItem->listBox()->repaint( true );