From d7dc9ba9f6df53a7d747ee8bec9aa1deda54d2a7 Mon Sep 17 00:00:00 2001 From: David Rosca Date: Sat, 31 Mar 2018 11:06:28 +0200 Subject: [PATCH] WebView: Don't show "Show image" action when showing image --- src/lib/webengine/webview.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/lib/webengine/webview.cpp b/src/lib/webengine/webview.cpp index fb6d044c1..24f499aea 100644 --- a/src/lib/webengine/webview.cpp +++ b/src/lib/webengine/webview.cpp @@ -830,11 +830,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();