From 862471aa5b1ba05e1faf248cec786fcf234ecc07 Mon Sep 17 00:00:00 2001 From: jfa Date: Thu, 15 Dec 2005 13:56:05 +0000 Subject: [PATCH] Fix for bug 10938: 'Copy', 'Paste' are active after application start. --- src/SalomeApp/SalomeApp_Application.cxx | 50 +++++++++++-------------- 1 file changed, 21 insertions(+), 29 deletions(-) diff --git a/src/SalomeApp/SalomeApp_Application.cxx b/src/SalomeApp/SalomeApp_Application.cxx index b985f077d..690b13b52 100644 --- a/src/SalomeApp/SalomeApp_Application.cxx +++ b/src/SalomeApp/SalomeApp_Application.cxx @@ -348,41 +348,33 @@ void SalomeApp_Application::onSelectionChanged() LightApp_SelectionMgr* mgr = selectionMgr(); mgr->selectedObjects(list); - SalomeApp_Study* study = dynamic_cast(activeStudy()); - if(study == NULL) return; + bool canCopy = false; + bool canPaste = false; - _PTR(Study) stdDS = study->studyDS(); - if(!stdDS) return; + SalomeApp_Study* study = dynamic_cast(activeStudy()); + if (study != NULL) { + _PTR(Study) stdDS = study->studyDS(); - QAction* qaction; + if (stdDS) { + SALOME_ListIteratorOfListIO it ( list ); - SALOME_ListIteratorOfListIO it( list ); - if(it.More() && list.Extent() == 1) - { - _PTR(SObject) so = stdDS->FindObjectID(it.Value()->getEntry()); + if (it.More() && list.Extent() == 1) { + _PTR(SObject) so = stdDS->FindObjectID(it.Value()->getEntry()); - qaction = action(EditCopyId); - if( so ) { - SALOMEDS_SObject* aSO = dynamic_cast(so.get()); - if ( aSO && studyMgr()->CanCopy(so) ) qaction->setEnabled(true); - else qaction->setEnabled(false); - } - else qaction->setEnabled(false); + if ( so ) { + SALOMEDS_SObject* aSO = dynamic_cast(so.get()); - qaction = action(EditPasteId); - if( so ) { - SALOMEDS_SObject* aSO = dynamic_cast(so.get()); - if( aSO && studyMgr()->CanPaste(so) ) qaction->setEnabled(true); - else qaction->setEnabled(false); - } - else qaction->setEnabled(false); - } - else { - qaction = action(EditCopyId); - qaction->setEnabled(false); - qaction = action(EditPasteId); - qaction->setEnabled(false); + if ( aSO ) { + canCopy = studyMgr()->CanCopy(so); + canPaste = studyMgr()->CanPaste(so); + } + } + } + } } + + action(EditCopyId)->setEnabled(canCopy); + action(EditPasteId)->setEnabled(canPaste); } /*!Delete references.*/ -- 2.39.2