1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 01:22:10 +01:00

Register custom schemes with QtWebEngine 5.12

This commit is contained in:
David Rosca 2019-02-14 08:53:27 +01:00
parent b508ed2260
commit eac5673656
No known key found for this signature in database
GPG Key ID: EBC3FC294452C6D8

View File

@ -40,12 +40,29 @@
#include <QNetworkProxy>
#include <QWebEngineProfile>
#include <QWebEngineCertificateError>
#include <QtWebEngineWidgetsVersion>
#if QTWEBENGINEWIDGETS_VERSION >= QT_VERSION_CHECK(5, 12, 0)
#include <QWebEngineUrlScheme>
#endif
NetworkManager::NetworkManager(QObject *parent)
: QNetworkAccessManager(parent)
{
// Create scheme handlers
m_extensionScheme = new ExtensionSchemeManager();
#if QTWEBENGINEWIDGETS_VERSION >= QT_VERSION_CHECK(5, 12, 0)
QWebEngineUrlScheme falkonScheme("falkon");
falkonScheme.setFlags(QWebEngineUrlScheme::SecureScheme | QWebEngineUrlScheme::ContentSecurityPolicyIgnored);
falkonScheme.setSyntax(QWebEngineUrlScheme::Syntax::Path);
QWebEngineUrlScheme::registerScheme(falkonScheme);
QWebEngineUrlScheme extensionScheme("extension");
extensionScheme.setFlags(QWebEngineUrlScheme::SecureScheme | QWebEngineUrlScheme::ContentSecurityPolicyIgnored);
extensionScheme.setSyntax(QWebEngineUrlScheme::Syntax::Path);
QWebEngineUrlScheme::registerScheme(extensionScheme);
#endif
mApp->webProfile()->installUrlSchemeHandler(QByteArrayLiteral("falkon"), new FalkonSchemeHandler());
mApp->webProfile()->installUrlSchemeHandler(QByteArrayLiteral("extension"), m_extensionScheme);
WebPage::addSupportedScheme(QSL("falkon"));