summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mainview.cpp2
-rw-r--r--src/mainview.h2
-rw-r--r--src/mainwindow.cpp4
-rw-r--r--src/rekonq.kcfg3
-rw-r--r--src/settings/settings_general.ui16
-rw-r--r--src/webview.cpp82
-rw-r--r--src/webview.h2
7 files changed, 77 insertions, 34 deletions
diff --git a/src/mainview.cpp b/src/mainview.cpp
index 850101e2..94dc1688 100644
--- a/src/mainview.cpp
+++ b/src/mainview.cpp
@@ -286,6 +286,8 @@ WebTab *MainView::newWebTab(bool focused)
connect(tab, SIGNAL(titleChanged(const QString &)), this, SLOT(webViewTitleChanged(const QString &)));
connect(tab->view(), SIGNAL(urlChanged(const QUrl &)), this, SLOT(webViewUrlChanged(const QUrl &)));
connect(tab->view(), SIGNAL(iconChanged()), this, SLOT(webViewIconChanged()));
+ connect(tab->view(), SIGNAL(openPreviousInHistory()), this, SIGNAL(openPreviousInHistory()));
+ connect(tab->view(), SIGNAL(openNextInHistory()), this, SIGNAL(openNextInHistory()));
// connecting webPage signals with mainview
connect(tab->page(), SIGNAL(windowCloseRequested()), this, SLOT(windowCloseRequested()));
diff --git a/src/mainview.h b/src/mainview.h
index 1d04d284..bc8b6765 100644
--- a/src/mainview.h
+++ b/src/mainview.h
@@ -106,6 +106,8 @@ Q_SIGNALS:
void showStatusBarMessage(const QString &message, Rekonq::Notify status = Rekonq::Info);
void linkHovered(const QString &link);
void browserTabLoading(bool);
+ void openPreviousInHistory();
+ void openNextInHistory();
void printRequested(QWebFrame *frame);
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 3a9c1246..11c00c28 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -304,6 +304,10 @@ void MainWindow::postLaunch()
// (shift +) ctrl + tab switching
connect(this, SIGNAL(ctrlTabPressed()), m_view, SLOT(nextTab()));
connect(this, SIGNAL(shiftCtrlTabPressed()), m_view, SLOT(previousTab()));
+
+ // wheel history navigation
+ connect(m_view, SIGNAL(openPreviousInHistory()), this, SLOT(openPrevious()));
+ connect(m_view, SIGNAL(openNextInHistory()), this, SLOT(openNext()));
// update toolbar actions signals
connect(m_view, SIGNAL(tabsChanged()), this, SLOT(updateActions()));
diff --git a/src/rekonq.kcfg b/src/rekonq.kcfg
index b605e69e..6700b4e1 100644
--- a/src/rekonq.kcfg
+++ b/src/rekonq.kcfg
@@ -76,6 +76,9 @@
<entry name="smoothScrolling" type="Bool">
<default>true</default>
</entry>
+ <entry name="hScrollWheelHistory" type="Bool">
+ <default>false</default>
+ </entry>
</group>
diff --git a/src/settings/settings_general.ui b/src/settings/settings_general.ui
index dccf479a..0b27dab2 100644
--- a/src/settings/settings_general.ui
+++ b/src/settings/settings_general.ui
@@ -175,6 +175,22 @@
</widget>
</item>
<item>
+ <widget class="QGroupBox" name="groupBox_5">
+ <property name="title">
+ <string>Navigation</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_3">
+ <item>
+ <widget class="QCheckBox" name="kcfg_hScrollWheelHistory">
+ <property name="text">
+ <string>Use horizontal scroll wheel to go through web history</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
diff --git a/src/webview.cpp b/src/webview.cpp
index 2c0b59ea..4fcf5417 100644
--- a/src/webview.cpp
+++ b/src/webview.cpp
@@ -617,42 +617,56 @@ void WebView::keyPressEvent(QKeyEvent *event)
void WebView::wheelEvent(QWheelEvent *event)
{
- // To let some websites (eg: google maps) to handle wheel events
- int prevPos = page()->currentFrame()->scrollPosition().y();
- KWebView::wheelEvent(event);
- int newPos = page()->currentFrame()->scrollPosition().y();
-
- // Sync with the zoom slider
- if (event->modifiers() == Qt::ControlModifier)
+ if( event->orientation() == Qt::Vertical || !ReKonfig::hScrollWheelHistory() )
{
- // Limits of the slider
- if (zoomFactor() > 1.9)
- setZoomFactor(1.9);
- else if (zoomFactor() < 0.1)
- setZoomFactor(0.1);
-
- // Round the factor (Fix slider's end value)
- int newFactor = zoomFactor() * 10;
- if ((zoomFactor() * 10 - newFactor) > 0.5)
- newFactor++;
-
- emit zoomChanged(newFactor);
+ // To let some websites (eg: google maps) to handle wheel events
+ int prevPos = page()->currentFrame()->scrollPosition().y();
+ KWebView::wheelEvent(event);
+ int newPos = page()->currentFrame()->scrollPosition().y();
+
+ // Sync with the zoom slider
+ if (event->modifiers() == Qt::ControlModifier)
+ {
+ // Limits of the slider
+ if (zoomFactor() > 1.9)
+ setZoomFactor(1.9);
+ else if (zoomFactor() < 0.1)
+ setZoomFactor(0.1);
+
+ // Round the factor (Fix slider's end value)
+ int newFactor = zoomFactor() * 10;
+ if ((zoomFactor() * 10 - newFactor) > 0.5)
+ newFactor++;
+
+ emit zoomChanged(newFactor);
+ }
+ else if (ReKonfig::smoothScrolling() && prevPos != newPos)
+ {
+
+ page()->currentFrame()->setScrollPosition(QPoint(page()->currentFrame()->scrollPosition().x(), prevPos));
+
+ if ((event->delta() > 0) != !m_scrollBottom)
+ stopScrolling();
+
+ if (event->delta() > 0)
+ m_scrollBottom = false;
+ else
+ m_scrollBottom = true;
+
+
+ setupSmoothScrolling(abs(newPos - prevPos));
+ }
}
- else if (ReKonfig::smoothScrolling() && prevPos != newPos)
- {
-
- page()->currentFrame()->setScrollPosition(QPoint(page()->currentFrame()->scrollPosition().x(), prevPos));
-
- if ((event->delta() > 0) != !m_scrollBottom)
- stopScrolling();
-
- if (event->delta() > 0)
- m_scrollBottom = false;
- else
- m_scrollBottom = true;
-
-
- setupSmoothScrolling(abs(newPos - prevPos));
+ // use horizontal wheel events to go back and forward in tab history
+ else {
+ // left -> go to previous page
+ if( event->delta() > 0 ){
+ emit openPreviousInHistory();
+ }
+ // right -> go to next page
+ if( event->delta() < 0 ){
+ emit openNextInHistory();
+ }
}
}
diff --git a/src/webview.h b/src/webview.h
index acd7eae2..a06a2cb2 100644
--- a/src/webview.h
+++ b/src/webview.h
@@ -85,6 +85,8 @@ private slots:
signals:
void loadUrl(const KUrl &, const Rekonq::OpenType &);
void zoomChanged(int);
+ void openPreviousInHistory();
+ void openNextInHistory();
private:
QPoint m_mousePos;