summaryrefslogtreecommitdiff
path: root/src/webpage.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/webpage.cpp')
-rw-r--r--src/webpage.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/webpage.cpp b/src/webpage.cpp
index bb6f0d9c..771b7f04 100644
--- a/src/webpage.cpp
+++ b/src/webpage.cpp
@@ -73,6 +73,8 @@
WebPage::WebPage(QObject *parent)
: QWebPage(parent)
+ , m_keyboardModifiers(Qt::NoModifier)
+ , m_pressedButtons(Qt::NoButton)
{
setForwardUnsupportedContent(true);
@@ -84,6 +86,34 @@ WebPage::WebPage(QObject *parent)
}
+bool WebPage::acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &request, NavigationType type)
+{
+ if (m_keyboardModifiers & Qt::ControlModifier || m_pressedButtons == Qt::MidButton)
+ {
+ Application::instance()->loadUrl(request.url(), Rekonq::NewTab);
+ m_keyboardModifiers = Qt::NoModifier;
+ m_pressedButtons = Qt::NoButton;
+ return false;
+ }
+
+ if (frame == mainFrame())
+ {
+ return QWebPage::acceptNavigationRequest(frame, request, type);
+ }
+ else
+ {
+ // if frame doesn't exists (perhaps) we are pointing to a blank target..
+ if (!frame)
+ {
+ Application::instance()->loadUrl(request.url(), Rekonq::NewTab);
+ return false;
+ }
+ }
+
+ return QWebPage::acceptNavigationRequest(frame, request, type);
+}
+
+
WebPage *WebPage::createWindow(QWebPage::WebWindowType type)
{
kDebug() << "WebPage createWindow slot";