Downloads from sites requiring authentication often failed because KIO (used for downloads) didn't have access to the cookies sent to QWebEngine. To fix this, now the cookies are added to the KIO store in response to the QWebEngineCookieStore::cookieAdded signal.
Unfortunately, KIO requires to know a cookie's origin URL, which QWebEngineCookieStore doesn't provide. As a workaround, WebEnginePartDownloadManager now also keeps trace of the last page being loaded and uses its URL as origin URL for cookies. This is not ideal and is likely to fail if more than one page is loaded at the same time. For the time being, however, I don't see a better way to do this.
Also, improve downloads in the following ways:
- if WebEnginePartDownloadManager can't find out which part asked for a given download, download the file using QWebEngineDownloadItem::accept rather than doing nothing
- if QWebEngineDownloadItem::type is SavePage, do it using QWebEngineDownloadItem::accept (only supported for Qt 5.8 or greater)
- if QWebEngineDownloadItem::type is Attachment or DownloadAttribute, ask the user whether to open or save it rather (only supported for Qt 5.8 or greater)