mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 18:56:34 +01:00
Register custom schemes with QtWebEngine 5.12
This commit is contained in:
parent
b508ed2260
commit
eac5673656
@ -40,12 +40,29 @@
|
|||||||
#include <QNetworkProxy>
|
#include <QNetworkProxy>
|
||||||
#include <QWebEngineProfile>
|
#include <QWebEngineProfile>
|
||||||
#include <QWebEngineCertificateError>
|
#include <QWebEngineCertificateError>
|
||||||
|
#include <QtWebEngineWidgetsVersion>
|
||||||
|
|
||||||
|
#if QTWEBENGINEWIDGETS_VERSION >= QT_VERSION_CHECK(5, 12, 0)
|
||||||
|
#include <QWebEngineUrlScheme>
|
||||||
|
#endif
|
||||||
|
|
||||||
NetworkManager::NetworkManager(QObject *parent)
|
NetworkManager::NetworkManager(QObject *parent)
|
||||||
: QNetworkAccessManager(parent)
|
: QNetworkAccessManager(parent)
|
||||||
{
|
{
|
||||||
// Create scheme handlers
|
// Create scheme handlers
|
||||||
m_extensionScheme = new ExtensionSchemeManager();
|
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("falkon"), new FalkonSchemeHandler());
|
||||||
mApp->webProfile()->installUrlSchemeHandler(QByteArrayLiteral("extension"), m_extensionScheme);
|
mApp->webProfile()->installUrlSchemeHandler(QByteArrayLiteral("extension"), m_extensionScheme);
|
||||||
WebPage::addSupportedScheme(QSL("falkon"));
|
WebPage::addSupportedScheme(QSL("falkon"));
|
||||||
|
Loading…
Reference in New Issue
Block a user