diff options
-rw-r--r-- | src/webview.cpp | 53 | ||||
-rw-r--r-- | src/webview.h | 6 |
2 files changed, 39 insertions, 20 deletions
diff --git a/src/webview.cpp b/src/webview.cpp index ac861fb0..740024c2 100644 --- a/src/webview.cpp +++ b/src/webview.cpp @@ -618,26 +618,6 @@ void WebView::bookmarkLink() void WebView::keyPressEvent(QKeyEvent *event) { - if (ReKonfig::accessKeysEnabled()) - { - m_accessKeysPressed = (event->modifiers() == Qt::ControlModifier - && event->key() == Qt::Key_Control); - if (!m_accessKeysPressed) - { - if (checkForAccessKey(event)) - { - hideAccessKeys(); - event->accept(); - return; - } - hideAccessKeys(); - } - else - { - QTimer::singleShot(200, this, SLOT(accessKeyShortcut())); - } - } - if (event->modifiers() == Qt::ControlModifier) { if (event->key() == Qt::Key_C) @@ -662,6 +642,8 @@ void WebView::keyPressEvent(QKeyEvent *event) // Auto Scrolling if (event->modifiers() == Qt::ShiftModifier) { + kDebug() << "AutoScrolling: " << event->key(); + if (event->key() == Qt::Key_Up) { m_vScrollSpeed--; @@ -711,6 +693,8 @@ void WebView::keyPressEvent(QKeyEvent *event) const QString tagName = page()->mainFrame()->evaluateJavaScript("document.activeElement.tagName").toString(); if (tagName != QL1S("INPUT") && tagName != QL1S("TEXTAREA") && event->modifiers() == Qt::NoModifier) { + kDebug() << "Using VI-LIKE modifiers: " << event->key(); + switch (event->key()) { case Qt::Key_J: @@ -734,10 +718,39 @@ void WebView::keyPressEvent(QKeyEvent *event) } } } + KWebView::keyPressEvent(event); } +void WebView::keyReleaseEvent(QKeyEvent *event) +{ + // access keys management + if (ReKonfig::accessKeysEnabled()) + { + m_accessKeysPressed = (event->key() == Qt::Key_Control); + + if (!m_accessKeysPressed) + { + if (checkForAccessKey(event)) + { + hideAccessKeys(); + event->accept(); + return; + } + hideAccessKeys(); + } + else + { + kDebug() << "Shotting access keys"; + QTimer::singleShot(200, this, SLOT(accessKeyShortcut())); + } + } + + KWebView::keyReleaseEvent(event); +} + + void WebView::wheelEvent(QWheelEvent *event) { if (event->orientation() == Qt::Vertical || !ReKonfig::hScrollWheelHistory()) diff --git a/src/webview.h b/src/webview.h index 6eb5b84d..b0254aa4 100644 --- a/src/webview.h +++ b/src/webview.h @@ -70,13 +70,19 @@ public: protected: void contextMenuEvent(QContextMenuEvent *event); + void mousePressEvent(QMouseEvent *event); void mouseMoveEvent(QMouseEvent *event); + void keyPressEvent(QKeyEvent *event); + void keyReleaseEvent(QKeyEvent *event); + void wheelEvent(QWheelEvent *event); + void dropEvent(QDropEvent *event); void dragEnterEvent(QDragEnterEvent *event); void dragMoveEvent(QDragMoveEvent * event); + void paintEvent(QPaintEvent *event); private Q_SLOTS: |