summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--examples/webenginewidgets/simplebrowser/doc/src/simplebrowser.qdoc8
-rw-r--r--examples/webenginewidgets/simplebrowser/downloadmanagerwidget.cpp6
-rw-r--r--examples/webenginewidgets/simplebrowser/downloadmanagerwidget.h6
-rw-r--r--examples/webenginewidgets/simplebrowser/downloadwidget.cpp22
-rw-r--r--examples/webenginewidgets/simplebrowser/downloadwidget.h10
-rw-r--r--src/core/api/core_api.pro6
-rw-r--r--src/core/api/qwebenginedownloadrequest.cpp (renamed from src/core/api/qwebenginedownloaditem.cpp)236
-rw-r--r--src/core/api/qwebenginedownloadrequest.h (renamed from src/core/api/qwebenginedownloaditem.h)58
-rw-r--r--src/core/api/qwebenginedownloadrequest_p.h (renamed from src/core/api/qwebenginedownloaditem_p.h)24
-rw-r--r--src/webengine/api/qquickwebengineprofile.cpp28
-rw-r--r--src/webengine/api/qquickwebengineprofile.h6
-rw-r--r--src/webengine/api/qquickwebengineprofile_p.h4
-rw-r--r--src/webengine/doc/src/webengine_download_request.qdoc (renamed from src/webengine/doc/src/webengine_download_item.qdoc)127
-rw-r--r--src/webengine/plugin/plugin.cpp22
-rw-r--r--src/webenginewidgets/api/qwebenginepage.cpp4
-rw-r--r--src/webenginewidgets/api/qwebenginepage.h6
-rw-r--r--src/webenginewidgets/api/qwebengineprofile.cpp38
-rw-r--r--src/webenginewidgets/api/qwebengineprofile.h4
-rw-r--r--src/webenginewidgets/api/qwebengineprofile_p.h2
-rw-r--r--tests/auto/quick/publicapi/tst_publicapi.cpp134
-rw-r--r--tests/auto/quick/qmltests/data/tst_download.qml42
-rw-r--r--tests/auto/widgets/loadsignals/tst_loadsignals.cpp8
-rw-r--r--tests/auto/widgets/qwebenginedownloadrequest/qwebenginedownloadrequest.pro (renamed from tests/auto/widgets/qwebenginedownloaditem/qwebenginedownloaditem.pro)0
-rw-r--r--tests/auto/widgets/qwebenginedownloadrequest/tst_qwebenginedownloadrequest.cpp (renamed from tests/auto/widgets/qwebenginedownloaditem/tst_qwebenginedownloaditem.cpp)202
-rw-r--r--tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp8
-rw-r--r--tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp6
-rw-r--r--tests/auto/widgets/widgets.pro2
27 files changed, 494 insertions, 525 deletions
diff --git a/examples/webenginewidgets/simplebrowser/doc/src/simplebrowser.qdoc b/examples/webenginewidgets/simplebrowser/doc/src/simplebrowser.qdoc
index 251ca5ad8..2bbe3fe33 100644
--- a/examples/webenginewidgets/simplebrowser/doc/src/simplebrowser.qdoc
+++ b/examples/webenginewidgets/simplebrowser/doc/src/simplebrowser.qdoc
@@ -314,7 +314,7 @@
Downloads are associated with a \l QWebEngineProfile. Whenever a download is
triggered on a web page the \l QWebEngineProfile::downloadRequested signal is
- emitted with a \l QWebEngineDownloadItem, which in this example is forwarded
+ emitted with a \l QWebEngineDownloadRequest, which in this example is forwarded
to \c DownloadManagerWidget::downloadRequested:
\quotefromfile webenginewidgets/simplebrowser/browser.cpp
@@ -329,10 +329,10 @@
\skipto DownloadManagerWidget::downloadRequested
\printuntil /^\}/
- The \l QWebEngineDownloadItem object will periodically emit the \l
- {QWebEngineDownloadItem::}{downloadProgress} signal to notify potential
+ The \l QWebEngineDownloadRequest object will periodically emit the \l
+ {QWebEngineDownloadRequest::}{downloadProgress} signal to notify potential
observers of the download progress and the \l
- {QWebEngineDownloadItem::}{stateChanged} signal when the download is
+ {QWebEngineDownloadRequest::}{stateChanged} signal when the download is
finished or when an error occurs. See \c downloadmanagerwidget.cpp for an
example of how these signals can be handled.
diff --git a/examples/webenginewidgets/simplebrowser/downloadmanagerwidget.cpp b/examples/webenginewidgets/simplebrowser/downloadmanagerwidget.cpp
index b6f9e9c13..cdd3a414a 100644
--- a/examples/webenginewidgets/simplebrowser/downloadmanagerwidget.cpp
+++ b/examples/webenginewidgets/simplebrowser/downloadmanagerwidget.cpp
@@ -56,7 +56,7 @@
#include <QFileDialog>
#include <QDir>
-#include <QWebEngineDownloadItem>
+#include <QWebEngineDownloadRequest>
DownloadManagerWidget::DownloadManagerWidget(QWidget *parent)
: QWidget(parent)
@@ -65,9 +65,9 @@ DownloadManagerWidget::DownloadManagerWidget(QWidget *parent)
setupUi(this);
}
-void DownloadManagerWidget::downloadRequested(QWebEngineDownloadItem *download)
+void DownloadManagerWidget::downloadRequested(QWebEngineDownloadRequest *download)
{
- Q_ASSERT(download && download->state() == QWebEngineDownloadItem::DownloadRequested);
+ Q_ASSERT(download && download->state() == QWebEngineDownloadRequest::DownloadRequested);
QString path = QFileDialog::getSaveFileName(this, tr("Save as"), QDir(download->downloadDirectory()).filePath(download->downloadFileName()));
if (path.isEmpty())
diff --git a/examples/webenginewidgets/simplebrowser/downloadmanagerwidget.h b/examples/webenginewidgets/simplebrowser/downloadmanagerwidget.h
index 7be9d8102..221cd261f 100644
--- a/examples/webenginewidgets/simplebrowser/downloadmanagerwidget.h
+++ b/examples/webenginewidgets/simplebrowser/downloadmanagerwidget.h
@@ -56,7 +56,7 @@
#include <QWidget>
QT_BEGIN_NAMESPACE
-class QWebEngineDownloadItem;
+class QWebEngineDownloadRequest;
QT_END_NAMESPACE
class DownloadWidget;
@@ -69,9 +69,9 @@ public:
explicit DownloadManagerWidget(QWidget *parent = nullptr);
// Prompts user with a "Save As" dialog. If the user doesn't cancel it, then
- // the QWebEngineDownloadItem will be accepted and the DownloadManagerWidget
+ // the QWebEngineDownloadRequest will be accepted and the DownloadManagerWidget
// will be shown on the screen.
- void downloadRequested(QWebEngineDownloadItem *webItem);
+ void downloadRequested(QWebEngineDownloadRequest *webItem);
private:
void add(DownloadWidget *downloadWidget);
diff --git a/examples/webenginewidgets/simplebrowser/downloadwidget.cpp b/examples/webenginewidgets/simplebrowser/downloadwidget.cpp
index ddddc5e5d..e9caa8658 100644
--- a/examples/webenginewidgets/simplebrowser/downloadwidget.cpp
+++ b/examples/webenginewidgets/simplebrowser/downloadwidget.cpp
@@ -52,9 +52,9 @@
#include <QFileInfo>
#include <QUrl>
-#include <QWebEngineDownloadItem>
+#include <QWebEngineDownloadRequest>
-DownloadWidget::DownloadWidget(QWebEngineDownloadItem *download, QWidget *parent)
+DownloadWidget::DownloadWidget(QWebEngineDownloadRequest *download, QWidget *parent)
: QFrame(parent)
, m_download(download)
, m_timeAdded()
@@ -66,16 +66,16 @@ DownloadWidget::DownloadWidget(QWebEngineDownloadItem *download, QWidget *parent
connect(m_cancelButton, &QPushButton::clicked,
[this](bool) {
- if (m_download->state() == QWebEngineDownloadItem::DownloadInProgress)
+ if (m_download->state() == QWebEngineDownloadRequest::DownloadInProgress)
m_download->cancel();
else
emit removeClicked(this);
});
- connect(m_download, &QWebEngineDownloadItem::downloadProgress,
+ connect(m_download, &QWebEngineDownloadRequest::downloadProgress,
this, &DownloadWidget::updateWidget);
- connect(m_download, &QWebEngineDownloadItem::stateChanged,
+ connect(m_download, &QWebEngineDownloadRequest::stateChanged,
this, &DownloadWidget::updateWidget);
updateWidget();
@@ -101,10 +101,10 @@ void DownloadWidget::updateWidget()
auto state = m_download->state();
switch (state) {
- case QWebEngineDownloadItem::DownloadRequested:
+ case QWebEngineDownloadRequest::DownloadRequested:
Q_UNREACHABLE();
break;
- case QWebEngineDownloadItem::DownloadInProgress:
+ case QWebEngineDownloadRequest::DownloadInProgress:
if (totalBytes >= 0) {
m_progressBar->setValue(qRound(100 * receivedBytes / totalBytes));
m_progressBar->setDisabled(false);
@@ -122,7 +122,7 @@ void DownloadWidget::updateWidget()
.arg(withUnit(bytesPerSecond)));
}
break;
- case QWebEngineDownloadItem::DownloadCompleted:
+ case QWebEngineDownloadRequest::DownloadCompleted:
m_progressBar->setValue(100);
m_progressBar->setDisabled(true);
m_progressBar->setFormat(
@@ -130,7 +130,7 @@ void DownloadWidget::updateWidget()
.arg(withUnit(receivedBytes))
.arg(withUnit(bytesPerSecond)));
break;
- case QWebEngineDownloadItem::DownloadCancelled:
+ case QWebEngineDownloadRequest::DownloadCancelled:
m_progressBar->setValue(0);
m_progressBar->setDisabled(true);
m_progressBar->setFormat(
@@ -138,7 +138,7 @@ void DownloadWidget::updateWidget()
.arg(withUnit(receivedBytes))
.arg(withUnit(bytesPerSecond)));
break;
- case QWebEngineDownloadItem::DownloadInterrupted:
+ case QWebEngineDownloadRequest::DownloadInterrupted:
m_progressBar->setValue(0);
m_progressBar->setDisabled(true);
m_progressBar->setFormat(
@@ -147,7 +147,7 @@ void DownloadWidget::updateWidget()
break;
}
- if (state == QWebEngineDownloadItem::DownloadInProgress) {
+ if (state == QWebEngineDownloadRequest::DownloadInProgress) {
static QIcon cancelIcon(QStringLiteral(":process-stop.png"));
m_cancelButton->setIcon(cancelIcon);
m_cancelButton->setToolTip(tr("Stop downloading"));
diff --git a/examples/webenginewidgets/simplebrowser/downloadwidget.h b/examples/webenginewidgets/simplebrowser/downloadwidget.h
index c20676aa6..c59b1b4b7 100644
--- a/examples/webenginewidgets/simplebrowser/downloadwidget.h
+++ b/examples/webenginewidgets/simplebrowser/downloadwidget.h
@@ -57,16 +57,16 @@
#include <QElapsedTimer>
QT_BEGIN_NAMESPACE
-class QWebEngineDownloadItem;
+class QWebEngineDownloadRequest;
QT_END_NAMESPACE
-// Displays one ongoing or finished download (QWebEngineDownloadItem).
+// Displays one ongoing or finished download (QWebEngineDownloadRequest).
class DownloadWidget final : public QFrame, public Ui::DownloadWidget
{
Q_OBJECT
public:
- // Precondition: The QWebEngineDownloadItem has been accepted.
- explicit DownloadWidget(QWebEngineDownloadItem *download, QWidget *parent = nullptr);
+ // Precondition: The QWebEngineDownloadRequest has been accepted.
+ explicit DownloadWidget(QWebEngineDownloadRequest *download, QWidget *parent = nullptr);
signals:
// This signal is emitted when the user indicates that they want to remove
@@ -79,7 +79,7 @@ private slots:
private:
QString withUnit(qreal bytes);
- QWebEngineDownloadItem *m_download;
+ QWebEngineDownloadRequest *m_download;
QElapsedTimer m_timeAdded;
};
diff --git a/src/core/api/core_api.pro b/src/core/api/core_api.pro
index 533ebf03f..885b81f70 100644
--- a/src/core/api/core_api.pro
+++ b/src/core/api/core_api.pro
@@ -53,8 +53,8 @@ HEADERS = \
qwebengineurlschemehandler.h \
qwebenginecontextmenurequest.h \
qwebenginecontextmenurequest_p.h \
- qwebenginedownloaditem.h \
- qwebenginedownloaditem_p.h
+ qwebenginedownloadrequest.h \
+ qwebenginedownloadrequest_p.h
SOURCES = \
qtwebenginecoreglobal.cpp \
@@ -72,7 +72,7 @@ SOURCES = \
qwebengineurlscheme.cpp \
qwebengineurlschemehandler.cpp \
qwebenginecontextmenurequest.cpp \
- qwebenginedownloaditem.cpp
+ qwebenginedownloadrequest.cpp
# Chromium headers included are not remotely clean
CONFIG -= warning_clean
diff --git a/src/core/api/qwebenginedownloaditem.cpp b/src/core/api/qwebenginedownloadrequest.cpp
index 967a7e3f9..bf4994a64 100644
--- a/src/core/api/qwebenginedownloaditem.cpp
+++ b/src/core/api/qwebenginedownloadrequest.cpp
@@ -37,8 +37,8 @@
**
****************************************************************************/
-#include "qwebenginedownloaditem.h"
-#include "qwebenginedownloaditem_p.h"
+#include "qwebenginedownloadrequest.h"
+#include "qwebenginedownloadrequest_p.h"
#include "profile_adapter.h"
@@ -49,63 +49,63 @@ QT_BEGIN_NAMESPACE
using QtWebEngineCore::ProfileAdapterClient;
-ASSERT_ENUMS_MATCH(ProfileAdapterClient::NoReason, QWebEngineDownloadItem::NoReason)
-ASSERT_ENUMS_MATCH(ProfileAdapterClient::FileFailed, QWebEngineDownloadItem::FileFailed)
-ASSERT_ENUMS_MATCH(ProfileAdapterClient::FileAccessDenied, QWebEngineDownloadItem::FileAccessDenied)
-ASSERT_ENUMS_MATCH(ProfileAdapterClient::FileNoSpace, QWebEngineDownloadItem::FileNoSpace)
-ASSERT_ENUMS_MATCH(ProfileAdapterClient::FileNameTooLong, QWebEngineDownloadItem::FileNameTooLong)
-ASSERT_ENUMS_MATCH(ProfileAdapterClient::FileTooLarge, QWebEngineDownloadItem::FileTooLarge)
-ASSERT_ENUMS_MATCH(ProfileAdapterClient::FileVirusInfected, QWebEngineDownloadItem::FileVirusInfected)
-ASSERT_ENUMS_MATCH(ProfileAdapterClient::FileTransientError, QWebEngineDownloadItem::FileTransientError)
-ASSERT_ENUMS_MATCH(ProfileAdapterClient::FileBlocked, QWebEngineDownloadItem::FileBlocked)
-ASSERT_ENUMS_MATCH(ProfileAdapterClient::FileSecurityCheckFailed, QWebEngineDownloadItem::FileSecurityCheckFailed)
-ASSERT_ENUMS_MATCH(ProfileAdapterClient::FileTooShort, QWebEngineDownloadItem::FileTooShort)
-ASSERT_ENUMS_MATCH(ProfileAdapterClient::FileHashMismatch, QWebEngineDownloadItem::FileHashMismatch)
-ASSERT_ENUMS_MATCH(ProfileAdapterClient::NetworkFailed, QWebEngineDownloadItem::NetworkFailed)
-ASSERT_ENUMS_MATCH(ProfileAdapterClient::NetworkTimeout, QWebEngineDownloadItem::NetworkTimeout)
-ASSERT_ENUMS_MATCH(ProfileAdapterClient::NetworkDisconnected, QWebEngineDownloadItem::NetworkDisconnected)
-ASSERT_ENUMS_MATCH(ProfileAdapterClient::NetworkServerDown, QWebEngineDownloadItem::NetworkServerDown)
-ASSERT_ENUMS_MATCH(ProfileAdapterClient::NetworkInvalidRequest, QWebEngineDownloadItem::NetworkInvalidRequest)
-ASSERT_ENUMS_MATCH(ProfileAdapterClient::ServerFailed, QWebEngineDownloadItem::ServerFailed)
-//ASSERT_ENUMS_MATCH(ProfileAdapterClient::ServerNoRange, QWebEngineDownloadItem::ServerNoRange)
-ASSERT_ENUMS_MATCH(ProfileAdapterClient::ServerBadContent, QWebEngineDownloadItem::ServerBadContent)
-ASSERT_ENUMS_MATCH(ProfileAdapterClient::ServerUnauthorized, QWebEngineDownloadItem::ServerUnauthorized)
-ASSERT_ENUMS_MATCH(ProfileAdapterClient::ServerCertProblem, QWebEngineDownloadItem::ServerCertProblem)
-ASSERT_ENUMS_MATCH(ProfileAdapterClient::ServerForbidden, QWebEngineDownloadItem::ServerForbidden)
-ASSERT_ENUMS_MATCH(ProfileAdapterClient::ServerUnreachable, QWebEngineDownloadItem::ServerUnreachable)
-ASSERT_ENUMS_MATCH(ProfileAdapterClient::UserCanceled, QWebEngineDownloadItem::UserCanceled)
-//ASSERT_ENUMS_MATCH(ProfileAdapterClient::UserShutdown, QWebEngineDownloadItem::UserShutdown)
-//ASSERT_ENUMS_MATCH(ProfileAdapterClient::Crash, QWebEngineDownloadItem::Crash)
-
-static inline QWebEngineDownloadItem::DownloadState toDownloadState(int state)
+ASSERT_ENUMS_MATCH(ProfileAdapterClient::NoReason, QWebEngineDownloadRequest::NoReason)
+ASSERT_ENUMS_MATCH(ProfileAdapterClient::FileFailed, QWebEngineDownloadRequest::FileFailed)
+ASSERT_ENUMS_MATCH(ProfileAdapterClient::FileAccessDenied, QWebEngineDownloadRequest::FileAccessDenied)
+ASSERT_ENUMS_MATCH(ProfileAdapterClient::FileNoSpace, QWebEngineDownloadRequest::FileNoSpace)
+ASSERT_ENUMS_MATCH(ProfileAdapterClient::FileNameTooLong, QWebEngineDownloadRequest::FileNameTooLong)
+ASSERT_ENUMS_MATCH(ProfileAdapterClient::FileTooLarge, QWebEngineDownloadRequest::FileTooLarge)
+ASSERT_ENUMS_MATCH(ProfileAdapterClient::FileVirusInfected, QWebEngineDownloadRequest::FileVirusInfected)
+ASSERT_ENUMS_MATCH(ProfileAdapterClient::FileTransientError, QWebEngineDownloadRequest::FileTransientError)
+ASSERT_ENUMS_MATCH(ProfileAdapterClient::FileBlocked, QWebEngineDownloadRequest::FileBlocked)
+ASSERT_ENUMS_MATCH(ProfileAdapterClient::FileSecurityCheckFailed, QWebEngineDownloadRequest::FileSecurityCheckFailed)
+ASSERT_ENUMS_MATCH(ProfileAdapterClient::FileTooShort, QWebEngineDownloadRequest::FileTooShort)
+ASSERT_ENUMS_MATCH(ProfileAdapterClient::FileHashMismatch, QWebEngineDownloadRequest::FileHashMismatch)
+ASSERT_ENUMS_MATCH(ProfileAdapterClient::NetworkFailed, QWebEngineDownloadRequest::NetworkFailed)
+ASSERT_ENUMS_MATCH(ProfileAdapterClient::NetworkTimeout, QWebEngineDownloadRequest::NetworkTimeout)
+ASSERT_ENUMS_MATCH(ProfileAdapterClient::NetworkDisconnected, QWebEngineDownloadRequest::NetworkDisconnected)
+ASSERT_ENUMS_MATCH(ProfileAdapterClient::NetworkServerDown, QWebEngineDownloadRequest::NetworkServerDown)
+ASSERT_ENUMS_MATCH(ProfileAdapterClient::NetworkInvalidRequest, QWebEngineDownloadRequest::NetworkInvalidRequest)
+ASSERT_ENUMS_MATCH(ProfileAdapterClient::ServerFailed, QWebEngineDownloadRequest::ServerFailed)
+//ASSERT_ENUMS_MATCH(ProfileAdapterClient::ServerNoRange, QWebEngineDownloadRequest::ServerNoRange)
+ASSERT_ENUMS_MATCH(ProfileAdapterClient::ServerBadContent, QWebEngineDownloadRequest::ServerBadContent)
+ASSERT_ENUMS_MATCH(ProfileAdapterClient::ServerUnauthorized, QWebEngineDownloadRequest::ServerUnauthorized)
+ASSERT_ENUMS_MATCH(ProfileAdapterClient::ServerCertProblem, QWebEngineDownloadRequest::ServerCertProblem)
+ASSERT_ENUMS_MATCH(ProfileAdapterClient::ServerForbidden, QWebEngineDownloadRequest::ServerForbidden)
+ASSERT_ENUMS_MATCH(ProfileAdapterClient::ServerUnreachable, QWebEngineDownloadRequest::ServerUnreachable)
+ASSERT_ENUMS_MATCH(ProfileAdapterClient::UserCanceled, QWebEngineDownloadRequest::UserCanceled)
+//ASSERT_ENUMS_MATCH(ProfileAdapterClient::UserShutdown, QWebEngineDownloadRequest::UserShutdown)
+//ASSERT_ENUMS_MATCH(ProfileAdapterClient::Crash, QWebEngineDownloadRequest::Crash)
+
+static inline QWebEngineDownloadRequest::DownloadState toDownloadState(int state)
{
switch (state) {
case ProfileAdapterClient::DownloadInProgress:
- return QWebEngineDownloadItem::DownloadInProgress;
+ return QWebEngineDownloadRequest::DownloadInProgress;
case ProfileAdapterClient::DownloadCompleted:
- return QWebEngineDownloadItem::DownloadCompleted;
+ return QWebEngineDownloadRequest::DownloadCompleted;
case ProfileAdapterClient::DownloadCancelled:
- return QWebEngineDownloadItem::DownloadCancelled;
+ return QWebEngineDownloadRequest::DownloadCancelled;
case ProfileAdapterClient::DownloadInterrupted:
- return QWebEngineDownloadItem::DownloadInterrupted;
+ return QWebEngineDownloadRequest::DownloadInterrupted;
default:
Q_UNREACHABLE();
- return QWebEngineDownloadItem::DownloadCancelled;
+ return QWebEngineDownloadRequest::DownloadCancelled;
}
}
-static inline QWebEngineDownloadItem::DownloadInterruptReason toDownloadInterruptReason(int reason)
+static inline QWebEngineDownloadRequest::DownloadInterruptReason toDownloadInterruptReason(int reason)
{
- return static_cast<QWebEngineDownloadItem::DownloadInterruptReason>(reason);
+ return static_cast<QWebEngineDownloadRequest::DownloadInterruptReason>(reason);
}
/*!
- \class QWebEngineDownloadItem
- \brief The QWebEngineDownloadItem class provides information about a download.
+ \class QWebEngineDownloadRequest
+ \brief The QWebEngineDownloadRequest class provides information about a download.
\inmodule QtWebEngineCore
- QWebEngineDownloadItem models a download throughout its life cycle, starting
+ QWebEngineDownloadRequest models a download throughout its life cycle, starting
with a pending download request and finishing with a completed download. It
can be used, for example, to get information about new downloads, to monitor
progress, and to pause, resume, and cancel downloads.
@@ -114,7 +114,7 @@ static inline QWebEngineDownloadItem::DownloadInterruptReason toDownloadInterrup
QWebEngineProfile's responsibility to notify the application of new download
requests, which it does by emitting the
\l{QWebEngineProfile::downloadRequested}{downloadRequested} signal together
- with a newly created QWebEngineDownloadItem. The application can then
+ with a newly created QWebEngineDownloadRequest. The application can then
examine this item and decide whether to accept it or not. A signal handler
must explicitly call accept() on the item for \QWE to actually start
downloading and writing data to disk. If no signal handler calls accept(),
@@ -157,13 +157,13 @@ static inline QWebEngineDownloadItem::DownloadInterruptReason toDownloadInterrup
QWebEnginePage::download, QWebEnginePage::save
*/
-QWebEngineDownloadItemPrivate::QWebEngineDownloadItemPrivate(QtWebEngineCore::ProfileAdapter *adapter, const QUrl &url)
+QWebEngineDownloadRequestPrivate::QWebEngineDownloadRequestPrivate(QtWebEngineCore::ProfileAdapter *adapter, const QUrl &url)
: m_profileAdapter(adapter)
, downloadFinished(false)
, downloadId(-1)
- , downloadState(QWebEngineDownloadItem::DownloadCancelled)
- , savePageFormat(QWebEngineDownloadItem::MimeHtmlSaveFormat)
- , interruptReason(QWebEngineDownloadItem::NoReason)
+ , downloadState(QWebEngineDownloadRequest::DownloadCancelled)
+ , savePageFormat(QWebEngineDownloadRequest::MimeHtmlSaveFormat)
+ , interruptReason(QWebEngineDownloadRequest::NoReason)
, downloadUrl(url)
, downloadPaused(false)
, isCustomFileName(false)
@@ -174,15 +174,15 @@ QWebEngineDownloadItemPrivate::QWebEngineDownloadItemPrivate(QtWebEngineCore::Pr
{
}
-QWebEngineDownloadItemPrivate::~QWebEngineDownloadItemPrivate()
+QWebEngineDownloadRequestPrivate::~QWebEngineDownloadRequestPrivate()
{
}
-void QWebEngineDownloadItemPrivate::update(const ProfileAdapterClient::DownloadItemInfo &info)
+void QWebEngineDownloadRequestPrivate::update(const ProfileAdapterClient::DownloadItemInfo &info)
{
- Q_Q(QWebEngineDownloadItem);
+ Q_Q(QWebEngineDownloadRequest);
- Q_ASSERT(downloadState != QWebEngineDownloadItem::DownloadRequested);
+ Q_ASSERT(downloadState != QWebEngineDownloadRequest::DownloadRequested);
if (toDownloadInterruptReason(info.downloadInterruptReason) != interruptReason) {
interruptReason = toDownloadInterruptReason(info.downloadInterruptReason);
@@ -215,7 +215,7 @@ void QWebEngineDownloadItemPrivate::update(const ProfileAdapterClient::DownloadI
}
}
-void QWebEngineDownloadItemPrivate::setFinished()
+void QWebEngineDownloadRequestPrivate::setFinished()
{
if (downloadFinished)
return;
@@ -234,14 +234,14 @@ void QWebEngineDownloadItemPrivate::setFinished()
\sa finished(), stateChanged()
*/
-void QWebEngineDownloadItem::accept()
+void QWebEngineDownloadRequest::accept()
{
- Q_D(QWebEngineDownloadItem);
+ Q_D(QWebEngineDownloadRequest);
- if (d->downloadState != QWebEngineDownloadItem::DownloadRequested)
+ if (d->downloadState != QWebEngineDownloadRequest::DownloadRequested)
return;
- d->downloadState = QWebEngineDownloadItem::DownloadInProgress;
+ d->downloadState = QWebEngineDownloadRequest::DownloadInProgress;
Q_EMIT stateChanged(d->downloadState);
}
@@ -259,23 +259,23 @@ void QWebEngineDownloadItem::accept()
\sa finished(), stateChanged()
*/
-void QWebEngineDownloadItem::cancel()
+void QWebEngineDownloadRequest::cancel()
{
- Q_D(QWebEngineDownloadItem);
+ Q_D(QWebEngineDownloadRequest);
- QWebEngineDownloadItem::DownloadState state = d->downloadState;
+ QWebEngineDownloadRequest::DownloadState state = d->downloadState;
- if (state == QWebEngineDownloadItem::DownloadCompleted
- || state == QWebEngineDownloadItem::DownloadCancelled)
+ if (state == QWebEngineDownloadRequest::DownloadCompleted
+ || state == QWebEngineDownloadRequest::DownloadCancelled)
return;
// We directly cancel the download request if the user cancels
// before it even started, so no need to notify the profile here.
- if (state == QWebEngineDownloadItem::DownloadInProgress) {
+ if (state == QWebEngineDownloadRequest::DownloadInProgress) {
if (d->m_profileAdapter)
d->m_profileAdapter->cancelDownload(d->downloadId);
} else {
- d->downloadState = QWebEngineDownloadItem::DownloadCancelled;
+ d->downloadState = QWebEngineDownloadRequest::DownloadCancelled;
Q_EMIT stateChanged(d->downloadState);
d->setFinished();
}
@@ -290,13 +290,13 @@ void QWebEngineDownloadItem::cancel()
\sa resume(), isPaused()
*/
-void QWebEngineDownloadItem::pause()
+void QWebEngineDownloadRequest::pause()
{
- Q_D(QWebEngineDownloadItem);
+ Q_D(QWebEngineDownloadRequest);
- QWebEngineDownloadItem::DownloadState state = d->downloadState;
+ QWebEngineDownloadRequest::DownloadState state = d->downloadState;
- if (state != QWebEngineDownloadItem::DownloadInProgress)
+ if (state != QWebEngineDownloadRequest::DownloadInProgress)
return;
if (d->m_profileAdapter)
@@ -311,13 +311,13 @@ void QWebEngineDownloadItem::pause()
\sa pause(), isPaused(), state()
*/
-void QWebEngineDownloadItem::resume()
+void QWebEngineDownloadRequest::resume()
{
- Q_D(QWebEngineDownloadItem);
+ Q_D(QWebEngineDownloadRequest);
- QWebEngineDownloadItem::DownloadState state = d->downloadState;
+ QWebEngineDownloadRequest::DownloadState state = d->downloadState;
- if (d->downloadFinished || (state != QWebEngineDownloadItem::DownloadInProgress && state != QWebEngineDownloadItem::DownloadInterrupted))
+ if (d->downloadFinished || (state != QWebEngineDownloadRequest::DownloadInProgress && state != QWebEngineDownloadRequest::DownloadInterrupted))
return;
if (d->m_profileAdapter)
d->m_profileAdapter->resumeDownload(d->downloadId);
@@ -327,14 +327,14 @@ void QWebEngineDownloadItem::resume()
Returns the download item's ID.
*/
-quint32 QWebEngineDownloadItem::id() const
+quint32 QWebEngineDownloadRequest::id() const
{
- Q_D(const QWebEngineDownloadItem);
+ Q_D(const QWebEngineDownloadRequest);
return d->downloadId;
}
/*!
- \fn void QWebEngineDownloadItem::finished()
+ \fn void QWebEngineDownloadRequest::finished()
This signal is emitted when the download finishes.
@@ -342,7 +342,7 @@ quint32 QWebEngineDownloadItem::id() const
*/
/*!
- \fn void QWebEngineDownloadItem::isPausedChanged(bool isPaused)
+ \fn void QWebEngineDownloadRequest::isPausedChanged(bool isPaused)
This signal is emitted whenever \a isPaused changes.
@@ -350,7 +350,7 @@ quint32 QWebEngineDownloadItem::id() const
*/
/*!
- \fn void QWebEngineDownloadItem::stateChanged(DownloadState state)
+ \fn void QWebEngineDownloadRequest::stateChanged(DownloadState state)
This signal is emitted whenever the download's \a state changes.
@@ -358,7 +358,7 @@ quint32 QWebEngineDownloadItem::id() const
*/
/*!
- \fn void QWebEngineDownloadItem::downloadProgress(qint64 bytesReceived, qint64 bytesTotal)
+ \fn void QWebEngineDownloadRequest::downloadProgress(qint64 bytesReceived, qint64 bytesTotal)
This signal is emitted to indicate the progress of the download request.
@@ -371,7 +371,7 @@ quint32 QWebEngineDownloadItem::id() const
*/
/*!
- \enum QWebEngineDownloadItem::DownloadState
+ \enum QWebEngineDownloadRequest::DownloadState
This enum describes the state of the download:
@@ -384,7 +384,7 @@ quint32 QWebEngineDownloadItem::id() const
*/
/*!
- \enum QWebEngineDownloadItem::SavePageFormat
+ \enum QWebEngineDownloadRequest::SavePageFormat
This enum describes the format that is used to save a web page.
@@ -397,7 +397,7 @@ quint32 QWebEngineDownloadItem::id() const
*/
/*!
- \enum QWebEngineDownloadItem::DownloadInterruptReason
+ \enum QWebEngineDownloadRequest::DownloadInterruptReason
Describes the reason why a download was interrupted:
@@ -440,9 +440,9 @@ quint32 QWebEngineDownloadItem::id() const
\sa DownloadState
*/
-QWebEngineDownloadItem::DownloadState QWebEngineDownloadItem::state() const
+QWebEngineDownloadRequest::DownloadState QWebEngineDownloadRequest::state() const
{
- Q_D(const QWebEngineDownloadItem);
+ Q_D(const QWebEngineDownloadRequest);
return d->downloadState;
}
@@ -452,9 +452,9 @@ QWebEngineDownloadItem::DownloadState QWebEngineDownloadItem::state() const
\c -1 means the size is unknown.
*/
-qint64 QWebEngineDownloadItem::totalBytes() const
+qint64 QWebEngineDownloadRequest::totalBytes() const
{
- Q_D(const QWebEngineDownloadItem);
+ Q_D(const QWebEngineDownloadRequest);
return d->totalBytes;
}
@@ -464,9 +464,9 @@ qint64 QWebEngineDownloadItem::totalBytes() const
\c -1 means the size is unknown.
*/
-qint64 QWebEngineDownloadItem::receivedBytes() const
+qint64 QWebEngineDownloadRequest::receivedBytes() const
{
- Q_D(const QWebEngineDownloadItem);
+ Q_D(const QWebEngineDownloadRequest);
return d->receivedBytes;
}
@@ -474,9 +474,9 @@ qint64 QWebEngineDownloadItem::receivedBytes() const
Returns the download's origin URL.
*/
-QUrl QWebEngineDownloadItem::url() const
+QUrl QWebEngineDownloadRequest::url() const
{
- Q_D(const QWebEngineDownloadItem);
+ Q_D(const QWebEngineDownloadRequest);
return d->downloadUrl;
}
@@ -484,9 +484,9 @@ QUrl QWebEngineDownloadItem::url() const
Returns the MIME type of the download.
*/
-QString QWebEngineDownloadItem::mimeType() const
+QString QWebEngineDownloadRequest::mimeType() const
{
- Q_D(const QWebEngineDownloadItem);
+ Q_D(const QWebEngineDownloadRequest);
return d->mimeType;
}
@@ -494,9 +494,9 @@ QString QWebEngineDownloadItem::mimeType() const
Returns the download directory path.
*/
-QString QWebEngineDownloadItem::downloadDirectory() const
+QString QWebEngineDownloadRequest::downloadDirectory() const
{
- Q_D(const QWebEngineDownloadItem);
+ Q_D(const QWebEngineDownloadRequest);
return d->downloadDirectory;
}
@@ -508,10 +508,10 @@ QString QWebEngineDownloadItem::downloadDirectory() const
download item's state.
*/
-void QWebEngineDownloadItem::setDownloadDirectory(const QString &directory)
+void QWebEngineDownloadRequest::setDownloadDirectory(const QString &directory)
{
- Q_D(QWebEngineDownloadItem);
- if (d->downloadState != QWebEngineDownloadItem::DownloadRequested) {
+ Q_D(QWebEngineDownloadRequest);
+ if (d->downloadState != QWebEngineDownloadRequest::DownloadRequested) {
qWarning("Setting the download directory is not allowed after the download has been accepted.");
return;
}
@@ -529,9 +529,9 @@ void QWebEngineDownloadItem::setDownloadDirectory(const QString &directory)
Returns the file name to download the file to.
*/
-QString QWebEngineDownloadItem::downloadFileName() const
+QString QWebEngineDownloadRequest::downloadFileName() const
{
- Q_D(const QWebEngineDownloadItem);
+ Q_D(const QWebEngineDownloadRequest);
return d->downloadFileName;
}
@@ -543,10 +543,10 @@ QString QWebEngineDownloadItem::downloadFileName() const
download item's state.
*/
-void QWebEngineDownloadItem::setDownloadFileName(const QString &fileName)
+void QWebEngineDownloadRequest::setDownloadFileName(const QString &fileName)
{
- Q_D(QWebEngineDownloadItem);
- if (d->downloadState != QWebEngineDownloadItem::DownloadRequested) {
+ Q_D(QWebEngineDownloadRequest);
+ if (d->downloadState != QWebEngineDownloadRequest::DownloadRequested) {
qWarning("Setting the download file name is not allowed after the download has been accepted.");
return;
}
@@ -561,9 +561,9 @@ void QWebEngineDownloadItem::setDownloadFileName(const QString &fileName)
Returns the suggested file name.
*/
-QString QWebEngineDownloadItem::suggestedFileName() const
+QString QWebEngineDownloadRequest::suggestedFileName() const
{
- Q_D(const QWebEngineDownloadItem);
+ Q_D(const QWebEngineDownloadRequest);
return d->suggestedFileName;
}
@@ -573,9 +573,9 @@ QString QWebEngineDownloadItem::suggestedFileName() const
\sa finished(), state(),
*/
-bool QWebEngineDownloadItem::isFinished() const
+bool QWebEngineDownloadRequest::isFinished() const
{
- Q_D(const QWebEngineDownloadItem);
+ Q_D(const QWebEngineDownloadRequest);
return d->downloadFinished;
}
@@ -585,9 +585,9 @@ bool QWebEngineDownloadItem::isFinished() const
\sa pause(), resume()
*/
-bool QWebEngineDownloadItem::isPaused() const
+bool QWebEngineDownloadRequest::isPaused() const
{
- Q_D(const QWebEngineDownloadItem);
+ Q_D(const QWebEngineDownloadRequest);
return d->downloadPaused;
}
@@ -595,9 +595,9 @@ bool QWebEngineDownloadItem::isPaused() const
Returns the format the web page will be saved in if this is a download request for a web page.
\sa setSavePageFormat(), isSavePageDownload()
*/
-QWebEngineDownloadItem::SavePageFormat QWebEngineDownloadItem::savePageFormat() const
+QWebEngineDownloadRequest::SavePageFormat QWebEngineDownloadRequest::savePageFormat() const
{
- Q_D(const QWebEngineDownloadItem);
+ Q_D(const QWebEngineDownloadRequest);
return d->savePageFormat;
}
@@ -606,9 +606,9 @@ QWebEngineDownloadItem::SavePageFormat QWebEngineDownloadItem::savePageFormat()
\sa savePageFormat(), isSavePageDownload()
*/
-void QWebEngineDownloadItem::setSavePageFormat(QWebEngineDownloadItem::SavePageFormat format)
+void QWebEngineDownloadRequest::setSavePageFormat(QWebEngineDownloadRequest::SavePageFormat format)
{
- Q_D(QWebEngineDownloadItem);
+ Q_D(QWebEngineDownloadRequest);
if (d->savePageFormat != format) {
d->savePageFormat = format;
Q_EMIT savePageFormatChanged();
@@ -620,9 +620,9 @@ void QWebEngineDownloadItem::setSavePageFormat(QWebEngineDownloadItem::SavePageF
\sa savePageFormat(), setSavePageFormat()
*/
-bool QWebEngineDownloadItem::isSavePageDownload() const
+bool QWebEngineDownloadRequest::isSavePageDownload() const
{
- Q_D(const QWebEngineDownloadItem);
+ Q_D(const QWebEngineDownloadRequest);
return d->isSavePageDownload;
}
@@ -632,9 +632,9 @@ bool QWebEngineDownloadItem::isSavePageDownload() const
\sa interruptReasonString()
*/
-QWebEngineDownloadItem::DownloadInterruptReason QWebEngineDownloadItem::interruptReason() const
+QWebEngineDownloadRequest::DownloadInterruptReason QWebEngineDownloadRequest::interruptReason() const
{
- Q_D(const QWebEngineDownloadItem);
+ Q_D(const QWebEngineDownloadRequest);
return d->interruptReason;
}
@@ -644,7 +644,7 @@ QWebEngineDownloadItem::DownloadInterruptReason QWebEngineDownloadItem::interrup
\sa interruptReason()
*/
-QString QWebEngineDownloadItem::interruptReasonString() const
+QString QWebEngineDownloadRequest::interruptReasonString() const
{
return ProfileAdapterClient::downloadInterruptReasonToString(
static_cast<ProfileAdapterClient::DownloadInterruptReason>(interruptReason()));
@@ -654,13 +654,13 @@ QString QWebEngineDownloadItem::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 *QWebEngineDownloadItem::page() const
+QObject *QWebEngineDownloadRequest::page() const
{
- Q_D(const QWebEngineDownloadItem);
+ Q_D(const QWebEngineDownloadRequest);
return d->page;
}
-QWebEngineDownloadItem::QWebEngineDownloadItem(QWebEngineDownloadItemPrivate *p, QObject *parent)
+QWebEngineDownloadRequest::QWebEngineDownloadRequest(QWebEngineDownloadRequestPrivate *p, QObject *parent)
: QObject(parent)
, d_ptr(p)
{
@@ -669,7 +669,7 @@ QWebEngineDownloadItem::QWebEngineDownloadItem(QWebEngineDownloadItemPrivate *p,
/*! \internal
*/
-QWebEngineDownloadItem::~QWebEngineDownloadItem()
+QWebEngineDownloadRequest::~QWebEngineDownloadRequest()
{
// MEMO Items are owned by profile by default and will be destroyed on profile's destruction
// It's not safe to access profile in that case, so we rely on profile to clean up items
diff --git a/src/core/api/qwebenginedownloaditem.h b/src/core/api/qwebenginedownloadrequest.h
index 095c4f79e..38d43cf1f 100644
--- a/src/core/api/qwebenginedownloaditem.h
+++ b/src/core/api/qwebenginedownloadrequest.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtWebEngine module of the Qt Toolkit.
@@ -37,8 +37,8 @@
**
****************************************************************************/
-#ifndef QWEBENGINEDOWNLOADITEM_H
-#define QWEBENGINEDOWNLOADITEM_H
+#ifndef QWEBENGINEDOWNLOADREQUEST_H
+#define QWEBENGINEDOWNLOADREQUEST_H
#include <QtWebEngineCore/qtwebenginecoreglobal.h>
@@ -48,31 +48,31 @@
QT_BEGIN_NAMESPACE
//TODO: class QWebEnginePage;
-class QWebEngineDownloadItemPrivate;
+class QWebEngineDownloadRequestPrivate;
class QWebEngineProfilePrivate;
-class Q_WEBENGINECORE_EXPORT QWebEngineDownloadItem : public QObject
+class Q_WEBENGINECORE_EXPORT QWebEngineDownloadRequest : public QObject
{
Q_OBJECT
public:
Q_PROPERTY(quint32 id READ id CONSTANT FINAL)
Q_PROPERTY(DownloadState state READ state NOTIFY stateChanged FINAL)
- Q_PROPERTY(SavePageFormat savePageFormat READ savePageFormat WRITE setSavePageFormat NOTIFY savePageFormatChanged REVISION 2 FINAL)
+ Q_PROPERTY(SavePageFormat savePageFormat READ savePageFormat WRITE setSavePageFormat NOTIFY savePageFormatChanged FINAL)
Q_PROPERTY(qint64 totalBytes READ totalBytes NOTIFY totalBytesChanged FINAL)
Q_PROPERTY(qint64 receivedBytes READ receivedBytes NOTIFY receivedBytesChanged FINAL)
- Q_PROPERTY(QString mimeType READ mimeType REVISION 1 FINAL)
- Q_PROPERTY(DownloadInterruptReason interruptReason READ interruptReason NOTIFY interruptReasonChanged REVISION 4 FINAL)
- Q_PROPERTY(QString interruptReasonString READ interruptReasonString NOTIFY interruptReasonChanged REVISION 4 FINAL)
- Q_PROPERTY(bool isFinished READ isFinished NOTIFY isFinishedChanged REVISION 5 FINAL)
- Q_PROPERTY(bool isPaused READ isPaused NOTIFY isPausedChanged REVISION 5 FINAL)
- Q_PROPERTY(bool isSavePageDownload READ isSavePageDownload CONSTANT REVISION 6 FINAL)
+ Q_PROPERTY(QString mimeType READ mimeType FINAL)
+ Q_PROPERTY(DownloadInterruptReason interruptReason READ interruptReason NOTIFY interruptReasonChanged FINAL)
+ Q_PROPERTY(QString interruptReasonString READ interruptReasonString NOTIFY interruptReasonChanged FINAL)
+ 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 7 FINAL)
- Q_PROPERTY(QUrl url READ url CONSTANT REVISION 10 FINAL)
- Q_PROPERTY(QString suggestedFileName READ suggestedFileName CONSTANT REVISION 10 FINAL)
- Q_PROPERTY(QString downloadDirectory READ downloadDirectory WRITE setDownloadDirectory NOTIFY downloadDirectoryChanged REVISION 10 FINAL)
- Q_PROPERTY(QString downloadFileName READ downloadFileName WRITE setDownloadFileName NOTIFY downloadFileNameChanged REVISION 10 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)
- ~QWebEngineDownloadItem();
+ ~QWebEngineDownloadRequest();
enum DownloadState {
DownloadRequested,
@@ -151,28 +151,28 @@ public Q_SLOTS:
void resume();
Q_SIGNALS:
- void stateChanged(QWebEngineDownloadItem::DownloadState state);
+ void stateChanged(QWebEngineDownloadRequest::DownloadState state);
//TODO: fix it for qml
void downloadProgress(qint64 bytesReceived, qint64 bytesTotal);
- Q_REVISION(2) void savePageFormatChanged();
+ void savePageFormatChanged();
void receivedBytesChanged();
void totalBytesChanged();
- Q_REVISION(4) void interruptReasonChanged();
- Q_REVISION(5) void isFinishedChanged();
- Q_REVISION(5) void isPausedChanged();
- Q_REVISION(10) void downloadDirectoryChanged();
- Q_REVISION(10) void downloadFileNameChanged();
+ void interruptReasonChanged();
+ void isFinishedChanged();
+ void isPausedChanged();
+ void downloadDirectoryChanged();
+ void downloadFileNameChanged();
private:
- Q_DISABLE_COPY(QWebEngineDownloadItem)
- Q_DECLARE_PRIVATE(QWebEngineDownloadItem)
+ Q_DISABLE_COPY(QWebEngineDownloadRequest)
+ Q_DECLARE_PRIVATE(QWebEngineDownloadRequest)
friend class QWebEngineProfilePrivate;
friend class QQuickWebEngineProfilePrivate;
- QWebEngineDownloadItem(QWebEngineDownloadItemPrivate*, QObject *parent = Q_NULLPTR);
- QScopedPointer<QWebEngineDownloadItemPrivate> d_ptr;
+ QWebEngineDownloadRequest(QWebEngineDownloadRequestPrivate*, QObject *parent = Q_NULLPTR);
+ QScopedPointer<QWebEngineDownloadRequestPrivate> d_ptr;
};
QT_END_NAMESPACE
-#endif // QWEBENGINEDOWNLOADITEM_H
+#endif // QWEBENGINEDOWNLOADREQUEST_H
diff --git a/src/core/api/qwebenginedownloaditem_p.h b/src/core/api/qwebenginedownloadrequest_p.h
index 8e38335c2..bc172bd7b 100644
--- a/src/core/api/qwebenginedownloaditem_p.h
+++ b/src/core/api/qwebenginedownloadrequest_p.h
@@ -37,8 +37,8 @@
**
****************************************************************************/
-#ifndef QWEBENGINEDOWNLOADITEM_P_H
-#define QWEBENGINEDOWNLOADITEM_P_H
+#ifndef QWEBENGINEDOWNLOADREQUEST_P_H
+#define QWEBENGINEDOWNLOADREQUEST_P_H
//
// W A R N I N G
@@ -52,7 +52,7 @@
//
#include "qtwebenginecoreglobal.h"
-#include "qwebenginedownloaditem.h"
+#include "qwebenginedownloadrequest.h"
#include "profile_adapter_client.h"
#include <QString>
#include <QPointer>
@@ -63,10 +63,10 @@ class ProfileAdapter;
QT_BEGIN_NAMESPACE
-class Q_WEBENGINECORE_PRIVATE_EXPORT QWebEngineDownloadItemPrivate {
+class Q_WEBENGINECORE_PRIVATE_EXPORT QWebEngineDownloadRequestPrivate {
public:
- QWebEngineDownloadItemPrivate(QtWebEngineCore::ProfileAdapter *adapter, const QUrl &url);
- ~QWebEngineDownloadItemPrivate();
+ QWebEngineDownloadRequestPrivate(QtWebEngineCore::ProfileAdapter *adapter, const QUrl &url);
+ ~QWebEngineDownloadRequestPrivate();
void update(const QtWebEngineCore::ProfileAdapterClient::DownloadItemInfo &info);
void setFinished();
@@ -74,9 +74,9 @@ public:
bool downloadFinished;
quint32 downloadId;
qint64 startTime;
- QWebEngineDownloadItem::DownloadState downloadState;
- QWebEngineDownloadItem::SavePageFormat savePageFormat;
- QWebEngineDownloadItem::DownloadInterruptReason interruptReason;
+ QWebEngineDownloadRequest::DownloadState downloadState;
+ QWebEngineDownloadRequest::SavePageFormat savePageFormat;
+ QWebEngineDownloadRequest::DownloadInterruptReason interruptReason;
QString downloadPath;
const QUrl downloadUrl;
QString mimeType;
@@ -88,13 +88,13 @@ public:
qint64 totalBytes;
qint64 receivedBytes;
bool isSavePageDownload;
- QWebEngineDownloadItem *q_ptr;
+ QWebEngineDownloadRequest *q_ptr;
QPointer<QtWebEngineCore::ProfileAdapter> m_profileAdapter;
QObject *page;
- Q_DECLARE_PUBLIC(QWebEngineDownloadItem)
+ Q_DECLARE_PUBLIC(QWebEngineDownloadRequest)
};
QT_END_NAMESPACE
-#endif // QWEBENGINEDOWNLOADITEM_P_H
+#endif // QWEBENGINEDOWNLOADREQUEST_P_H
diff --git a/src/webengine/api/qquickwebengineprofile.cpp b/src/webengine/api/qquickwebengineprofile.cpp
index 6ae997da4..2022306b0 100644
--- a/src/webengine/api/qquickwebengineprofile.cpp
+++ b/src/webengine/api/qquickwebengineprofile.cpp
@@ -54,7 +54,7 @@
#include "renderer_host/user_resource_controller_host.h"
#include "web_engine_settings.h"
-#include <QtWebEngineCore/private/qwebenginedownloaditem_p.h>
+#include <QtWebEngineCore/private/qwebenginedownloadrequest_p.h>
#include <QtWebEngineCore/qwebengineurlscheme.h>
using QtWebEngineCore::ProfileAdapter;
@@ -127,12 +127,12 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn QQuickWebEngineProfile::downloadRequested(QWebEngineDownloadItem *download)
+ \fn QQuickWebEngineProfile::downloadRequested(QWebEngineDownloadRequest *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
- \c{QWebEngineDownloadItem::accept()} or it will be
+ \c{QWebEngineDownloadRequest::accept()} or it will be
cancelled by default.
The download item is parented by the profile. If it is not accepted, it
will be deleted immediately after the signal emission.
@@ -140,7 +140,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn QQuickWebEngineProfile::downloadFinished(QWebEngineDownloadItem *download)
+ \fn QQuickWebEngineProfile::downloadFinished(QWebEngineDownloadRequest *download)
This signal is emitted whenever downloading stops, because it finished successfully, was
cancelled, or was interrupted (for example, because connectivity was lost).
@@ -236,16 +236,16 @@ void QQuickWebEngineProfilePrivate::downloadRequested(DownloadItemInfo &info)
Q_Q(QQuickWebEngineProfile);
Q_ASSERT(!m_ongoingDownloads.contains(info.id));
- QWebEngineDownloadItemPrivate *itemPrivate = new QWebEngineDownloadItemPrivate(m_profileAdapter, info.url);
+ QWebEngineDownloadRequestPrivate *itemPrivate = new QWebEngineDownloadRequestPrivate(m_profileAdapter, info.url);
itemPrivate->downloadId = info.id;
- itemPrivate->downloadState = QWebEngineDownloadItem::DownloadRequested;
+ itemPrivate->downloadState = QWebEngineDownloadRequest::DownloadRequested;
itemPrivate->startTime = info.startTime;
itemPrivate->totalBytes = info.totalBytes;
itemPrivate->mimeType = info.mimeType;
itemPrivate->downloadDirectory = QFileInfo(info.path).path();
itemPrivate->downloadFileName = QFileInfo(info.path).fileName();
itemPrivate->suggestedFileName = info.suggestedFileName;
- itemPrivate->savePageFormat = static_cast<QWebEngineDownloadItem::SavePageFormat>(
+ itemPrivate->savePageFormat = static_cast<QWebEngineDownloadRequest::SavePageFormat>(
info.savePageFormat);
itemPrivate->isSavePageDownload = info.isSavePageDownload;
if (info.page && info.page->clientType() == QtWebEngineCore::WebContentsAdapterClient::QmlClient)
@@ -253,21 +253,21 @@ void QQuickWebEngineProfilePrivate::downloadRequested(DownloadItemInfo &info)
else
itemPrivate->page = nullptr;
- QWebEngineDownloadItem *download = new QWebEngineDownloadItem(itemPrivate, q);
+ QWebEngineDownloadRequest *download = new QWebEngineDownloadRequest(itemPrivate, q);
m_ongoingDownloads.insert(info.id, download);
- QObject::connect(download, &QWebEngineDownloadItem::destroyed, q, [id = info.id, this] () { downloadDestroyed(id); });
+ QObject::connect(download, &QWebEngineDownloadRequest::destroyed, q, [id = info.id, this] () { downloadDestroyed(id); });
QQmlEngine::setObjectOwnership(download, QQmlEngine::JavaScriptOwnership);
Q_EMIT q->downloadRequested(download);
- QWebEngineDownloadItem::DownloadState state = download->state();
+ QWebEngineDownloadRequest::DownloadState state = download->state();
info.path = QDir(download->downloadDirectory()).filePath(download->downloadFileName());
info.savePageFormat = itemPrivate->savePageFormat;
- info.accepted = state != QWebEngineDownloadItem::DownloadCancelled
- && state != QWebEngineDownloadItem::DownloadRequested;
+ info.accepted = state != QWebEngineDownloadRequest::DownloadCancelled
+ && state != QWebEngineDownloadRequest::DownloadRequested;
- if (state == QWebEngineDownloadItem::DownloadRequested) {
+ if (state == QWebEngineDownloadRequest::DownloadRequested) {
// Delete unaccepted downloads.
info.accepted = false;
delete download;
@@ -281,7 +281,7 @@ void QQuickWebEngineProfilePrivate::downloadUpdated(const DownloadItemInfo &info
Q_Q(QQuickWebEngineProfile);
- QWebEngineDownloadItem* download = m_ongoingDownloads.value(info.id).data();
+ QWebEngineDownloadRequest* download = m_ongoingDownloads.value(info.id).data();
if (!download) {
downloadDestroyed(info.id);
diff --git a/src/webengine/api/qquickwebengineprofile.h b/src/webengine/api/qquickwebengineprofile.h
index b5fae2271..ca90d7ae8 100644
--- a/src/webengine/api/qquickwebengineprofile.h
+++ b/src/webengine/api/qquickwebengineprofile.h
@@ -50,7 +50,7 @@
QT_BEGIN_NAMESPACE
-class QWebEngineDownloadItem;
+class QWebEngineDownloadRequest;
class QQuickWebEngineProfilePrivate;
class QQuickWebEngineScript;
class QQuickWebEngineSettings;
@@ -173,8 +173,8 @@ Q_SIGNALS:
Q_REVISION(5) void useForGlobalCertificateVerificationChanged();
Q_REVISION(5) void downloadPathChanged();
- void downloadRequested(QWebEngineDownloadItem *download);
- void downloadFinished(QWebEngineDownloadItem *download);
+ void downloadRequested(QWebEngineDownloadRequest *download);
+ void downloadFinished(QWebEngineDownloadRequest *download);
Q_REVISION(5) void presentNotification(QWebEngineNotification *notification);
diff --git a/src/webengine/api/qquickwebengineprofile_p.h b/src/webengine/api/qquickwebengineprofile_p.h
index 06754c8b3..f1fd93543 100644
--- a/src/webengine/api/qquickwebengineprofile_p.h
+++ b/src/webengine/api/qquickwebengineprofile_p.h
@@ -62,7 +62,7 @@
QT_BEGIN_NAMESPACE
-class QWebEngineDownloadItem;
+class QWebEngineDownloadRequest;
class QQuickWebEngineSettings;
class QQuickWebEngineViewPrivate;
@@ -100,7 +100,7 @@ private:
QQuickWebEngineProfile *q_ptr;
QScopedPointer<QQuickWebEngineSettings> m_settings;
QPointer<QtWebEngineCore::ProfileAdapter> m_profileAdapter;
- QMap<quint32, QPointer<QWebEngineDownloadItem> > m_ongoingDownloads;
+ QMap<quint32, QPointer<QWebEngineDownloadRequest> > m_ongoingDownloads;
QList<QQuickWebEngineScript *> m_userScripts;
};
diff --git a/src/webengine/doc/src/webengine_download_item.qdoc b/src/webengine/doc/src/webengine_download_request.qdoc
index 9bfa97768..2b96ec45b 100644
--- a/src/webengine/doc/src/webengine_download_item.qdoc
+++ b/src/webengine/doc/src/webengine_download_request.qdoc
@@ -26,13 +26,12 @@
****************************************************************************/
/*!
- \qmltype WebEngineDownloadItem
- \instantiates QWebEngineDownloadItem
+ \qmltype WebEngineDownloadRequest
+ \instantiates QWebEngineDownloadRequest
\inqmlmodule QtWebEngine
- \since QtWebEngine 1.1
\brief Provides information about a download.
- WebEngineDownloadItem models a download throughout its life cycle, starting
+ WebEngineDownloadRequest models a download throughout its life cycle, starting
with a pending download request and finishing with a completed download. It
can be used, for example, to get information about new downloads, to monitor
progress, and to pause, resume, and cancel downloads.
@@ -41,7 +40,7 @@
WebEngineProfile's responsibility to notify the application of new download
requests, which it does by emitting the
\l{WebEngineProfile::downloadRequested}{downloadRequested} signal together
- with a newly created WebEngineDownloadItem. The application can then examine
+ with a newly created WebEngineDownloadRequest. The application can then examine
this item and decide whether to accept it or not. A signal handler must
explicitly call accept() on the item for \QWE to actually start
downloading and writing data to disk. If no signal handler calls accept(),
@@ -73,7 +72,7 @@
*/
/*!
- \qmlmethod void WebEngineDownloadItem::accept()
+ \qmlmethod void WebEngineDownloadRequest::accept()
Accepts the download request, which will start the download.
@@ -85,7 +84,7 @@
*/
/*!
- \qmlmethod void WebEngineDownloadItem::cancel()
+ \qmlmethod void WebEngineDownloadRequest::cancel()
Cancels the download.
@@ -101,8 +100,7 @@
*/
/*!
- \qmlmethod void WebEngineDownloadItem::pause()
- \since QtWebEngine 1.6
+ \qmlmethod void WebEngineDownloadRequest::pause()
Pauses the download.
@@ -113,8 +111,7 @@
*/
/*!
- \qmlmethod void WebEngineDownloadItem::resume()
- \since QtWebEngine 1.6
+ \qmlmethod void WebEngineDownloadRequest::resume()
Resumes the download if it was paused or interrupted.
@@ -125,30 +122,30 @@
*/
/*!
- \qmlproperty int WebEngineDownloadItem::id
+ \qmlproperty int WebEngineDownloadRequest::id
Holds the download item's ID.
*/
/*!
- \qmlproperty enumeration WebEngineDownloadItem::state
+ \qmlproperty enumeration WebEngineDownloadRequest::state
Describes the state of the download:
- \value WebEngineDownloadItem.DownloadRequested
+ \value WebEngineDownloadRequest.DownloadRequested
Download has been requested, but it has not been accepted yet.
- \value WebEngineDownloadItem.DownloadInProgress
+ \value WebEngineDownloadRequest.DownloadInProgress
Download is in progress.
- \value WebEngineDownloadItem.DownloadCompleted
+ \value WebEngineDownloadRequest.DownloadCompleted
Download completed successfully.
- \value WebEngineDownloadItem.DownloadCancelled
+ \value WebEngineDownloadRequest.DownloadCancelled
Download was cancelled by the user.
- \value WebEngineDownloadItem.DownloadInterrupted
+ \value WebEngineDownloadRequest.DownloadInterrupted
Download has been interrupted (by the server or because of lost connectivity).
*/
/*!
- \qmlproperty int WebEngineDownloadItem::totalBytes
+ \qmlproperty int WebEngineDownloadRequest::totalBytes
Holds the total amount of data to download in bytes.
@@ -156,29 +153,26 @@
*/
/*!
- \qmlproperty int WebEngineDownloadItem::receivedBytes
+ \qmlproperty int WebEngineDownloadRequest::receivedBytes
Holds the amount of data in bytes that has been downloaded so far.
*/
/*!
- \qmlproperty url WebEngineDownloadItem::url
+ \qmlproperty url WebEngineDownloadRequest::url
\readonly
- \since QtWebEngine 1.10
Returns the download's origin URL.
*/
/*!
- \qmlproperty string WebEngineDownloadItem::mimeType
- \since QtWebEngine 1.2
+ \qmlproperty string WebEngineDownloadRequest::mimeType
Holds the MIME type of the download.
*/
/*!
- \qmlproperty string WebEngineDownloadItem::downloadDirectory
- \since QtWebEngine 1.10
+ \qmlproperty string WebEngineDownloadRequest::downloadDirectory
Holds the full target path without file name where data is being downloaded to.
@@ -190,8 +184,7 @@
*/
/*!
- \qmlproperty string WebEngineDownloadItem::downloadFileName
- \since QtWebEngine 1.10
+ \qmlproperty string WebEngineDownloadRequest::downloadFileName
Holds the name of the file to which data is being downloaded.
@@ -203,34 +196,31 @@
*/
/*!
- \qmlproperty string WebEngineDownloadItem::suggestedFileName
- \since QtWebEngine 1.10
+ \qmlproperty string WebEngineDownloadRequest::suggestedFileName
Returns the suggested file name.
*/
/*!
- \qmlproperty enumeration WebEngineDownloadItem::savePageFormat
- \since QtWebEngine 1.3
+ \qmlproperty enumeration WebEngineDownloadRequest::savePageFormat
Describes the format that is used to save a web page.
- \value WebEngineDownloadItem.UnknownSaveFormat
+ \value WebEngineDownloadRequest.UnknownSaveFormat
This is not a request for downloading a complete web page.
- \value WebEngineDownloadItem.SingleHtmlSaveFormat
+ \value WebEngineDownloadRequest.SingleHtmlSaveFormat
The page is saved as a single HTML page. Resources such as images
are not saved.
- \value WebEngineDownloadItem.CompleteHtmlSaveFormat
+ \value WebEngineDownloadRequest.CompleteHtmlSaveFormat
The page is saved as a complete HTML page, for example a directory
containing the single HTML page and the resources.
- \value WebEngineDownloadItem.MimeHtmlSaveFormat
+ \value WebEngineDownloadRequest.MimeHtmlSaveFormat
The page is saved as a complete web page in the MIME HTML format.
*/
/*!
\qmlproperty bool WebEngineDownloadItem::isSavePageDownload
\readonly
- \since QtWebEngine 1.7
Whether this is a download request for saving a web page or a file.
@@ -238,67 +228,63 @@
*/
/*!
- \qmlproperty enumeration WebEngineDownloadItem::interruptReason
+ \qmlproperty enumeration WebEngineDownloadRequest::interruptReason
\readonly
- \since QtWebEngine 1.5
Returns the reason why the download was interrupted:
- \value WebEngineDownloadItem.NoReason Unknown reason or not interrupted.
- \value WebEngineDownloadItem.FileFailed General file operation failure.
- \value WebEngineDownloadItem.FileAccessDenied The file cannot be written locally, due to access restrictions.
- \value WebEngineDownloadItem.FileNoSpace Insufficient space on the target drive.
- \value WebEngineDownloadItem.FileNameTooLong The directory or file name is too long.
- \value WebEngineDownloadItem.FileTooLarge The file size exceeds the file system limitation.
- \value WebEngineDownloadItem.FileVirusInfected The file is infected with a virus.
- \value WebEngineDownloadItem.FileTransientError Temporary problem (for example the file is in use,
+ \value WebEngineDownloadRequest.NoReason Unknown reason or not interrupted.
+ \value WebEngineDownloadRequest.FileFailed General file operation failure.
+ \value WebEngineDownloadRequest.FileAccessDenied The file cannot be written locally, due to access restrictions.
+ \value WebEngineDownloadRequest.FileNoSpace Insufficient space on the target drive.
+ \value WebEngineDownloadRequest.FileNameTooLong The directory or file name is too long.
+ \value WebEngineDownloadRequest.FileTooLarge The file size exceeds the file system limitation.
+ \value WebEngineDownloadRequest.FileVirusInfected The file is infected with a virus.
+ \value WebEngineDownloadRequest.FileTransientError Temporary problem (for example the file is in use,
out of memory, or too many files are opened at once).
- \value WebEngineDownloadItem.FileBlocked The file was blocked due to local policy.
- \value WebEngineDownloadItem.FileSecurityCheckFailed An attempt to check the safety of the download
+ \value WebEngineDownloadRequest.FileBlocked The file was blocked due to local policy.
+ \value WebEngineDownloadRequest.FileSecurityCheckFailed An attempt to check the safety of the download
failed due to unexpected reasons.
- \value WebEngineDownloadItem.FileTooShort An attempt was made to seek past the end of a file when
+ \value WebEngineDownloadRequest.FileTooShort An attempt was made to seek past the end of a file when
opening a file (as part of resuming a previously interrupted download).
- \value WebEngineDownloadItem.FileHashMismatch The partial file did not match the expected hash.
+ \value WebEngineDownloadRequest.FileHashMismatch The partial file did not match the expected hash.
- \value WebEngineDownloadItem.NetworkFailed General network failure.
- \value WebEngineDownloadItem.NetworkTimeout The network operation has timed out.
- \value WebEngineDownloadItem.NetworkDisconnected The network connection has been terminated.
- \value WebEngineDownloadItem.NetworkServerDown The server has gone down.
- \value WebEngineDownloadItem.NetworkInvalidRequest The network request was invalid (for example, the
+ \value WebEngineDownloadRequest.NetworkFailed General network failure.
+ \value WebEngineDownloadRequest.NetworkTimeout The network operation has timed out.
+ \value WebEngineDownloadRequest.NetworkDisconnected The network connection has been terminated.
+ \value WebEngineDownloadRequest.NetworkServerDown The server has gone down.
+ \value WebEngineDownloadRequest.NetworkInvalidRequest The network request was invalid (for example, the
original or redirected URL is invalid, has an unsupported scheme, or is disallowed by policy).
- \value WebEngineDownloadItem.ServerFailed General server failure.
- \value WebEngineDownloadItem.ServerBadContent The server does not have the requested data.
- \value WebEngineDownloadItem.ServerUnauthorized The server did not authorize access to the resource.
- \value WebEngineDownloadItem.ServerCertProblem A problem with the server certificate occurred.
- \value WebEngineDownloadItem.ServerForbidden Access forbidden by the server.
- \value WebEngineDownloadItem.ServerUnreachable Unexpected server response (might indicate that
+ \value WebEngineDownloadRequest.ServerFailed General server failure.
+ \value WebEngineDownloadRequest.ServerBadContent The server does not have the requested data.
+ \value WebEngineDownloadRequest.ServerUnauthorized The server did not authorize access to the resource.
+ \value WebEngineDownloadRequest.ServerCertProblem A problem with the server certificate occurred.
+ \value WebEngineDownloadRequest.ServerForbidden Access forbidden by the server.
+ \value WebEngineDownloadRequest.ServerUnreachable Unexpected server response (might indicate that
the responding server may not be the intended server).
- \value WebEngineDownloadItem.UserCanceled The user canceled the download.
+ \value WebEngineDownloadRequest.UserCanceled The user canceled the download.
\sa interruptReasonString
*/
/*!
- \qmlproperty string WebEngineDownloadItem::interruptReasonString
+ \qmlproperty string WebEngineDownloadRequest::interruptReasonString
Returns a human-readable description of the reason for interrupting the download.
- \since QtWebEngine 1.5
\sa interruptReason
*/
/*!
- \qmlproperty bool WebEngineDownloadItem::isFinished
+ \qmlproperty bool WebEngineDownloadRequest::isFinished
\readonly
- \since QtWebEngine 1.6
Whether this download is finished (completed, cancelled, or non-resumable interrupted state).
*/
/*!
- \qmlproperty bool WebEngineDownloadItem::isPaused
+ \qmlproperty bool WebEngineDownloadRequest::isPaused
\readonly
- \since QtWebEngine 1.6
Whether this download is paused.
@@ -306,9 +292,8 @@
*/
/*!
- \qmlproperty WebEngineView WebEngineDownloadItem::view
+ \qmlproperty WebEngineView WebEngineDownloadRequest::view
\readonly
- \since QtWebEngine 1.8
Returns the view the download was requested on. If the download was not triggered by content in a view,
\c nullptr is returned.
diff --git a/src/webengine/plugin/plugin.cpp b/src/webengine/plugin/plugin.cpp
index 031db6b31..2dad9fefc 100644
--- a/src/webengine/plugin/plugin.cpp
+++ b/src/webengine/plugin/plugin.cpp
@@ -58,7 +58,7 @@
#include <QtWebEngineCore/qwebenginequotarequest.h>
#include <QtWebEngineCore/qwebengineregisterprotocolhandlerrequest.h>
#include <QtWebEngineCore/qwebenginecontextmenurequest.h>
-#include <QtWebEngineCore/qwebenginedownloaditem.h>
+#include <QtWebEngineCore/qwebenginedownloadrequest.h>
QT_BEGIN_NAMESPACE
@@ -107,24 +107,8 @@ public:
qmlRegisterType<QQuickWebEngineScript>(uri, 1, 1, "WebEngineScript");
qRegisterMetaType<QWebEngineCertificateError>();
qmlRegisterUncreatableType<QWebEngineCertificateError>(uri, 1, 1, "WebEngineCertificateError", msgUncreatableType("WebEngineCertificateError"));
- qmlRegisterUncreatableType<QWebEngineDownloadItem>(uri, 1, 1, "WebEngineDownloadItem",
- msgUncreatableType("WebEngineDownloadItem"));
- qmlRegisterUncreatableType<QWebEngineDownloadItem, 1>(uri, 1, 2, "WebEngineDownloadItem",
- msgUncreatableType("WebEngineDownloadItem"));
- qmlRegisterUncreatableType<QWebEngineDownloadItem, 2>(uri, 1, 3, "WebEngineDownloadItem",
- msgUncreatableType("WebEngineDownloadItem"));
- qmlRegisterUncreatableType<QWebEngineDownloadItem, 3>(uri, 1, 4, "WebEngineDownloadItem",
- msgUncreatableType("WebEngineDownloadItem"));
- qmlRegisterUncreatableType<QWebEngineDownloadItem, 4>(uri, 1, 5, "WebEngineDownloadItem",
- msgUncreatableType("WebEngineDownloadItem"));
- qmlRegisterUncreatableType<QWebEngineDownloadItem, 5>(uri, 1, 6, "WebEngineDownloadItem",
- msgUncreatableType("WebEngineDownloadItem"));
- qmlRegisterUncreatableType<QWebEngineDownloadItem, 6>(uri, 1, 7, "WebEngineDownloadItem",
- msgUncreatableType("WebEngineDownloadItem"));
- qmlRegisterUncreatableType<QWebEngineDownloadItem, 7>(uri, 1, 8, "WebEngineDownloadItem",
- msgUncreatableType("WebEngineDownloadItem"));
- qmlRegisterUncreatableType<QWebEngineDownloadItem, 10>(uri, 1, 10, "WebEngineDownloadItem",
- msgUncreatableType("WebEngineDownloadItem"));
+ qmlRegisterUncreatableType<QWebEngineDownloadRequest>(uri, 1, 1, "WebEngineDownloadRequest",
+ msgUncreatableType("WebEngineDownloadRequest"));
qmlRegisterUncreatableType<QQuickWebEngineNewViewRequest>(uri, 1, 1, "WebEngineNewViewRequest", msgUncreatableType("WebEngineNewViewRequest"));
qmlRegisterUncreatableType<QQuickWebEngineNewViewRequest, 1>(uri, 1, 5, "WebEngineNewViewRequest", tr("Cannot create separate instance of WebEngineNewViewRequest"));
qmlRegisterUncreatableType<QQuickWebEngineSettings>(uri, 1, 1, "WebEngineSettings", msgUncreatableType("WebEngineSettings"));
diff --git a/src/webenginewidgets/api/qwebenginepage.cpp b/src/webenginewidgets/api/qwebenginepage.cpp
index a48d3a934..1e4ade4ac 100644
--- a/src/webenginewidgets/api/qwebenginepage.cpp
+++ b/src/webenginewidgets/api/qwebenginepage.cpp
@@ -1086,11 +1086,11 @@ void QWebEnginePage::setBackgroundColor(const QColor &color)
*
* This function issues an asynchronous download request for the web page and returns immediately.
*
- * \sa QWebEngineDownloadItem::SavePageFormat
+ * \sa QWebEngineDownloadRequest::SavePageFormat
* \since 5.8
*/
void QWebEnginePage::save(const QString &filePath,
- QWebEngineDownloadItem::SavePageFormat format) const
+ QWebEngineDownloadRequest::SavePageFormat format) const
{
Q_D(const QWebEnginePage);
d->ensureInitialized();
diff --git a/src/webenginewidgets/api/qwebenginepage.h b/src/webenginewidgets/api/qwebenginepage.h
index ffb9425f0..199ba9e2e 100644
--- a/src/webenginewidgets/api/qwebenginepage.h
+++ b/src/webenginewidgets/api/qwebenginepage.h
@@ -42,7 +42,7 @@
#include <QtWebEngineWidgets/qtwebenginewidgetsglobal.h>
#include <QtWebEngineWidgets/qwebengineclientcertificateselection.h>
-#include <QtWebEngineCore/qwebenginedownloaditem.h>
+#include <QtWebEngineCore/qwebenginedownloadrequest.h>
#include <QtWebEngineCore/qwebenginecallback.h>
#include <QtWebEngineCore/qwebenginehttprequest.h>
@@ -295,8 +295,8 @@ public:
QColor backgroundColor() const;
void setBackgroundColor(const QColor &color);
- void save(const QString &filePath, QWebEngineDownloadItem::SavePageFormat format
- = QWebEngineDownloadItem::MimeHtmlSaveFormat) const;
+ void save(const QString &filePath, QWebEngineDownloadRequest::SavePageFormat format
+ = QWebEngineDownloadRequest::MimeHtmlSaveFormat) const;
bool isAudioMuted() const;
void setAudioMuted(bool muted);
diff --git a/src/webenginewidgets/api/qwebengineprofile.cpp b/src/webenginewidgets/api/qwebengineprofile.cpp
index 499d6df9d..ea9db34c4 100644
--- a/src/webenginewidgets/api/qwebengineprofile.cpp
+++ b/src/webenginewidgets/api/qwebengineprofile.cpp
@@ -41,8 +41,8 @@
#include "qwebengineprofile_p.h"
#include "qwebenginecookiestore.h"
-#include "qwebenginedownloaditem.h"
-#include "qwebenginedownloaditem_p.h"
+#include "qwebenginedownloadrequest.h"
+#include "qwebenginedownloadrequest_p.h"
#include "qwebenginenotificationpresenter_p.h"
#include "qwebenginepage.h"
#include "qwebenginepage_p.h"
@@ -58,10 +58,10 @@
QT_BEGIN_NAMESPACE
-ASSERT_ENUMS_MATCH(QWebEngineDownloadItem::UnknownSaveFormat, QtWebEngineCore::ProfileAdapterClient::UnknownSavePageFormat)
-ASSERT_ENUMS_MATCH(QWebEngineDownloadItem::SingleHtmlSaveFormat, QtWebEngineCore::ProfileAdapterClient::SingleHtmlSaveFormat)
-ASSERT_ENUMS_MATCH(QWebEngineDownloadItem::CompleteHtmlSaveFormat, QtWebEngineCore::ProfileAdapterClient::CompleteHtmlSaveFormat)
-ASSERT_ENUMS_MATCH(QWebEngineDownloadItem::MimeHtmlSaveFormat, QtWebEngineCore::ProfileAdapterClient::MimeHtmlSaveFormat)
+ASSERT_ENUMS_MATCH(QWebEngineDownloadRequest::UnknownSaveFormat, QtWebEngineCore::ProfileAdapterClient::UnknownSavePageFormat)
+ASSERT_ENUMS_MATCH(QWebEngineDownloadRequest::SingleHtmlSaveFormat, QtWebEngineCore::ProfileAdapterClient::SingleHtmlSaveFormat)
+ASSERT_ENUMS_MATCH(QWebEngineDownloadRequest::CompleteHtmlSaveFormat, QtWebEngineCore::ProfileAdapterClient::CompleteHtmlSaveFormat)
+ASSERT_ENUMS_MATCH(QWebEngineDownloadRequest::MimeHtmlSaveFormat, QtWebEngineCore::ProfileAdapterClient::MimeHtmlSaveFormat)
using QtWebEngineCore::ProfileAdapter;
@@ -151,19 +151,19 @@ void QWebEngineProfilePrivate::showNotification(QSharedPointer<QtWebEngineCore::
}
/*!
- \fn QWebEngineProfile::downloadRequested(QWebEngineDownloadItem *download)
+ \fn QWebEngineProfile::downloadRequested(QWebEngineDownloadRequest *download)
\since 5.5
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 QWebEngineDownloadItem::accept() or it will be
+ The download has to be explicitly accepted with QWebEngineDownloadRequest::accept() or it will be
cancelled by default.
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.
- \sa QWebEngineDownloadItem, QWebEnginePage::download()
+ \sa QWebEngineDownloadRequest, QWebEnginePage::download()
*/
QWebEngineProfilePrivate::QWebEngineProfilePrivate(ProfileAdapter* profileAdapter)
@@ -223,37 +223,37 @@ void QWebEngineProfilePrivate::downloadRequested(DownloadItemInfo &info)
Q_Q(QWebEngineProfile);
Q_ASSERT(!m_ongoingDownloads.contains(info.id));
- QWebEngineDownloadItemPrivate *itemPrivate = new QWebEngineDownloadItemPrivate(m_profileAdapter, info.url);
+ QWebEngineDownloadRequestPrivate *itemPrivate = new QWebEngineDownloadRequestPrivate(m_profileAdapter, info.url);
itemPrivate->downloadId = info.id;
- itemPrivate->downloadState = info.accepted ? QWebEngineDownloadItem::DownloadInProgress
- : QWebEngineDownloadItem::DownloadRequested;
+ itemPrivate->downloadState = info.accepted ? QWebEngineDownloadRequest::DownloadInProgress
+ : QWebEngineDownloadRequest::DownloadRequested;
itemPrivate->startTime = info.startTime;
itemPrivate->downloadDirectory = QFileInfo(info.path).path();
itemPrivate->downloadFileName = QFileInfo(info.path).fileName();
itemPrivate->suggestedFileName = info.suggestedFileName;
itemPrivate->mimeType = info.mimeType;
- itemPrivate->savePageFormat = static_cast<QWebEngineDownloadItem::SavePageFormat>(info.savePageFormat);
+ itemPrivate->savePageFormat = static_cast<QWebEngineDownloadRequest::SavePageFormat>(info.savePageFormat);
itemPrivate->isSavePageDownload = info.isSavePageDownload;
if (info.page && info.page->clientType() == QtWebEngineCore::WebContentsAdapterClient::WidgetsClient)
itemPrivate->page = static_cast<QWebEnginePagePrivate *>(info.page)->q_ptr;
else
itemPrivate->page = nullptr;
- QWebEngineDownloadItem *download = new QWebEngineDownloadItem(itemPrivate, q);
+ QWebEngineDownloadRequest *download = new QWebEngineDownloadRequest(itemPrivate, q);
m_ongoingDownloads.insert(info.id, download);
- QObject::connect(download, &QWebEngineDownloadItem::destroyed, q, [id = info.id, this] () { downloadDestroyed(id); });
+ QObject::connect(download, &QWebEngineDownloadRequest::destroyed, q, [id = info.id, this] () { downloadDestroyed(id); });
Q_EMIT q->downloadRequested(download);
- QWebEngineDownloadItem::DownloadState state = download->state();
+ QWebEngineDownloadRequest::DownloadState state = download->state();
info.path = QDir(download->downloadDirectory()).filePath(download->downloadFileName());
info.savePageFormat = static_cast<QtWebEngineCore::ProfileAdapterClient::SavePageFormat>(
download->savePageFormat());
- info.accepted = state != QWebEngineDownloadItem::DownloadCancelled;
+ info.accepted = state != QWebEngineDownloadRequest::DownloadCancelled;
- if (state == QWebEngineDownloadItem::DownloadRequested) {
+ if (state == QWebEngineDownloadRequest::DownloadRequested) {
// Delete unaccepted downloads.
info.accepted = false;
delete download;
@@ -265,7 +265,7 @@ void QWebEngineProfilePrivate::downloadUpdated(const DownloadItemInfo &info)
if (!m_ongoingDownloads.contains(info.id))
return;
- QWebEngineDownloadItem* download = m_ongoingDownloads.value(info.id).data();
+ QWebEngineDownloadRequest* download = m_ongoingDownloads.value(info.id).data();
if (!download) {
downloadDestroyed(info.id);
diff --git a/src/webenginewidgets/api/qwebengineprofile.h b/src/webenginewidgets/api/qwebengineprofile.h
index 794ba6279..a8bf70856 100644
--- a/src/webenginewidgets/api/qwebengineprofile.h
+++ b/src/webenginewidgets/api/qwebengineprofile.h
@@ -55,7 +55,7 @@ class QObject;
class QUrl;
class QWebEngineClientCertificateStore;
class QWebEngineCookieStore;
-class QWebEngineDownloadItem;
+class QWebEngineDownloadRequest;
class QWebEngineNotification;
class QWebEnginePage;
class QWebEnginePagePrivate;
@@ -149,7 +149,7 @@ public:
static QWebEngineProfile *defaultProfile();
Q_SIGNALS:
- void downloadRequested(QWebEngineDownloadItem *download);
+ void downloadRequested(QWebEngineDownloadRequest *download);
private:
Q_DISABLE_COPY(QWebEngineProfile)
diff --git a/src/webenginewidgets/api/qwebengineprofile_p.h b/src/webenginewidgets/api/qwebengineprofile_p.h
index 64e9500b0..60fa4632f 100644
--- a/src/webenginewidgets/api/qwebengineprofile_p.h
+++ b/src/webenginewidgets/api/qwebengineprofile_p.h
@@ -99,7 +99,7 @@ private:
QWebEngineSettings *m_settings;
QPointer<QtWebEngineCore::ProfileAdapter> m_profileAdapter;
QScopedPointer<QWebEngineScriptCollection> m_scriptCollection;
- QMap<quint32, QPointer<QWebEngineDownloadItem> > m_ongoingDownloads;
+ QMap<quint32, QPointer<QWebEngineDownloadRequest> > m_ongoingDownloads;
std::function<void(std::unique_ptr<QWebEngineNotification>)> m_notificationPresenter;
};
diff --git a/tests/auto/quick/publicapi/tst_publicapi.cpp b/tests/auto/quick/publicapi/tst_publicapi.cpp
index 1ffaa13da..e5f5bf27d 100644
--- a/tests/auto/quick/publicapi/tst_publicapi.cpp
+++ b/tests/auto/quick/publicapi/tst_publicapi.cpp
@@ -41,7 +41,7 @@
#include <QtWebEngineCore/QWebEngineQuotaRequest>
#include <QtWebEngineCore/QWebEngineRegisterProtocolHandlerRequest>
#include <QtWebEngineCore/QWebEngineContextMenuRequest>
-#include <QtWebEngineCore/QWebEngineDownloadItem>
+#include <QtWebEngineCore/QWebEngineDownloadRequest>
#include <private/qquickwebengineview_p.h>
#include <private/qquickwebengineaction_p.h>
#include <private/qquickwebengineclientcertificateselection_p.h>
@@ -64,7 +64,7 @@ static const QList<const QMetaObject *> typesToCheck = QList<const QMetaObject *
<< &QQuickWebEngineAction::staticMetaObject
<< &QQuickWebEngineClientCertificateOption::staticMetaObject
<< &QQuickWebEngineClientCertificateSelection::staticMetaObject
- << &QWebEngineDownloadItem::staticMetaObject
+ << &QWebEngineDownloadRequest::staticMetaObject
<< &QQuickWebEngineHistory::staticMetaObject
<< &QQuickWebEngineHistoryListModel::staticMetaObject
<< &QQuickWebEngineLoadRequest::staticMetaObject
@@ -199,69 +199,69 @@ static const QStringList expectedAPI = QStringList()
<< "QWebEngineContextMenuRequest.selectedText --> QString"
<< "QWebEngineContextMenuRequest.spellCheckerSuggestions --> QStringList"
<< "QWebEngineContextMenuRequest.position --> QPoint"
- << "QWebEngineDownloadItem.CompleteHtmlSaveFormat --> SavePageFormat"
- << "QWebEngineDownloadItem.DownloadCancelled --> DownloadState"
- << "QWebEngineDownloadItem.DownloadCompleted --> DownloadState"
- << "QWebEngineDownloadItem.DownloadInProgress --> DownloadState"
- << "QWebEngineDownloadItem.DownloadInterrupted --> DownloadState"
- << "QWebEngineDownloadItem.DownloadRequested --> DownloadState"
- << "QWebEngineDownloadItem.FileAccessDenied --> DownloadInterruptReason"
- << "QWebEngineDownloadItem.FileBlocked --> DownloadInterruptReason"
- << "QWebEngineDownloadItem.FileFailed --> DownloadInterruptReason"
- << "QWebEngineDownloadItem.FileHashMismatch --> DownloadInterruptReason"
- << "QWebEngineDownloadItem.FileNameTooLong --> DownloadInterruptReason"
- << "QWebEngineDownloadItem.FileNoSpace --> DownloadInterruptReason"
- << "QWebEngineDownloadItem.FileSecurityCheckFailed --> DownloadInterruptReason"
- << "QWebEngineDownloadItem.FileTooLarge --> DownloadInterruptReason"
- << "QWebEngineDownloadItem.FileTooShort --> DownloadInterruptReason"
- << "QWebEngineDownloadItem.FileTransientError --> DownloadInterruptReason"
- << "QWebEngineDownloadItem.FileVirusInfected --> DownloadInterruptReason"
- << "QWebEngineDownloadItem.MimeHtmlSaveFormat --> SavePageFormat"
- << "QWebEngineDownloadItem.NetworkDisconnected --> DownloadInterruptReason"
- << "QWebEngineDownloadItem.NetworkFailed --> DownloadInterruptReason"
- << "QWebEngineDownloadItem.NetworkInvalidRequest --> DownloadInterruptReason"
- << "QWebEngineDownloadItem.NetworkServerDown --> DownloadInterruptReason"
- << "QWebEngineDownloadItem.NetworkTimeout --> DownloadInterruptReason"
- << "QWebEngineDownloadItem.NoReason --> DownloadInterruptReason"
- << "QWebEngineDownloadItem.ServerBadContent --> DownloadInterruptReason"
- << "QWebEngineDownloadItem.ServerCertProblem --> DownloadInterruptReason"
- << "QWebEngineDownloadItem.ServerFailed --> DownloadInterruptReason"
- << "QWebEngineDownloadItem.ServerForbidden --> DownloadInterruptReason"
- << "QWebEngineDownloadItem.ServerUnauthorized --> DownloadInterruptReason"
- << "QWebEngineDownloadItem.ServerUnreachable --> DownloadInterruptReason"
- << "QWebEngineDownloadItem.SingleHtmlSaveFormat --> SavePageFormat"
- << "QWebEngineDownloadItem.UnknownSaveFormat --> SavePageFormat"
- << "QWebEngineDownloadItem.UserCanceled --> DownloadInterruptReason"
- << "QWebEngineDownloadItem.accept() --> void"
- << "QWebEngineDownloadItem.cancel() --> void"
- << "QWebEngineDownloadItem.id --> uint"
- << "QWebEngineDownloadItem.interruptReason --> DownloadInterruptReason"
- << "QWebEngineDownloadItem.interruptReasonChanged() --> void"
- << "QWebEngineDownloadItem.interruptReasonString --> QString"
- << "QWebEngineDownloadItem.isFinished --> bool"
- << "QWebEngineDownloadItem.isFinishedChanged() --> void"
- << "QWebEngineDownloadItem.isPaused --> bool"
- << "QWebEngineDownloadItem.isPausedChanged() --> void"
- << "QWebEngineDownloadItem.isSavePageDownload --> bool"
- << "QWebEngineDownloadItem.mimeType --> QString"
- << "QWebEngineDownloadItem.pause() --> void"
- << "QWebEngineDownloadItem.receivedBytes --> qlonglong"
- << "QWebEngineDownloadItem.receivedBytesChanged() --> void"
- << "QWebEngineDownloadItem.resume() --> void"
- << "QWebEngineDownloadItem.savePageFormat --> SavePageFormat"
- << "QWebEngineDownloadItem.savePageFormatChanged() --> void"
- << "QWebEngineDownloadItem.state --> DownloadState"
- << "QWebEngineDownloadItem.stateChanged(QWebEngineDownloadItem::DownloadState) --> void"
- << "QWebEngineDownloadItem.totalBytes --> qlonglong"
- << "QWebEngineDownloadItem.totalBytesChanged() --> void"
- // FIXME << "QWebEngineDownloadItem.view --> QQuickWebEngineView*"
- << "QWebEngineDownloadItem.url --> QUrl"
- << "QWebEngineDownloadItem.suggestedFileName --> QString"
- << "QWebEngineDownloadItem.downloadDirectory --> QString"
- << "QWebEngineDownloadItem.downloadDirectoryChanged() --> void"
- << "QWebEngineDownloadItem.downloadFileName --> QString"
- << "QWebEngineDownloadItem.downloadFileNameChanged() --> void"
- << "QWebEngineDownloadItem.downloadProgress(qlonglong,qlonglong) --> void" // FIXME
+ << "QWebEngineDownloadRequest.CompleteHtmlSaveFormat --> SavePageFormat"
+ << "QWebEngineDownloadRequest.DownloadCancelled --> DownloadState"
+ << "QWebEngineDownloadRequest.DownloadCompleted --> DownloadState"
+ << "QWebEngineDownloadRequest.DownloadInProgress --> DownloadState"
+ << "QWebEngineDownloadRequest.DownloadInterrupted --> DownloadState"
+ << "QWebEngineDownloadRequest.DownloadRequested --> DownloadState"
+ << "QWebEngineDownloadRequest.FileAccessDenied --> DownloadInterruptReason"
+ << "QWebEngineDownloadRequest.FileBlocked --> DownloadInterruptReason"
+ << "QWebEngineDownloadRequest.FileFailed --> DownloadInterruptReason"
+ << "QWebEngineDownloadRequest.FileHashMismatch --> DownloadInterruptReason"
+ << "QWebEngineDownloadRequest.FileNameTooLong --> DownloadInterruptReason"
+ << "QWebEngineDownloadRequest.FileNoSpace --> DownloadInterruptReason"
+ << "QWebEngineDownloadRequest.FileSecurityCheckFailed --> DownloadInterruptReason"
+ << "QWebEngineDownloadRequest.FileTooLarge --> DownloadInterruptReason"
+ << "QWebEngineDownloadRequest.FileTooShort --> DownloadInterruptReason"
+ << "QWebEngineDownloadRequest.FileTransientError --> DownloadInterruptReason"
+ << "QWebEngineDownloadRequest.FileVirusInfected --> DownloadInterruptReason"
+ << "QWebEngineDownloadRequest.MimeHtmlSaveFormat --> SavePageFormat"
+ << "QWebEngineDownloadRequest.NetworkDisconnected --> DownloadInterruptReason"
+ << "QWebEngineDownloadRequest.NetworkFailed --> DownloadInterruptReason"
+ << "QWebEngineDownloadRequest.NetworkInvalidRequest --> DownloadInterruptReason"
+ << "QWebEngineDownloadRequest.NetworkServerDown --> DownloadInterruptReason"
+ << "QWebEngineDownloadRequest.NetworkTimeout --> DownloadInterruptReason"
+ << "QWebEngineDownloadRequest.NoReason --> DownloadInterruptReason"
+ << "QWebEngineDownloadRequest.ServerBadContent --> DownloadInterruptReason"
+ << "QWebEngineDownloadRequest.ServerCertProblem --> DownloadInterruptReason"
+ << "QWebEngineDownloadRequest.ServerFailed --> DownloadInterruptReason"
+ << "QWebEngineDownloadRequest.ServerForbidden --> DownloadInterruptReason"
+ << "QWebEngineDownloadRequest.ServerUnauthorized --> DownloadInterruptReason"
+ << "QWebEngineDownloadRequest.ServerUnreachable --> DownloadInterruptReason"
+ << "QWebEngineDownloadRequest.SingleHtmlSaveFormat --> SavePageFormat"
+ << "QWebEngineDownloadRequest.UnknownSaveFormat --> SavePageFormat"
+ << "QWebEngineDownloadRequest.UserCanceled --> DownloadInterruptReason"
+ << "QWebEngineDownloadRequest.accept() --> void"
+ << "QWebEngineDownloadRequest.cancel() --> void"
+ << "QWebEngineDownloadRequest.id --> uint"
+ << "QWebEngineDownloadRequest.interruptReason --> DownloadInterruptReason"
+ << "QWebEngineDownloadRequest.interruptReasonChanged() --> void"
+ << "QWebEngineDownloadRequest.interruptReasonString --> QString"
+ << "QWebEngineDownloadRequest.isFinished --> bool"
+ << "QWebEngineDownloadRequest.isFinishedChanged() --> void"
+ << "QWebEngineDownloadRequest.isPaused --> bool"
+ << "QWebEngineDownloadRequest.isPausedChanged() --> void"
+ << "QWebEngineDownloadRequest.isSavePageDownload --> bool"
+ << "QWebEngineDownloadRequest.mimeType --> QString"
+ << "QWebEngineDownloadRequest.pause() --> void"
+ << "QWebEngineDownloadRequest.receivedBytes --> qlonglong"
+ << "QWebEngineDownloadRequest.receivedBytesChanged() --> void"
+ << "QWebEngineDownloadRequest.resume() --> void"
+ << "QWebEngineDownloadRequest.savePageFormat --> SavePageFormat"
+ << "QWebEngineDownloadRequest.savePageFormatChanged() --> void"
+ << "QWebEngineDownloadRequest.state --> DownloadState"
+ << "QWebEngineDownloadRequest.stateChanged(QWebEngineDownloadRequest::DownloadState) --> void"
+ << "QWebEngineDownloadRequest.totalBytes --> qlonglong"
+ << "QWebEngineDownloadRequest.totalBytesChanged() --> void"
+ // FIXME << "QWebEngineDownloadRequest.view --> QQuickWebEngineView*"
+ << "QWebEngineDownloadRequest.url --> QUrl"
+ << "QWebEngineDownloadRequest.suggestedFileName --> QString"
+ << "QWebEngineDownloadRequest.downloadDirectory --> QString"
+ << "QWebEngineDownloadRequest.downloadDirectoryChanged() --> void"
+ << "QWebEngineDownloadRequest.downloadFileName --> QString"
+ << "QWebEngineDownloadRequest.downloadFileNameChanged() --> void"
+ << "QWebEngineDownloadRequest.downloadProgress(qlonglong,qlonglong) --> void" // FIXME
<< "QQuickWebEngineFileDialogRequest.FileModeOpen --> FileMode"
<< "QQuickWebEngineFileDialogRequest.FileModeOpenMultiple --> FileMode"
<< "QQuickWebEngineFileDialogRequest.FileModeSave --> FileMode"
@@ -333,8 +333,8 @@ static const QStringList expectedAPI = QStringList()
<< "QQuickWebEngineProfile.cachePath --> QString"
<< "QQuickWebEngineProfile.cachePathChanged() --> void"
<< "QQuickWebEngineProfile.clearHttpCache() --> void"
- << "QQuickWebEngineProfile.downloadFinished(QWebEngineDownloadItem*) --> void"
- << "QQuickWebEngineProfile.downloadRequested(QWebEngineDownloadItem*) --> void"
+ << "QQuickWebEngineProfile.downloadFinished(QWebEngineDownloadRequest*) --> void"
+ << "QQuickWebEngineProfile.downloadRequested(QWebEngineDownloadRequest*) --> void"
<< "QQuickWebEngineProfile.downloadPath --> QString"
<< "QQuickWebEngineProfile.downloadPathChanged() --> void"
<< "QQuickWebEngineProfile.presentNotification(QWebEngineNotification*) --> void"
diff --git a/tests/auto/quick/qmltests/data/tst_download.qml b/tests/auto/quick/qmltests/data/tst_download.qml
index 1b1750dd8..8607d846d 100644
--- a/tests/auto/quick/qmltests/data/tst_download.qml
+++ b/tests/auto/quick/qmltests/data/tst_download.qml
@@ -155,7 +155,7 @@ TestWebEngineView {
compare(downLoadRequestedSpy.count, 1)
compare(downloadUrl, webEngineView.url)
compare(suggestedFileName, "download.zip")
- compare(downloadState[0], WebEngineDownloadItem.DownloadRequested)
+ compare(downloadState[0], WebEngineDownloadRequest.DownloadRequested)
verify(!downloadInterruptReason)
}
@@ -179,11 +179,11 @@ TestWebEngineView {
compare(downLoadRequestedSpy.count, 1)
compare(downloadUrl, webEngineView.url)
compare(suggestedFileName, "download.zip")
- compare(downloadState[0], WebEngineDownloadItem.DownloadRequested)
- tryCompare(downloadState, "1", WebEngineDownloadItem.DownloadInProgress)
+ compare(downloadState[0], WebEngineDownloadRequest.DownloadRequested)
+ tryCompare(downloadState, "1", WebEngineDownloadRequest.DownloadInProgress)
downloadFinishedSpy.wait()
compare(totalBytes, receivedBytes)
- tryCompare(downloadState, "2", WebEngineDownloadItem.DownloadCompleted)
+ tryCompare(downloadState, "2", WebEngineDownloadRequest.DownloadCompleted)
verify(!downloadInterruptReason)
}
@@ -196,8 +196,8 @@ TestWebEngineView {
compare(downloadUrl, webEngineView.url)
compare(suggestedFileName, "download.zip")
compare(downloadFinishedSpy.count, 1)
- tryCompare(downloadState, "1", WebEngineDownloadItem.DownloadCancelled)
- tryCompare(webEngineView, "downloadInterruptReason", WebEngineDownloadItem.UserCanceled)
+ tryCompare(downloadState, "1", WebEngineDownloadRequest.DownloadCancelled)
+ tryCompare(webEngineView, "downloadInterruptReason", WebEngineDownloadRequest.UserCanceled)
}
function test_downloadLocation() {
@@ -230,15 +230,15 @@ TestWebEngineView {
compare(downLoadRequestedSpy.count, 1);
compare(downloadUrl, webEngineView.url);
compare(suggestedFileName, "download.zip");
- compare(downloadState[0], WebEngineDownloadItem.DownloadRequested);
- tryCompare(downloadState, "1", WebEngineDownloadItem.DownloadInProgress);
+ compare(downloadState[0], WebEngineDownloadRequest.DownloadRequested);
+ tryCompare(downloadState, "1", WebEngineDownloadRequest.DownloadInProgress);
compare(downloadedPath, testDownloadProfile.downloadPath + downloadDirectory + downloadFileName);
compare(downloadDirectoryChanged, 1);
compare(downloadFileNameChanged, 1);
compare(downloadPathChanged, 2);
downloadFinishedSpy.wait();
compare(totalBytes, receivedBytes);
- tryCompare(downloadState, "2", WebEngineDownloadItem.DownloadCompleted);
+ tryCompare(downloadState, "2", WebEngineDownloadRequest.DownloadCompleted);
verify(!downloadInterruptReason);
}
@@ -253,15 +253,15 @@ TestWebEngineView {
compare(downLoadRequestedSpy.count, 1);
compare(downloadUrl, webEngineView.url);
compare(suggestedFileName, "download.zip");
- compare(downloadState[0], WebEngineDownloadItem.DownloadRequested);
- tryCompare(downloadState, "1", WebEngineDownloadItem.DownloadInProgress);
+ compare(downloadState[0], WebEngineDownloadRequest.DownloadRequested);
+ tryCompare(downloadState, "1", WebEngineDownloadRequest.DownloadInProgress);
compare(downloadedPath, testDownloadProfile.downloadPath + downloadDirectory + "download.zip");
compare(downloadDirectoryChanged, 1);
compare(downloadFileNameChanged, 0);
compare(downloadPathChanged, 1);
downloadFinishedSpy.wait();
compare(totalBytes, receivedBytes);
- tryCompare(downloadState, "2", WebEngineDownloadItem.DownloadCompleted);
+ tryCompare(downloadState, "2", WebEngineDownloadRequest.DownloadCompleted);
verify(!downloadInterruptReason);
// Download the same file to another directory with suggested file name.
@@ -277,15 +277,15 @@ TestWebEngineView {
compare(downLoadRequestedSpy.count, 1);
compare(downloadUrl, webEngineView.url);
compare(suggestedFileName, "download.zip");
- compare(downloadState[0], WebEngineDownloadItem.DownloadRequested);
- tryCompare(downloadState, "1", WebEngineDownloadItem.DownloadInProgress);
+ compare(downloadState[0], WebEngineDownloadRequest.DownloadRequested);
+ tryCompare(downloadState, "1", WebEngineDownloadRequest.DownloadInProgress);
compare(downloadedPath, testDownloadProfile.downloadPath + downloadDirectory + "download.zip");
compare(downloadDirectoryChanged, 1);
compare(downloadFileNameChanged, 0);
compare(downloadPathChanged, 1);
downloadFinishedSpy.wait();
compare(totalBytes, receivedBytes);
- tryCompare(downloadState, "2", WebEngineDownloadItem.DownloadCompleted);
+ tryCompare(downloadState, "2", WebEngineDownloadRequest.DownloadCompleted);
verify(!downloadInterruptReason);
// Download same file to same directory second time -> file name should be unified.
@@ -301,15 +301,15 @@ TestWebEngineView {
compare(downLoadRequestedSpy.count, 1);
compare(downloadUrl, webEngineView.url);
compare(suggestedFileName, "download.zip");
- compare(downloadState[0], WebEngineDownloadItem.DownloadRequested);
- tryCompare(downloadState, "1", WebEngineDownloadItem.DownloadInProgress);
+ compare(downloadState[0], WebEngineDownloadRequest.DownloadRequested);
+ tryCompare(downloadState, "1", WebEngineDownloadRequest.DownloadInProgress);
compare(downloadedPath, testDownloadProfile.downloadPath + downloadDirectory + "download (1).zip");
compare(downloadDirectoryChanged, 1);
compare(downloadFileNameChanged, 1);
compare(downloadPathChanged, 1);
downloadFinishedSpy.wait();
compare(totalBytes, receivedBytes);
- tryCompare(downloadState, "2", WebEngineDownloadItem.DownloadCompleted);
+ tryCompare(downloadState, "2", WebEngineDownloadRequest.DownloadCompleted);
verify(!downloadInterruptReason);
}
@@ -323,15 +323,15 @@ TestWebEngineView {
compare(downLoadRequestedSpy.count, 1);
compare(downloadUrl, webEngineView.url);
compare(suggestedFileName, "download.zip");
- compare(downloadState[0], WebEngineDownloadItem.DownloadRequested);
- tryCompare(downloadState, "1", WebEngineDownloadItem.DownloadInProgress);
+ compare(downloadState[0], WebEngineDownloadRequest.DownloadRequested);
+ tryCompare(downloadState, "1", WebEngineDownloadRequest.DownloadInProgress);
compare(downloadedPath, testDownloadProfile.downloadPath + downloadedSetPath);
compare(downloadDirectoryChanged, 1);
compare(downloadFileNameChanged, 1);
compare(downloadPathChanged, 2);
downloadFinishedSpy.wait();
compare(totalBytes, receivedBytes);
- tryCompare(downloadState, "2", WebEngineDownloadItem.DownloadCompleted);
+ tryCompare(downloadState, "2", WebEngineDownloadRequest.DownloadCompleted);
verify(!downloadInterruptReason);
}
}
diff --git a/tests/auto/widgets/loadsignals/tst_loadsignals.cpp b/tests/auto/widgets/loadsignals/tst_loadsignals.cpp
index 31874c5e7..635c618c4 100644
--- a/tests/auto/widgets/loadsignals/tst_loadsignals.cpp
+++ b/tests/auto/widgets/loadsignals/tst_loadsignals.cpp
@@ -232,10 +232,10 @@ void tst_LoadSignals::fileDownloadDoesNotTriggerLoadSignals_qtbug66661()
// allow the download
QTemporaryDir tempDir;
- QWebEngineDownloadItem::DownloadState downloadState = QWebEngineDownloadItem::DownloadRequested;
+ QWebEngineDownloadRequest::DownloadState downloadState = QWebEngineDownloadRequest::DownloadRequested;
connect(view->page()->profile(), &QWebEngineProfile::downloadRequested,
- [&downloadState, &tempDir](QWebEngineDownloadItem* item){
- connect(item, &QWebEngineDownloadItem::stateChanged, [&downloadState](QWebEngineDownloadItem::DownloadState newState){
+ [&downloadState, &tempDir](QWebEngineDownloadRequest* item){
+ connect(item, &QWebEngineDownloadRequest::stateChanged, [&downloadState](QWebEngineDownloadRequest::DownloadState newState){
downloadState = newState;
});
item->setDownloadDirectory(tempDir.path());
@@ -253,7 +253,7 @@ void tst_LoadSignals::fileDownloadDoesNotTriggerLoadSignals_qtbug66661()
|| (loadFinishedSpy->size() != 1), 10000, 100);
// Download must have occurred
- QTRY_COMPARE(downloadState, QWebEngineDownloadItem::DownloadCompleted);
+ QTRY_COMPARE(downloadState, QWebEngineDownloadRequest::DownloadCompleted);
// No further loadStarted should have occurred within this time
QCOMPARE(loadStartedSpy->size(), 1);
diff --git a/tests/auto/widgets/qwebenginedownloaditem/qwebenginedownloaditem.pro b/tests/auto/widgets/qwebenginedownloadrequest/qwebenginedownloadrequest.pro
index 18a66c466..18a66c466 100644
--- a/tests/auto/widgets/qwebenginedownloaditem/qwebenginedownloaditem.pro
+++ b/tests/auto/widgets/qwebenginedownloadrequest/qwebenginedownloadrequest.pro
diff --git a/tests/auto/widgets/qwebenginedownloaditem/tst_qwebenginedownloaditem.cpp b/tests/auto/widgets/qwebenginedownloadrequest/tst_qwebenginedownloadrequest.cpp
index 3d2ad4332..a84b8356e 100644
--- a/tests/auto/widgets/qwebenginedownloaditem/tst_qwebenginedownloaditem.cpp
+++ b/tests/auto/widgets/qwebenginedownloadrequest/tst_qwebenginedownloadrequest.cpp
@@ -32,14 +32,14 @@
#include <QTemporaryDir>
#include <QTest>
#include <QRegularExpression>
-#include <QWebEngineDownloadItem>
+#include <QWebEngineDownloadRequest>
#include <QWebEnginePage>
#include <QWebEngineProfile>
#include <QWebEngineSettings>
#include <QWebEngineView>
#include <httpserver.h>
-class tst_QWebEngineDownloadItem : public QObject
+class tst_QWebEngineDownloadRequest : public QObject
{
Q_OBJECT
@@ -89,8 +89,8 @@ private:
QWebEngineProfile *m_profile;
QWebEnginePage *m_page;
QWebEngineView *m_view;
- QSet<QWebEngineDownloadItem *> m_requestedDownloads;
- QSet<QWebEngineDownloadItem *> m_finishedDownloads;
+ QSet<QWebEngineDownloadRequest *> m_requestedDownloads;
+ QSet<QWebEngineDownloadRequest *> m_finishedDownloads;
};
class ScopedConnection {
@@ -101,22 +101,22 @@ private:
QMetaObject::Connection m_connection;
};
-Q_DECLARE_METATYPE(tst_QWebEngineDownloadItem::UserAction)
-Q_DECLARE_METATYPE(tst_QWebEngineDownloadItem::FileAction)
+Q_DECLARE_METATYPE(tst_QWebEngineDownloadRequest::UserAction)
+Q_DECLARE_METATYPE(tst_QWebEngineDownloadRequest::FileAction)
-void tst_QWebEngineDownloadItem::initTestCase()
+void tst_QWebEngineDownloadRequest::initTestCase()
{
m_server = new HttpServer();
m_profile = new QWebEngineProfile;
m_profile->setHttpCacheType(QWebEngineProfile::NoCache);
m_profile->settings()->setAttribute(QWebEngineSettings::AutoLoadIconsForPage, false);
- connect(m_profile, &QWebEngineProfile::downloadRequested, [this](QWebEngineDownloadItem *item) {
+ connect(m_profile, &QWebEngineProfile::downloadRequested, [this](QWebEngineDownloadRequest *item) {
m_requestedDownloads.insert(item);
- connect(item, &QWebEngineDownloadItem::destroyed, [this, item](){
+ connect(item, &QWebEngineDownloadRequest::destroyed, [this, item](){
m_requestedDownloads.remove(item);
m_finishedDownloads.remove(item);
});
- connect(item, &QWebEngineDownloadItem::isFinishedChanged, [this, item](){
+ connect(item, &QWebEngineDownloadRequest::isFinishedChanged, [this, item](){
m_finishedDownloads.insert(item);
});
});
@@ -127,14 +127,14 @@ void tst_QWebEngineDownloadItem::initTestCase()
m_view->show();
}
-void tst_QWebEngineDownloadItem::init()
+void tst_QWebEngineDownloadRequest::init()
{
QVERIFY(m_server->start());
}
-void tst_QWebEngineDownloadItem::cleanup()
+void tst_QWebEngineDownloadRequest::cleanup()
{
- for (QWebEngineDownloadItem *item : m_finishedDownloads) {
+ for (QWebEngineDownloadRequest *item : m_finishedDownloads) {
item->deleteLater();
}
QTRY_COMPARE(m_requestedDownloads.count(), 0);
@@ -144,7 +144,7 @@ void tst_QWebEngineDownloadItem::cleanup()
m_profile->setDownloadPath("");
}
-void tst_QWebEngineDownloadItem::cleanupTestCase()
+void tst_QWebEngineDownloadRequest::cleanupTestCase()
{
delete m_view;
delete m_page;
@@ -152,7 +152,7 @@ void tst_QWebEngineDownloadItem::cleanupTestCase()
delete m_server;
}
-void tst_QWebEngineDownloadItem::saveLink(QPoint linkPos)
+void tst_QWebEngineDownloadRequest::saveLink(QPoint linkPos)
{
// Simulate right-clicking on link and choosing "save link as" from menu.
QSignalSpy menuSpy(m_view, &QWebEngineView::customContextMenuRequested);
@@ -169,7 +169,7 @@ void tst_QWebEngineDownloadItem::saveLink(QPoint linkPos)
m_page->triggerAction(QWebEnginePage::DownloadLinkToDisk);
}
-void tst_QWebEngineDownloadItem::clickLink(QPoint linkPos)
+void tst_QWebEngineDownloadRequest::clickLink(QPoint linkPos)
{
// Simulate left-clicking on link.
QTRY_VERIFY(m_view->focusWidget());
@@ -177,7 +177,7 @@ void tst_QWebEngineDownloadItem::clickLink(QPoint linkPos)
QTest::mouseClick(renderWidget, Qt::LeftButton, {}, linkPos);
}
-void tst_QWebEngineDownloadItem::simulateUserAction(QPoint linkPos, UserAction action)
+void tst_QWebEngineDownloadRequest::simulateUserAction(QPoint linkPos, UserAction action)
{
switch (action) {
case SaveLink: return saveLink(linkPos);
@@ -185,7 +185,7 @@ void tst_QWebEngineDownloadItem::simulateUserAction(QPoint linkPos, UserAction a
}
}
-void tst_QWebEngineDownloadItem::downloadLink_data()
+void tst_QWebEngineDownloadRequest::downloadLink_data()
{
QTest::addColumn<UserAction>("userAction");
QTest::addColumn<bool>("anchorHasDownloadAttribute");
@@ -381,7 +381,7 @@ void tst_QWebEngineDownloadItem::downloadLink_data()
/* fileAction */ << FileIsDownloaded;
}
-void tst_QWebEngineDownloadItem::downloadLink()
+void tst_QWebEngineDownloadRequest::downloadLink()
{
QFETCH(UserAction, userAction);
QFETCH(bool, anchorHasDownloadAttribute);
@@ -439,29 +439,29 @@ void tst_QWebEngineDownloadItem::downloadLink()
QUrl downloadUrl = m_server->url(slashFileName);
int acceptedCount = 0;
int finishedCount = 0;
- ScopedConnection sc2 = connect(m_profile, &QWebEngineProfile::downloadRequested, [&](QWebEngineDownloadItem *item) {
- QCOMPARE(item->state(), QWebEngineDownloadItem::DownloadRequested);
+ ScopedConnection sc2 = connect(m_profile, &QWebEngineProfile::downloadRequested, [&](QWebEngineDownloadRequest *item) {
+ QCOMPARE(item->state(), QWebEngineDownloadRequest::DownloadRequested);
QCOMPARE(item->isFinished(), false);
QCOMPARE(item->totalBytes(), -1);
QCOMPARE(item->receivedBytes(), 0);
- QCOMPARE(item->interruptReason(), QWebEngineDownloadItem::NoReason);
+ QCOMPARE(item->interruptReason(), QWebEngineDownloadRequest::NoReason);
QCOMPARE(item->isSavePageDownload(), false);
QCOMPARE(item->mimeType(), QString(fileMimeTypeDetected));
QCOMPARE(QDir(item->downloadDirectory()).filePath(item->downloadFileName()), suggestedPath);
- QCOMPARE(item->savePageFormat(), QWebEngineDownloadItem::UnknownSaveFormat);
+ QCOMPARE(item->savePageFormat(), QWebEngineDownloadRequest::UnknownSaveFormat);
QCOMPARE(item->url(), downloadUrl);
QCOMPARE(item->page(), m_page);
- connect(item, &QWebEngineDownloadItem::isFinishedChanged, [&, item]() {
- QCOMPARE(item->state(), QWebEngineDownloadItem::DownloadCompleted);
+ connect(item, &QWebEngineDownloadRequest::isFinishedChanged, [&, item]() {
+ QCOMPARE(item->state(), QWebEngineDownloadRequest::DownloadCompleted);
QCOMPARE(item->isFinished(), true);
QCOMPARE(item->totalBytes(), fileContents.size());
QCOMPARE(item->receivedBytes(), fileContents.size());
- QCOMPARE(item->interruptReason(), QWebEngineDownloadItem::NoReason);
+ QCOMPARE(item->interruptReason(), QWebEngineDownloadRequest::NoReason);
QCOMPARE(item->isSavePageDownload(), false);
QCOMPARE(item->mimeType(), QString(fileMimeTypeDetected));
QCOMPARE(QDir(item->downloadDirectory()).filePath(item->downloadFileName()), downloadPath);
- QCOMPARE(item->savePageFormat(), QWebEngineDownloadItem::UnknownSaveFormat);
+ QCOMPARE(item->savePageFormat(), QWebEngineDownloadRequest::UnknownSaveFormat);
QCOMPARE(item->url(), downloadUrl);
QCOMPARE(item->page(), m_page);
@@ -507,7 +507,7 @@ void tst_QWebEngineDownloadItem::downloadLink()
QCOMPARE(file.readAll(), fileContents);
}
-void tst_QWebEngineDownloadItem::downloadTwoLinks_data()
+void tst_QWebEngineDownloadRequest::downloadTwoLinks_data()
{
QTest::addColumn<UserAction>("action1");
QTest::addColumn<UserAction>("action2");
@@ -517,7 +517,7 @@ void tst_QWebEngineDownloadItem::downloadTwoLinks_data()
QTest::newRow("Click+Click") << ClickLink << ClickLink;
}
-void tst_QWebEngineDownloadItem::downloadTwoLinks()
+void tst_QWebEngineDownloadRequest::downloadTwoLinks()
{
QFETCH(UserAction, action1);
QFETCH(UserAction, action2);
@@ -553,13 +553,13 @@ void tst_QWebEngineDownloadItem::downloadTwoLinks()
QString standardDir = QStandardPaths::writableLocation(QStandardPaths::DownloadLocation);
int acceptedCount = 0;
int finishedCount = 0;
- ScopedConnection sc2 = connect(m_profile, &QWebEngineProfile::downloadRequested, [&](QWebEngineDownloadItem *item) {
- QCOMPARE(item->state(), QWebEngineDownloadItem::DownloadRequested);
+ ScopedConnection sc2 = connect(m_profile, &QWebEngineProfile::downloadRequested, [&](QWebEngineDownloadRequest *item) {
+ QCOMPARE(item->state(), QWebEngineDownloadRequest::DownloadRequested);
QCOMPARE(item->isFinished(), false);
QCOMPARE(item->totalBytes(), -1);
QCOMPARE(item->receivedBytes(), 0);
- QCOMPARE(item->interruptReason(), QWebEngineDownloadItem::NoReason);
- QCOMPARE(item->savePageFormat(), QWebEngineDownloadItem::UnknownSaveFormat);
+ QCOMPARE(item->interruptReason(), QWebEngineDownloadRequest::NoReason);
+ QCOMPARE(item->savePageFormat(), QWebEngineDownloadRequest::UnknownSaveFormat);
QCOMPARE(item->mimeType(), QStringLiteral("text/plain"));
QString filePart = QChar('/') + item->url().fileName();
QString fileName = item->url().fileName();
@@ -569,7 +569,7 @@ void tst_QWebEngineDownloadItem::downloadTwoLinks()
if (action1 == ClickLink && action2 == ClickLink && filePart != QStringLiteral("/file1") && filePart != QStringLiteral("/file2"))
QFAIL(qPrintable("Unexpected file name: " + filePart));
- connect(item, &QWebEngineDownloadItem::isFinishedChanged, [&]() {
+ connect(item, &QWebEngineDownloadRequest::isFinishedChanged, [&]() {
finishedCount++;
});
item->setDownloadDirectory(tmpDir.path());
@@ -595,20 +595,20 @@ void tst_QWebEngineDownloadItem::downloadTwoLinks()
QTRY_COMPARE(finishedCount, 2);
}
-void tst_QWebEngineDownloadItem::downloadPage_data()
+void tst_QWebEngineDownloadRequest::downloadPage_data()
{
QTest::addColumn<bool>("saveWithPageAction");
- QTest::addColumn<QWebEngineDownloadItem::SavePageFormat>("savePageFormat");
- QTest::newRow("SingleHtmlSaveFormat") << false << QWebEngineDownloadItem::SingleHtmlSaveFormat;
- QTest::newRow("CompleteHtmlSaveFormat") << false << QWebEngineDownloadItem::CompleteHtmlSaveFormat;
- QTest::newRow("MimeHtmlSaveFormat") << false << QWebEngineDownloadItem::MimeHtmlSaveFormat;
- QTest::newRow("SavePageAction") << true << QWebEngineDownloadItem::MimeHtmlSaveFormat;
+ QTest::addColumn<QWebEngineDownloadRequest::SavePageFormat>("savePageFormat");
+ QTest::newRow("SingleHtmlSaveFormat") << false << QWebEngineDownloadRequest::SingleHtmlSaveFormat;
+ QTest::newRow("CompleteHtmlSaveFormat") << false << QWebEngineDownloadRequest::CompleteHtmlSaveFormat;
+ QTest::newRow("MimeHtmlSaveFormat") << false << QWebEngineDownloadRequest::MimeHtmlSaveFormat;
+ QTest::newRow("SavePageAction") << true << QWebEngineDownloadRequest::MimeHtmlSaveFormat;
}
-void tst_QWebEngineDownloadItem::downloadPage()
+void tst_QWebEngineDownloadRequest::downloadPage()
{
QFETCH(bool, saveWithPageAction);
- QFETCH(QWebEngineDownloadItem::SavePageFormat, savePageFormat);
+ QFETCH(QWebEngineDownloadRequest::SavePageFormat, savePageFormat);
// Set up HTTP server
int indexRequestCount = 0;
@@ -631,12 +631,12 @@ void tst_QWebEngineDownloadItem::downloadPage()
QUrl downloadUrl = m_server->url("/");
int acceptedCount = 0;
int finishedCount = 0;
- ScopedConnection sc2 = connect(m_profile, &QWebEngineProfile::downloadRequested, [&](QWebEngineDownloadItem *item) {
- QCOMPARE(item->state(), saveWithPageAction ? QWebEngineDownloadItem::DownloadRequested : QWebEngineDownloadItem::DownloadInProgress);
+ ScopedConnection sc2 = connect(m_profile, &QWebEngineProfile::downloadRequested, [&](QWebEngineDownloadRequest *item) {
+ QCOMPARE(item->state(), saveWithPageAction ? QWebEngineDownloadRequest::DownloadRequested : QWebEngineDownloadRequest::DownloadInProgress);
QCOMPARE(item->isFinished(), false);
QCOMPARE(item->totalBytes(), -1);
QCOMPARE(item->receivedBytes(), 0);
- QCOMPARE(item->interruptReason(), QWebEngineDownloadItem::NoReason);
+ QCOMPARE(item->interruptReason(), QWebEngineDownloadRequest::NoReason);
QCOMPARE(item->isSavePageDownload(), true);
// FIXME(juvaldma): why is mimeType always the same?
QCOMPARE(item->mimeType(), QStringLiteral("application/x-mimearchive"));
@@ -654,12 +654,12 @@ void tst_QWebEngineDownloadItem::downloadPage()
QCOMPARE(QDir(item->downloadDirectory()).filePath(item->downloadFileName()), downloadPath);
- connect(item, &QWebEngineDownloadItem::isFinishedChanged, [&, item]() {
- QCOMPARE(item->state(), QWebEngineDownloadItem::DownloadCompleted);
+ connect(item, &QWebEngineDownloadRequest::isFinishedChanged, [&, item]() {
+ QCOMPARE(item->state(), QWebEngineDownloadRequest::DownloadCompleted);
QCOMPARE(item->isFinished(), true);
QCOMPARE(item->totalBytes(), item->receivedBytes());
QVERIFY(item->receivedBytes() > 0);
- QCOMPARE(item->interruptReason(), QWebEngineDownloadItem::NoReason);
+ QCOMPARE(item->interruptReason(), QWebEngineDownloadRequest::NoReason);
QCOMPARE(item->isSavePageDownload(), true);
QCOMPARE(item->mimeType(), QStringLiteral("application/x-mimearchive"));
QCOMPARE(QDir(item->downloadDirectory()).filePath(item->downloadFileName()), downloadPath);
@@ -692,7 +692,7 @@ void tst_QWebEngineDownloadItem::downloadPage()
QVERIFY(file.exists());
}
-void tst_QWebEngineDownloadItem::downloadViaSetUrl()
+void tst_QWebEngineDownloadRequest::downloadViaSetUrl()
{
// Reproduce the scenario described in QTBUG-63388 by triggering downloads
// of the same file multiple times via QWebEnginePage::setUrl
@@ -715,7 +715,7 @@ void tst_QWebEngineDownloadItem::downloadViaSetUrl()
// Set up profile and download handler
QList<QUrl> downloadUrls;
- ScopedConnection sc2 = connect(m_profile, &QWebEngineProfile::downloadRequested, [&](QWebEngineDownloadItem *item) {
+ ScopedConnection sc2 = connect(m_profile, &QWebEngineProfile::downloadRequested, [&](QWebEngineDownloadRequest *item) {
downloadUrls.append(item->url());
});
@@ -746,7 +746,7 @@ void tst_QWebEngineDownloadItem::downloadViaSetUrl()
}
}
-void tst_QWebEngineDownloadItem::downloadFileNot1()
+void tst_QWebEngineDownloadRequest::downloadFileNot1()
{
// Trigger file download via download() but don't accept().
@@ -755,11 +755,11 @@ void tst_QWebEngineDownloadItem::downloadFileNot1()
rr->sendResponse();
});
- QPointer<QWebEngineDownloadItem> downloadItem;
+ QPointer<QWebEngineDownloadRequest> downloadItem;
int downloadCount = 0;
- ScopedConnection sc2 = connect(m_profile, &QWebEngineProfile::downloadRequested, [&](QWebEngineDownloadItem *item) {
+ ScopedConnection sc2 = connect(m_profile, &QWebEngineProfile::downloadRequested, [&](QWebEngineDownloadRequest *item) {
QVERIFY(item);
- QCOMPARE(item->state(), QWebEngineDownloadItem::DownloadRequested);
+ QCOMPARE(item->state(), QWebEngineDownloadRequest::DownloadRequested);
downloadItem = item;
downloadCount++;
});
@@ -769,7 +769,7 @@ void tst_QWebEngineDownloadItem::downloadFileNot1()
QVERIFY(!downloadItem);
}
-void tst_QWebEngineDownloadItem::downloadFileNot2()
+void tst_QWebEngineDownloadRequest::downloadFileNot2()
{
// Trigger file download via download() but call cancel() instead of accept().
@@ -778,11 +778,11 @@ void tst_QWebEngineDownloadItem::downloadFileNot2()
rr->sendResponse();
});
- QPointer<QWebEngineDownloadItem> downloadItem;
+ QPointer<QWebEngineDownloadRequest> downloadItem;
int downloadCount = 0;
- ScopedConnection sc2 = connect(m_profile, &QWebEngineProfile::downloadRequested, [&](QWebEngineDownloadItem *item) {
+ ScopedConnection sc2 = connect(m_profile, &QWebEngineProfile::downloadRequested, [&](QWebEngineDownloadRequest *item) {
QVERIFY(item);
- QCOMPARE(item->state(), QWebEngineDownloadItem::DownloadRequested);
+ QCOMPARE(item->state(), QWebEngineDownloadRequest::DownloadRequested);
item->cancel();
downloadItem = item;
downloadCount++;
@@ -791,20 +791,20 @@ void tst_QWebEngineDownloadItem::downloadFileNot2()
m_page->download(m_server->url(QByteArrayLiteral("/file")));
QTRY_COMPARE(downloadCount, 1);
QVERIFY(downloadItem);
- QCOMPARE(downloadItem->state(), QWebEngineDownloadItem::DownloadCancelled);
+ QCOMPARE(downloadItem->state(), QWebEngineDownloadRequest::DownloadCancelled);
}
-void tst_QWebEngineDownloadItem::downloadDeleted()
+void tst_QWebEngineDownloadRequest::downloadDeleted()
{
- QPointer<QWebEngineDownloadItem> downloadItem;
+ QPointer<QWebEngineDownloadRequest> downloadItem;
m_server->setExpectError(true);
int downloadCount = 0;
int finishedCount = 0;
- ScopedConnection sc2 = connect(m_profile, &QWebEngineProfile::downloadRequested, [&](QWebEngineDownloadItem *item) {
+ ScopedConnection sc2 = connect(m_profile, &QWebEngineProfile::downloadRequested, [&](QWebEngineDownloadRequest *item) {
QVERIFY(item);
- QCOMPARE(item->state(), QWebEngineDownloadItem::DownloadRequested);
+ QCOMPARE(item->state(), QWebEngineDownloadRequest::DownloadRequested);
downloadItem = item;
- connect(downloadItem, &QWebEngineDownloadItem::isFinishedChanged, [&]() {
+ connect(downloadItem, &QWebEngineDownloadRequest::isFinishedChanged, [&]() {
finishedCount++;
});
item->accept();
@@ -819,7 +819,7 @@ void tst_QWebEngineDownloadItem::downloadDeleted()
QTRY_COMPARE(finishedCount, 1);
}
-void tst_QWebEngineDownloadItem::downloadDeletedByProfile()
+void tst_QWebEngineDownloadRequest::downloadDeletedByProfile()
{
m_server->setExpectError(true);
@@ -828,9 +828,9 @@ void tst_QWebEngineDownloadItem::downloadDeletedByProfile()
profile->settings()->setAttribute(QWebEngineSettings::AutoLoadIconsForPage, false);
bool downloadFinished = false;
- QPointer<QWebEngineDownloadItem> downloadItem;
- connect(profile, &QWebEngineProfile::downloadRequested, [&] (QWebEngineDownloadItem *item) {
- connect(item, &QWebEngineDownloadItem::isFinishedChanged, [&] () {
+ QPointer<QWebEngineDownloadRequest> downloadItem;
+ connect(profile, &QWebEngineProfile::downloadRequested, [&] (QWebEngineDownloadRequest *item) {
+ connect(item, &QWebEngineDownloadRequest::isFinishedChanged, [&] () {
downloadFinished = true;
});
downloadItem = item;
@@ -850,7 +850,7 @@ void tst_QWebEngineDownloadItem::downloadDeletedByProfile()
QTRY_COMPARE(downloadItem.isNull(), true);
}
-void tst_QWebEngineDownloadItem::downloadUniqueFilename_data()
+void tst_QWebEngineDownloadRequest::downloadUniqueFilename_data()
{
QTest::addColumn<QString>("baseName");
QTest::addColumn<QString>("extension");
@@ -859,7 +859,7 @@ void tst_QWebEngineDownloadItem::downloadUniqueFilename_data()
QTest::newRow("tar.gz") << QString("test(1.test)") << QString("tar.gz");
}
-void tst_QWebEngineDownloadItem::downloadUniqueFilename()
+void tst_QWebEngineDownloadRequest::downloadUniqueFilename()
{
QFETCH(QString, baseName);
QFETCH(QString, extension);
@@ -887,15 +887,15 @@ void tst_QWebEngineDownloadItem::downloadUniqueFilename()
});
// Set up profile and download handler
- ScopedConnection sc2 = connect(m_profile, &QWebEngineProfile::downloadRequested, [&](QWebEngineDownloadItem *item) {
+ ScopedConnection sc2 = connect(m_profile, &QWebEngineProfile::downloadRequested, [&](QWebEngineDownloadRequest *item) {
suggestedFileName = item->suggestedFileName();
item->accept();
- connect(item, &QWebEngineDownloadItem::isFinishedChanged, [&, item]() {
- QCOMPARE(item->state(), QWebEngineDownloadItem::DownloadCompleted);
+ connect(item, &QWebEngineDownloadRequest::isFinishedChanged, [&, item]() {
+ QCOMPARE(item->state(), QWebEngineDownloadRequest::DownloadCompleted);
QCOMPARE(item->isFinished(), true);
QCOMPARE(item->totalBytes(), item->receivedBytes());
QVERIFY(item->receivedBytes() > 0);
- QCOMPARE(item->interruptReason(), QWebEngineDownloadItem::NoReason);
+ QCOMPARE(item->interruptReason(), QWebEngineDownloadRequest::NoReason);
QCOMPARE(item->isSavePageDownload(), false);
downloadedFilePath = QDir(item->downloadDirectory()).filePath(item->downloadFileName());
downloadFinished = true;
@@ -917,7 +917,7 @@ void tst_QWebEngineDownloadItem::downloadUniqueFilename()
}
}
-void tst_QWebEngineDownloadItem::downloadUniqueFilenameWithTimestamp()
+void tst_QWebEngineDownloadRequest::downloadUniqueFilenameWithTimestamp()
{
// Set up HTTP server
QString baseName("test(1.test)");
@@ -945,15 +945,15 @@ void tst_QWebEngineDownloadItem::downloadUniqueFilenameWithTimestamp()
});
// Set up profile and download handler
- ScopedConnection sc2 = connect(m_profile, &QWebEngineProfile::downloadRequested, [&](QWebEngineDownloadItem *item) {
+ ScopedConnection sc2 = connect(m_profile, &QWebEngineProfile::downloadRequested, [&](QWebEngineDownloadRequest *item) {
suggestedFileName = item->suggestedFileName();
item->accept();
- connect(item, &QWebEngineDownloadItem::isFinishedChanged, [&, item]() {
- QCOMPARE(item->state(), QWebEngineDownloadItem::DownloadCompleted);
+ connect(item, &QWebEngineDownloadRequest::isFinishedChanged, [&, item]() {
+ QCOMPARE(item->state(), QWebEngineDownloadRequest::DownloadCompleted);
QCOMPARE(item->isFinished(), true);
QCOMPARE(item->totalBytes(), item->receivedBytes());
QVERIFY(item->receivedBytes() > 0);
- QCOMPARE(item->interruptReason(), QWebEngineDownloadItem::NoReason);
+ QCOMPARE(item->interruptReason(), QWebEngineDownloadRequest::NoReason);
QCOMPARE(item->page(), m_page);
downloadFinished = true;
downloadedFilePath = QDir(item->downloadDirectory()).filePath(item->downloadFileName());
@@ -997,7 +997,7 @@ void tst_QWebEngineDownloadItem::downloadUniqueFilenameWithTimestamp()
}
}
-void tst_QWebEngineDownloadItem::downloadToDefaultLocation()
+void tst_QWebEngineDownloadRequest::downloadToDefaultLocation()
{
QTemporaryDir tmpDir;
QVERIFY(tmpDir.isValid());
@@ -1014,7 +1014,7 @@ void tst_QWebEngineDownloadItem::downloadToDefaultLocation()
QCOMPARE(m_profile->downloadPath(), QStandardPaths::writableLocation(QStandardPaths::DownloadLocation));
}
-void tst_QWebEngineDownloadItem::downloadToNonExistentDir()
+void tst_QWebEngineDownloadRequest::downloadToNonExistentDir()
{
QString baseName("test(1.test)");
QString extension("txt");
@@ -1042,15 +1042,15 @@ void tst_QWebEngineDownloadItem::downloadToNonExistentDir()
});
// Set up profile and download handler
- ScopedConnection sc2 = connect(m_profile, &QWebEngineProfile::downloadRequested, [&](QWebEngineDownloadItem *item) {
+ ScopedConnection sc2 = connect(m_profile, &QWebEngineProfile::downloadRequested, [&](QWebEngineDownloadRequest *item) {
suggestedFileName = item->suggestedFileName();
item->accept();
- connect(item, &QWebEngineDownloadItem::isFinishedChanged, [&, item]() {
- QCOMPARE(item->state(), QWebEngineDownloadItem::DownloadCompleted);
+ connect(item, &QWebEngineDownloadRequest::isFinishedChanged, [&, item]() {
+ QCOMPARE(item->state(), QWebEngineDownloadRequest::DownloadCompleted);
QCOMPARE(item->isFinished(), true);
QCOMPARE(item->totalBytes(), item->receivedBytes());
QVERIFY(item->receivedBytes() > 0);
- QCOMPARE(item->interruptReason(), QWebEngineDownloadItem::NoReason);
+ QCOMPARE(item->interruptReason(), QWebEngineDownloadRequest::NoReason);
QCOMPARE(item->page(), m_page);
downloadFinished = true;
downloadedFilePath = QDir(item->downloadDirectory()).filePath(item->downloadFileName());
@@ -1068,7 +1068,7 @@ void tst_QWebEngineDownloadItem::downloadToNonExistentDir()
QCOMPARE(suggestedFileName, fileName);
}
-void tst_QWebEngineDownloadItem::downloadToReadOnlyDir()
+void tst_QWebEngineDownloadRequest::downloadToReadOnlyDir()
{
#ifdef Q_OS_WIN
QSKIP("Cannot change file permissions on Windows.");
@@ -1099,12 +1099,12 @@ void tst_QWebEngineDownloadItem::downloadToReadOnlyDir()
}
});
- QPointer<QWebEngineDownloadItem> downloadItem;
- ScopedConnection sc2 = connect(m_profile, &QWebEngineProfile::downloadRequested, [&](QWebEngineDownloadItem *item) {
+ QPointer<QWebEngineDownloadRequest> downloadItem;
+ ScopedConnection sc2 = connect(m_profile, &QWebEngineProfile::downloadRequested, [&](QWebEngineDownloadRequest *item) {
suggestedFileName = item->suggestedFileName();
downloadItem = item;
item->accept();
- connect(item, &QWebEngineDownloadItem::isFinishedChanged, [&]() {
+ connect(item, &QWebEngineDownloadRequest::isFinishedChanged, [&]() {
downloadFinished = true;
});
downloadAccepted = true;
@@ -1118,9 +1118,9 @@ void tst_QWebEngineDownloadItem::downloadToReadOnlyDir()
QTRY_VERIFY(downloadAccepted);
QVERIFY(downloadItem);
- QTRY_COMPARE(downloadItem->state(), QWebEngineDownloadItem::DownloadInterrupted);
+ QTRY_COMPARE(downloadItem->state(), QWebEngineDownloadRequest::DownloadInterrupted);
QCOMPARE(downloadItem->isFinished(), false);
- QCOMPARE(downloadItem->interruptReason(), QWebEngineDownloadItem::FileAccessDenied);
+ QCOMPARE(downloadItem->interruptReason(), QWebEngineDownloadRequest::FileAccessDenied);
QVERIFY(!QFile(downloadedFilePath).exists());
QCOMPARE(suggestedFileName, fileName);
@@ -1130,7 +1130,7 @@ void tst_QWebEngineDownloadItem::downloadToReadOnlyDir()
QFile(m_profile->downloadPath()).setPermissions(QFileDevice::WriteOwner);
}
-void tst_QWebEngineDownloadItem::downloadToDirectoryWithFileName_data()
+void tst_QWebEngineDownloadRequest::downloadToDirectoryWithFileName_data()
{
QTest::addColumn<bool>("setDirectoryFirst");
@@ -1138,7 +1138,7 @@ void tst_QWebEngineDownloadItem::downloadToDirectoryWithFileName_data()
QTest::newRow("setFileNameFirst") << false;
}
-void tst_QWebEngineDownloadItem::downloadToDirectoryWithFileName()
+void tst_QWebEngineDownloadRequest::downloadToDirectoryWithFileName()
{
QFETCH(bool, setDirectoryFirst);
QString downloadDirectory;
@@ -1169,7 +1169,7 @@ void tst_QWebEngineDownloadItem::downloadToDirectoryWithFileName()
});
// Set up profile and download handler
- ScopedConnection sc2 = connect(m_profile, &QWebEngineProfile::downloadRequested, [&](QWebEngineDownloadItem *item) {
+ ScopedConnection sc2 = connect(m_profile, &QWebEngineProfile::downloadRequested, [&](QWebEngineDownloadRequest *item) {
if (!downloadDirectory.isEmpty() && setDirectoryFirst) {
item->setDownloadDirectory(downloadDirectory);
@@ -1188,12 +1188,12 @@ void tst_QWebEngineDownloadItem::downloadToDirectoryWithFileName()
item->accept();
- connect(item, &QWebEngineDownloadItem::isFinishedChanged, [&, item]() {
- QCOMPARE(item->state(), QWebEngineDownloadItem::DownloadCompleted);
+ connect(item, &QWebEngineDownloadRequest::isFinishedChanged, [&, item]() {
+ QCOMPARE(item->state(), QWebEngineDownloadRequest::DownloadCompleted);
QCOMPARE(item->isFinished(), true);
QCOMPARE(item->totalBytes(), item->receivedBytes());
QVERIFY(item->receivedBytes() > 0);
- QCOMPARE(item->interruptReason(), QWebEngineDownloadItem::NoReason);
+ QCOMPARE(item->interruptReason(), QWebEngineDownloadRequest::NoReason);
QCOMPARE(item->page(), m_page);
downloadFinished = true;
downloadedFilePath = QDir(item->downloadDirectory()).filePath(item->downloadFileName());
@@ -1231,7 +1231,7 @@ void tst_QWebEngineDownloadItem::downloadToDirectoryWithFileName()
QCOMPARE(downloadedSuggestedFileName, fileName);
// Download another file to the same directory and set file name by
- // QWebEngineDownloadItem::setDownloadDirectory() and setDownloadFileName() to avoid uniquification.
+ // QWebEngineDownloadRequest::setDownloadDirectory() and setDownloadFileName() to avoid uniquification.
downloadFinished = false;
downloadDirectory = m_profile->downloadPath() + QDir::separator() + "test1" + QDir::separator();
downloadFileName = "test1.txt";
@@ -1252,7 +1252,7 @@ void tst_QWebEngineDownloadItem::downloadToDirectoryWithFileName()
QCOMPARE(downloadedSuggestedFileName, fileName);
// Download the same file to same directory and set file name by
- // QWebEngineDownloadItem::setDownloadDirectory() and setDownloadFileName() to avoid uniquification.
+ // QWebEngineDownloadRequest::setDownloadDirectory() and setDownloadFileName() to avoid uniquification.
downloadFinished = false;
downloadDirectory = m_profile->downloadPath() + QDir::separator() + "test2" + QDir::separator();
downloadFileName = "test1.txt";
@@ -1274,5 +1274,5 @@ void tst_QWebEngineDownloadItem::downloadToDirectoryWithFileName()
QCOMPARE(downloadedSuggestedFileName, fileName);
}
-QTEST_MAIN(tst_QWebEngineDownloadItem)
-#include "tst_qwebenginedownloaditem.moc"
+QTEST_MAIN(tst_QWebEngineDownloadRequest)
+#include "tst_qwebenginedownloadrequest.moc"
diff --git a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
index 21cbfa2ba..c4c4850f1 100644
--- a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
+++ b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
@@ -45,7 +45,7 @@
#include <qnetworkcookiejar.h>
#include <qnetworkreply.h>
#include <qnetworkrequest.h>
-#include <qwebenginedownloaditem.h>
+#include <qwebenginedownloadrequest.h>
#include <qwebenginefindtextresult.h>
#include <qwebenginefullscreenrequest.h>
#include <qwebenginehistory.h>
@@ -1679,9 +1679,9 @@ void tst_QWebEnginePage::savePage()
QWebEnginePage *page = view.page();
connect(page->profile(), &QWebEngineProfile::downloadRequested,
- [] (QWebEngineDownloadItem *item)
+ [] (QWebEngineDownloadRequest *item)
{
- connect(item, &QWebEngineDownloadItem::isFinishedChanged,
+ connect(item, &QWebEngineDownloadRequest::isFinishedChanged,
&QTestEventLoop::instance(), &QTestEventLoop::exitLoop, Qt::QueuedConnection);
});
@@ -1695,7 +1695,7 @@ void tst_QWebEnginePage::savePage()
// Save the loaded page as HTML.
QTemporaryDir tempDir(QDir::tempPath() + "/tst_qwebengineview-XXXXXX");
const QString filePath = tempDir.path() + "/thingumbob.html";
- page->save(filePath, QWebEngineDownloadItem::CompleteHtmlSaveFormat);
+ page->save(filePath, QWebEngineDownloadRequest::CompleteHtmlSaveFormat);
QTestEventLoop::instance().enterLoop(10);
// Load something else.
diff --git a/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp b/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp
index 34da70005..57720ccc6 100644
--- a/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp
+++ b/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp
@@ -39,7 +39,7 @@
#include <QtWebEngineWidgets/qwebenginepage.h>
#include <QtWebEngineWidgets/qwebenginesettings.h>
#include <QtWebEngineWidgets/qwebengineview.h>
-#include <QtWebEngineCore/qwebenginedownloaditem.h>
+#include <QtWebEngineCore/qwebenginedownloadrequest.h>
#if QT_CONFIG(webengine_webchannel)
#include <QWebChannel>
@@ -834,10 +834,10 @@ void tst_QWebEngineProfile::httpAcceptLanguage()
void tst_QWebEngineProfile::downloadItem()
{
- qRegisterMetaType<QWebEngineDownloadItem *>();
+ qRegisterMetaType<QWebEngineDownloadRequest *>();
QWebEngineProfile testProfile;
QWebEnginePage page(&testProfile);
- QSignalSpy downloadSpy(&testProfile, SIGNAL(downloadRequested(QWebEngineDownloadItem *)));
+ QSignalSpy downloadSpy(&testProfile, SIGNAL(downloadRequested(QWebEngineDownloadRequest *)));
page.load(QUrl::fromLocalFile(QCoreApplication::applicationFilePath()));
QTRY_COMPARE(downloadSpy.count(), 1);
}
diff --git a/tests/auto/widgets/widgets.pro b/tests/auto/widgets/widgets.pro
index aa213fc75..947587f5e 100644
--- a/tests/auto/widgets/widgets.pro
+++ b/tests/auto/widgets/widgets.pro
@@ -14,7 +14,7 @@ SUBDIRS += \
proxypac \
schemes \
shutdown \
- qwebenginedownloaditem \
+ qwebenginedownloadrequest \
qwebenginepage \
qwebenginehistory \
qwebengineprofile \