1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 10:46:35 +01:00

Merge branch 'Falkon/3.0'

This commit is contained in:
David Rosca 2018-03-31 12:18:23 +02:00
commit b0b4b2b268
No known key found for this signature in database
GPG Key ID: EBC3FC294452C6D8
2 changed files with 22 additions and 6 deletions

View File

@ -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();

View File

@ -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<QString> 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();