diff options
Diffstat (limited to 'src/webenginequick/api/qquickwebengineprofile.cpp')
-rw-r--r-- | src/webenginequick/api/qquickwebengineprofile.cpp | 67 |
1 files changed, 60 insertions, 7 deletions
diff --git a/src/webenginequick/api/qquickwebengineprofile.cpp b/src/webenginequick/api/qquickwebengineprofile.cpp index 1badd25be..edca5e99c 100644 --- a/src/webenginequick/api/qquickwebengineprofile.cpp +++ b/src/webenginequick/api/qquickwebengineprofile.cpp @@ -14,6 +14,7 @@ #include <QtWebEngineCore/qwebenginescriptcollection.h> #include <QtWebEngineCore/private/qwebenginescriptcollection_p.h> +#include <QtWebEngineCore/qwebengineclienthints.h> #include <QtWebEngineCore/qwebenginecookiestore.h> #include <QtWebEngineCore/qwebenginenotification.h> #include <QtWebEngineCore/private/qwebenginedownloadrequest_p.h> @@ -104,6 +105,8 @@ QT_BEGIN_NAMESPACE The download item is parented by the profile. If it is not accepted, it will be deleted immediately after the signal emission. This signal cannot be used with a queued connection. + + \note To use from C++ static_cast \a download to QWebEngineDownloadRequest */ /*! @@ -112,6 +115,8 @@ QT_BEGIN_NAMESPACE This signal is emitted whenever downloading stops, because it finished successfully, was cancelled, or was interrupted (for example, because connectivity was lost). The \a download argument holds the state of the finished download instance. + + \note To use from C++ static_cast \a download to QWebEngineDownloadRequest */ /*! @@ -124,8 +129,18 @@ QT_BEGIN_NAMESPACE \sa WebEngineProfile::presentNotification */ +/*! + \fn QQuickWebEngineProfile::clearHttpCacheCompleted() + \since 6.7 + + This signal is emitted when the clearHttpCache() operation is completed. + + \sa clearHttpCache() +*/ + QQuickWebEngineProfilePrivate::QQuickWebEngineProfilePrivate(ProfileAdapter *profileAdapter) : m_settings(new QQuickWebEngineSettings()) + , m_clientHints(new QWebEngineClientHints(profileAdapter)) , m_profileAdapter(profileAdapter) { profileAdapter->addClient(this); @@ -209,10 +224,13 @@ void QQuickWebEngineProfilePrivate::downloadRequested(DownloadItemInfo &info) Q_Q(QQuickWebEngineProfile); Q_ASSERT(!m_ongoingDownloads.contains(info.id)); - QWebEngineDownloadRequestPrivate *itemPrivate = new QWebEngineDownloadRequestPrivate(m_profileAdapter, info.url); + QWebEngineDownloadRequestPrivate *itemPrivate = + new QWebEngineDownloadRequestPrivate(m_profileAdapter); itemPrivate->downloadId = info.id; - itemPrivate->downloadState = QWebEngineDownloadRequest::DownloadRequested; + itemPrivate->downloadState = info.accepted ? QWebEngineDownloadRequest::DownloadInProgress + : QWebEngineDownloadRequest::DownloadRequested; itemPrivate->startTime = info.startTime; + itemPrivate->downloadUrl = info.url; itemPrivate->totalBytes = info.totalBytes; itemPrivate->mimeType = info.mimeType; itemPrivate->downloadDirectory = QFileInfo(info.path).path(); @@ -276,6 +294,12 @@ void QQuickWebEngineProfilePrivate::showNotification(QSharedPointer<QtWebEngineC Q_EMIT q->presentNotification(notification); } +void QQuickWebEngineProfilePrivate::clearHttpCacheCompleted() +{ + Q_Q(QQuickWebEngineProfile); + Q_EMIT q->clearHttpCacheCompleted(); +} + QQuickWebEngineScriptCollection *QQuickWebEngineProfilePrivate::getUserScripts() { Q_Q(QQuickWebEngineProfile); @@ -322,16 +346,16 @@ QQuickWebEngineScriptCollection *QQuickWebEngineProfilePrivate::getUserScripts() */ /*! - \qmlsignal WebEngineProfile::downloadRequested(WebEngineDownloadItem download) + \qmlsignal WebEngineProfile::downloadRequested(WebEngineDownloadRequest download) This signal is emitted whenever a download has been triggered. The \a download argument holds the state of the download. - The download has to be explicitly accepted with WebEngineDownloadItem::accept() or the + The download has to be explicitly accepted with WebEngineDownloadRequest::accept() or the download will be cancelled by default. */ /*! - \qmlsignal WebEngineProfile::downloadFinished(WebEngineDownloadItem download) + \qmlsignal WebEngineProfile::downloadFinished(WebEngineDownloadRequest download) This signal is emitted whenever downloading stops, because it finished successfully, was cancelled, or was interrupted (for example, because connectivity was lost). @@ -348,6 +372,15 @@ QQuickWebEngineScriptCollection *QQuickWebEngineProfilePrivate::getUserScripts() */ /*! + \qmlsignal WebEngineProfile::clearHttpCacheCompleted() + \since QtWebEngine 6.7 + + This signal is emitted when the clearHttpCache() operation is completed. + + \sa clearHttpCache() +*/ + +/*! Constructs a new profile with the parent \a parent. */ QQuickWebEngineProfile::QQuickWebEngineProfile(QObject *parent) @@ -871,7 +904,11 @@ QWebEngineCookieStore *QQuickWebEngineProfile::cookieStore() const Removes the profile's cache entries. - \sa WebEngineProfile::cachePath + \note Make sure that you do not start new navigation or any operation on the profile while + the clear operation is in progress. The clearHttpCacheCompleted() signal notifies about the + completion. + + \sa WebEngineProfile::cachePath clearHttpCacheCompleted() */ /*! @@ -879,7 +916,11 @@ QWebEngineCookieStore *QQuickWebEngineProfile::cookieStore() const Removes the profile's cache entries. - \sa WebEngineProfile::clearHttpCache + \note Make sure that you do not start new navigation or any operation on the profile while + the clear operation is in progress. The clearHttpCacheCompleted() signal notifies about the + completion. + + \sa WebEngineProfile::clearHttpCache() clearHttpCacheCompleted() */ void QQuickWebEngineProfile::clearHttpCache() { @@ -987,6 +1028,18 @@ QWebEngineClientCertificateStore *QQuickWebEngineProfile::clientCertificateStore #endif } +/*! + Return the Client Hints settings associated with this browsing context. + + \since 6.8 + \sa QWebEngineClientHints +*/ +QWebEngineClientHints *QQuickWebEngineProfile::clientHints() const +{ + Q_D(const QQuickWebEngineProfile); + return d->m_clientHints.data(); +} + void QQuickWebEngineProfile::ensureQmlContext(const QObject *object) { if (!qmlContext(this)) { |