diff options
Diffstat (limited to 'src/mainwindow.cpp')
-rw-r--r-- | src/mainwindow.cpp | 39 |
1 files changed, 31 insertions, 8 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 3d76d35f..62f420b7 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -1089,14 +1089,6 @@ void MainWindow::openNext(Qt::MouseButtons mouseButtons, Qt::KeyboardModifiers k void MainWindow::keyPressEvent(QKeyEvent *event) { - // hide findbar - if (event->key() == Qt::Key_Escape) - { - m_findBar->hide(); - currentTab()->setFocus(); // give focus to web pages - return; - } - // ctrl + tab action if ((event->modifiers() == Qt::ControlModifier) && (event->key() == Qt::Key_Tab)) { @@ -1115,6 +1107,37 @@ void MainWindow::keyPressEvent(QKeyEvent *event) } +bool MainWindow::event(QEvent *event) +{ + // Avoid a conflict with window-global actions + if (event->type() == QEvent::ShortcutOverride || event->type() == QEvent::KeyPress) + { + QKeyEvent *kev = static_cast<QKeyEvent *>(event); + if (kev->key() == Qt::Key_Escape) + { + // if zoombar is visible, hide it + if (m_zoomBar->isVisible()) + { + m_zoomBar->hide(); + event->accept(); + currentTab()->setFocus(); + return true; + } + + // if findbar is visible, hide it + if (m_findBar->isVisible()) + { + m_findBar->hide(); + event->accept(); + currentTab()->setFocus(); + return true; + } + } + } + return KMainWindow::event(event); +} + + void MainWindow::notifyMessage(const QString &msg, Rekonq::Notify status) { if (this != QApplication::activeWindow()) |