1
mirror of https://invent.kde.org/network/falkon.git synced 2024-09-21 17:52:10 +02:00

DownloadManager: Immediately show file dialog when download was user requested

QWebEngineDownloadItem::UserRequested should be set when initiating
download from web actions - Save image as..., Save link as...
It doesn't seem to work with current QtWebEngine however
This commit is contained in:
David Rosca 2017-01-27 15:02:25 +01:00
parent 880b0eb5b1
commit 953c52e73d

View File

@ -258,7 +258,14 @@ void DownloadManager::download(QWebEngineDownloadItem *downloadItem)
// Filename may have been percent encoded and actually containing path
fileName = QFileInfo(fileName).fileName();
#if QT_VERSION >= QT_VERSION_CHECK(5, 8, 0)
const bool forceAsk = downloadItem->savePageFormat() != QWebEngineDownloadItem::UnknownSaveFormat
|| downloadItem->type() == QWebEngineDownloadItem::UserRequested;
#else
const bool forceAsk = downloadItem->savePageFormat() != QWebEngineDownloadItem::UnknownSaveFormat;
#endif
qDebug() << downloadItem->type();
if (m_useExternalManager) {
startExternalManager(downloadItem->url());
@ -269,6 +276,11 @@ void DownloadManager::download(QWebEngineDownloadItem *downloadItem)
if (downloadItem->savePageFormat() != QWebEngineDownloadItem::UnknownSaveFormat) {
// Save Page requested
result = SavePage;
#if QT_VERSION >= QT_VERSION_CHECK(5, 8, 0)
} else if (downloadItem->type() == QWebEngineDownloadItem::UserRequested) {
// Save x as... requested
result = Save;
#endif
} else {
// Ask what to do
DownloadOptionsDialog optionsDialog(fileName, downloadItem, mApp->activeWindow());