Changed to PlatformMouseEvent constructor to allow construction from a QContextMenuEvent.
[WebKit-https.git] / WebKit / qt / Api / qwebpage.cpp
index b303a16159abc012f2b238a9aa02f1ad4bbc0400..8ed3e1dbb7e9499d5e74b4091db97ca5db7c8319 100644 (file)
@@ -435,10 +435,7 @@ void QWebPage::mousePressEvent(QMouseEvent *ev)
     if (!frame->eventHandler)
         return;
 
-    if (ev->button() == Qt::RightButton)
-        frame->eventHandler->sendContextMenuEvent(PlatformMouseEvent(ev, 1));
-    else
-        frame->eventHandler->handleMousePressEvent(PlatformMouseEvent(ev, 1));
+    frame->eventHandler->handleMousePressEvent(PlatformMouseEvent(ev, 1));
 
     //FIXME need to keep track of subframe focus for key events!
     frame->page->setFocus();
@@ -468,6 +465,13 @@ void QWebPage::mouseReleaseEvent(QMouseEvent *ev)
     d->frameUnderMouse = 0;
 }
 
+void QWebPage::contextMenuEvent(QContextMenuEvent *ev)
+{
+    QWebFramePrivate *frame = d->currentFrame(ev->pos())->d;
+    if (frame->eventHandler)
+        frame->eventHandler->sendContextMenuEvent(PlatformMouseEvent(ev, 1));
+}
+
 void QWebPage::wheelEvent(QWheelEvent *ev)
 {
     QWebFramePrivate *frame = d->currentFrame(ev->pos())->d;