mirror of
https://invent.kde.org/network/falkon.git
synced 2024-11-11 09:32:12 +01: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:
parent
880b0eb5b1
commit
953c52e73d
|
@ -258,7 +258,14 @@ void DownloadManager::download(QWebEngineDownloadItem *downloadItem)
|
||||||
// Filename may have been percent encoded and actually containing path
|
// Filename may have been percent encoded and actually containing path
|
||||||
fileName = QFileInfo(fileName).fileName();
|
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;
|
const bool forceAsk = downloadItem->savePageFormat() != QWebEngineDownloadItem::UnknownSaveFormat;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
qDebug() << downloadItem->type();
|
||||||
|
|
||||||
if (m_useExternalManager) {
|
if (m_useExternalManager) {
|
||||||
startExternalManager(downloadItem->url());
|
startExternalManager(downloadItem->url());
|
||||||
|
@ -269,6 +276,11 @@ void DownloadManager::download(QWebEngineDownloadItem *downloadItem)
|
||||||
if (downloadItem->savePageFormat() != QWebEngineDownloadItem::UnknownSaveFormat) {
|
if (downloadItem->savePageFormat() != QWebEngineDownloadItem::UnknownSaveFormat) {
|
||||||
// Save Page requested
|
// Save Page requested
|
||||||
result = SavePage;
|
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 {
|
} else {
|
||||||
// Ask what to do
|
// Ask what to do
|
||||||
DownloadOptionsDialog optionsDialog(fileName, downloadItem, mApp->activeWindow());
|
DownloadOptionsDialog optionsDialog(fileName, downloadItem, mApp->activeWindow());
|
||||||
|
|
Loading…
Reference in New Issue
Block a user