From 3aadeb6f1103a5559f33df18a53f2eb0c762df37 Mon Sep 17 00:00:00 2001 From: nds Date: Tue, 13 Dec 2005 06:34:15 +0000 Subject: [PATCH] If no browser is set when requesting help, displayed message for define another browser in preferences --- src/LightApp/LightApp_Application.cxx | 35 +++++++++++------------ src/LightApp/resources/LightApp_msg_en.po | 6 ++++ 2 files changed, 23 insertions(+), 18 deletions(-) diff --git a/src/LightApp/LightApp_Application.cxx b/src/LightApp/LightApp_Application.cxx index 88f104dbe..b630aed9d 100644 --- a/src/LightApp/LightApp_Application.cxx +++ b/src/LightApp/LightApp_Application.cxx @@ -77,12 +77,7 @@ #include #include #include - -#ifdef WIN32 -#define DEFAULT_BROWSER "start iexplore.exe" -#else -#define DEFAULT_BROWSER "mozilla" -#endif +#include #define FIRST_HELP_ID 1000000 @@ -778,17 +773,13 @@ public: postEvent (qApp, ce2000); } } - - if( myStatus != 0 || myApp.isEmpty()) + if( myStatus != 0) { - 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); - } + qApp->lock(); + SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), + QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").arg(myApp).arg(myHelpFile), + QObject::tr("BUT_OK")); + qApp->unlock(); } } @@ -819,8 +810,15 @@ void LightApp_Application::onHelpContentsModule() QString anApp = resMgr->stringValue("ExternalBrowser", "application"); QString aParams = resMgr->stringValue("ExternalBrowser", "parameters"); - RunBrowser* rs = new RunBrowser(anApp, aParams, helpFile); - rs->start(); + if (!anApp.isEmpty()) { + RunBrowser* rs = new RunBrowser(anApp, aParams, helpFile); + rs->start(); + } + else { + SUIT_MessageBox::warn1(desktop(), tr("WRN_WARNING"), + tr("DEFINE_EXTERNAL_BROWSER"), + tr("BUT_OK")); + } } /*!Sets enable or disable some actions on selection changed.*/ @@ -1475,6 +1473,7 @@ void LightApp_Application::createPreferences( LightApp_Preferences* pref ) int apppref = pref->addPreference( tr( "PREF_APP" ), extgroup, LightApp_Preferences::File, "ExternalBrowser", "application" ); pref->setItemProperty( apppref, "existing", true ); pref->setItemProperty( apppref, "flags", QFileInfo::ExeUser ); + pref->setItemProperty( apppref, "readOnly", false ); pref->addPreference( tr( "PREF_PARAM" ), extgroup, LightApp_Preferences::String, "ExternalBrowser", "parameters" ); diff --git a/src/LightApp/resources/LightApp_msg_en.po b/src/LightApp/resources/LightApp_msg_en.po index c272e8fc2..1c4443353 100644 --- a/src/LightApp/resources/LightApp_msg_en.po +++ b/src/LightApp/resources/LightApp_msg_en.po @@ -80,6 +80,12 @@ msgstr "VT&K view" msgid "LightApp_Application::INF_CANCELLED" msgstr "Module activation cancelled" +msgid "EXTERNAL_BROWSER_CANNOT_SHOW_PAGE" +msgstr "External browser \"%1\" can not show help page \"%2\"" + +msgid "LightApp_Application::DEFINE_EXTERNAL_BROWSER" +msgstr "Define external browser in preferences" + msgid "LightApp_Application::DATA_MODELS" msgstr "Data models" -- 2.39.2