1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-14 11:02:19 +01:00

Add copy image option in context menu (#2058)

This commit is contained in:
Vlad 2016-08-16 13:57:11 +03:00 committed by David Rosca
parent 5085111657
commit 81aab60023
2 changed files with 7 additions and 0 deletions

View File

@ -439,6 +439,11 @@ void WebView::copyLinkToClipboard()
} }
} }
void WebView::copyImageToClipboard()
{
triggerPageAction(QWebEnginePage::CopyImageToClipboard);
}
void WebView::downloadLinkToDisk() void WebView::downloadLinkToDisk()
{ {
triggerPageAction(QWebEnginePage::DownloadLinkToDisk); triggerPageAction(QWebEnginePage::DownloadLinkToDisk);
@ -735,6 +740,7 @@ void WebView::createImageContextMenu(QMenu* menu, const WebHitTestResult &hitTes
connect(act, SIGNAL(triggered()), this, SLOT(openActionUrl())); connect(act, SIGNAL(triggered()), this, SLOT(openActionUrl()));
connect(act, SIGNAL(ctrlTriggered()), this, SLOT(userDefinedOpenUrlInNewTab())); connect(act, SIGNAL(ctrlTriggered()), this, SLOT(userDefinedOpenUrlInNewTab()));
menu->addAction(act); 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->addAction(QIcon::fromTheme("edit-copy"), tr("Copy image ad&dress"), this, SLOT(copyLinkToClipboard()))->setData(hitTest.imageUrl());
menu->addSeparator(); menu->addSeparator();
menu->addAction(QIcon::fromTheme("document-save"), tr("&Save image as..."), this, SLOT(downloadImageToDisk())); menu->addAction(QIcon::fromTheme("document-save"), tr("&Save image as..."), this, SLOT(downloadImageToDisk()));

View File

@ -120,6 +120,7 @@ protected slots:
void openUrlInNewWindow(); void openUrlInNewWindow();
void sendLinkByMail(); void sendLinkByMail();
void copyLinkToClipboard(); void copyLinkToClipboard();
void copyImageToClipboard();
void downloadLinkToDisk(); void downloadLinkToDisk();
void downloadImageToDisk(); void downloadImageToDisk();
void downloadMediaToDisk(); void downloadMediaToDisk();