From 0a578ce16b0ea5eadae32d0055b45f56f36eefa4 Mon Sep 17 00:00:00 2001 From: Viktor Engelmann Date: Mon, 19 Dec 2016 15:58:04 +0100 Subject: 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 Reviewed-by: Allan Sandfeld Jensen --- src/webenginewidgets/api/qwebenginedownloaditem.cpp | 15 +++++++++++++++ src/webenginewidgets/api/qwebenginedownloaditem.h | 1 + 2 files changed, 16 insertions(+) (limited to 'src/webenginewidgets/api') 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(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(); -- cgit v1.2.3