summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJocelyn Turcotte <jocelyn.turcotte@digia.com>2014-09-11 17:26:37 +0200
committerJocelyn Turcotte <jocelyn.turcotte@digia.com>2014-09-12 11:23:15 +0200
commitdce5b2a30773bbf508afda54601dd84e8cb691ce (patch)
tree245b1c1cb6da455e6e5729f9ebaaab7650461ac3
parent88d5cb119658310d1751e6162123a000ad078b99 (diff)
Enable JavaScript touch events
They are disabled by default at the moment, enable them conditionally to a touch screen being available. Change-Id: I5827fe2326b7bc019fa5613121d1cfa666608e52 Reviewed-by: Andras Becsi <andras.becsi@digia.com>
-rw-r--r--src/core/web_engine_settings.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/core/web_engine_settings.cpp b/src/core/web_engine_settings.cpp
index 76eb7f25e..6af3210bf 100644
--- a/src/core/web_engine_settings.cpp
+++ b/src/core/web_engine_settings.cpp
@@ -42,6 +42,7 @@
#include <QFont>
#include <QTimer>
+#include <QTouchDevice>
static const int batchTimerTimeout = 100;
@@ -68,6 +69,21 @@ private:
#include "web_engine_settings.moc"
+static inline bool isTouchScreenAvailable() {
+ static bool initialized = false;
+ static bool touchScreenAvailable = false;
+ if (!initialized) {
+ Q_FOREACH (const QTouchDevice *d, QTouchDevice::devices()) {
+ if (d->type() == QTouchDevice::TouchScreen) {
+ touchScreenAvailable = true;
+ break;
+ }
+ }
+ initialized = true;
+ }
+ return touchScreenAvailable;
+}
+
WebEngineSettings::WebEngineSettings(WebEngineSettingsDelegate *delegate)
: m_adapter(0)
@@ -245,6 +261,7 @@ void WebEngineSettings::applySettingsToWebPreferences(WebPreferences *prefs)
{
// Override for now
prefs->java_enabled = false;
+ prefs->touch_enabled = isTouchScreenAvailable();
// Attributes mapping.
prefs->loads_images_automatically = testAttribute(AutoLoadImages);