forked from qt-creator/qt-creator
Help: move global constants
Global constants that are used only in one place could live just there. Change-Id: Ibee751b6ccc4fb0d35a8e708995730991becd749 Reviewed-by: Karsten Heimrich <karsten.heimrich@digia.com>
This commit is contained in:
@@ -1168,8 +1168,8 @@ void HelpPlugin::handleHelpRequest(const QUrl &url)
|
|||||||
|
|
||||||
QString address = url.toString();
|
QString address = url.toString();
|
||||||
if (!Core::HelpManager::instance()->findFile(url).isValid()) {
|
if (!Core::HelpManager::instance()->findFile(url).isValid()) {
|
||||||
if (address.startsWith(HelpViewer::NsNokia)
|
if (address.startsWith(QLatin1String("qthelp://com.nokia."))
|
||||||
|| address.startsWith(HelpViewer::NsTrolltech)) {
|
|| address.startsWith(QLatin1String("qthelp://com.trolltech."))) {
|
||||||
// local help not installed, resort to external web help
|
// local help not installed, resort to external web help
|
||||||
QString urlPrefix = QLatin1String("http://doc.qt.digia.com/");
|
QString urlPrefix = QLatin1String("http://doc.qt.digia.com/");
|
||||||
if (url.authority() == QLatin1String("com.nokia.qtcreator"))
|
if (url.authority() == QLatin1String("com.nokia.qtcreator"))
|
||||||
|
|||||||
@@ -48,18 +48,6 @@
|
|||||||
|
|
||||||
using namespace Help::Internal;
|
using namespace Help::Internal;
|
||||||
|
|
||||||
const QString HelpViewer::NsNokia = QLatin1String("qthelp://com.nokia.");
|
|
||||||
const QString HelpViewer::NsTrolltech = QLatin1String("qthelp://com.trolltech.");
|
|
||||||
|
|
||||||
const QString HelpViewer::AboutBlankPage =
|
|
||||||
QCoreApplication::translate("HelpViewer", "<title>about:blank</title>");
|
|
||||||
|
|
||||||
const QString HelpViewer::PageNotFoundMessage =
|
|
||||||
QCoreApplication::translate("HelpViewer", "<html><head><meta http-equiv=\""
|
|
||||||
"content-type\" content=\"text/html; charset=UTF-8\"><title>Error 404...</title>"
|
|
||||||
"</head><body><div align=\"center\"><br><br><h1>The page could not be found</h1>"
|
|
||||||
"<br><h3>'%1'</h3></div></body>");
|
|
||||||
|
|
||||||
struct ExtensionMap {
|
struct ExtensionMap {
|
||||||
const char *extension;
|
const char *extension;
|
||||||
const char *mimeType;
|
const char *mimeType;
|
||||||
|
|||||||
@@ -85,11 +85,6 @@ public:
|
|||||||
bool findText(const QString &text, Find::FindFlags flags,
|
bool findText(const QString &text, Find::FindFlags flags,
|
||||||
bool incremental, bool fromSearch, bool *wrapped = 0);
|
bool incremental, bool fromSearch, bool *wrapped = 0);
|
||||||
|
|
||||||
static const QString NsNokia;
|
|
||||||
static const QString NsTrolltech;
|
|
||||||
static const QString AboutBlankPage;
|
|
||||||
static const QString PageNotFoundMessage;
|
|
||||||
|
|
||||||
static bool isLocalUrl(const QUrl &url);
|
static bool isLocalUrl(const QUrl &url);
|
||||||
static bool canOpenPage(const QString &url);
|
static bool canOpenPage(const QString &url);
|
||||||
static QString mimeFromUrl(const QUrl &url);
|
static QString mimeFromUrl(const QUrl &url);
|
||||||
|
|||||||
@@ -168,8 +168,14 @@ void HelpViewer::setSource(const QUrl &url)
|
|||||||
}
|
}
|
||||||
|
|
||||||
QTextBrowser::setSource(url);
|
QTextBrowser::setSource(url);
|
||||||
setHtml(string == Help::Constants::AboutBlank ? AboutBlankPage
|
setHtml(string == Help::Constants::AboutBlank
|
||||||
: PageNotFoundMessage.arg(url.toString()));
|
? HelpViewer::tr("<title>about:blank</title>")
|
||||||
|
: HelpViewer::tr("<html><head><meta http-equiv=\""
|
||||||
|
"content-type\" content=\"text/html; charset=UTF-8\"><title>Error 404...</title>"
|
||||||
|
"</head><body><div align=\"center\"><br><br><h1>The page could not be found</h1>"
|
||||||
|
"<br><h3>'%1'</h3></div></body>")
|
||||||
|
.arg(url.toString()));
|
||||||
|
|
||||||
emit loadFinished(true);
|
emit loadFinished(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user