1// Copyright (C) 2022 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QQUICKWEBVIEWSETTINGS_H
5#define QQUICKWEBVIEWSETTINGS_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtWebViewQuick/private/qtwebviewquickglobal_p.h>
19#include <QObject>
20#include <QtQmlIntegration/qqmlintegration.h>
21#include <QtWebView/private/qwebview_p.h>
22#include <QtCore/qpointer.h>
23
24QT_BEGIN_NAMESPACE
25
26class QWebView;
27class QWebViewSettings;
28
29class Q_WEBVIEWQUICK_EXPORT QQuickWebViewSettings : public QObject
30{
31 Q_OBJECT
32 Q_PROPERTY(bool localStorageEnabled READ localStorageEnabled WRITE setLocalStorageEnabled NOTIFY localStorageEnabledChanged)
33 Q_PROPERTY(bool javaScriptEnabled READ javaScriptEnabled WRITE setJavaScriptEnabled NOTIFY javaScriptEnabledChanged)
34 Q_PROPERTY(bool allowFileAccess READ allowFileAccess WRITE setAllowFileAccess NOTIFY allowFileAccessChanged)
35 Q_PROPERTY(bool localContentCanAccessFileUrls READ localContentCanAccessFileUrls WRITE setLocalContentCanAccessFileUrls NOTIFY localContentCanAccessFileUrlsChanged)
36 QML_NAMED_ELEMENT(WebViewSettings)
37 QML_ADDED_IN_VERSION(6, 5)
38 QML_UNCREATABLE("")
39
40public:
41 ~QQuickWebViewSettings() override;
42
43 bool localStorageEnabled() const;
44 bool javaScriptEnabled() const;
45 bool localContentCanAccessFileUrls() const;
46 bool allowFileAccess() const;
47
48public Q_SLOTS:
49 void setLocalStorageEnabled(bool enabled);
50 void setJavaScriptEnabled(bool enabled);
51 void setAllowFileAccess(bool enabled);
52 void setLocalContentCanAccessFileUrls(bool enabled);
53
54Q_SIGNALS:
55 void localStorageEnabledChanged();
56 void javaScriptEnabledChanged();
57 void allowFileAccessChanged();
58 void localContentCanAccessFileUrlsChanged();
59
60private:
61 friend class QQuickWebView;
62
63 explicit QQuickWebViewSettings(QWebViewSettings *webviewsettings, QObject *p = nullptr);
64 QPointer<QWebViewSettings> d;
65 bool m_allowFileAccess;
66};
67
68QT_END_NAMESPACE
69
70#endif // QQUICKWEBVIEWSETTINGS_H
71

source code of qtwebview/src/quick/qquickwebviewsettings_p.h