Pressing Ctrl-F opens the "Search" box in the ircview. Pressing Esc used to close it, but it doesn't anymore; now it opens a message box saying the keyboard shortcut is ambiguous. This is a regression from 2b37878. Eike Hein reproduced it.
I'll fix it tomorrow-ish; aside from the bug the feature introduced in the mentioned commit also needs some polish to deal with the searchbar situation.
commit 74f88466f964b3bb739fabf1a5a7d2eaa028ab76 branch master Author: Eike Hein <hein@kde.org> Date: Sat Nov 20 04:01:14 2010 +0100 Fix shortcut ambiguity when the search bar is open. BUG:257298 diff --git a/src/viewer/searchbar.cpp b/src/viewer/searchbar.cpp index be14384..a5679a9 100644 --- a/src/viewer/searchbar.cpp +++ b/src/viewer/searchbar.cpp @@ -28,6 +28,12 @@ SearchBar::SearchBar(QWidget* parent) { setupUi(this); + m_searchEdit->installEventFilter(this); + m_closeButton->installEventFilter(this); + m_findNextButton->installEventFilter(this); + m_findPreviousButton->installEventFilter(this); + m_optionsButton->installEventFilter(this); + m_searchFoward = false; m_matchCase = false; m_wholeWords = false; @@ -44,7 +50,8 @@ SearchBar::SearchBar(QWidget* parent) m_timer = new QTimer(this); m_timer->setSingleShot(true); - new QShortcut(QKeySequence(Qt::Key_Escape), this, SLOT(hide())); + m_closeShortcut = new QShortcut(QKeySequence(Qt::Key_Escape), this, SLOT(hide())); + m_closeShortcut->setEnabled(false); connect(m_timer, SIGNAL(timeout()), SLOT(slotFind())); connect(m_searchEdit, SIGNAL(textChanged(const QString&)), SLOT(slotTextChanged())); @@ -76,6 +83,24 @@ SearchBar::~SearchBar() { } +bool SearchBar::eventFilter(QObject* object, QEvent* e) +{ + Q_UNUSED(object); + + if (e->type() == QEvent::FocusIn) + { + static_cast<Application*>(kapp)->getMainWindow()->actionCollection()->action("focus_input_box")->setEnabled(false); + m_closeShortcut->setEnabled(true); + } + else if (e->type() == QEvent::FocusOut) + { + static_cast<Application*>(kapp)->getMainWindow()->actionCollection()->action("focus_input_box")->setEnabled(true); + m_closeShortcut->setEnabled(false); + } + + return false; +} + void SearchBar::showEvent(QShowEvent *e) { QWidget::showEvent(e); diff --git a/src/viewer/searchbar.h b/src/viewer/searchbar.h index 0a71774..d52a363 100644 --- a/src/viewer/searchbar.h +++ b/src/viewer/searchbar.h @@ -22,6 +22,8 @@ the konvi gods */ +class QShortcut; + class KMenu; class KIcon; @@ -42,6 +44,8 @@ class SearchBar : public QWidget, private Ui::SearchBarBase bool wholeWords() const; bool fromCursor() const; + bool eventFilter(QObject* object, QEvent* e); + protected: virtual void showEvent(QShowEvent* e); virtual void hideEvent(QHideEvent* e); @@ -78,6 +82,8 @@ class SearchBar : public QWidget, private Ui::SearchBarBase bool m_matchCase; bool m_wholeWords; bool m_fromCursor; + + QShortcut* m_closeShortcut; }; #endif /* SEARCHBAR_H */