diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/mainwindow.cpp | 39 | ||||
-rw-r--r-- | src/mainwindow.h | 2 |
2 files changed, 32 insertions, 9 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()) diff --git a/src/mainwindow.h b/src/mainwindow.h index 565843f2..00bd40a5 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -129,7 +129,7 @@ protected: * Filters out ESC key to show/hide the search bar */ void keyPressEvent(QKeyEvent *event); - + bool event(QEvent *event); bool queryClose(); private Q_SLOTS: |