diff options
Diffstat (limited to 'src/widgets/widgets/qtextbrowser.cpp')
-rw-r--r-- | src/widgets/widgets/qtextbrowser.cpp | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/src/widgets/widgets/qtextbrowser.cpp b/src/widgets/widgets/qtextbrowser.cpp index 61e7a5fbfb..e05da51207 100644 --- a/src/widgets/widgets/qtextbrowser.cpp +++ b/src/widgets/widgets/qtextbrowser.cpp @@ -3,7 +3,7 @@ ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the QtWidgets module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage @@ -151,12 +151,18 @@ public: QString QTextBrowserPrivate::findFile(const QUrl &name) const { QString fileName; - if (name.scheme() == QLatin1String("qrc")) + if (name.scheme() == QLatin1String("qrc")) { fileName = QLatin1String(":/") + name.path(); - else if (name.scheme().isEmpty()) + } else if (name.scheme().isEmpty()) { fileName = name.path(); - else - fileName = name.toLocalFile(); + } else { +#if defined(Q_OS_ANDROID) + if (name.scheme() == QLatin1String("assets")) + fileName = QLatin1String("assets:") + name.path(); + else +#endif + fileName = name.toLocalFile(); + } if (QFileInfo(fileName).isAbsolute()) return fileName; @@ -217,13 +223,14 @@ void QTextBrowserPrivate::_q_activateAnchor(const QString &href) textOrSourceChanged = false; #ifndef QT_NO_DESKTOPSERVICES - if ((openExternalLinks - && url.scheme() != QLatin1String("file") - && url.scheme() != QLatin1String("qrc") - && !url.isRelative()) - || (url.isRelative() && !currentURL.isRelative() - && currentURL.scheme() != QLatin1String("file") - && currentURL.scheme() != QLatin1String("qrc"))) { + bool isFileScheme = + url.scheme() == QLatin1String("file") +#if defined(Q_OS_ANDROID) + || url.scheme() == QLatin1String("assets") +#endif + || url.scheme() == QLatin1String("qrc"); + if ((openExternalLinks && !isFileScheme && !url.isRelative()) + || (url.isRelative() && !currentURL.isRelative() && !isFileScheme)) { QDesktopServices::openUrl(url); return; } |