summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYoann Laissus <yoannlaissus@gmail.com>2011-02-08 17:17:07 +0100
committerAndrea Diamantini <adjam7@gmail.com>2011-02-08 17:17:07 +0100
commitcb73caa1ec9092fb10a4be8e4511e76e2251a5b2 (patch)
tree5049bd01004564a34cb4bc9c11fb736b8bf29043
parentImprove SSL managements, following the changes in kwebkitpart (diff)
downloadrekonq-cb73caa1ec9092fb10a4be8e4511e76e2251a5b2.tar.xz
Hide bars on ESC key pressed:
zoombar first, findbar second. Reviewed by adjam BUG:264929
-rw-r--r--src/mainwindow.cpp39
-rw-r--r--src/mainwindow.h2
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: