mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-08-09 06:52:50 -04:00
Fix clearing search field when using application
* Reset clear timer when manipulating the entry view and opening/closing entries * Only start the clear timer if there is an active search
This commit is contained in:
parent
b188385184
commit
eb88b8cc0c
2 changed files with 13 additions and 1 deletions
|
@ -115,7 +115,7 @@ bool SearchWidget::eventFilter(QObject* obj, QEvent* event)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (event->type() == QEvent::FocusOut) {
|
} else if (event->type() == QEvent::FocusOut && !m_ui->searchEdit->text().isEmpty()) {
|
||||||
if (config()->get("security/clearsearch").toBool()) {
|
if (config()->get("security/clearsearch").toBool()) {
|
||||||
int timeout = config()->get("security/clearsearchtimeout").toInt();
|
int timeout = config()->get("security/clearsearchtimeout").toInt();
|
||||||
if (timeout > 0) {
|
if (timeout > 0) {
|
||||||
|
@ -124,6 +124,7 @@ bool SearchWidget::eventFilter(QObject* obj, QEvent* event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (event->type() == QEvent::FocusIn) {
|
} else if (event->type() == QEvent::FocusIn) {
|
||||||
|
// Never clear the search if we are using it
|
||||||
m_clearSearchTimer->stop();
|
m_clearSearchTimer->stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,6 +140,8 @@ void SearchWidget::connectSignals(SignalMultiplexer& mx)
|
||||||
mx.connect(this, SIGNAL(copyPressed()), SLOT(copyPassword()));
|
mx.connect(this, SIGNAL(copyPressed()), SLOT(copyPassword()));
|
||||||
mx.connect(this, SIGNAL(downPressed()), SLOT(setFocus()));
|
mx.connect(this, SIGNAL(downPressed()), SLOT(setFocus()));
|
||||||
mx.connect(SIGNAL(clearSearch()), m_ui->searchEdit, SLOT(clear()));
|
mx.connect(SIGNAL(clearSearch()), m_ui->searchEdit, SLOT(clear()));
|
||||||
|
mx.connect(SIGNAL(entrySelectionChanged()), this, SLOT(resetSearchClearTimer()));
|
||||||
|
mx.connect(SIGNAL(currentModeChanged(DatabaseWidget::Mode)), this, SLOT(resetSearchClearTimer()));
|
||||||
mx.connect(m_ui->searchEdit, SIGNAL(returnPressed()), SLOT(switchToEntryEdit()));
|
mx.connect(m_ui->searchEdit, SIGNAL(returnPressed()), SLOT(switchToEntryEdit()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -177,6 +180,14 @@ void SearchWidget::startSearch()
|
||||||
search(m_ui->searchEdit->text());
|
search(m_ui->searchEdit->text());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SearchWidget::resetSearchClearTimer()
|
||||||
|
{
|
||||||
|
// Restart the search clear timer if it is running
|
||||||
|
if (m_clearSearchTimer->isActive()) {
|
||||||
|
m_clearSearchTimer->start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void SearchWidget::updateCaseSensitive()
|
void SearchWidget::updateCaseSensitive()
|
||||||
{
|
{
|
||||||
emit caseSensitiveChanged(m_actionCaseSensitive->isChecked());
|
emit caseSensitiveChanged(m_actionCaseSensitive->isChecked());
|
||||||
|
|
|
@ -70,6 +70,7 @@ private slots:
|
||||||
void searchFocus();
|
void searchFocus();
|
||||||
void toggleHelp();
|
void toggleHelp();
|
||||||
void showSearchMenu();
|
void showSearchMenu();
|
||||||
|
void resetSearchClearTimer();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const QScopedPointer<Ui::SearchWidget> m_ui;
|
const QScopedPointer<Ui::SearchWidget> m_ui;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue