mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-04-04 21:17:43 +03:00
Add advanced search term parser
* Support quoted strings & per-field searching * Support regex and exact matching * Simplify search sequence * Make search widget larger * Add regex converter to Tools namespace
This commit is contained in:
parent
4b57fcb563
commit
4b983251cb
14 changed files with 303 additions and 68 deletions
|
@ -209,7 +209,7 @@ DatabaseWidget::DatabaseWidget(Database* db, QWidget* parent)
|
|||
m_fileWatchUnblockTimer.setSingleShot(true);
|
||||
m_ignoreAutoReload = false;
|
||||
|
||||
m_searchCaseSensitive = false;
|
||||
m_EntrySearcher = new EntrySearcher(false);
|
||||
m_searchLimitGroup = config()->get("SearchLimitGroup", false).toBool();
|
||||
|
||||
#ifdef WITH_XC_SSHAGENT
|
||||
|
@ -227,6 +227,7 @@ DatabaseWidget::DatabaseWidget(Database* db, QWidget* parent)
|
|||
|
||||
DatabaseWidget::~DatabaseWidget()
|
||||
{
|
||||
delete m_EntrySearcher;
|
||||
}
|
||||
|
||||
DatabaseWidget::Mode DatabaseWidget::currentMode() const
|
||||
|
@ -1012,17 +1013,15 @@ void DatabaseWidget::search(const QString& searchtext)
|
|||
|
||||
emit searchModeAboutToActivate();
|
||||
|
||||
Qt::CaseSensitivity caseSensitive = m_searchCaseSensitive ? Qt::CaseSensitive : Qt::CaseInsensitive;
|
||||
|
||||
Group* searchGroup = m_searchLimitGroup ? currentGroup() : m_db->rootGroup();
|
||||
|
||||
QList<Entry*> searchResult = EntrySearcher().search(searchtext, searchGroup, caseSensitive);
|
||||
QList<Entry*> searchResult = m_EntrySearcher->search(searchtext, searchGroup);
|
||||
|
||||
m_entryView->displaySearch(searchResult);
|
||||
m_lastSearchText = searchtext;
|
||||
|
||||
// Display a label detailing our search results
|
||||
if (searchResult.size() > 0) {
|
||||
if (!searchResult.isEmpty()) {
|
||||
m_searchingLabel->setText(tr("Search Results (%1)").arg(searchResult.size()));
|
||||
} else {
|
||||
m_searchingLabel->setText(tr("No Results"));
|
||||
|
@ -1035,7 +1034,7 @@ void DatabaseWidget::search(const QString& searchtext)
|
|||
|
||||
void DatabaseWidget::setSearchCaseSensitive(bool state)
|
||||
{
|
||||
m_searchCaseSensitive = state;
|
||||
m_EntrySearcher->setCaseSensitive(state);
|
||||
refreshSearch();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue