diff options
author | Andrea Diamantini <adjam7@gmail.com> | 2009-10-04 12:05:46 +0200 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2009-10-04 12:05:46 +0200 |
commit | 279a8146743edea4d81fce5766fd722959b502b1 (patch) | |
tree | 409e25b996a7a29a85290668689096f131ffb2e4 | |
parent | not show the search menu if there are no search engines available. (diff) | |
download | rekonq-279a8146743edea4d81fce5766fd722959b502b1.tar.xz |
View image action
another brilliant patch from Ronny Scholz (thanks!)
-rw-r--r-- | src/webview.cpp | 23 | ||||
-rw-r--r-- | src/webview.h | 1 |
2 files changed, 23 insertions, 1 deletions
diff --git a/src/webview.cpp b/src/webview.cpp index f828fdac..88c0e664 100644 --- a/src/webview.cpp +++ b/src/webview.cpp @@ -203,7 +203,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); @@ -387,6 +392,22 @@ void WebView::printFrame() } +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() { KAction *a = qobject_cast<KAction*>(sender()); diff --git a/src/webview.h b/src/webview.h index baf8f9f5..101d2558 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(); |