6#include "mailwebenginepage.h"
7#include <QFontDatabase>
9#include <QWebEngineProfile>
10#include <QWebEngineSettings>
12using namespace MessageViewer;
14MailWebEnginePage::MailWebEnginePage(
QObject *parent)
15 : WebEngineViewer::WebEnginePage(parent)
20void MailWebEnginePage::initialize()
22 const bool enableElement =
false;
23 settings()->setAttribute(QWebEngineSettings::JavascriptEnabled, enableElement);
24 settings()->setAttribute(QWebEngineSettings::PluginsEnabled, enableElement);
25 settings()->setAttribute(QWebEngineSettings::JavascriptCanOpenWindows, enableElement);
26 settings()->setAttribute(QWebEngineSettings::JavascriptCanAccessClipboard, enableElement);
27 settings()->setAttribute(QWebEngineSettings::LocalStorageEnabled, enableElement);
28 settings()->setAttribute(QWebEngineSettings::XSSAuditingEnabled, enableElement);
30 settings()->setAttribute(QWebEngineSettings::LocalContentCanAccessRemoteUrls,
true);
33 settings()->setAttribute(QWebEngineSettings::ErrorPageEnabled, enableElement);
34 settings()->setAttribute(QWebEngineSettings::HyperlinkAuditingEnabled, enableElement);
35 settings()->setAttribute(QWebEngineSettings::FullScreenSupportEnabled, enableElement);
36 settings()->setAttribute(QWebEngineSettings::WebGLEnabled, enableElement);
37 settings()->setAttribute(QWebEngineSettings::AutoLoadIconsForPage, enableElement);
38 settings()->setAttribute(QWebEngineSettings::Accelerated2dCanvasEnabled, enableElement);
39 settings()->setAttribute(QWebEngineSettings::WebGLEnabled, enableElement);
41 settings()->setAttribute(QWebEngineSettings::FocusOnNavigationEnabled, enableElement);
42 settings()->setAttribute(QWebEngineSettings::AllowRunningInsecureContent, enableElement);
43 settings()->setAttribute(QWebEngineSettings::PdfViewerEnabled, enableElement);
44 settings()->setAttribute(QWebEngineSettings::NavigateOnDropEnabled, enableElement);
45 profile()->setPersistentCookiesPolicy(QWebEngineProfile::NoPersistentCookies);
46 profile()->setHttpCacheType(QWebEngineProfile::MemoryHttpCache);
49 settings()->setFontFamily(QWebEngineSettings::StandardFont, font.family());
50 settings()->setFontSize(QWebEngineSettings::DefaultFontSize, font.pixelSize());
51 connect(
this, &QWebEnginePage::featurePermissionRequested,
this, &MailWebEnginePage::slotFeaturePermissionRequested);
54void MailWebEnginePage::setPrintElementBackground(
bool printElementBackground)
56 settings()->setAttribute(QWebEngineSettings::PrintElementBackgrounds, printElementBackground);
59void MailWebEnginePage::slotFeaturePermissionRequested(
const QUrl &url, QWebEnginePage::Feature feature)
62 setFeaturePermission(url, feature, QWebEnginePage::PermissionDeniedByUser);
65#include "moc_mailwebenginepage.cpp"
KCRASH_EXPORT void initialize()
QFont systemFont(SystemFont type)
QFuture< ArgsType< Signal > > connect(Sender *sender, Signal signal)