Skip to content

KeePassX PR Migration: #190 Search for Group Names#168

Merged
droidmonkey merged 2 commits intodevelopfrom
migrate/190-search-groups
Jan 28, 2017
Merged

KeePassX PR Migration: #190 Search for Group Names#168
droidmonkey merged 2 commits intodevelopfrom
migrate/190-search-groups

Conversation

@phoerious
Copy link
Copy Markdown
Member

Description

This is a rebased version of KeePassX pull request keepassx/keepassx#190 by @jsoref.
It allows to not only search for entries in the database, but also for their group names.

Additionally, I removed two assertions which lead to crashes when the search result was empty and KeePassXC was compiled in Debug mode.

How Has This Been Tested?

Searching for group names of entries works as expected. All existing unit tests pass.

Types of changes

  • ✅ New feature (non-breaking change which adds functionality)

Checklist:

  • ✅ I have read the CONTRIBUTING document. [REQUIRED]
  • ✅ My code follows the code style of this project. [REQUIRED]
  • ✅ All new and existing tests passed. [REQUIRED]

@phoerious phoerious added this to the v2.2.0 milestone Jan 15, 2017
{
Entry* entry = m_entryView->currentEntry();
Q_ASSERT(entry);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@debfx what's the point of placing Q_ASSERT here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Asked myself the same question, especially because there is an if (!entry) return right after it which handles a non-existing entry much better and without crashing the program.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea is to catch bugs when working on the code (thus the assert) but not crash the application in normal use.

Apparently it has caught a bug in this case so it seems to be useful.

Copy link
Copy Markdown
Member Author

@phoerious phoerious Jan 16, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, it wasn't exactly a bug. It was only an empty search result and the function did what it was supposed to do: nothing. The bug was rather the assertion which crashed the program when hitting enter in the search box when there were no results.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some code clearly calls switchToGroup/EntryEdit() when it does not make sense. I'd rather get to the bottom of it and fix the root cause.

The if (...) return is only meant as a safety measure to not crash the program on non-fatal bugs.

Copy link
Copy Markdown
Member Author

@phoerious phoerious Jan 16, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a signal that was directly triggered by a QT event. So if you want to catch that earlier you have to plug in an additional function in between which does nothing else but also returning when there is no valid entry. The code which connects the signal is this in SearchWidget.cpp:104:

mx.connect(m_ui->searchEdit, SIGNAL(returnPressed()), SLOT(switchToEntryEdit()));

Connecting another member function to only catch empty search results seems very superfluous to me when switchToEntryEdit() already handles that case perfectly.

Copy link
Copy Markdown
Member Author

@phoerious phoerious Jan 16, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, thinking about it more, switchToEntryEdit() already IS the intermediate member which catches invalid entries, because then it delegates further to switchToEntryEdit(Entry*, bool). Having an assertion there makes sense, but having an assertion already in switchToEntryEdit() is a mistake.
It's perfectly possible that m_entryView->currentEntry() returns no entry when there is none. Checking for that and returning is correct, asserting there would be one is not.

@phoerious phoerious force-pushed the migrate/190-search-groups branch from a056f57 to 6885ba9 Compare January 25, 2017 12:24
@droidmonkey droidmonkey merged commit a3fd320 into develop Jan 28, 2017
@droidmonkey droidmonkey deleted the migrate/190-search-groups branch January 28, 2017 16:27
droidmonkey added a commit that referenced this pull request Jun 25, 2017
- Added YubiKey 2FA integration for unlocking databases [#127]
- Added TOTP support [#519]
- Added CSV import tool [#146, #490]
- Added KeePassXC CLI tool [#254]
- Added diceware password generator [#373]
- Added support for entry references [#370, #378]
- Added support for Twofish encryption [#167]
- Enabled DEP and ASLR for in-memory protection [#371]
- Enabled single instance mode [#510]
- Enabled portable mode [#645]
- Enabled database lock on screensaver and session lock [#545]
- Redesigned welcome screen with common features and recent databases [#292]
- Multiple updates to search behavior [#168, #213, #374, #471, #603, #654]
- Added auto-type fields {CLEARFIELD}, {SPACE}, {{}, {}} [#267, #427, #480]
- Fixed auto-type errors on Linux [#550]
- Prompt user prior to executing a cmd:// URL [#235]
- Entry attributes can be protected (hidden) [#220]
- Added extended ascii to password generator [#538]
- Added new database icon to toolbar [#289]
- Added context menu entry to empty recycle bin in databases [#520]
- Added "apply" button to entry and group edit windows [#624]
- Added macOS tray icon and enabled minimize on close [#583]
- Fixed issues with unclean shutdowns [#170, #580]
- Changed keyboard shortcut to create new database to CTRL+SHIFT+N [#515]
- Compare window title to entry URLs [#556]
- Implemented inline error messages [#162]
- Ignore group expansion and other minor changes when making database "dirty" [#464]
- Updated license and copyright information on souce files [#632]
- Added contributors list to about dialog [#629]
@phoerious phoerious added pr: new feature Pull request adds a new feature and removed new feature labels Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr: new feature Pull request adds a new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants