aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/help/textbrowserhelpviewer.cpp
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@digia.com>2014-06-17 15:37:40 +0200
committerEike Ziller <eike.ziller@digia.com>2014-06-18 12:09:12 +0200
commitbe68fe7f4a73c0ca51258fd3ae8d907da6ffc55a (patch)
treec9f73e13db1a6ca7bd073885da992db1427ac65c /src/plugins/help/textbrowserhelpviewer.cpp
parent46cdd910242f1ba155c66096d2ba11f7a61ec53d (diff)
Help: Unify help content loading and error message.
Task-number: QTCREATORBUG-12352 Change-Id: If74453e75cc8eaf27c114d0976099388be778fa6 Reviewed-by: Karsten Heimrich <karsten.heimrich@digia.com>
Diffstat (limited to 'src/plugins/help/textbrowserhelpviewer.cpp')
-rw-r--r--src/plugins/help/textbrowserhelpviewer.cpp46
1 files changed, 6 insertions, 40 deletions
diff --git a/src/plugins/help/textbrowserhelpviewer.cpp b/src/plugins/help/textbrowserhelpviewer.cpp
index 4b8735c7f48..832af0d6aa7 100644
--- a/src/plugins/help/textbrowserhelpviewer.cpp
+++ b/src/plugins/help/textbrowserhelpviewer.cpp
@@ -122,36 +122,11 @@ QUrl TextBrowserHelpViewer::source() const
void TextBrowserHelpViewer::setSource(const QUrl &url)
{
- const QString &string = url.toString();
- if (url.isValid() && string != QLatin1String("help")) {
- if (launchWithExternalApp(url))
- return;
-
- QUrl resolvedUrl;
- if (url.scheme() == QLatin1String("http"))
- resolvedUrl = url;
-
- if (!resolvedUrl.isValid()) {
- const QHelpEngineCore &engine = LocalHelpManager::helpEngine();
- resolvedUrl = engine.findFile(url);
- }
-
- if (resolvedUrl.isValid()) {
- m_textBrowser->setSource(resolvedUrl);
- slotLoadFinished();
- return;
- }
- }
+ if (launchWithExternalApp(url))
+ return;
+ slotLoadStarted();
m_textBrowser->setSource(url);
- m_textBrowser->setHtml(string == Help::Constants::AboutBlank
- ? 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></html>")
- .arg(url.toString()));
-
slotLoadFinished();
}
@@ -321,18 +296,9 @@ TextBrowserHelpWidget::TextBrowserHelpWidget(int zoom, TextBrowserHelpViewer *pa
QVariant TextBrowserHelpWidget::loadResource(int type, const QUrl &name)
{
- QByteArray ba;
- if (type < 4) {
- const QHelpEngineCore &engine = LocalHelpManager::helpEngine();
- ba = engine.fileData(name);
- if (name.toString().endsWith(QLatin1String(".svg"), Qt::CaseInsensitive)) {
- QImage image;
- image.loadFromData(ba, "svg");
- if (!image.isNull())
- return image;
- }
- }
- return ba;
+ if (type < 4)
+ return LocalHelpManager::helpData(name).data;
+ return QByteArray();
}
bool TextBrowserHelpWidget::hasAnchorAt(const QPoint &pos)