diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2021-06-18 11:39:36 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-06-22 03:32:24 +0000 |
commit | 3752a3cbcd0cc0742a5b955e925df18395afdb75 (patch) | |
tree | 453369210f11bd672441d11ef4065e79109ac260 | |
parent | 15e5ba4bfc920adf56df8dd11cb09ca3a9942963 (diff) |
Add page() and view() back to download-item
Restores a QML type but this time derived from the core type.
Change-Id: I09ddb6672f7262ae31e4c57f09d019f71abccd41
Reviewed-by: Kirill Burtsev <kirill.burtsev@qt.io>
(cherry picked from commit b2ecb708e149fe8914d7d0cbfcf9c300e52a029e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | src/core/api/qwebenginedownloadrequest.cpp | 14 | ||||
-rw-r--r-- | src/core/api/qwebenginedownloadrequest.h | 13 | ||||
-rw-r--r-- | src/core/api/qwebenginepage.cpp | 4 | ||||
-rw-r--r-- | src/core/api/qwebenginepage.h | 2 | ||||
-rw-r--r-- | src/webenginequick/CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/webenginequick/api/qquickwebenginedownloadrequest.cpp | 66 | ||||
-rw-r--r-- | src/webenginequick/api/qquickwebenginedownloadrequest_p.h | 78 | ||||
-rw-r--r-- | src/webenginequick/api/qquickwebengineprofile.cpp | 14 | ||||
-rw-r--r-- | src/webenginequick/api/qquickwebengineprofile.h | 6 | ||||
-rw-r--r-- | src/webenginequick/api/qquickwebengineprofile_p.h | 4 | ||||
-rw-r--r-- | src/webenginequick/plugin/plugin.cpp | 4 | ||||
-rw-r--r-- | tests/auto/quick/publicapi/tst_publicapi.cpp | 8 | ||||
-rw-r--r-- | tests/auto/widgets/qwebenginedownloadrequest/tst_qwebenginedownloadrequest.cpp | 14 |
13 files changed, 188 insertions, 40 deletions
diff --git a/src/core/api/qwebenginedownloadrequest.cpp b/src/core/api/qwebenginedownloadrequest.cpp index 006fd2e4b..57823a7c9 100644 --- a/src/core/api/qwebenginedownloadrequest.cpp +++ b/src/core/api/qwebenginedownloadrequest.cpp @@ -40,10 +40,13 @@ #include "qwebenginedownloadrequest.h" #include "qwebenginedownloadrequest_p.h" +#include "qwebenginepage.h" + #include "profile_adapter.h" +#include "web_contents_adapter_client.h" #include <QDir> -#include "QFileInfo" +#include <QFileInfo> QT_BEGIN_NAMESPACE @@ -662,14 +665,17 @@ QString QWebEngineDownloadRequest::interruptReasonString() const Returns the page the download was requested on. If the download was not triggered by content in a page, \c nullptr is returned. */ -QObject *QWebEngineDownloadRequest::page() const +QWebEnginePage *QWebEngineDownloadRequest::page() const { Q_D(const QWebEngineDownloadRequest); - //TODO: come back here when page is in core - Q_UNREACHABLE(); + if (d->adapterClient->clientType() == QtWebEngineCore::WebContentsAdapterClient::WidgetsClient) + return const_cast<QWebEnginePage *>(static_cast<const QWebEnginePage *>(d->adapterClient->holdingQObject())); return nullptr; } + +/*! \internal +*/ QWebEngineDownloadRequest::QWebEngineDownloadRequest(QWebEngineDownloadRequestPrivate *p, QObject *parent) : QObject(parent) , d_ptr(p) diff --git a/src/core/api/qwebenginedownloadrequest.h b/src/core/api/qwebenginedownloadrequest.h index 60782390c..f3056a936 100644 --- a/src/core/api/qwebenginedownloadrequest.h +++ b/src/core/api/qwebenginedownloadrequest.h @@ -47,8 +47,8 @@ QT_BEGIN_NAMESPACE -//TODO: class QWebEnginePage; class QWebEngineDownloadRequestPrivate; +class QWebEnginePage; class QWebEngineProfilePrivate; class Q_WEBENGINECORE_EXPORT QWebEngineDownloadRequest : public QObject @@ -66,13 +66,12 @@ public: Q_PROPERTY(bool isFinished READ isFinished NOTIFY isFinishedChanged FINAL) Q_PROPERTY(bool isPaused READ isPaused NOTIFY isPausedChanged FINAL) Q_PROPERTY(bool isSavePageDownload READ isSavePageDownload CONSTANT FINAL) - //TODO: Q_PROPERTY(QQuickWebEngineView *view READ view CONSTANT REVISION(1,7) FINAL) Q_PROPERTY(QUrl url READ url CONSTANT FINAL) Q_PROPERTY(QString suggestedFileName READ suggestedFileName CONSTANT FINAL) Q_PROPERTY(QString downloadDirectory READ downloadDirectory WRITE setDownloadDirectory NOTIFY downloadDirectoryChanged FINAL) Q_PROPERTY(QString downloadFileName READ downloadFileName WRITE setDownloadFileName NOTIFY downloadFileNameChanged FINAL) - ~QWebEngineDownloadRequest(); + ~QWebEngineDownloadRequest() override; enum DownloadState { DownloadRequested, @@ -141,8 +140,7 @@ public: QString downloadFileName() const; void setDownloadFileName(const QString &fileName); - //TODO: - QObject *page() const; + QWebEnginePage *page() const; public Q_SLOTS: void accept(); @@ -168,9 +166,10 @@ private: Q_DECLARE_PRIVATE(QWebEngineDownloadRequest) friend class QWebEngineProfilePrivate; - friend class QQuickWebEngineProfilePrivate; friend class QWebEnginePage; - QWebEngineDownloadRequest(QWebEngineDownloadRequestPrivate*, QObject *parent = nullptr); + +protected: + QWebEngineDownloadRequest(QWebEngineDownloadRequestPrivate *, QObject *parent = nullptr); QScopedPointer<QWebEngineDownloadRequestPrivate> d_ptr; }; diff --git a/src/core/api/qwebenginepage.cpp b/src/core/api/qwebenginepage.cpp index 6b66a0d70..3028c38f5 100644 --- a/src/core/api/qwebenginepage.cpp +++ b/src/core/api/qwebenginepage.cpp @@ -2415,10 +2415,6 @@ void QWebEnginePage::setVisible(bool visible) d->adapter->setVisible(visible); } -QWebEnginePage* QWebEnginePage::fromDownloadRequest(QWebEngineDownloadRequest *request) { - return static_cast<QWebEnginePagePrivate *>(request->d_ptr->adapterClient)->q_ptr; -} - QDataStream &operator<<(QDataStream &stream, const QWebEngineHistory &history) { auto adapter = history.d_func()->adapter(); diff --git a/src/core/api/qwebenginepage.h b/src/core/api/qwebenginepage.h index f2ac8eb6c..3eb4147ac 100644 --- a/src/core/api/qwebenginepage.h +++ b/src/core/api/qwebenginepage.h @@ -324,8 +324,6 @@ public: void acceptAsNewWindow(QWebEngineNewWindowRequest &request); - static QWebEnginePage* fromDownloadRequest(QWebEngineDownloadRequest * request); - Q_SIGNALS: void loadStarted(); void loadProgress(int progress); diff --git a/src/webenginequick/CMakeLists.txt b/src/webenginequick/CMakeLists.txt index dd4c8cd39..1362984dc 100644 --- a/src/webenginequick/CMakeLists.txt +++ b/src/webenginequick/CMakeLists.txt @@ -11,6 +11,7 @@ qt_internal_add_module(WebEngineQuick api/qquickwebengineaction_p_p.h api/qquickwebengineclientcertificateselection.cpp api/qquickwebengineclientcertificateselection_p.h api/qquickwebenginedialogrequests.cpp api/qquickwebenginedialogrequests_p.h + api/qquickwebenginedownloadrequest.cpp api/qquickwebenginedownloadrequest_p.h api/qquickwebenginefaviconprovider.cpp api/qquickwebenginefaviconprovider_p_p.h api/qquickwebengineprofile.cpp api/qquickwebengineprofile.h api/qquickwebengineprofile_p.h diff --git a/src/webenginequick/api/qquickwebenginedownloadrequest.cpp b/src/webenginequick/api/qquickwebenginedownloadrequest.cpp new file mode 100644 index 000000000..bd3383004 --- /dev/null +++ b/src/webenginequick/api/qquickwebenginedownloadrequest.cpp @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** Copyright (C) 2021 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtWebEngine module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qquickwebenginedownloadrequest_p.h" +#include "QtWebEngineCore/private/qwebenginedownloadrequest_p.h" + +#include "web_contents_adapter_client.h" + +QT_BEGIN_NAMESPACE + +/*! + \internal +*/ +QQuickWebEngineDownloadRequest::QQuickWebEngineDownloadRequest(QWebEngineDownloadRequestPrivate *p, QObject *parent) + : QWebEngineDownloadRequest(p, parent) +{ +} + +/*! + \internal + Returns the WebEngineView the download was requested on. If the download was not triggered by content in a WebEngineView, + \c nullptr is returned. +*/ +QQuickWebEngineView *QQuickWebEngineDownloadRequest::view() const +{ + Q_ASSERT(d_ptr->adapterClient->clientType() == QtWebEngineCore::WebContentsAdapterClient::QmlClient); + return const_cast<QQuickWebEngineView *>(static_cast<const QQuickWebEngineView *>(d_ptr->adapterClient->holdingQObject())); +} + +QT_END_NAMESPACE diff --git a/src/webenginequick/api/qquickwebenginedownloadrequest_p.h b/src/webenginequick/api/qquickwebenginedownloadrequest_p.h new file mode 100644 index 000000000..971c9882b --- /dev/null +++ b/src/webenginequick/api/qquickwebenginedownloadrequest_p.h @@ -0,0 +1,78 @@ +/**************************************************************************** +** +** Copyright (C) 2021 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtWebEngine module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QQUICKWEBENGINEDOWNLOADREQUEST_P_H +#define QQUICKWEBENGINEDOWNLOADREQUEST_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include <QtWebEngineQuick/private/qtwebenginequickglobal_p.h> +#include <QtWebEngineQuick/private/qquickwebengineview_p.h> + +#include <QtWebEngineCore/qwebenginedownloadrequest.h> + +QT_BEGIN_NAMESPACE + +class QQuickWebEngineProfilePrivate; + +class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineDownloadRequest : public QWebEngineDownloadRequest +{ + Q_OBJECT +public: + Q_PROPERTY(QQuickWebEngineView *view READ view CONSTANT FINAL) + + QQuickWebEngineView *view() const; +private: + Q_DISABLE_COPY(QQuickWebEngineDownloadRequest) + friend class QQuickWebEngineProfilePrivate; + QQuickWebEngineDownloadRequest(QWebEngineDownloadRequestPrivate *, QObject *parent = nullptr); +}; + +QT_END_NAMESPACE + +#endif // QQUICKWEBENGINEDOWNLOADREQUEST_P_H diff --git a/src/webenginequick/api/qquickwebengineprofile.cpp b/src/webenginequick/api/qquickwebengineprofile.cpp index c95a838af..a2f970c29 100644 --- a/src/webenginequick/api/qquickwebengineprofile.cpp +++ b/src/webenginequick/api/qquickwebengineprofile.cpp @@ -39,6 +39,7 @@ #include "qquickwebengineprofile.h" #include "qquickwebengineprofile_p.h" +#include "qquickwebenginedownloadrequest_p.h" #include "qquickwebenginesettings_p.h" #include "qquickwebenginescriptcollection.h" #include "qquickwebengineview_p_p.h" @@ -51,6 +52,7 @@ #include <QtWebEngineCore/qwebenginenotification.h> #include <QtWebEngineCore/private/qwebenginedownloadrequest_p.h> #include <QtWebEngineCore/qwebengineurlscheme.h> + #include <QFileInfo> #include <QDir> #include <QQmlEngine> @@ -126,7 +128,7 @@ QT_BEGIN_NAMESPACE */ /*! - \fn QQuickWebEngineProfile::downloadRequested(QWebEngineDownloadRequest *download) + \fn QQuickWebEngineProfile::downloadRequested(QQuickWebEngineDownloadRequest *download) This signal is emitted whenever a download has been triggered. The \a download argument holds the state of the download. @@ -139,7 +141,7 @@ QT_BEGIN_NAMESPACE */ /*! - \fn QQuickWebEngineProfile::downloadFinished(QWebEngineDownloadRequest *download) + \fn QQuickWebEngineProfile::downloadFinished(QQuickWebEngineDownloadRequest *download) This signal is emitted whenever downloading stops, because it finished successfully, was cancelled, or was interrupted (for example, because connectivity was lost). @@ -253,10 +255,10 @@ void QQuickWebEngineProfilePrivate::downloadRequested(DownloadItemInfo &info) else itemPrivate->adapterClient = nullptr; - QWebEngineDownloadRequest *download = new QWebEngineDownloadRequest(itemPrivate, q); + QQuickWebEngineDownloadRequest *download = new QQuickWebEngineDownloadRequest(itemPrivate, q); m_ongoingDownloads.insert(info.id, download); - QObject::connect(download, &QWebEngineDownloadRequest::destroyed, q, [id = info.id, this] () { downloadDestroyed(id); }); + QObject::connect(download, &QObject::destroyed, q, [id = info.id, this] () { downloadDestroyed(id); }); QQmlEngine::setObjectOwnership(download, QQmlEngine::JavaScriptOwnership); Q_EMIT q->downloadRequested(download); @@ -281,14 +283,14 @@ void QQuickWebEngineProfilePrivate::downloadUpdated(const DownloadItemInfo &info Q_Q(QQuickWebEngineProfile); - QWebEngineDownloadRequest* download = m_ongoingDownloads.value(info.id).data(); + QQuickWebEngineDownloadRequest* download = m_ongoingDownloads.value(info.id).data(); if (!download) { downloadDestroyed(info.id); return; } - download->d_func()->update(info); + download->d_ptr->update(info); if (info.state != ProfileAdapterClient::DownloadInProgress) { Q_EMIT q->downloadFinished(download); diff --git a/src/webenginequick/api/qquickwebengineprofile.h b/src/webenginequick/api/qquickwebengineprofile.h index 8d71d3303..f93c3a5d4 100644 --- a/src/webenginequick/api/qquickwebengineprofile.h +++ b/src/webenginequick/api/qquickwebengineprofile.h @@ -47,7 +47,7 @@ QT_BEGIN_NAMESPACE -class QWebEngineDownloadRequest; +class QQuickWebEngineDownloadRequest; class QWebEngineScript; class QQuickWebEngineSettings; class QWebEngineClientCertificateStore; @@ -167,8 +167,8 @@ Q_SIGNALS: Q_REVISION(1,3) void spellCheckEnabledChanged(); Q_REVISION(1,5) void useForGlobalCertificateVerificationChanged(); Q_REVISION(1,5) void downloadPathChanged(); - void downloadRequested(QWebEngineDownloadRequest *download); - void downloadFinished(QWebEngineDownloadRequest *download); + void downloadRequested(QQuickWebEngineDownloadRequest *download); + void downloadFinished(QQuickWebEngineDownloadRequest *download); Q_REVISION(1,5) void presentNotification(QWebEngineNotification *notification); diff --git a/src/webenginequick/api/qquickwebengineprofile_p.h b/src/webenginequick/api/qquickwebengineprofile_p.h index b9b52a693..8c2b14fda 100644 --- a/src/webenginequick/api/qquickwebengineprofile_p.h +++ b/src/webenginequick/api/qquickwebengineprofile_p.h @@ -62,7 +62,7 @@ QT_BEGIN_NAMESPACE -class QWebEngineDownloadRequest; +class QQuickWebEngineDownloadRequest; class QQuickWebEngineSettings; class QQuickWebEngineViewPrivate; class QQuickWebEngineScriptCollection; @@ -95,7 +95,7 @@ private: QQuickWebEngineProfile *q_ptr; QScopedPointer<QQuickWebEngineSettings> m_settings; QPointer<QtWebEngineCore::ProfileAdapter> m_profileAdapter; - QMap<quint32, QPointer<QWebEngineDownloadRequest> > m_ongoingDownloads; + QMap<quint32, QPointer<QQuickWebEngineDownloadRequest> > m_ongoingDownloads; QScopedPointer<QQuickWebEngineScriptCollection> m_scriptCollection; }; diff --git a/src/webenginequick/plugin/plugin.cpp b/src/webenginequick/plugin/plugin.cpp index a76ffbb48..8f2dc6015 100644 --- a/src/webenginequick/plugin/plugin.cpp +++ b/src/webenginequick/plugin/plugin.cpp @@ -42,6 +42,7 @@ #include <QtWebEngineQuick/private/qquickwebengineclientcertificateselection_p.h> #include <QtWebEngineQuick/private/qquickwebenginedialogrequests_p.h> +#include <QtWebEngineQuick/private/qquickwebenginedownloadrequest_p.h> #include <QtWebEngineQuick/private/qquickwebenginefaviconprovider_p_p.h> #include <QtWebEngineQuick/private/qquickwebenginesettings_p.h> #include <QtWebEngineQuick/private/qquickwebenginesingleton_p.h> @@ -59,7 +60,6 @@ #include <QtWebEngineCore/qwebenginequotarequest.h> #include <QtWebEngineCore/qwebengineregisterprotocolhandlerrequest.h> #include <QtWebEngineCore/qwebenginecontextmenurequest.h> -#include <QtWebEngineCore/qwebenginedownloadrequest.h> #include <QtWebEngineCore/qwebenginescript.h> QT_BEGIN_NAMESPACE @@ -111,7 +111,7 @@ public: uri, 1, 1, "WebEngineScript", msgUncreatableType("WebEngineScript")); // for enums qRegisterMetaType<QWebEngineCertificateError>(); qmlRegisterUncreatableType<QWebEngineCertificateError>(uri, 1, 1, "WebEngineCertificateError", msgUncreatableType("WebEngineCertificateError")); - qmlRegisterUncreatableType<QWebEngineDownloadRequest>(uri, 1, 1, "WebEngineDownloadRequest", + qmlRegisterUncreatableType<QQuickWebEngineDownloadRequest>(uri, 1, 1, "WebEngineDownloadRequest", msgUncreatableType("WebEngineDownloadRequest")); qmlRegisterUncreatableType<QWebEngineNewWindowRequest>(uri, 1, 1, "WebEngineNewViewRequest", msgUncreatableType("WebEngineNewViewRequest")); qmlRegisterUncreatableType<QQuickWebEngineSettings>(uri, 1, 1, "WebEngineSettings", msgUncreatableType("WebEngineSettings")); diff --git a/tests/auto/quick/publicapi/tst_publicapi.cpp b/tests/auto/quick/publicapi/tst_publicapi.cpp index c4188cd37..46cc25514 100644 --- a/tests/auto/quick/publicapi/tst_publicapi.cpp +++ b/tests/auto/quick/publicapi/tst_publicapi.cpp @@ -51,6 +51,7 @@ #include <private/qquickwebengineaction_p.h> #include <private/qquickwebengineclientcertificateselection_p.h> #include <private/qquickwebenginedialogrequests_p.h> +#include <private/qquickwebenginedownloadrequest_p.h> #include <private/qquickwebenginesettings_p.h> #include <private/qquickwebenginesingleton_p.h> @@ -65,6 +66,7 @@ static const QList<const QMetaObject *> typesToCheck = QList<const QMetaObject * << &QQuickWebEngineAction::staticMetaObject << &QQuickWebEngineClientCertificateOption::staticMetaObject << &QQuickWebEngineClientCertificateSelection::staticMetaObject + << &QQuickWebEngineDownloadRequest::staticMetaObject << &QWebEngineDownloadRequest::staticMetaObject << &QWebEngineHistory::staticMetaObject << &QWebEngineHistoryModel::staticMetaObject @@ -254,7 +256,6 @@ static const QStringList expectedAPI = QStringList() << "QWebEngineDownloadRequest.stateChanged(QWebEngineDownloadRequest::DownloadState) --> void" << "QWebEngineDownloadRequest.totalBytes --> qlonglong" << "QWebEngineDownloadRequest.totalBytesChanged() --> void" - // FIXME << "QWebEngineDownloadRequest.view --> QQuickWebEngineView*" << "QWebEngineDownloadRequest.url --> QUrl" << "QWebEngineDownloadRequest.suggestedFileName --> QString" << "QWebEngineDownloadRequest.downloadDirectory --> QString" @@ -262,6 +263,7 @@ static const QStringList expectedAPI = QStringList() << "QWebEngineDownloadRequest.downloadFileName --> QString" << "QWebEngineDownloadRequest.downloadFileNameChanged() --> void" << "QWebEngineDownloadRequest.downloadProgress(qlonglong,qlonglong) --> void" // FIXME + << "QQuickWebEngineDownloadRequest.view --> QQuickWebEngineView*" << "QQuickWebEngineFileDialogRequest.FileModeOpen --> FileMode" << "QQuickWebEngineFileDialogRequest.FileModeOpenMultiple --> FileMode" << "QQuickWebEngineFileDialogRequest.FileModeSave --> FileMode" @@ -358,8 +360,8 @@ static const QStringList expectedAPI = QStringList() << "QQuickWebEngineProfile.cachePath --> QString" << "QQuickWebEngineProfile.cachePathChanged() --> void" << "QQuickWebEngineProfile.clearHttpCache() --> void" - << "QQuickWebEngineProfile.downloadFinished(QWebEngineDownloadRequest*) --> void" - << "QQuickWebEngineProfile.downloadRequested(QWebEngineDownloadRequest*) --> void" + << "QQuickWebEngineProfile.downloadFinished(QQuickWebEngineDownloadRequest*) --> void" + << "QQuickWebEngineProfile.downloadRequested(QQuickWebEngineDownloadRequest*) --> void" << "QQuickWebEngineProfile.downloadPath --> QString" << "QQuickWebEngineProfile.downloadPathChanged() --> void" << "QQuickWebEngineProfile.presentNotification(QWebEngineNotification*) --> void" diff --git a/tests/auto/widgets/qwebenginedownloadrequest/tst_qwebenginedownloadrequest.cpp b/tests/auto/widgets/qwebenginedownloadrequest/tst_qwebenginedownloadrequest.cpp index f95c4ab33..1f24928ab 100644 --- a/tests/auto/widgets/qwebenginedownloadrequest/tst_qwebenginedownloadrequest.cpp +++ b/tests/auto/widgets/qwebenginedownloadrequest/tst_qwebenginedownloadrequest.cpp @@ -445,7 +445,7 @@ void tst_QWebEngineDownloadRequest::downloadLink() QCOMPARE(QDir(item->downloadDirectory()).filePath(item->downloadFileName()), suggestedPath); QCOMPARE(item->savePageFormat(), QWebEngineDownloadRequest::UnknownSaveFormat); QCOMPARE(item->url(), downloadUrl); - QCOMPARE(QWebEnginePage::fromDownloadRequest(item), m_page); + QCOMPARE(item->page(), m_page); connect(item, &QWebEngineDownloadRequest::isFinishedChanged, [&, item]() { QCOMPARE(item->state(), QWebEngineDownloadRequest::DownloadCompleted); @@ -458,7 +458,7 @@ void tst_QWebEngineDownloadRequest::downloadLink() QCOMPARE(QDir(item->downloadDirectory()).filePath(item->downloadFileName()), downloadPath); QCOMPARE(item->savePageFormat(), QWebEngineDownloadRequest::UnknownSaveFormat); QCOMPARE(item->url(), downloadUrl); - QCOMPARE(QWebEnginePage::fromDownloadRequest(item), m_page); + QCOMPARE(item->page(), m_page); finishedCount++; }); @@ -631,7 +631,7 @@ void tst_QWebEngineDownloadRequest::downloadPage() QCOMPARE(item->mimeType(), QStringLiteral("application/x-mimearchive")); QCOMPARE(item->savePageFormat(), savePageFormat); QCOMPARE(item->url(), downloadUrl); - QCOMPARE(QWebEnginePage::fromDownloadRequest(item), m_page); + QCOMPARE(item->page(), m_page); if (saveWithPageAction) { QVERIFY(!item->downloadDirectory().isEmpty()); @@ -654,7 +654,7 @@ void tst_QWebEngineDownloadRequest::downloadPage() QCOMPARE(QDir(item->downloadDirectory()).filePath(item->downloadFileName()), downloadPath); QCOMPARE(item->savePageFormat(), savePageFormat); QCOMPARE(item->url(), downloadUrl); - QCOMPARE(QWebEnginePage::fromDownloadRequest(item), m_page); + QCOMPARE(item->page(), m_page); finishedCount++; }); @@ -934,7 +934,7 @@ void tst_QWebEngineDownloadRequest::downloadUniqueFilenameWithTimestamp() QCOMPARE(item->totalBytes(), item->receivedBytes()); QVERIFY(item->receivedBytes() > 0); QCOMPARE(item->interruptReason(), QWebEngineDownloadRequest::NoReason); - QCOMPARE(QWebEnginePage::fromDownloadRequest(item), m_page); + QCOMPARE(item->page(), m_page); downloadFinished = true; downloadedFilePath = QDir(item->downloadDirectory()).filePath(item->downloadFileName()); }); @@ -1030,7 +1030,7 @@ void tst_QWebEngineDownloadRequest::downloadToNonExistentDir() QCOMPARE(item->totalBytes(), item->receivedBytes()); QVERIFY(item->receivedBytes() > 0); QCOMPARE(item->interruptReason(), QWebEngineDownloadRequest::NoReason); - QCOMPARE(QWebEnginePage::fromDownloadRequest(item), m_page); + QCOMPARE(item->page(), m_page); downloadFinished = true; downloadedFilePath = QDir(item->downloadDirectory()).filePath(item->downloadFileName()); }); @@ -1179,7 +1179,7 @@ void tst_QWebEngineDownloadRequest::downloadToDirectoryWithFileName() QCOMPARE(item->totalBytes(), item->receivedBytes()); QVERIFY(item->receivedBytes() > 0); QCOMPARE(item->interruptReason(), QWebEngineDownloadRequest::NoReason); - QCOMPARE(QWebEnginePage::fromDownloadRequest(item), m_page); + QCOMPARE(item->page(), m_page); downloadFinished = true; downloadedFilePath = QDir(item->downloadDirectory()).filePath(item->downloadFileName()); downloadedSuggestedFileName = item->suggestedFileName(); |