1
mirror of https://invent.kde.org/network/falkon.git synced 2024-09-21 09:42:10 +02:00

SearchToolBar: Add Shift+Enter shortcut to find previous

BUG: 402989
FIXED-IN: 3.1.0
This commit is contained in:
David Rosca 2019-01-24 15:53:59 +01:00
parent 25a6008e6d
commit a237c8ff87
No known key found for this signature in database
GPG Key ID: EBC3FC294452C6D8

View File

@ -42,7 +42,6 @@ SearchToolBar::SearchToolBar(WebView* view, QWidget* parent)
connect(ui->closeButton, SIGNAL(clicked()), this, SLOT(close()));
connect(ui->lineEdit, &QLineEdit::textEdited, this, &SearchToolBar::findNext);
connect(ui->lineEdit, &QLineEdit::returnPressed, this, &SearchToolBar::findNext);
connect(ui->next, &QAbstractButton::clicked, this, &SearchToolBar::findNext);
connect(ui->previous, &QAbstractButton::clicked, this, &SearchToolBar::findPrevious);
connect(ui->caseSensitive, &QAbstractButton::clicked, this, &SearchToolBar::caseSensitivityChanged);
@ -150,8 +149,23 @@ bool SearchToolBar::eventFilter(QObject* obj, QEvent* event)
{
Q_UNUSED(obj);
if (event->type() == QEvent::KeyPress && static_cast<QKeyEvent*>(event)->key() == Qt::Key_Escape) {
close();
if (event->type() == QEvent::KeyPress) {
QKeyEvent *ke = static_cast<QKeyEvent*>(event);
switch (ke->key()) {
case Qt::Key_Escape:
close();
break;
case Qt::Key_Enter:
case Qt::Key_Return:
if (ke->modifiers() & Qt::ShiftModifier) {
findPrevious();
} else {
findNext();
}
break;
default:
break;
}
}
return false;