Skip to content

Commit

Permalink
Add search help pop-up
Browse files Browse the repository at this point in the history
* Support ! modifier (same as -)
  • Loading branch information
droidmonkey committed Nov 2, 2018
1 parent d1fab61 commit 99cfe23
Show file tree
Hide file tree
Showing 10 changed files with 462 additions and 9 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion src/core/EntrySearcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ bool EntrySearcher::searchEntryImpl(const QString& searchString, Entry* entry)
found = !attachments.filter(term->regex).empty();
break;
default:
// Terms without a specific field try to match title, username, url, and notes
found = term->regex.match(entry->resolvePlaceholder(entry->title())).hasMatch() ||
term->regex.match(entry->resolvePlaceholder(entry->username())).hasMatch() ||
term->regex.match(entry->resolvePlaceholder(entry->url())).hasMatch() ||
Expand Down Expand Up @@ -139,7 +140,7 @@ QList<QSharedPointer<EntrySearcher::SearchTerm> > EntrySearcher::parseSearchTerm
term->regex = Tools::convertToRegex(term->word, !mods.contains("*"), mods.contains("+"), m_caseSensitive);

// Exclude modifier
term->exclude = mods.contains("-");
term->exclude = mods.contains("-") || mods.contains("!");

// Determine the field to search
QString field = result.captured(2);
Expand Down
7 changes: 7 additions & 0 deletions src/gui/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ MainWindow::MainWindow()
// Setup the search widget in the toolbar
SearchWidget* search = new SearchWidget();
search->connectSignals(m_actionMultiplexer);
connect(this, SIGNAL(windowMoved()), search, SLOT(windowMoved()));
m_searchWidgetAction = m_ui->toolBar->addWidget(search);
m_searchWidgetAction->setEnabled(false);

Expand Down Expand Up @@ -775,6 +776,12 @@ void MainWindow::changeEvent(QEvent* event)
}
}

void MainWindow::moveEvent(QMoveEvent* event)
{
emit windowMoved();
QMainWindow::moveEvent(event);
}

void MainWindow::saveWindowInformation()
{
if (isVisible()) {
Expand Down
4 changes: 4 additions & 0 deletions src/gui/MainWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ class MainWindow : public QMainWindow
PasswordGeneratorScreen = 3
};

signals:
void windowMoved();

public slots:
void openDatabase(const QString& fileName, const QString& pw = QString(), const QString& keyFile = QString());
void appExit();
Expand All @@ -78,6 +81,7 @@ public slots:
protected:
void closeEvent(QCloseEvent* event) override;
void changeEvent(QEvent* event) override;
void moveEvent(QMoveEvent* event) override;

private slots:
void setMenuActionState(DatabaseWidget::Mode mode = DatabaseWidget::None);
Expand Down
Loading

0 comments on commit 99cfe23

Please sign in to comment.