Skip to content

Commit 08fecf3

Browse files
committed
Add search help pop-up
* Support ! modifier (same as '-')
1 parent 1deeeb9 commit 08fecf3

File tree

10 files changed

+469
-9
lines changed

10 files changed

+469
-9
lines changed
897 Bytes
Loading
1.19 KB
Loading
2.07 KB
Loading

src/core/EntrySearcher.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ bool EntrySearcher::searchEntryImpl(const QString& searchString, Entry* entry)
9696
found = !attachments.filter(term->regex).empty();
9797
break;
9898
default:
99+
// Terms without a specific field try to match title, username, url, and notes
99100
found = term->regex.match(entry->resolvePlaceholder(entry->title())).hasMatch() ||
100101
term->regex.match(entry->resolvePlaceholder(entry->username())).hasMatch() ||
101102
term->regex.match(entry->resolvePlaceholder(entry->url())).hasMatch() ||
@@ -139,7 +140,7 @@ QList<QSharedPointer<EntrySearcher::SearchTerm> > EntrySearcher::parseSearchTerm
139140
term->regex = Tools::convertToRegex(term->word, !mods.contains("*"), mods.contains("+"), m_caseSensitive);
140141

141142
// Exclude modifier
142-
term->exclude = mods.contains("-");
143+
term->exclude = mods.contains("-") || mods.contains("!");
143144

144145
// Determine the field to search
145146
QString field = result.captured(2);

src/gui/MainWindow.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ MainWindow::MainWindow()
129129
// Setup the search widget in the toolbar
130130
SearchWidget* search = new SearchWidget();
131131
search->connectSignals(m_actionMultiplexer);
132+
connect(this, SIGNAL(windowMoved()), search, SLOT(windowMoved()));
132133
m_searchWidgetAction = m_ui->toolBar->addWidget(search);
133134
m_searchWidgetAction->setEnabled(false);
134135

@@ -775,6 +776,12 @@ void MainWindow::changeEvent(QEvent* event)
775776
}
776777
}
777778

779+
void MainWindow::moveEvent(QMoveEvent* event)
780+
{
781+
emit windowMoved();
782+
QMainWindow::moveEvent(event);
783+
}
784+
778785
void MainWindow::saveWindowInformation()
779786
{
780787
if (isVisible()) {

src/gui/MainWindow.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ class MainWindow : public QMainWindow
5555
PasswordGeneratorScreen = 3
5656
};
5757

58+
signals:
59+
void windowMoved();
60+
5861
public slots:
5962
void openDatabase(const QString& fileName, const QString& pw = QString(), const QString& keyFile = QString());
6063
void appExit();
@@ -78,6 +81,7 @@ public slots:
7881
protected:
7982
void closeEvent(QCloseEvent* event) override;
8083
void changeEvent(QEvent* event) override;
84+
void moveEvent(QMoveEvent* event) override;
8185

8286
private slots:
8387
void setMenuActionState(DatabaseWidget::Mode mode = DatabaseWidget::None);

0 commit comments

Comments
 (0)