diff options
author | Michal Klocek <michal.klocek@qt.io> | 2020-08-10 09:31:27 +0200 |
---|---|---|
committer | Michal Klocek <michal.klocek@qt.io> | 2020-08-18 23:23:35 +0200 |
commit | 75393077108480e1762612331c399a012b5feba7 (patch) | |
tree | 38db972a8d47853de4640d15458bfab6e74ea6b0 /src/core/api | |
parent | 322742fbdc9a18497946fc736daba9f6bf73ac54 (diff) |
Remove obsolete, deprecated api from qwebenginedownloaditem
This patch removes:
* path()
* type()
* DownloadType enum
Change-Id: I3e29f9e8ce9e39b015c57cb7005e0290d1496291
Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'src/core/api')
-rw-r--r-- | src/core/api/qwebenginedownloaditem.cpp | 109 | ||||
-rw-r--r-- | src/core/api/qwebenginedownloaditem.h | 25 | ||||
-rw-r--r-- | src/core/api/qwebenginedownloaditem_p.h | 2 |
3 files changed, 3 insertions, 133 deletions
diff --git a/src/core/api/qwebenginedownloaditem.cpp b/src/core/api/qwebenginedownloaditem.cpp index f7ddf024b..967a7e3f9 100644 --- a/src/core/api/qwebenginedownloaditem.cpp +++ b/src/core/api/qwebenginedownloaditem.cpp @@ -163,13 +163,13 @@ QWebEngineDownloadItemPrivate::QWebEngineDownloadItemPrivate(QtWebEngineCore::Pr , downloadId(-1) , downloadState(QWebEngineDownloadItem::DownloadCancelled) , savePageFormat(QWebEngineDownloadItem::MimeHtmlSaveFormat) - , type(QWebEngineDownloadItem::Attachment) , interruptReason(QWebEngineDownloadItem::NoReason) , downloadUrl(url) , downloadPaused(false) , isCustomFileName(false) , totalBytes(-1) , receivedBytes(0) + , isSavePageDownload(false) , page(nullptr) { } @@ -397,25 +397,6 @@ quint32 QWebEngineDownloadItem::id() const */ /*! - \enum QWebEngineDownloadItem::DownloadType - \obsolete - - Describes the requested download's type. - - \value Attachment The web server's response includes a - \c Content-Disposition header with the \c attachment directive. If \c Content-Disposition - is present in the reply, the web server is indicating that the client should prompt the - user to save the content regardless of the content type. - See \l {RFC 2616 section 19.5.1} for details. - \value DownloadAttribute The user clicked a link with the \c download - attribute. - \value UserRequested The user initiated the download, for example by - selecting a web action. - \value SavePage Saving of the current page was requested (for example by - the \l{QWebEnginePage::WebAction}{QWebEnginePage::SavePage} web action). -*/ - -/*! \enum QWebEngineDownloadItem::DownloadInterruptReason Describes the reason why a download was interrupted: @@ -510,78 +491,6 @@ QString QWebEngineDownloadItem::mimeType() const } /*! - \obsolete - - Use \l suggestedFileName(), \l downloadDirectory(), and - \l downloadFileName() instead. - - Returns the full target path where data is being downloaded to. - - The path includes the file name. The default suggested path is the standard download location - and file name is deduced not to overwrite already existing files. -*/ - -QString QWebEngineDownloadItem::path() const -{ - Q_D(const QWebEngineDownloadItem); - return QDir::cleanPath(QDir(d->downloadDirectory).filePath(d->downloadFileName)); -} - -/*! - \obsolete - - Use \l setDownloadDirectory() and \l setDownloadFileName() instead. - - Sets the full target path to download the file to. - - The \a path should also include the file name. The download path can only be set in response - to the QWebEngineProfile::downloadRequested() signal before the download is accepted. - Past that point, this function has no effect on the download item's state. -*/ -void QWebEngineDownloadItem::setPath(QString path) -{ - Q_D(QWebEngineDownloadItem); - if (d->downloadState != QWebEngineDownloadItem::DownloadRequested) { - qWarning("Setting the download path is not allowed after the download has been accepted."); - return; - } - if (QDir(d->downloadDirectory).filePath(d->downloadFileName) != path) { - if (QFileInfo(path).fileName().isEmpty()) { - qWarning("The download path does not include file name."); - return; - } - - if (QFileInfo(path).isDir()) { - qWarning("The download path matches with an already existing directory path."); - return; - } - - QString newDirectory; - QString newFileName; - - if (QFileInfo(path).fileName() == path) { - newDirectory = QStringLiteral(""); - newFileName = path; - } else { - newDirectory = QFileInfo(path).path(); - newFileName = QFileInfo(path).fileName(); - } - - if (d->downloadDirectory != newDirectory) { - d->downloadDirectory = newDirectory; - Q_EMIT pathChanged(); - Q_EMIT downloadDirectoryChanged(); - } - - if (d->downloadFileName != newFileName) { - d->downloadFileName = newFileName; - Q_EMIT pathChanged(); - Q_EMIT downloadFileNameChanged(); - } - } -} - -/*! Returns the download directory path. */ @@ -707,20 +616,6 @@ void QWebEngineDownloadItem::setSavePageFormat(QWebEngineDownloadItem::SavePageF } /*! - Returns the requested download's type. - \obsolete - - \note This property works unreliably, except for \c SavePage - downloads. Use \l isSavePageDownload() instead. - */ - -QWebEngineDownloadItem::DownloadType QWebEngineDownloadItem::type() const -{ - Q_D(const QWebEngineDownloadItem); - return d->type; -} - -/*! Returns \c true if this is a download request for saving a web page. \sa savePageFormat(), setSavePageFormat() @@ -728,7 +623,7 @@ QWebEngineDownloadItem::DownloadType QWebEngineDownloadItem::type() const bool QWebEngineDownloadItem::isSavePageDownload() const { Q_D(const QWebEngineDownloadItem); - return d->type == QWebEngineDownloadItem::SavePage; + return d->isSavePageDownload; } /*! diff --git a/src/core/api/qwebenginedownloaditem.h b/src/core/api/qwebenginedownloaditem.h index 9310d95db..095c4f79e 100644 --- a/src/core/api/qwebenginedownloaditem.h +++ b/src/core/api/qwebenginedownloaditem.h @@ -61,8 +61,6 @@ public: 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(QString path READ path WRITE setPath NOTIFY pathChanged FINAL) - Q_PROPERTY(DownloadType type READ type REVISION 3 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) @@ -124,38 +122,16 @@ public: }; Q_ENUM(DownloadInterruptReason) - enum DownloadType { - Attachment = 0, - DownloadAttribute, - UserRequested, - SavePage - }; - Q_ENUM(DownloadType) - quint32 id() const; DownloadState state() const; qint64 totalBytes() const; qint64 receivedBytes() const; QUrl url() const; QString mimeType() const; -#if QT_DEPRECATED_SINCE(5, 14) -#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) - QT_DEPRECATED_VERSION_X(5, 14, "Use downloadDirectory() and downloadFileName() instead") - QString path() const; - QT_DEPRECATED_VERSION_X(5, 14, "Use setDownloadDirectory() and setDownloadFileName() instead") - void setPath(QString path); -#else - QT_DEPRECATED_X("Use downloadDirectory() and downloadFileName() instead") - QString path() const; - QT_DEPRECATED_X("Use setDownloadDirectory() and setDownloadFileName() instead") - void setPath(QString path); -#endif -#endif bool isFinished() const; bool isPaused() const; SavePageFormat savePageFormat() const; void setSavePageFormat(SavePageFormat format); - DownloadType Q_DECL_DEPRECATED type() const; DownloadInterruptReason interruptReason() const; QString interruptReasonString() const; bool isSavePageDownload() const; @@ -181,7 +157,6 @@ Q_SIGNALS: Q_REVISION(2) void savePageFormatChanged(); void receivedBytesChanged(); void totalBytesChanged(); - void pathChanged(); Q_REVISION(4) void interruptReasonChanged(); Q_REVISION(5) void isFinishedChanged(); Q_REVISION(5) void isPausedChanged(); diff --git a/src/core/api/qwebenginedownloaditem_p.h b/src/core/api/qwebenginedownloaditem_p.h index b40a21250..8e38335c2 100644 --- a/src/core/api/qwebenginedownloaditem_p.h +++ b/src/core/api/qwebenginedownloaditem_p.h @@ -76,7 +76,6 @@ public: qint64 startTime; QWebEngineDownloadItem::DownloadState downloadState; QWebEngineDownloadItem::SavePageFormat savePageFormat; - QWebEngineDownloadItem::DownloadType type; QWebEngineDownloadItem::DownloadInterruptReason interruptReason; QString downloadPath; const QUrl downloadUrl; @@ -88,6 +87,7 @@ public: bool isCustomFileName; qint64 totalBytes; qint64 receivedBytes; + bool isSavePageDownload; QWebEngineDownloadItem *q_ptr; QPointer<QtWebEngineCore::ProfileAdapter> m_profileAdapter; QObject *page; |