diff options
author | Orcan Ogetbil <oget.fedora@gmail.com> | 2010-12-20 22:55:49 +0000 |
---|---|---|
committer | Orcan Ogetbil <oget.fedora@gmail.com> | 2010-12-20 22:55:49 +0000 |
commit | 1b01ff89a892df30494fa3d964c6b0acf179804a (patch) | |
tree | 8e71443314925d6a40634ce0c0cd4ec666af28d7 /muse2/muse/help.cpp | |
parent | e5a7a6f186c458e3c7087dbc5604959b519bdba9 (diff) |
Use the default browser of the system to open help pages. Added some groupboxes and layouts to genset.
Diffstat (limited to 'muse2/muse/help.cpp')
-rw-r--r-- | muse2/muse/help.cpp | 38 |
1 files changed, 9 insertions, 29 deletions
diff --git a/muse2/muse/help.cpp b/muse2/muse/help.cpp index 268449e6..30803838 100644 --- a/muse2/muse/help.cpp +++ b/muse2/muse/help.cpp @@ -9,8 +9,9 @@ #include <unistd.h> #include <stdlib.h> +#include <QDesktopServices> #include <QMessageBox> -#include <QProcess> +#include <QUrl> #include "app.h" #include "globals.h" @@ -25,9 +26,9 @@ void MusE::startHelpBrowser() { QString lang(getenv("LANG")); - QString museHelp = museGlobalShare + QString("/html/index_") + lang + QString(".html"); + QString museHelp = DOCDIR + QString("/html/index_") + lang + QString(".html"); if (access(museHelp.toLatin1(), R_OK) != 0) { - museHelp = museGlobalShare + QString("/html/index.html"); + museHelp = DOCDIR + QString("/html/index.html"); if (access(museHelp.toLatin1(), R_OK) != 0) { QString info(tr("no help found at: ")); info += museHelp; @@ -82,33 +83,12 @@ void MusE::aboutQt() void MusE::launchBrowser(QString &whereTo) { - char testStr[40]; - strcpy(testStr, "which "); - strcat(testStr, config.helpBrowser.toLatin1()); - if (config.helpBrowser == "" || system(testStr)) - { - QMessageBox::information( this, "Unable to launch help", - "For some reason MusE has failed to detect or launch\n" - "a browser on your machine. Please go to Settings->Global Settings->GUI\n" - "and insert the program name of your favourite browser.", - "Ok", - 0 ); - return; - } - - QString exe = QString("/bin/sh"); - if(QFile::exists(exe)) - { - // Orcan: Shall we use this instead? Opens the default browser of the user: - // QDesktopServices::openUrl(QUrl(whereTo)); - QStringList arguments; - arguments << "-c" << config.helpBrowser << whereTo; - QProcess helper; - helper.start(exe, arguments); - } - else + if (! QDesktopServices::openUrl(QUrl(whereTo))) { + QMessageBox::information(this, tr("Unable to launch help"), + tr("For some reason MusE has to launch the default\n" + "browser on your machine."), + QMessageBox::Ok, QMessageBox::Ok); printf("Unable to launch help\n"); } - } |