diff options
author | Andrea Diamantini <adjam7@gmail.com> | 2012-01-17 16:36:24 +0100 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2012-01-17 16:36:24 +0100 |
commit | bca368f9fa495334b3dd9670a5ee7264c62e0c80 (patch) | |
tree | 789bcae04011b5eff47f728536bf846c69c70afd /src/webview.cpp | |
parent | Fix a bookmarks bar crash (diff) | |
download | rekonq-bca368f9fa495334b3dd9670a5ee7264c62e0c80.tar.xz |
Moved access keys activation to release key event
This to copy konqueror behavior.
Also added some kDebug messages to better work with the "key event"
features:
- vi-like navigation
- access keys
- autoscroll
Diffstat (limited to 'src/webview.cpp')
-rw-r--r-- | src/webview.cpp | 53 |
1 files changed, 33 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()) |