From: nri Date: Mon, 19 May 2003 08:01:46 +0000 (+0000) Subject: NRI : Use component username from Catalog. X-Git-Tag: Start-v1_1a~6 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=c814e553dc10974f77928e5e559bf718bf458017;p=modules%2Fsuperv.git NRI : Use component username from Catalog. --- diff --git a/src/SUPERVGUI/SUPERVGUI.cxx b/src/SUPERVGUI/SUPERVGUI.cxx index 16526a3..ecc765b 100644 --- a/src/SUPERVGUI/SUPERVGUI.cxx +++ b/src/SUPERVGUI/SUPERVGUI.cxx @@ -474,7 +474,8 @@ void SUPERVGUI::whatIsSelected(const Handle(SALOME_InteractiveObject)& theObj, b if (comp->FindAttribute(anAttr, "AttributeName")) { aName = SALOMEDS::AttributeName::_narrow(anAttr); QString compName(aName->Value()); - if (compName.compare(STUDY_SUPERVISION) == 0) { + // if (compName.compare(STUDY_SUPERVISION) == 0) { + if (compName.compare( QAD_Application::getDesktop()->getComponentUserName( "SUPERV" ) ) == 0) { SALOMEDS::GenericAttribute_var anAttr; if (obj->FindAttribute(anAttr, "AttributeIOR")) { SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); diff --git a/src/SUPERVGUI/SUPERVGUI_Def.h b/src/SUPERVGUI/SUPERVGUI_Def.h index 64ae50c..f202f59 100644 --- a/src/SUPERVGUI/SUPERVGUI_Def.h +++ b/src/SUPERVGUI/SUPERVGUI_Def.h @@ -12,7 +12,7 @@ // Nom du noeud de supervision dans l'etude // ---------------------------------------- -#define STUDY_SUPERVISION "Supervision" +#define STUDY_SUPERVISION "SUPERV" #define STUDY_PORT_IN "In" #define STUDY_PORT_OUT "Out" diff --git a/src/SUPERVGUI/SUPERVGUI_Main.cxx b/src/SUPERVGUI/SUPERVGUI_Main.cxx index f156749..74595fb 100644 --- a/src/SUPERVGUI/SUPERVGUI_Main.cxx +++ b/src/SUPERVGUI/SUPERVGUI_Main.cxx @@ -713,7 +713,8 @@ void SUPERVGUI_Main::showPopup(QPopupMenu* p, QMouseEvent* e) { // To check is Supervision active? if (myIsLocked) return; - if (QAD_Application::getDesktop()->getActiveComponent().compare(STUDY_SUPERVISION) !=0) return; + // if (QAD_Application::getDesktop()->getActiveComponent().compare(STUDY_SUPERVISION) !=0) return; + if (QAD_Application::getDesktop()->getActiveComponent().compare( QAD_Application::getDesktop()->getComponentUserName( "SUPERV" ) ) !=0) return; checkIsInStudy(); if (e->button() == RightButton) { @@ -884,7 +885,7 @@ bool SUPERVGUI_Main::putDataStudy(SUPERV_Port p, const char* inout) { aComponent = aBuilder->NewComponent(STUDY_SUPERVISION); anAttr = aBuilder->FindOrCreateAttribute(aComponent, "AttributeName"); aName = SALOMEDS::AttributeName::_narrow(anAttr); - aName->SetValue(STUDY_SUPERVISION); + aName->SetValue( QAD_Application::getDesktop()->getComponentUserName( "SUPERV" ) ); anAttr = aBuilder->FindOrCreateAttribute(aComponent, "AttributePixMap"); aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr); diff --git a/src/Supervision/SuperV_Impl.cxx b/src/Supervision/SuperV_Impl.cxx index 7f656a0..92cd325 100644 --- a/src/Supervision/SuperV_Impl.cxx +++ b/src/Supervision/SuperV_Impl.cxx @@ -30,7 +30,7 @@ using namespace std; #include "Utils_CorbaException.hxx" -#define STUDY_SUPERVISION "Supervision" +#define STUDY_SUPERVISION "SUPERV" SuperV_Impl::SuperV_Impl( CORBA::ORB_ptr orb , PortableServer::POA_ptr poa , @@ -162,7 +162,7 @@ void SuperV_Impl::Close(SALOMEDS::SComponent_ptr theComponent) { } char* SuperV_Impl::ComponentDataType() { - return(strdup("Supervision")); + return(strdup("SUPERV")); } char* SuperV_Impl::IORToLocalPersistentID(SALOMEDS::SObject_ptr theSObject, @@ -239,8 +239,16 @@ SALOMEDS::SObject_ptr SuperV_Impl::PublishInStudy(SALOMEDS::Study_ptr theStudy, aFather = aBuilder->NewComponent(STUDY_SUPERVISION); anAttr = aBuilder->FindOrCreateAttribute(aFather, "AttributeName"); aName = SALOMEDS::AttributeName::_narrow(anAttr); - aName->SetValue(STUDY_SUPERVISION); - + //NRI aName->SetValue(STUDY_SUPERVISION); + + SALOME_NamingService *NamingService = new SALOME_NamingService(_Orb); + CORBA::Object_var objVarN = NamingService->Resolve("/Kernel/ModulCatalog"); + SALOME_ModuleCatalog::ModuleCatalog_var Catalogue = SALOME_ModuleCatalog::ModuleCatalog::_narrow(objVarN); + SALOME_ModuleCatalog::Acomponent_var Comp = Catalogue->GetComponent( STUDY_SUPERVISION ); + if ( !Comp->_is_nil() ) { + aName->SetValue( Comp->componentusername() ); + } + anAttr = aBuilder->FindOrCreateAttribute(aFather, "AttributePixMap"); aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr); aPixmap->SetPixMap( "ICON_OBJBROWSER_Supervision" );