1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 09:32:12 +01:00

Bring back MouseGestures plugin

This commit is contained in:
David Rosca 2015-10-02 11:14:10 +02:00
parent 939ebeb2c9
commit 75fe50ca48
4 changed files with 16 additions and 25 deletions

View File

@ -1033,7 +1033,7 @@ void WebView::_mouseReleaseEvent(QMouseEvent *event)
case Qt::RightButton:
if (s_forceContextMenuOnMouseRelease) {
QContextMenuEvent ev(QContextMenuEvent::Mouse, event->pos(), event->globalPos(), event->modifiers());
QApplication::sendEvent(this, &ev);
_contextMenuEvent(&ev);
event->accept();
}
break;
@ -1116,6 +1116,10 @@ void WebView::resizeEvent(QResizeEvent *event)
void WebView::contextMenuEvent(QContextMenuEvent *event)
{
// Context menu is created in mouseReleaseEvent
if (s_forceContextMenuOnMouseRelease)
return;
const QPoint pos = event->pos();
const QContextMenuEvent::Reason reason = event->reason();
@ -1135,14 +1139,6 @@ void WebView::loadRequest(const LoadRequest &req)
bool WebView::eventFilter(QObject *obj, QEvent *event)
{
if (s_forceContextMenuOnMouseRelease && obj == this && event->type() == QEvent::ContextMenu) {
QContextMenuEvent* ev = static_cast<QContextMenuEvent*>(event);
if (ev->reason() == QContextMenuEvent::Mouse && ev->spontaneous()) {
ev->accept();
return true;
}
}
// Hack to find widget that receives input events
if (obj == this && event->type() == QEvent::ChildAdded) {
QObject *child = static_cast<QChildEvent*>(event)->child();

View File

@ -27,8 +27,7 @@
#include "QjtMouseGesture.h"
#include <QMouseEvent>
#include <QWebFrame>
#include <QWebHistory>
#include <QWebEngineHistory>
#include <QSettings>
MouseGestures::MouseGestures(const QString &settingsPath, QObject* parent)
@ -99,14 +98,6 @@ bool MouseGestures::mousePress(QObject* obj, QMouseEvent* event)
{
m_view = qobject_cast<WebView*>(obj);
QWebFrame* frame = m_view.data()->page()->mainFrame();
if (frame->scrollBarGeometry(Qt::Vertical).contains(event->pos()) ||
frame->scrollBarGeometry(Qt::Horizontal).contains(event->pos())
) {
return false;
}
if (m_enableRockerNavigation && event->buttons() == (Qt::RightButton | Qt::LeftButton)) {
bool accepted = false;
@ -183,11 +174,16 @@ void MouseGestures::upGestured()
void MouseGestures::downGestured()
{
if (!m_view) {
TabbedWebView* view = qobject_cast<TabbedWebView*>(m_view.data());
if (!view)
return;
}
m_view.data()->openNewTab(Qz::NT_SelectedNewEmptyTab);
BrowserWindow* window = view->browserWindow();
if (!window)
return;
TabWidget* tabWidget = window->tabWidget();
tabWidget->addView(QUrl(), Qz::NT_SelectedNewEmptyTab);
}
void MouseGestures::leftGestured()
@ -245,7 +241,7 @@ void MouseGestures::downUpGestured()
BrowserWindow* window = view->browserWindow();
if (!window)
return;
TabWidget* tabWidget = window->tabWidget();
tabWidget->duplicateTab(tabWidget->currentIndex());
}

View File

@ -35,7 +35,7 @@ PluginSpec MouseGesturesPlugin::pluginSpec()
spec.name = "Mouse Gestures";
spec.info = "Mouse gestures for QupZilla";
spec.description = "Provides support for navigating in webpages by mouse gestures";
spec.version = "0.4.0";
spec.version = "0.5.0";
spec.author = "David Rosca <nowrep@gmail.com>";
spec.icon = QPixmap(":/mousegestures/data/icon.png");
spec.hasSettings = true;

View File

@ -44,6 +44,5 @@ isEqual(QT_MAJOR_VERSION, 5): !qtHaveModule(KWallet): disablePlugin(KWalletPassw
disablePlugin(AccessKeysNavigation)
disablePlugin(CopyTitle)
disablePlugin(MailHandle)
disablePlugin(MouseGestures)
disablePlugin(PIM)
disablePlugin(Videoner)