diff options
author | Viktor Engelmann <viktor.engelmann@qt.io> | 2016-12-19 15:58:04 +0100 |
---|---|---|
committer | Viktor Engelmann <viktor.engelmann@qt.io> | 2017-01-12 13:42:48 +0000 |
commit | 0a578ce16b0ea5eadae32d0055b45f56f36eefa4 (patch) | |
tree | 24ef4e345f42e66986882713ce6cd3a687de85ce /src/webenginewidgets | |
parent | 479ca165d3df610a135f9129cb3cecb0a7c7e069 (diff) |
Add methods for textual description of DownloadInterruptReason
A method was added to get a textual description of a
Q(Quick)WebEngineDownloadItem::DownloadInterruptReason.
Basically returns the same description from the QDoc entry, but
shortened where that was to long.
Also moved the ASSERT_ENUMS_MATCHes from
download_manager_delegate_qt.cpp to the newly created
browser_context_adapter_client.cpp.
Task-number: QTBUG-56839
Change-Id: I17c68987b7f12fcaeb71fd27f7ebb35c0ac87bac
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/webenginewidgets')
-rw-r--r-- | src/webenginewidgets/api/qwebenginedownloaditem.cpp | 15 | ||||
-rw-r--r-- | src/webenginewidgets/api/qwebenginedownloaditem.h | 1 |
2 files changed, 16 insertions, 0 deletions
diff --git a/src/webenginewidgets/api/qwebenginedownloaditem.cpp b/src/webenginewidgets/api/qwebenginedownloaditem.cpp index 4a3371904..582f0308c 100644 --- a/src/webenginewidgets/api/qwebenginedownloaditem.cpp +++ b/src/webenginewidgets/api/qwebenginedownloaditem.cpp @@ -464,6 +464,8 @@ QWebEngineDownloadItem::DownloadType QWebEngineDownloadItem::type() const /*! Returns the reason why the download was interrupted. \since 5.9 + + \sa interruptReasonString() */ QWebEngineDownloadItem::DownloadInterruptReason QWebEngineDownloadItem::interruptReason() const @@ -472,6 +474,19 @@ QWebEngineDownloadItem::DownloadInterruptReason QWebEngineDownloadItem::interrup return d->interruptReason; } +/*! + Returns a human-readable description of the reason for interrupting the download. + \since 5.9 + + \sa interruptReason() +*/ + +QString QWebEngineDownloadItem::interruptReasonString() const +{ + return BrowserContextAdapterClient::downloadInterruptReasonToString( + static_cast<BrowserContextAdapterClient::DownloadInterruptReason>(interruptReason())); +} + QWebEngineDownloadItem::QWebEngineDownloadItem(QWebEngineDownloadItemPrivate *p, QObject *parent) : QObject(parent) , d_ptr(p) diff --git a/src/webenginewidgets/api/qwebenginedownloaditem.h b/src/webenginewidgets/api/qwebenginedownloaditem.h index 6990b1e52..846194f40 100644 --- a/src/webenginewidgets/api/qwebenginedownloaditem.h +++ b/src/webenginewidgets/api/qwebenginedownloaditem.h @@ -124,6 +124,7 @@ public: void setSavePageFormat(SavePageFormat format); DownloadType type() const; DownloadInterruptReason interruptReason() const; + QString interruptReasonString() const; public Q_SLOTS: void accept(); |