55 const qreal KDeccelaration = 1000.00; |
55 const qreal KDeccelaration = 1000.00; |
56 |
56 |
57 static const int KStartPanDistance = 50; |
57 static const int KStartPanDistance = 50; |
58 static const int KWaitForClickTimeoutMS = 200; |
58 static const int KWaitForClickTimeoutMS = 200; |
59 static const int KLongPressDuration = 1000; |
59 static const int KLongPressDuration = 1000; |
60 static const int KLongPressThreshold = 30; |
60 static const int KLongPressThreshold = 18; |
61 //The amount of pixels to try to pan before pan mode unlocks |
61 //The amount of pixels to try to pan before pan mode unlocks |
62 static const int KPanModeChangeDelta = 100; |
62 static const int KPanModeChangeDelta = 100; |
63 |
63 |
64 /*! |
64 /*! |
65 \class WebTouchNavigation |
65 \class WebTouchNavigation |
631 if (hitTestResult.isContentEditable()) { |
640 if (hitTestResult.isContentEditable()) { |
632 QMouseEvent moveEvt(QEvent::MouseMove, pos, Qt::LeftButton, Qt::LeftButton, Qt::NoModifier); |
641 QMouseEvent moveEvt(QEvent::MouseMove, pos, Qt::LeftButton, Qt::LeftButton, Qt::NoModifier); |
633 m_webPage->event(&moveEvt); |
642 m_webPage->event(&moveEvt); |
634 m_textSelected = true; |
643 m_textSelected = true; |
635 } |
644 } |
|
645 } else { // FIXME add following lines to enable the auto-scroll while selecting text |
|
646 if (m_textSelected) { |
|
647 QMouseEvent moveEvt(QEvent::MouseMove, pos, Qt::LeftButton, Qt::LeftButton, Qt::NoModifier); |
|
648 m_webPage->event(&moveEvt); |
|
649 } |
636 } |
650 } |
637 } |
651 } |
638 if (!m_textSelected) |
652 if (!m_textSelected) |
639 scrollFrame(diff); |
653 scrollFrame(diff); |
640 |
654 |
726 startScrollTimer(); |
740 startScrollTimer(); |
727 } |
741 } |
728 } else { |
742 } else { |
729 // we don't want to automatically display the SIP (Software input panel) by qtwebkit |
743 // we don't want to automatically display the SIP (Software input panel) by qtwebkit |
730 bool sipEnabled = qApp->autoSipEnabled(); |
744 bool sipEnabled = qApp->autoSipEnabled(); |
731 qApp->setAutoSipEnabled(false); |
745 //qApp->setAutoSipEnabled(false); |
732 QMouseEvent iev = m_ishighlighted ? |
746 QMouseEvent iev = m_ishighlighted ? |
733 QMouseEvent(ev->type(), m_higlightedPos, ev->button(), ev->buttons(), getEventModifier(m_higlightedPos)) : |
747 QMouseEvent(ev->type(), m_higlightedPos, ev->button(), ev->buttons(), getEventModifier(m_higlightedPos)) : |
734 QMouseEvent(QEvent::MouseButtonRelease, m_touchPosition, ev->button(), ev->buttons(), getEventModifier(m_touchPosition)); |
748 QMouseEvent(QEvent::MouseButtonRelease, m_touchPosition, ev->button(), ev->buttons(), getEventModifier(m_touchPosition)); |
735 m_webPage->event(&iev); |
749 m_webPage->event(&iev); |
736 qApp->setAutoSipEnabled(sipEnabled); |
750 qApp->setAutoSipEnabled(sipEnabled); |
737 #if defined __SYMBIAN32__ |
751 #if defined __SYMBIAN32__ |
738 // FIXME Remove this, it will be fixed Qt 4.6.3 ? |
752 // FIXME Remove this, it will be fixed Qt 4.6.3 ? |
739 if (ev->button() == Qt::LeftButton) { |
753 if (ev->button() == Qt::LeftButton) { |
740 QWebHitTestResult htr = m_frame->hitTestContent(ev->pos()); |
754 QWebHitTestResult htr = m_frame->hitTestContent(ev->pos()); |
741 if (htr.isContentEditable()) { |
755 QEvent* vkbEvent; |
742 QEvent vkbEvent(QEvent::RequestSoftwareInputPanel); |
756 QInputContext *ic = qApp->inputContext(); |
743 QList<QGraphicsView*> views = m_view->scene()->views(); |
757 if (htr.isContentEditable()) |
744 QWidget* view = qobject_cast<QWidget*>(views.value(0)); |
758 vkbEvent = new QEvent(QEvent::RequestSoftwareInputPanel); |
745 if (view) |
759 else |
746 QApplication::sendEvent(view, &vkbEvent); |
760 vkbEvent = new QEvent(QEvent::CloseSoftwareInputPanel); |
747 } |
761 if (ic) |
|
762 ic->filterEvent(vkbEvent); |
|
763 delete vkbEvent; |
748 } |
764 } |
749 #endif |
765 #endif |
750 } |
766 } |
751 } |
767 } |
752 |
768 |
753 void GWebTouchNavigation::mouseDoubleClickEvent(const QPoint& pos) |
769 void GWebTouchNavigation::mouseDoubleClickEvent(const QPoint& pos) |
754 { |
770 { |
755 |
|
756 if (m_doubleClickTimer && !m_doubleClickTimer->isActive()) |
771 if (m_doubleClickTimer && !m_doubleClickTimer->isActive()) |
757 return; |
772 return; |
758 else if (m_doubleClickTimer) |
773 else if (m_doubleClickTimer) |
759 m_doubleClickTimer->stop(); |
774 m_doubleClickTimer->stop(); |
760 |
775 |
1372 void GWebTouchNavigation::onLoadFinished(bool ok) |
1387 void GWebTouchNavigation::onLoadFinished(bool ok) |
1373 { |
1388 { |
1374 Q_UNUSED(ok) |
1389 Q_UNUSED(ok) |
1375 m_isLoading = false; |
1390 m_isLoading = false; |
1376 } |
1391 } |
1377 void GWebTouchNavigation::setPage( QWebPage * page) |
1392 void GWebTouchNavigation::setPage( QWebPage * page, bool aWantSlideView) |
1378 { |
1393 { |
1379 if (m_webPage) { |
1394 // Need to listen to the load signals to determine whethter slideView should |
|
1395 // be called when scrolling. This is called only when m_wantSlideViewCalls is set and hence, |
|
1396 // there is no need to disconnect and connect to these signals if m_wantSlideViewCalls/ new value |
|
1397 // of m_wantSlideViewCalls is false |
|
1398 if (m_webPage && m_wantSlideViewCalls) { |
1380 disconnect(m_webPage, SIGNAL(loadStarted()), this, SLOT(onLoadStarted())); |
1399 disconnect(m_webPage, SIGNAL(loadStarted()), this, SLOT(onLoadStarted())); |
1381 disconnect(m_webPage, SIGNAL(loadFinished(bool)), this, SLOT(onLoadFinished(bool))); |
1400 disconnect(m_webPage, SIGNAL(loadFinished(bool)), this, SLOT(onLoadFinished(bool))); |
1382 //disconnect(m_webPage->mainFrame(), SIGNAL(contentsSizeChanged(const QSize &)), this, SLOT(onContentsSizeChanged(const QSize &))); |
1401 //disconnect(m_webPage->mainFrame(), SIGNAL(contentsSizeChanged(const QSize &)), this, SLOT(onContentsSizeChanged(const QSize &))); |
1383 } |
1402 } |
1384 m_webPage = page; |
1403 m_webPage = page; |
1385 if (m_webPage) { |
1404 m_wantSlideViewCalls = aWantSlideView; |
|
1405 if (m_webPage && m_wantSlideViewCalls) { |
1386 connect(m_webPage, SIGNAL(loadStarted()), this, SLOT(onLoadStarted())); |
1406 connect(m_webPage, SIGNAL(loadStarted()), this, SLOT(onLoadStarted())); |
1387 connect(m_webPage, SIGNAL(loadFinished(bool)), this, SLOT(onLoadFinished(bool))); |
1407 connect(m_webPage, SIGNAL(loadFinished(bool)), this, SLOT(onLoadFinished(bool))); |
1388 //connect(m_webPage->mainFrame(), SIGNAL(contentsSizeChanged(const QSize &)), this, SLOT(onContentsSizeChanged(const QSize &))); |
1408 //connect(m_webPage->mainFrame(), SIGNAL(contentsSizeChanged(const QSize &)), this, SLOT(onContentsSizeChanged(const QSize &))); |
1389 } |
1409 } |
1390 } |
1410 } |