ginebra2/ContentViews/ScrollableWebContentView.cpp
changeset 9 b39122337a00
parent 3 0954f5dd2cd0
child 16 3c88a81ff781
--- a/ginebra2/ContentViews/ScrollableWebContentView.cpp	Mon Jul 12 15:46:53 2010 -0400
+++ b/ginebra2/ContentViews/ScrollableWebContentView.cpp	Fri Aug 06 17:23:08 2010 -0400
@@ -77,6 +77,8 @@
     m_zoomAnimator = new QPropertyAnimation(webAnimationItem, "geometry");
     m_zoomAnimator->setDuration(ZoomAnimationDuration);
     connect(m_zoomAnimator, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)), this, SLOT(zoomAnimationStateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
+    
+    m_gesturesEnabled = true;
 }
 
 ScrollableWebContentView::~ScrollableWebContentView()
@@ -266,8 +268,13 @@
     Q_UNUSED(item);
 
     bool handled = false;
-    if (!isVisible())
-        return handled;
+    
+    if (!isVisible() || !m_gesturesEnabled) {
+        if (event->type() == QEvent::GraphicsSceneContextMenu)
+            return true;
+        else
+            return handled;
+    }
 
     //Pass all events to recognizer
     handled  = m_gestureRecognizer.mouseEventFilter(static_cast<QGraphicsSceneMouseEvent *>(event));
@@ -310,9 +317,12 @@
 
 void ScrollableWebContentView::handleRelease(GestureEvent* gestureEvent)
 {
+    //FIX ME:
+    emit mouseEvent(QEvent::GraphicsSceneMousePress);
     //Cache release event to send on release
     QPointF pos = gestureEvent->position();
     sendEventToWebKit(QEvent::GraphicsSceneMouseRelease, pos);
+    emit mouseEvent(QEvent::GraphicsSceneMouseRelease);
 }
 
 void ScrollableWebContentView::handleDoubleTap(GestureEvent* gestureEvent)
@@ -511,7 +521,6 @@
     event.setButton(Qt::LeftButton);
     event.setButtons(Qt::LeftButton);
     event.setModifiers(Qt::NoModifier);
-
     viewportWidget()->webView()->page()->event(&event);
 }