summaryrefslogtreecommitdiff
path: root/src/webview.cpp
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2012-01-27 16:48:46 +0100
committerAndrea Diamantini <adjam7@gmail.com>2012-01-27 16:48:46 +0100
commit0eb6fc942efa069b36a60707fc870edcacf1c261 (patch)
tree2c6b9b427f8d2361725c31985650c775e34acc9d /src/webview.cpp
parentAccess keys handling fixes (diff)
downloadrekonq-0eb6fc942efa069b36a60707fc870edcacf1c261.tar.xz
Open links in new tabs with CTRL + ENTER
BUG:291213
Diffstat (limited to 'src/webview.cpp')
-rw-r--r--src/webview.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/webview.cpp b/src/webview.cpp
index 850229d1..b4f9d0be 100644
--- a/src/webview.cpp
+++ b/src/webview.cpp
@@ -637,6 +637,8 @@ void WebView::keyPressEvent(QKeyEvent *event)
return;
}
+ const QString tagName = page()->mainFrame()->evaluateJavaScript("document.activeElement.tagName").toString();
+
if (event->modifiers() == Qt::ControlModifier)
{
if (event->key() == Qt::Key_C)
@@ -652,9 +654,17 @@ void WebView::keyPressEvent(QKeyEvent *event)
event->accept();
return;
}
+
+ // CTRL + RETURN: open link into another tab
+ if (event->key() == Qt::Key_Return && tagName == QL1S("A"))
+ {
+ KUrl u = KUrl(page()->mainFrame()->evaluateJavaScript("document.activeElement.attributes[\"href\"].value").toString());
+ emit loadUrl(u, Rekonq::NewTab);
+ event->accept();
+ return;
+ }
}
- const QString tagName = page()->mainFrame()->evaluateJavaScript("document.activeElement.tagName").toString();
bool isContentEditable = page()->mainFrame()->evaluateJavaScript("document.activeElement.isContentEditable").toBool();
// Auto Scrolling