summaryrefslogtreecommitdiff
path: root/src/webview.cpp
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2012-06-07 00:10:34 +0200
committerAndrea Diamantini <adjam7@gmail.com>2012-06-07 00:11:12 +0200
commit2ffe15ca52c33e454d7bf0e632fc39752710733f (patch)
treefa5313b5010d4a5898c42839899dfdf123fc064a /src/webview.cpp
parentfix minimum requirement and add screenshots (diff)
downloadrekonq-2ffe15ca52c33e454d7bf0e632fc39752710733f.tar.xz
Letting SHIFT + MidClick reverse open new tab settings
BUG: 299024
Diffstat (limited to 'src/webview.cpp')
-rw-r--r--src/webview.cpp71
1 files changed, 45 insertions, 26 deletions
diff --git a/src/webview.cpp b/src/webview.cpp
index 65295294..b592335c 100644
--- a/src/webview.cpp
+++ b/src/webview.cpp
@@ -81,15 +81,8 @@ WebView::WebView(QWidget* parent)
, m_accessKeysPressed(false)
, m_accessKeysActive(false)
{
- // download system
- connect(this, SIGNAL(linkShiftClicked(KUrl)), page(), SLOT(downloadUrl(KUrl)));
-
- // middle click || ctrl + click signal
- connect(this, SIGNAL(linkMiddleOrCtrlClicked(KUrl)), this, SLOT(loadUrlInNewTab(KUrl)));
-
// loadUrl signal
- connect(this, SIGNAL(loadUrl(KUrl, Rekonq::OpenType)),
- rApp, SLOT(loadUrl(KUrl, Rekonq::OpenType)));
+ connect(this, SIGNAL(loadUrl(KUrl, Rekonq::OpenType)), rApp, SLOT(loadUrl(KUrl, Rekonq::OpenType)));
// Auto scroll timer
connect(m_autoScrollTimer, SIGNAL(timeout()), this, SLOT(scrollFrameChanged()));
@@ -475,6 +468,7 @@ void WebView::mousePressEvent(QMouseEvent *event)
default:
break;
};
+
KWebView::mousePressEvent(event);
}
@@ -906,24 +900,6 @@ void WebView::inspect()
}
-void WebView::loadUrlInNewTab(const KUrl &u)
-{
- QNetworkRequest req(u);
- req.setRawHeader(QByteArray("Referer"), url().toEncoded());
-
- WebTab *w = 0;
- if (ReKonfig::openLinksInNewWindow())
- {
- w = rApp->newMainWindow()->mainView()->currentWebTab();
- }
- else
- {
- w = rApp->mainWindow()->mainView()->newWebTab(!ReKonfig::openNewTabsInBackground());
- }
- w->view()->load(req);
-}
-
-
void WebView::scrollFrameChanged()
{
// do the scrolling
@@ -1234,3 +1210,46 @@ void WebView::blockImage()
QString imageUrl = action->data().toString();
rApp->adblockManager()->addCustomRule(imageUrl);
}
+
+
+void WebView::mouseReleaseEvent(QMouseEvent *event)
+{
+ QWebHitTestResult hitTest = page()->mainFrame()->hitTestContent(event->pos());
+ const QUrl url = hitTest.linkUrl();
+
+ if (!url.isEmpty())
+ {
+ if (event->button() & Qt::MidButton)
+ {
+ if (event->modifiers() & Qt::ShiftModifier)
+ {
+ if (ReKonfig::openNewTabsInBackground())
+ emit loadUrl(url, Rekonq::NewFocusedTab);
+ else
+ emit loadUrl(url, Rekonq::NewBackGroundTab);
+ event->accept();
+ return;
+ }
+
+ emit loadUrl(url, Rekonq::NewTab);
+ event->accept();
+ return;
+ }
+
+ if ((event->button() & Qt::LeftButton) && (event->modifiers() & Qt::ControlModifier))
+ {
+ emit loadUrl(url, Rekonq::NewTab);
+ event->accept();
+ return;
+ }
+
+ if ((event->button() & Qt::LeftButton) && (event->modifiers() & Qt::ShiftModifier))
+ {
+ page()->downloadUrl(url);
+ event->accept();
+ return;
+ }
+ }
+
+ QWebView::mouseReleaseEvent(event);
+}