summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorTamas Zakor <ztamas@inf.u-szeged.hu>2019-05-09 14:49:56 +0200
committerTamas Zakor <ztamas@inf.u-szeged.hu>2019-05-16 11:57:07 +0000
commita4eeb9dbd995d598bd3a639dd450def7c242b383 (patch)
tree99d1b0fe8fa64be15948b601960c54e5b632783b /src/core
parent0c2beb49b858f49489fa4f1ecee6bfdd6ce57e68 (diff)
Add API to get the suggested download file name
[ChangeLog][DownloadItem] Add functions and property to get the suggested download file name. Task-number: QTBUG-56978 Change-Id: I902870c6358271322da613a15ccc11639384e404 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/core')
-rw-r--r--src/core/download_manager_delegate_qt.cpp10
-rw-r--r--src/core/profile_adapter_client.h1
2 files changed, 8 insertions, 3 deletions
diff --git a/src/core/download_manager_delegate_qt.cpp b/src/core/download_manager_delegate_qt.cpp
index 2af958068..ba506601f 100644
--- a/src/core/download_manager_delegate_qt.cpp
+++ b/src/core/download_manager_delegate_qt.cpp
@@ -208,7 +208,8 @@ bool DownloadManagerDelegateQt::DetermineDownloadTarget(download::DownloadItem*
false /* done */,
downloadType,
item->GetLastReason(),
- adapterClient
+ adapterClient,
+ suggestedFilename
};
for (ProfileAdapterClient *client : qAsConst(clients)) {
@@ -309,7 +310,9 @@ void DownloadManagerDelegateQt::ChooseSavePath(content::WebContents *web_content
false, /* done */
ProfileAdapterClient::SavePage,
ProfileAdapterClient::NoReason,
- adapterClient
+ adapterClient,
+ QFileInfo(suggestedFilePath).fileName()
+
};
for (ProfileAdapterClient *client : qAsConst(clients)) {
@@ -375,7 +378,8 @@ void DownloadManagerDelegateQt::OnDownloadUpdated(download::DownloadItem *downlo
download->IsDone(),
0 /* downloadType (unused) */,
download->GetLastReason(),
- adapterClient
+ adapterClient,
+ toQt(download->GetSuggestedFilename())
};
for (ProfileAdapterClient *client : qAsConst(clients)) {
diff --git a/src/core/profile_adapter_client.h b/src/core/profile_adapter_client.h
index b463043da..3589f6cd7 100644
--- a/src/core/profile_adapter_client.h
+++ b/src/core/profile_adapter_client.h
@@ -138,6 +138,7 @@ public:
int downloadType;
int downloadInterruptReason;
WebContentsAdapterClient *page;
+ QString suggestedFileName;
};
virtual ~ProfileAdapterClient() { }