I've added a context menu entry to view the image under the mouse curser.
You may left click to open it in the current tab or use middle click/ctrl+left 
click to open it in a new tab.
diff --git a/src/webview.cpp b/src/webview.cpp
index 417da6b..616b883 100644
--- a/src/webview.cpp
+++ b/src/webview.cpp
@@ -198,7 +198,12 @@ void WebView::contextMenuEvent(QContextMenuEvent *event)
     {
         menu.addSeparator();
 
-        // TODO Add "View Image" && remove copy_this_image action
+        // TODO remove copy_this_image action      
+        a = new KAction(KIcon("view-media-visualization"), i18n("&View Image"), this);
+        a->setData(result.imageUrl());
+        connect(a, SIGNAL(triggered(Qt::MouseButtons, Qt::KeyboardModifiers)), this, SLOT(viewImage(Qt::MouseButtons, Qt::KeyboardModifiers)));
+        menu.addAction(a);
+        
         a = pageAction(QWebPage::DownloadImageToDisk);
         a->setIcon(KIcon("document-save"));
         menu.addAction(a);
@@ -381,6 +386,21 @@ void WebView::printFrame()
     Application::instance()->mainWindow()->printRequested(page()->currentFrame());
 }
 
+void WebView::viewImage(Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers)
+{
+    KAction *a = qobject_cast<KAction*>(sender());
+    KUrl url(a->data().toUrl());
+    
+    if (modifiers & Qt::ControlModifier || buttons == Qt::MidButton)
+    {
+        Application::instance()->loadUrl(url, Rekonq::SettingOpenTab);
+    }
+    else
+    {
+        Application::instance()->loadUrl(url, Rekonq::CurrentTab);
+    }
+}
+
 
 void WebView::openLinkInNewWindow()
 {
diff --git a/src/webview.h b/src/webview.h
index baf8f9f..101d255 100644
--- a/src/webview.h
+++ b/src/webview.h
@@ -74,6 +74,7 @@ private slots:
 
     void printFrame();
 
+    void viewImage(Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers);
     void openLinkInNewWindow();
     void openLinkInNewTab();
 
_______________________________________________
rekonq mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/rekonq

Reply via email to