diff --git a/src/lib/downloads/downloadmanager.cpp b/src/lib/downloads/downloadmanager.cpp index a00a61ed0..e27b78818 100644 --- a/src/lib/downloads/downloadmanager.cpp +++ b/src/lib/downloads/downloadmanager.cpp @@ -79,7 +79,7 @@ void DownloadManager::loadSettings() Settings settings; settings.beginGroup("DownloadManager"); m_downloadPath = settings.value("defaultDownloadPath", QString()).toString(); - m_lastDownloadPath = settings.value("lastDownloadPath", QDir::homePath().append(QLatin1Char('/'))).toString(); + m_lastDownloadPath = settings.value("lastDownloadPath", QStandardPaths::writableLocation(QStandardPaths::DownloadLocation)).toString(); m_closeOnFinish = settings.value("CloseManagerOnFinish", false).toBool(); m_useNativeDialog = settings.value("useNativeDialog", DEFAULT_DOWNLOAD_USE_NATIVE_DIALOG).toBool(); diff --git a/src/lib/webengine/webview.cpp b/src/lib/webengine/webview.cpp index 28d75232d..1fe64163d 100644 --- a/src/lib/webengine/webview.cpp +++ b/src/lib/webengine/webview.cpp @@ -511,7 +511,21 @@ void WebView::copyLinkToClipboard() void WebView::savePageAs() { +#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0) + page()->runJavaScript(QSL("document.contentType"), WebPage::SafeJsWorld, [this](const QVariant &res) { + const QSet webPageTypes = { + QSL("text/html"), + QSL("application/xhtml+xml") + }; + if (res.isNull() || webPageTypes.contains(res.toString())) { + triggerPageAction(QWebEnginePage::SavePage); + } else { + page()->download(url()); + } + }); +#else triggerPageAction(QWebEnginePage::SavePage); +#endif } void WebView::copyImageToClipboard() @@ -824,11 +838,13 @@ void WebView::createLinkContextMenu(QMenu* menu, const WebHitTestResult &hitTest void WebView::createImageContextMenu(QMenu* menu, const WebHitTestResult &hitTest) { menu->addSeparator(); - Action* act = new Action(tr("Show i&mage")); - act->setData(hitTest.imageUrl()); - connect(act, SIGNAL(triggered()), this, SLOT(openActionUrl())); - connect(act, SIGNAL(ctrlTriggered()), this, SLOT(userDefinedOpenUrlInNewTab())); - menu->addAction(act); + if (hitTest.imageUrl() != url()) { + Action *act = new Action(tr("Show i&mage")); + act->setData(hitTest.imageUrl()); + connect(act, SIGNAL(triggered()), this, SLOT(openActionUrl())); + connect(act, SIGNAL(ctrlTriggered()), this, SLOT(userDefinedOpenUrlInNewTab())); + menu->addAction(act); + } menu->addAction(tr("Copy image"), this, SLOT(copyImageToClipboard())); menu->addAction(QIcon::fromTheme("edit-copy"), tr("Copy image ad&dress"), this, SLOT(copyLinkToClipboard()))->setData(hitTest.imageUrl()); menu->addSeparator();