forked from qt-creator/qt-creator
Allow http request to be opened in the help plugin.
Reviewed-by: ck
This commit is contained in:
@@ -818,16 +818,8 @@ void HelpPlugin::handleHelpRequest(const QUrl &url)
|
||||
if (HelpViewer::launchWithExternalApp(url))
|
||||
return;
|
||||
|
||||
if (Core::HelpManager::instance()->findFile(url).isValid()) {
|
||||
if (url.queryItemValue(QLatin1String("view")) == QLatin1String("split")) {
|
||||
if (HelpViewer* viewer = viewerForContextMode())
|
||||
viewer->setSource(url);
|
||||
} else {
|
||||
activateHelpMode();
|
||||
m_centralWidget->setSource(url);
|
||||
}
|
||||
} else {
|
||||
QString address = url.toString();
|
||||
QString address = url.toString();
|
||||
if (!Core::HelpManager::instance()->findFile(url).isValid()) {
|
||||
if (address.startsWith(HelpViewer::NsNokia)
|
||||
|| address.startsWith(HelpViewer::NsTrolltech)) {
|
||||
// local help not installed, resort to external web help
|
||||
@@ -839,7 +831,15 @@ void HelpPlugin::handleHelpRequest(const QUrl &url)
|
||||
}
|
||||
address = urlPrefix + address.mid(address.lastIndexOf(QLatin1Char('/')));
|
||||
}
|
||||
QDesktopServices::openUrl(address);
|
||||
}
|
||||
|
||||
const QUrl newUrl(address);
|
||||
if (newUrl.queryItemValue(QLatin1String("view")) == QLatin1String("split")) {
|
||||
if (HelpViewer* viewer = viewerForContextMode())
|
||||
viewer->setSource(newUrl);
|
||||
} else {
|
||||
activateHelpMode();
|
||||
m_centralWidget->setSource(newUrl);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -147,8 +147,6 @@ bool HelpViewer::launchWithExternalApp(const QUrl &url)
|
||||
actualTmpFile.close();
|
||||
return QDesktopServices::openUrl(QUrl(actualTmpFile.fileName()));
|
||||
}
|
||||
} else if (url.scheme() == QLatin1String("http")) {
|
||||
return QDesktopServices::openUrl(url);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@@ -144,6 +144,13 @@ QUrl HelpViewer::source() const
|
||||
|
||||
void HelpViewer::setSource(const QUrl &url)
|
||||
{
|
||||
const QString &scheme = url.scheme();
|
||||
if (scheme != QLatin1String("qthelp") && scheme != QLatin1String("about")) {
|
||||
QTextBrowser::setSource(resolvedUrl);
|
||||
emit loadFinished(true);
|
||||
return;
|
||||
}
|
||||
|
||||
const QString &string = url.toString();
|
||||
if (url.isValid() && string != QLatin1String("help")) {
|
||||
if (launchWithExternalApp(url))
|
||||
|
@@ -121,9 +121,13 @@ HelpNetworkAccessManager::HelpNetworkAccessManager(QObject *parent)
|
||||
{
|
||||
}
|
||||
|
||||
QNetworkReply *HelpNetworkAccessManager::createRequest(Operation /*op*/,
|
||||
const QNetworkRequest &request, QIODevice* /*outgoingData*/)
|
||||
QNetworkReply *HelpNetworkAccessManager::createRequest(Operation op,
|
||||
const QNetworkRequest &request, QIODevice* outgoingData)
|
||||
{
|
||||
const QString &scheme = request.url().scheme();
|
||||
if (scheme != QLatin1String("qthelp") && scheme != QLatin1String("about"))
|
||||
return QNetworkAccessManager::createRequest(op, request, outgoingData);
|
||||
|
||||
QString url = request.url().toString();
|
||||
const QHelpEngineCore &engine = LocalHelpManager::helpEngine();
|
||||
// TODO: For some reason the url to load is already wrong (passed from webkit)
|
||||
|
Reference in New Issue
Block a user