summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorMartin Smith <msmith@trolltech.com>2010-04-13 12:44:36 (GMT)
committerMartin Smith <msmith@trolltech.com>2010-04-13 12:44:36 (GMT)
commitaa7881ad6fbc3f79b273f5a03a3796febe7da976 (patch)
treea37c50edff6a87b72883a9dda765d0bc17b4d3f9 /tools
parent3d3bff79216a24625ac7e5aa33b40c5363a228fc (diff)
parent6bebe02e8d01e17f80d9951126c3158bf2bcc6e0 (diff)
downloadQt-aa7881ad6fbc3f79b273f5a03a3796febe7da976.zip
Qt-aa7881ad6fbc3f79b273f5a03a3796febe7da976.tar.gz
Qt-aa7881ad6fbc3f79b273f5a03a3796febe7da976.tar.bz2
Merge branch '4.7' of git@scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.7
Diffstat (limited to 'tools')
-rw-r--r--tools/assistant/tools/assistant/helpviewer.h3
-rw-r--r--tools/assistant/tools/assistant/helpviewer_qtb.cpp34
-rw-r--r--tools/assistant/tools/assistant/helpviewer_qtb.h3
-rw-r--r--tools/assistant/tools/assistant/helpviewer_qwv.cpp32
-rw-r--r--tools/assistant/tools/assistant/helpviewer_qwv.h2
5 files changed, 58 insertions, 16 deletions
diff --git a/tools/assistant/tools/assistant/helpviewer.h b/tools/assistant/tools/assistant/helpviewer.h
index 246700f..6f1f48d 100644
--- a/tools/assistant/tools/assistant/helpviewer.h
+++ b/tools/assistant/tools/assistant/helpviewer.h
@@ -47,6 +47,7 @@
QT_BEGIN_NAMESPACE
+class QMouseEvent;
class QUrl;
class AbstractHelpViewer
@@ -64,6 +65,8 @@ public:
virtual void resetScale() = 0;
virtual qreal scale() const = 0;
+ virtual bool handleForwardBackwardMouseButtons(QMouseEvent *e) = 0;
+
static QString AboutBlank;
static QString LocalHelpFile;
static QString PageNotFoundMessage;
diff --git a/tools/assistant/tools/assistant/helpviewer_qtb.cpp b/tools/assistant/tools/assistant/helpviewer_qtb.cpp
index 07b89eb..3ff64e8 100644
--- a/tools/assistant/tools/assistant/helpviewer_qtb.cpp
+++ b/tools/assistant/tools/assistant/helpviewer_qtb.cpp
@@ -127,6 +127,20 @@ void HelpViewer::resetScale()
zoomCount = 0;
}
+bool HelpViewer::handleForwardBackwardMouseButtons(QMouseEvent *e)
+{
+ if (e->button() == Qt::XButton1) {
+ QTextBrowser::backward();
+ return true;
+ }
+
+ if (e->button() == Qt::XButton2) {
+ QTextBrowser::forward();
+ return true;
+ }
+ return false;
+}
+
void HelpViewer::setSource(const QUrl &url)
{
TRACE_OBJ
@@ -229,15 +243,10 @@ void HelpViewer::contextMenuEvent(QContextMenuEvent *e)
void HelpViewer::mouseReleaseEvent(QMouseEvent *e)
{
TRACE_OBJ
- if (e->button() == Qt::XButton1) {
- QTextBrowser::backward();
- return;
- }
-
- if (e->button() == Qt::XButton2) {
- QTextBrowser::forward();
+#ifndef Q_OS_LINUX
+ if (handleForwardBackwardMouseButtons(e))
return;
- }
+#endif
controlPressed = e->modifiers() & Qt::ControlModifier;
if ((controlPressed && hasAnchorAt(e->pos())) ||
@@ -249,6 +258,15 @@ void HelpViewer::mouseReleaseEvent(QMouseEvent *e)
QTextBrowser::mouseReleaseEvent(e);
}
+void HelpViewer::mousePressEvent(QMouseEvent *e)
+{
+#ifdef Q_OS_LINUX
+ if (handleForwardBackwardMouseButtons(e))
+ return;
+#endif
+ QTextBrowser::mousePressEvent(e);
+}
+
void HelpViewer::keyPressEvent(QKeyEvent *e)
{
TRACE_OBJ
diff --git a/tools/assistant/tools/assistant/helpviewer_qtb.h b/tools/assistant/tools/assistant/helpviewer_qtb.h
index a05782c..acb734b 100644
--- a/tools/assistant/tools/assistant/helpviewer_qtb.h
+++ b/tools/assistant/tools/assistant/helpviewer_qtb.h
@@ -72,6 +72,8 @@ public:
void resetScale();
qreal scale() const { return zoomCount; }
+ bool handleForwardBackwardMouseButtons(QMouseEvent *e);
+
void setSource(const QUrl &url);
inline bool hasSelection() const
@@ -91,6 +93,7 @@ private:
void contextMenuEvent(QContextMenuEvent *e);
void mouseReleaseEvent(QMouseEvent *e);
void keyPressEvent(QKeyEvent *e);
+ void mousePressEvent(QMouseEvent *e);
private slots:
void openLinkInNewTab();
diff --git a/tools/assistant/tools/assistant/helpviewer_qwv.cpp b/tools/assistant/tools/assistant/helpviewer_qwv.cpp
index 18046a7..db1cd58 100644
--- a/tools/assistant/tools/assistant/helpviewer_qwv.cpp
+++ b/tools/assistant/tools/assistant/helpviewer_qwv.cpp
@@ -301,6 +301,22 @@ void HelpViewer::resetScale()
setTextSizeMultiplier(1.0);
}
+bool HelpViewer::handleForwardBackwardMouseButtons(QMouseEvent *e)
+{
+ TRACE_OBJ
+ if (e->button() == Qt::XButton1) {
+ triggerPageAction(QWebPage::Back);
+ return true;
+ }
+
+ if (e->button() == Qt::XButton2) {
+ triggerPageAction(QWebPage::Forward);
+ return true;
+ }
+
+ return false;
+}
+
void HelpViewer::setSource(const QUrl &url)
{
TRACE_OBJ
@@ -328,15 +344,10 @@ void HelpViewer::wheelEvent(QWheelEvent *e)
void HelpViewer::mouseReleaseEvent(QMouseEvent *e)
{
TRACE_OBJ
- if (e->button() == Qt::XButton1) {
- triggerPageAction(QWebPage::Back);
+#ifndef Q_OS_LINUX
+ if (handleForwardBackwardMouseButtons(e))
return;
- }
-
- if (e->button() == Qt::XButton2) {
- triggerPageAction(QWebPage::Forward);
- return;
- }
+#endif
QWebView::mouseReleaseEvent(e);
}
@@ -356,6 +367,11 @@ void HelpViewer::actionChanged()
void HelpViewer::mousePressEvent(QMouseEvent *event)
{
TRACE_OBJ
+#ifdef Q_OS_LINUX
+ if (handleForwardBackwardMouseButtons(event))
+ return;
+#endif
+
HelpPage *currentPage = static_cast<HelpPage*>(page());
if (currentPage) {
currentPage->m_pressedButtons = event->buttons();
diff --git a/tools/assistant/tools/assistant/helpviewer_qwv.h b/tools/assistant/tools/assistant/helpviewer_qwv.h
index 41ee553..a2c0389 100644
--- a/tools/assistant/tools/assistant/helpviewer_qwv.h
+++ b/tools/assistant/tools/assistant/helpviewer_qwv.h
@@ -69,6 +69,8 @@ public:
void resetScale();
qreal scale() const { return textSizeMultiplier(); }
+ bool handleForwardBackwardMouseButtons(QMouseEvent *e);
+
void setSource(const QUrl &url);
inline QUrl source() const { return url(); }