From: srn Date: Fri, 17 Jun 2005 09:30:19 +0000 (+0000) Subject: BugID IPAL8989: Changed method onSelectionChanged X-Git-Tag: T3_0_0_a4~88 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=f43c6c9e18b56c8cd8b8bc09b2a97e9108aaee23;p=modules%2Fgui.git BugID IPAL8989: Changed method onSelectionChanged --- diff --git a/src/SalomeApp/SalomeApp_Application.cxx b/src/SalomeApp/SalomeApp_Application.cxx index 467b1ff55..d9b61e94e 100644 --- a/src/SalomeApp/SalomeApp_Application.cxx +++ b/src/SalomeApp/SalomeApp_Application.cxx @@ -74,6 +74,9 @@ #include "SALOMEDS_StudyManager.hxx" +#include "SALOME_ListIteratorOfListIO.hxx" +#include "SALOME_ListIO.hxx" + #define OBJECT_BROWSER_WIDTH 300 static const char* imageEmptyIcon[] = { @@ -479,7 +482,51 @@ void SalomeApp_Application::onSelection() void SalomeApp_Application::onSelectionChanged() { -} + /* + SalomeApp_Module* module = dynamic_cast(activeModule()); + if(module == NULL) return; + + QString ior = module->engineIOR(); + if(ior.length() < 5) return; //Not a real CORBA IOR + CORBA::Object_var obj = orb()->string_to_object(ior.latin1()); + if(CORBA::is_nil(obj)) return; + + SALOMEDS::Driver_var engine = SALOMEDS::Driver::_narrow(obj); + if(CORBA::is_nil(engine)) return; +*/ + + SALOME_ListIO list; + SalomeApp_SelectionMgr* mgr = selectionMgr(); + mgr->selectedObjects(list); + + SalomeApp_Study* study = dynamic_cast(activeStudy()); + if(study == NULL) return; + + _PTR(Study) stdDS = study->studyDS(); + if(!stdDS) return; + + QAction* qaction; + + for ( SALOME_ListIteratorOfListIO it( list ); it.More(); it.Next() ) + { + _PTR(SObject) so = stdDS->FindObjectID(it.Value()->getEntry()); + qaction = action(EditCutId); + if( studyMgr()->CanCopy(so) ) { + qaction->setEnabled(true); + qaction = action(EditCopyId); + qaction->setEnabled(true); + } + else { + qaction->setEnabled(false); + qaction = action(EditCopyId); + qaction->setEnabled(false); + } + qaction = action(EditPasteId); + if( studyMgr()->CanPaste(so) ) qaction->setEnabled(true); + else qaction->setEnabled(false); + } +} + void SalomeApp_Application::onAboutRefresh() { @@ -538,6 +585,13 @@ void SalomeApp_Application::updateCommandsStatus() a = action( PropertiesId ); if( a ) a->setEnabled( activeStudy() ); + + a = action(EditCutId); + a->setEnabled(false); + a = action(EditCopyId); + a->setEnabled(false); + a = action(EditPasteId); + a->setEnabled(false); } //=======================================================================