diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2018-07-23 17:17:40 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2018-08-02 20:52:02 +0000 |
commit | 595589197313178551cf7ccd645d2732643875bf (patch) | |
tree | 8ed5686b3de206775425eb5c9fcca8dfb3a01320 /src/webenginewidgets/api/qwebengineprofile.cpp | |
parent | 1481e8d87fe89d9e27d9de593767b55a0e84a31f (diff) |
Add QWebEngineDownloadItem page/view accessor
To be able to determine where a download was triggered.
[ChangeLog][DownloadItem] Added a page/view accessor to tell were
the download was triggered.
Change-Id: I21843a545a3e0eb66f5e5fa8a50e77564f2118a7
Reviewed-by: Jüri Valdmann <juri.valdmann@qt.io>
Diffstat (limited to 'src/webenginewidgets/api/qwebengineprofile.cpp')
-rw-r--r-- | src/webenginewidgets/api/qwebengineprofile.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/webenginewidgets/api/qwebengineprofile.cpp b/src/webenginewidgets/api/qwebengineprofile.cpp index a7a7ea19b..4523a425a 100644 --- a/src/webenginewidgets/api/qwebengineprofile.cpp +++ b/src/webenginewidgets/api/qwebengineprofile.cpp @@ -38,12 +38,13 @@ ****************************************************************************/ #include "qwebengineprofile.h" +#include "qwebengineprofile_p.h" #include "qwebenginecookiestore.h" #include "qwebenginedownloaditem.h" #include "qwebenginedownloaditem_p.h" #include "qwebenginepage.h" -#include "qwebengineprofile_p.h" +#include "qwebenginepage_p.h" #include "qwebenginesettings.h" #include "qwebenginescriptcollection_p.h" #include "qtwebenginecoreglobal.h" @@ -202,6 +203,10 @@ void QWebEngineProfilePrivate::downloadRequested(DownloadItemInfo &info) itemPrivate->mimeType = info.mimeType; itemPrivate->savePageFormat = static_cast<QWebEngineDownloadItem::SavePageFormat>(info.savePageFormat); itemPrivate->type = static_cast<QWebEngineDownloadItem::DownloadType>(info.downloadType); + 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); |