From: admin Date: Mon, 21 Dec 2009 10:52:37 +0000 (+0000) Subject: This commit was generated by cvs2git to create tag 'WSDL_Dev_V1'. X-Git-Tag: WSDL_Dev_V1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=3ac9ec77c31676175426c43cf72ee48c223d18db;p=modules%2Fgui.git This commit was generated by cvs2git to create tag 'WSDL_Dev_V1'. Sprout from V5_1_main 2009-12-18 11:16:45 UTC vsr 'Merge from BR_PARAVIS_DEV 17/12/2009' Cherrypick from V5_1_main 2009-12-21 10:52:35 UTC adv 'Improve HELP system: allow customize help items for modules': src/LightApp/LightApp_Application.cxx --- diff --git a/src/LightApp/LightApp_Application.cxx b/src/LightApp/LightApp_Application.cxx index ca407cac2..46d71f48f 100644 --- a/src/LightApp/LightApp_Application.cxx +++ b/src/LightApp/LightApp_Application.cxx @@ -82,6 +82,7 @@ #include #include #include +#include #include @@ -480,22 +481,48 @@ void LightApp_Application::createActions() if ( aModule.isEmpty() ) // module title (user name) continue; QString modName = moduleName( aModule ); // module name + IMap paramValue; if ( modName.isEmpty() ) modName = aModule; // for KERNEL and GUI QString rootDir = QString( "%1_ROOT_DIR" ).arg( modName ); // module root dir variable QString modDir = getenv( rootDir.toLatin1().constData() ); // module root dir - if ( !modDir.isEmpty() ) { + + QString docSection; + if (resMgr->hasValue( modName, "documentation" ) ) + docSection = resMgr->stringValue(modName, "documentation"); + else if ( resMgr->hasSection( modName + "_documentation" ) ) + docSection = modName + "_documentation"; + if ( !docSection.isEmpty() ) { + QStringList listOfParam = resMgr->parameters( docSection ); + foreach( QString paramName, listOfParam ){ + QString valueStr = resMgr->stringValue( docSection, paramName ); + if ( !valueStr.isEmpty() ) { + QFileInfo fi( valueStr ); + if ( fi.isRelative() && !modDir.isEmpty() ) + valueStr = Qtx::addSlash( modDir ) + valueStr; + if ( QFile::exists( valueStr ) ) + paramValue.insert( paramName, valueStr ); + } + } + } + + if ( paramValue.isEmpty() && !modDir.isEmpty() ) { QStringList idxLst = QStringList() << modDir << "share" << "doc" << "salome" << "gui" << modName << "index.html"; QString indexFile = idxLst.join( QDir::separator() ); // index file - if ( QFile::exists( indexFile ) ) { - QAction* a = createAction( id, tr( "%1 Help" ).arg( aModule ), - resMgr->loadPixmap( "STD", tr( "ICON_HELP" ), false ), - tr( "%1 Help" ).arg( aModule ), - tr( "%1 Help" ).arg( aModule ), - 0, desk, false, this, SLOT( onHelpContentsModule() ) ); - a->setData( indexFile ); - createMenu( a, helpModuleMenu, -1 ); - id++; - } + if ( QFile::exists( indexFile ) ) + paramValue.insert( tr( "%1 Help" ).arg( aModule ), indexFile ); + } + + IMapConstIterator fileIt; + for ( fileIt = paramValue.begin(); fileIt != paramValue.end(); fileIt++ ) { + QString helpFileName = fileIt.key(); + QString helpFilePath = fileIt.value(); + QAction* a = createAction( id, helpFileName, + resMgr->loadPixmap( "STD", tr( "ICON_HELP" ), false ), + helpFileName, helpFileName, + 0, desk, false, this, SLOT( onHelpContentsModule() ) ); + a->setData( helpFilePath ); + createMenu( a, helpModuleMenu, -1 ); + id++; } }