diff options
author | Andras Becsi <andras.becsi@digia.com> | 2015-02-06 11:59:01 +0100 |
---|---|---|
committer | Andras Becsi <andras.becsi@theqtcompany.com> | 2015-02-06 12:03:10 +0000 |
commit | eda8fbdf0d6249f4f89e3456092cbe790b27b1fb (patch) | |
tree | 483c297a34ca40c4c5d87474c479d826e43a856c /src/core/download_manager_delegate_qt.cpp | |
parent | 22f4a67e434703b400ad9ee669f673144e5f33dc (diff) |
Reverse the logic for download cancellation
Since we require downloads to be explicitly accepted
we should have 'accepted' as a member in the download
info instead of 'cancelled'.
Change-Id: Ia8ff4a4b29f3c8631f4cb1c410ece5f11d9cdc93
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
Diffstat (limited to 'src/core/download_manager_delegate_qt.cpp')
-rw-r--r-- | src/core/download_manager_delegate_qt.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/core/download_manager_delegate_qt.cpp b/src/core/download_manager_delegate_qt.cpp index 73a0976da..3ef8cc9af 100644 --- a/src/core/download_manager_delegate_qt.cpp +++ b/src/core/download_manager_delegate_qt.cpp @@ -126,7 +126,6 @@ bool DownloadManagerDelegateQt::DetermineDownloadTarget(content::DownloadItem* i item->AddObserver(this); if (m_contextAdapter->client()) { - bool cancelled = false; BrowserContextAdapterClient::DownloadItemInfo info = { item->GetId(), toQt(item->GetURL()), @@ -134,18 +133,18 @@ bool DownloadManagerDelegateQt::DetermineDownloadTarget(content::DownloadItem* i item->GetTotalBytes(), item->GetReceivedBytes(), suggestedFilePath, - cancelled + false /* accepted */ }; m_contextAdapter->client()->downloadRequested(info); suggestedFile.setFile(info.path); - if (!info.cancelled && !suggestedFile.absoluteDir().mkpath(suggestedFile.absolutePath())) { + if (info.accepted && !suggestedFile.absoluteDir().mkpath(suggestedFile.absolutePath())) { qWarning("Creating download path failed, download cancelled: %s", suggestedFile.absolutePath().toUtf8().data()); - cancelled = true; + info.accepted = false; } - if (info.cancelled) { + if (!info.accepted) { cancelDownload(callback); return true; } @@ -180,7 +179,7 @@ void DownloadManagerDelegateQt::OnDownloadUpdated(content::DownloadItem *downloa download->GetTotalBytes(), download->GetReceivedBytes(), QString(), - false + true /* accepted */ }; m_contextAdapter->client()->downloadUpdated(info); } |