From: ouv Date: Mon, 3 Sep 2007 09:49:15 +0000 (+0000) Subject: CTH16289 X-Git-Tag: CTH_V1_3~19 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=448b7b4a6e5dbec401f3ad4eb96b7af55209715c;p=modules%2Fgui.git CTH16289 --- diff --git a/src/LightApp/LightApp_Application.cxx b/src/LightApp/LightApp_Application.cxx index 4726b53a3..ca99cc1d6 100644 --- a/src/LightApp/LightApp_Application.cxx +++ b/src/LightApp/LightApp_Application.cxx @@ -125,7 +125,6 @@ #include #include #include -#include #include #include #include @@ -916,82 +915,52 @@ void LightApp_Application::updateCommandsStatus() } /*! - \class RunBrowser - Runs system command in separate thread +\class LightApp_RunBrowser +Runs system command in separate thread */ -class RunBrowser: public QThread { -public: - - RunBrowser( LightApp_Application* app, QString theApp, QString theParams, QString theHelpFile, QString theContext=NULL): - myApp(theApp), myParams(theParams), +LightApp_RunBrowser::LightApp_RunBrowser( LightApp_Application* app, + QString theApp, + QString theParams, + QString theHelpFile, + QString theContext ): + myApp(theApp), myParams(theParams), #ifdef WIN32 - myHelpFile("file://" + theHelpFile + theContext), + myHelpFile("file://" + theHelpFile + theContext), #else - myHelpFile("file:" + theHelpFile + theContext), + myHelpFile("file:" + theHelpFile + theContext), #endif - myStatus(0), - myLApp( app ) -{ -}; - - // virtual void run() - // { - // QString aCommand; - - // if ( !myApp.isEmpty()) - // { - //aCommand.sprintf("%s %s %s",myApp.latin1(),myParams.latin1(),myHelpFile.latin1()); - - //QProcess* proc = new QProcess(); - // proc->addArgument( aCommand ); - ////myStatus = system(aCommand); - - ////if(myStatus != 0) - //if(!proc->start()) - // { - // QCustomEvent* ce2000 = new QCustomEvent( 2000 ); - // QString* msg = new QString( QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").arg(myApp).arg(myHelpFile) ); - // ce2000->setData( msg ); - // postEvent( myLApp, ce2000 ); - // } - // } - // } - - virtual void run() - { - QString aCommand; + myStatus(0), + myLApp( app ) +{ +} - if ( !myApp.isEmpty()) - { - aCommand.sprintf("%s %s %s",myApp.latin1(),myParams.latin1(),myHelpFile.latin1()); - myStatus = system(aCommand); - if(myStatus != 0) - { - QCustomEvent* ce2000 = new QCustomEvent (2000); - postEvent (qApp, ce2000); - } - } +void LightApp_RunBrowser::run() +{ + QString aCommand; - if( myStatus != 0 || myApp.isEmpty()) - { - myParams = ""; - aCommand.sprintf("%s %s %s", QString(DEFAULT_BROWSER).latin1(),myParams.latin1(), myHelpFile.latin1()); - myStatus = system(aCommand); - if(myStatus != 0) - { - QCustomEvent* ce2001 = new QCustomEvent (2001); - postEvent (qApp, ce2001); - } - } + if ( !myApp.isEmpty()) + { + aCommand.sprintf("%s %s %s",myApp.latin1(),myParams.latin1(),myHelpFile.latin1()); + myStatus = system(aCommand); + if(myStatus != 0) + { + QCustomEvent* ce2000 = new QCustomEvent (2000); + postEvent (qApp, ce2000); + } } -private: - QString myApp; - QString myParams; - QString myHelpFile; - int myStatus; - LightApp_Application* myLApp; -}; + if( myStatus != 0 || myApp.isEmpty()) + { + myParams = ""; + aCommand.sprintf("%s %s %s", QString(DEFAULT_BROWSER).latin1(),myParams.latin1(), myHelpFile.latin1()); + myStatus = system(aCommand); + if(myStatus != 0) + { + QCustomEvent* ce2001 = new QCustomEvent (2001); + postEvent (qApp, ce2001); + } + } +} /*! SLOT: Displays help contents for choosen module @@ -1031,7 +1000,7 @@ void LightApp_Application::onHelpContentsModule() QString aParams = resMgr->stringValue("ExternalBrowser", "parameters"); if (!anApp.isEmpty()) { - RunBrowser* rs = new RunBrowser( this, anApp, aParams, helpFile ); + LightApp_RunBrowser* rs = new LightApp_RunBrowser( this, anApp, aParams, helpFile ); rs->start(); } else { @@ -1067,7 +1036,7 @@ void LightApp_Application::onHelpContextModule(const QString& theComponentName, QString aParams = resMgr->stringValue("ExternalBrowser", "parameters"); if (!anApp.isEmpty()) { - RunBrowser* rs = new RunBrowser( this, anApp, aParams, helpFile ); + LightApp_RunBrowser* rs = new LightApp_RunBrowser( this, anApp, aParams, helpFile ); rs->start(); } else { diff --git a/src/LightApp/LightApp_Application.h b/src/LightApp/LightApp_Application.h index 8f81e404f..f70724b03 100644 --- a/src/LightApp/LightApp_Application.h +++ b/src/LightApp/LightApp_Application.h @@ -49,6 +49,8 @@ class QWidget; class QStringList; class QPixmap; +#include + #ifdef WIN32 #pragma warning( disable:4251 ) #endif @@ -252,6 +254,25 @@ protected: static int lastStudyId; }; +/*! + \class LightApp_RunBrowser + Runs system command in separate thread +*/ +class LIGHTAPP_EXPORT LightApp_RunBrowser: public QThread { +public: + LightApp_RunBrowser( LightApp_Application*, QString, QString, QString, QString = NULL ); + +public: + virtual void run(); + +private: + QString myApp; + QString myParams; + QString myHelpFile; + int myStatus; + LightApp_Application* myLApp; +}; + #ifdef WIN32 #pragma warning( default:4251 ) #endif