X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGuiHelpers%2FStandardApp_Module.cxx;h=380beaad9ec228ccccec6a2798e82eea7d7e2a30;hb=8091ffdec0e55752a16ec4d46ac1b944fc1e1ddf;hp=8917f75feae8ea49b4462961209c9f0ffa595393;hpb=5591003bbd7a8bb88d87944015ecb01243ffce99;p=modules%2Fgui.git diff --git a/src/GuiHelpers/StandardApp_Module.cxx b/src/GuiHelpers/StandardApp_Module.cxx index 8917f75fe..380beaad9 100644 --- a/src/GuiHelpers/StandardApp_Module.cxx +++ b/src/GuiHelpers/StandardApp_Module.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2011-2014 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2011-2021 CEA/DEN, EDF R&D, OPEN CASCADE // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -20,6 +20,8 @@ #include "StandardApp_Module.hxx" +#include "SALOME_GuiServices.hxx" + #include #include #include @@ -136,9 +138,9 @@ int StandardApp_Module::createStandardAction(const QString& label, } // Creating the action - QAction * action= this->createAction( effIdentifier, label, actionIcon, - label, effToolTip, 0, getApp()->desktop(), - false, slotobject, slotmember); + this->createAction( effIdentifier, label, actionIcon, + label, effToolTip, 0, getApp()->desktop(), + false, slotobject, slotmember); return effIdentifier; } @@ -169,14 +171,17 @@ void StandardApp_Module::addActionInMenubar(int actionId, int menuId) { * Add the specified action as an item in the popup menu, with the * specified visible rule. The default is "visible for object browser". */ -void StandardApp_Module::addActionInPopupMenu(int actionId,const QString& rule) { +void StandardApp_Module::addActionInPopupMenu(int actionId,const QString& menus,const QString& rule) { // _GBO_ for a fine customization of the rule (for example with a // test on the type of the selected object), see the LIGTH module: // implement "LightApp_Selection* createSelection() const;" int parentId = -1; QtxPopupMgr* mgr = this->popupMgr(); this->action( actionId )->setIconVisibleInMenu(true); - mgr->insert ( this->action( actionId ), parentId, 0 ); + if (! menus.isEmpty()) + mgr->insert ( this->action( actionId ), menus, parentId, 0 ); + else + mgr->insert ( this->action( actionId ), parentId, 0 ); mgr->setRule( this->action( actionId ), rule, QtxPopupMgr::VisibleRule ); } @@ -276,7 +281,7 @@ bool StandardApp_Module::activateModule( SUIT_Study* theStudy ) setToolShown( true ); if ( this->createStudyComponentAtActivation() ) { - this->createStudyComponent(theStudy); + this->createStudyComponent(); } return bOk; @@ -298,12 +303,9 @@ bool StandardApp_Module::createStudyComponentAtActivation() { * the module. This component is associated to the engine (return by * getEngine()) if the engine is a SALOMEDS::Driver. */ -void StandardApp_Module::createStudyComponent(SUIT_Study* theStudy) { +void StandardApp_Module::createStudyComponent() { - SALOME_NamingService *aNamingService = SalomeApp_Application::namingService(); - CORBA::Object_var aSMObject = aNamingService->Resolve("/myStudyManager"); - SALOMEDS::StudyManager_var aStudyManager = SALOMEDS::StudyManager::_narrow(aSMObject); - SALOMEDS::Study_var aDSStudy = aStudyManager->GetStudyByID(theStudy->id()); + SALOMEDS::Study_var aDSStudy = GUI::getStudyServant(); SALOMEDS::SComponent_var aFather = aDSStudy->FindComponent(QCHARSTAR(moduleName())); if (aFather->_is_nil())