Messagelib

templatewebenginepage.cpp
1 /*
2  SPDX-FileCopyrightText: 2017-2021 Laurent Montel <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 #include "templatewebenginepage.h"
8 #include <QWebEngineProfile>
9 #include <QWebEngineSettings>
10 
11 using namespace TemplateParser;
12 
13 TemplateWebEnginePage::TemplateWebEnginePage(QObject *parent)
14  : QWebEnginePage(parent)
15 {
16  settings()->setAttribute(QWebEngineSettings::JavascriptEnabled, false);
17  settings()->setAttribute(QWebEngineSettings::PluginsEnabled, false);
18  settings()->setAttribute(QWebEngineSettings::JavascriptCanOpenWindows, false);
19  settings()->setAttribute(QWebEngineSettings::JavascriptCanAccessClipboard, false);
20  settings()->setAttribute(QWebEngineSettings::LocalStorageEnabled, false);
21  settings()->setAttribute(QWebEngineSettings::XSSAuditingEnabled, false);
22  settings()->setAttribute(QWebEngineSettings::ErrorPageEnabled, false);
23  settings()->setAttribute(QWebEngineSettings::LocalContentCanAccessRemoteUrls, false);
24  // We need to activate it in qt5.15 otherwise we can't load local css file and co
25  // settings()->setAttribute(QWebEngineSettings::LocalContentCanAccessFileUrls, false);
26  settings()->setAttribute(QWebEngineSettings::HyperlinkAuditingEnabled, false);
27  settings()->setAttribute(QWebEngineSettings::FullScreenSupportEnabled, false);
28  settings()->setAttribute(QWebEngineSettings::ScreenCaptureEnabled, false);
29  settings()->setAttribute(QWebEngineSettings::WebGLEnabled, false);
30  settings()->setAttribute(QWebEngineSettings::AutoLoadIconsForPage, false);
31  settings()->setAttribute(QWebEngineSettings::Accelerated2dCanvasEnabled, false);
32  settings()->setAttribute(QWebEngineSettings::WebGLEnabled, false);
33 
34  settings()->setAttribute(QWebEngineSettings::FocusOnNavigationEnabled, false);
35  settings()->setAttribute(QWebEngineSettings::AllowRunningInsecureContent, false);
36  settings()->setAttribute(QWebEngineSettings::PdfViewerEnabled, false);
37  profile()->setPersistentCookiesPolicy(QWebEngineProfile::NoPersistentCookies);
38  profile()->setHttpCacheType(QWebEngineProfile::MemoryHttpCache);
39 }
40 
41 TemplateWebEnginePage::~TemplateWebEnginePage() = default;
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Sun Dec 5 2021 23:04:55 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.