mirror of
https://invent.kde.org/network/falkon.git
synced 2024-11-11 01:22:10 +01:00
NetworkManager: Fix QtWebEngine warning about registering schemes
This commit is contained in:
parent
797e4c12a2
commit
067155d53a
|
@ -281,6 +281,8 @@ MainApplication::MainApplication(int &argc, char** argv)
|
|||
|
||||
Settings::createSettings(DataPaths::currentProfilePath() + QLatin1String("/settings.ini"));
|
||||
|
||||
NetworkManager::registerSchemes();
|
||||
|
||||
m_webProfile = isPrivate() ? new QWebEngineProfile(this) : QWebEngineProfile::defaultProfile();
|
||||
connect(m_webProfile, &QWebEngineProfile::downloadRequested, this, &MainApplication::downloadRequested);
|
||||
|
||||
|
|
|
@ -52,17 +52,6 @@ NetworkManager::NetworkManager(QObject *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"));
|
||||
|
@ -309,6 +298,21 @@ void NetworkManager::shutdown()
|
|||
mApp->webProfile()->setRequestInterceptor(nullptr);
|
||||
}
|
||||
|
||||
// static
|
||||
void NetworkManager::registerSchemes()
|
||||
{
|
||||
#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
|
||||
}
|
||||
|
||||
QNetworkReply *NetworkManager::createRequest(QNetworkAccessManager::Operation op, const QNetworkRequest &request, QIODevice *outgoingData)
|
||||
{
|
||||
QNetworkRequest req = request;
|
||||
|
|
|
@ -48,6 +48,8 @@ public:
|
|||
void loadSettings();
|
||||
void shutdown();
|
||||
|
||||
static void registerSchemes();
|
||||
|
||||
protected:
|
||||
QNetworkReply *createRequest(Operation op, const QNetworkRequest &request, QIODevice *outgoingData) override;
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user