From cc5a58baa33f8993b404d669ad7d4af305b54cc9 Mon Sep 17 00:00:00 2001 From: mkr Date: Wed, 21 Sep 2005 07:43:33 +0000 Subject: [PATCH] Fix for bug IPAL9972 : Change Informations and Rename problems. --- src/SUPERVGUI/SUPERVGUI_CanvasNode.cxx | 15 ++++++++++++--- src/SUPERVGUI/SUPERVGUI_Information.cxx | 10 ++++++++-- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/src/SUPERVGUI/SUPERVGUI_CanvasNode.cxx b/src/SUPERVGUI/SUPERVGUI_CanvasNode.cxx index 3eaa873..ce5d915 100644 --- a/src/SUPERVGUI/SUPERVGUI_CanvasNode.cxx +++ b/src/SUPERVGUI/SUPERVGUI_CanvasNode.cxx @@ -349,7 +349,8 @@ bool SUPERVGUI_CanvasNode::setNodeName(QString aName) { void SUPERVGUI_CanvasNode::rename() { QString aName = SalomeApp_NameDlg::getName( SUIT_Session::session()->activeApplication()->desktop(), myNode->Name() ); - if (!aName.isEmpty()) { + //mkr : modifications for fixing bug IPAL9972 + if (!aName.isEmpty() && aName.compare( myNode->Name() ) != 0) { setNodeName(aName); } } @@ -444,9 +445,17 @@ void SUPERVGUI_CanvasNode::stopRestart() { void SUPERVGUI_CanvasNode::changeInformation() { SUPERVGUI_Information* aDlg = new SUPERVGUI_Information(myNode, !myMain->isEditable()); if (aDlg->exec()) { + QString aName = myNode->Name(); - if (!aName.isEmpty() && myMain->isEditable()) - setNodeName(aName); + if (!aName.isEmpty() && myMain->isEditable()) { + //mkr : modifications for fixing bug IPAL9972 + //setNodeName(aName); + + setName(myNode->Name()); + getPrs()->updateInfo(); + // TODO: update name of all the links to this node + } + } delete aDlg; } diff --git a/src/SUPERVGUI/SUPERVGUI_Information.cxx b/src/SUPERVGUI/SUPERVGUI_Information.cxx index 0b6d820..b2fe0b2 100644 --- a/src/SUPERVGUI/SUPERVGUI_Information.cxx +++ b/src/SUPERVGUI/SUPERVGUI_Information.cxx @@ -278,14 +278,20 @@ QString SUPERVGUI_Information::date( SUPERV_Date d ) { */ void SUPERVGUI_Information::okButton() { Trace("SUPERVGUI_Information::okButton"); - myNode->SetName( nameV->text().latin1()); + //mkr : modifications for fixing bug IPAL9972 + bool aIsAccept = true; + if ( QString( myNode->Name() ).compare( nameV->text() ) != 0 ) + if ( !myNode->SetName( nameV->text().latin1()) ) { + QMessageBox::warning( SUIT_Session::session()->activeApplication()->desktop(), tr( "ERROR" ), tr( "MSG_CANT_RENAMENODE" ) ); + aIsAccept = false; + } myNode->SetAuthor( authV->text().latin1() ); if (myNode->IsFactory()) { SUPERV_FNode aFNode = SUPERV::FNode::_narrow(myNode); aFNode->SetContainer( contV->text().latin1() ); } myNode->SetComment( commV->text().latin1() ); - accept(); + if ( aIsAccept ) accept(); } /*! -- 2.39.2