Commit Graph

117 Commits

Author SHA1 Message Date
Janek Bevendorff
d612cad09a
Refactor Database and Database widgets (#2491)
The Database, DatabaseWidget, and DatabaseTabWidget classes share many responsibilities in inconsistent ways resulting in impenetrable and unmaintainable code and a diverse set of bugs and architecture restrictions. This patch reworks the architecture, responsibilities of, and dependencies between these classes.

The core changes are:

* Move loading and saving logic from widgets into the Database class
* Get rid of the DatabaseManagerStruct and move all the information contained in it into the Database
* Let database objects keep track of modifications and dirty/clean state instead of handing this to external widgets
* Move GUI interactions for loading and saving from the DatabaseTabWidget into the DatabaseWidget (resolves #2494 as a side-effect)
* Heavily clean up DatabaseTabWidget and degrade it to a slightly glorified QTabWidget
* Use QSharedPointers for all Database objects
* Remove the modifiedImmediate signal and replace it with a markAsModified() method
* Implement proper tabName() method instead of reading back titles from GUI widgets (resolves #1389 and its duplicates #2146 #855)
* Fix unwanted AES-KDF downgrade if database uses Argon2 and has CustomData
* Improve code

This patch is also the first major step towards solving issues #476 and #2322.
2018-11-22 11:47:31 +01:00
Jonathan White
880c3aeb34
Add search help pop-up
* Support ! modifier (same as '-')
* Create reusable PopupHelpWidget as self-contained popup that can
be positioned around a parent widget and will follow the movement
and sizing of the window
* Eliminated KEEPASSXC_MAIN_WINDOW macro and replaced with
getMainWindow() function
* Add tests to cover search help show/hide
2018-11-17 09:04:15 -05:00
Jonathan White
4b983251cb
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
2018-11-17 08:49:50 -05:00
Jonathan White
ee9c71e11e
Fix multiple issues with entries and keyboard shortcuts (#2431)
* Cleanup entry change notification with entryview focus in/out
* Change Open URL shortcut to CTRL+SHIFT+U to conform with an "action" 
including SHIFT
* Change Copy URL shortcut to CTRL+U to conform with "copy" without SHIFT
* Entry specific toolbar and menu items are disabled unless the entry
row has focus (prevents unintended actions)
* Reword security setting for password visibility in entry edit view
* Add shortcut to hide/unhide usernames (CTRL+SHIFT+B)
* Organize entry menu

* Fix #1588 - show keyboard shortcuts in context menu
* Fix #2403 - Change auto-type shortcut to CTRL + SHIFT + V
* Fix #2096 - Add (CTRL+F) to search bar background
* Fix #2031 & Fix #2266 - add shortcut to hide/unhide passwords (CTRL+SHIFT+C)
* Fix #2166 - Add reveal password button to entry preview
2018-11-16 10:00:59 -05:00
Felix Fontein
a7dd9f19f4 CLI: add commands to show and copy TOTP to clipboard (#2454)
* Add CLI commands show --totp and totp-clip for handling TOTPs, resolves #2429.
* Adding tests for new CLI TOTP commands
* Update keepassxc-cli man page.
2018-11-09 21:58:42 -05:00
Janek Bevendorff
108e4efc8a Fix tests on Windows 2018-10-19 21:49:55 +02:00
Janek Bevendorff
113c8eb702 Add CLI tests and improve coding style and i18n
The CLI module was lacking unit test coverage and showed some severe
coding style violations, which this patch addresses.

In addition, all uses of qCritical() with untranslatble raw char*
sequences were removed in favor of proper locale strings. These are
written to STDERR through QTextStreams and support output
redirection for testing purposes. With this change, error messages don't
depend on the global Qt logging settings and targets anymore and go
directly to the terminal or into a file if needed.

This patch also fixes a bug discovered during unit test development,
where the extract command would just dump the raw XML contents without
decrypting embedded Salsa20-protected values first, making the XML
export mostly useless, since passwords are scrambled.

Lastly, all CLI commands received a dedicated -h/--help option.
2018-10-19 21:49:54 +02:00
Jonathan White
c1e9f45df9 Introduce synchronize merge method
* Create history-based merging that keeps older data in history instead of discarding or deleting it
* Extract merge logic into the Merger class
* Allows special merge behavior
* Improve handling of deletion and changes on groups
* Enable basic change tracking while merging
* Prevent unintended timestamp changes while merging
* Handle differences in timestamp precision
* Introduce comparison operators to allow for more sophisticated comparisons (ignore special properties, ...)
* Introduce Clock class to handle datetime across the app

Merge Strategies:
* Default (use inherited/fallback method)
* Duplicate (duplicate conflicting nodes, apply all deletions)
* KeepLocal (use local values, but apply all deletions)
* KeepRemote (use remote values, but apply all deletions)
* KeepNewer (merge history only)
* Synchronize (merge history, newest value stays on top, apply all deletions)
2018-09-30 09:36:39 -04:00
Janek Bevendorff
e443cde452 Add a new database settings wizard
This patch implements a new database wizard to guide users through the process
of setting up a new database and choosing sane encryption settings.

It also reimplements the master key settings to be more
user-friendly. Users can now add, change, or remove individual composite
key components instead of having to set all components at once. This
avoids confusion about a password being reset if the user only wants to
add a key file.

With these changes comes a major refactor of how database composite keys and key
components are handled. Copying of keys is prohibited and each key
exists only once in memory and is referenced via shared pointers. GUI
components for changing individual keys are encapsulated into separate
classes to be more reusable. The password edit and generator widgets
have also been refactored to be more reusable.
2018-09-25 21:12:47 +02:00
Jonathan White
1dc9f10c7f
Complete refactor of TOTP integration
* Eliminate TOTP logic from GUI elements
* Consolidate TOTP functionality under the Totp namespace
* Eliminate guessing about state and encoders
* Increased test cases
* Add entry view column for TOTP [#2132]
* General code cleanup, reduction of unnecessary steps, separation of concerns
* Rename SetupTotpDialog to TotpSetupDialog for consistency
2018-09-15 12:10:26 -04:00
Jonathan White
ca27fb06d5
Merge branch 'master'
Conflicts:
	INSTALL.md
	release-tool
	src/browser/BrowserOptionDialog.cpp
	src/browser/BrowserService.cpp
	src/browser/BrowserService.h
	src/browser/NativeMessagingBase.h
	src/browser/NativeMessagingHost.h
	src/core/Uuid.cpp
	src/gui/DatabaseTabWidget.cpp
	src/gui/DatabaseWidget.cpp
	src/gui/EditWidget.cpp
	src/gui/MainWindow.cpp
	src/gui/MainWindow.ui
	src/proxy/NativeMessagingHost.h
	src/sshagent/ASN1Key.cpp
2018-08-24 09:42:38 -04:00
Jonathan White
3b1e15ea1a Disable apply button when creating new entry/group
* Workaround to prevent data loss if apply is hit but not OK or Cancel
* Refactor required to fix this issue
2018-08-18 10:31:40 -04:00
louib
f25c8d3d2a Adding a GUI test. 2018-04-30 17:07:07 -04:00
Louis-Bertrand Varin
8324d03f0a Formatting the code. 2018-03-31 16:01:30 -04:00
Daniel Wilches
240939ce3b Request confirmation to discard unsaved changes
Solves #1181
2018-03-29 18:35:08 -07:00
Joan Bruguera
f305517724 Skip the tray restore/hide test of #1595 if there's no tray (fix CI build). 2018-03-12 21:30:25 +01:00
Joan Bruguera
8646586c1a Add GUI test for issue #1595 (minus the minimize at startup case). 2018-03-12 21:30:25 +01:00
Janek Bevendorff
7fbdcd3fed Add tests for newline sanitization 2018-02-26 17:27:17 +01:00
Janek Bevendorff
698b44f71c Update zxcvbn library 2018-02-21 06:18:33 -05:00
Jonathan White
397d804cdd Add tests & minor edits 2018-02-21 09:04:46 +01:00
Nick Spain
7dfcad6f8f Write regression test for #1447 2018-02-18 16:17:12 +01:00
Jonathan White
8c8a61ddfe
Disable auto save for GUI tests 2018-01-28 14:06:17 -05:00
Janek Bevendorff
7a6850d5fe Move useful QTest template specializations to global header file
Fix KDBX test linker errors on Windows
2018-01-24 13:32:37 +01:00
Fonic
8c78aca69e Code cleanup
Comprehensive code cleanup:
- formatting
- comments
- obsolete code
2018-01-21 15:17:05 +01:00
Fonic
66291ecc38 Update GUI test to account for changed column indices
Update clicks within entry view referencing column indices to account
for changed column indices due to new way of showing/hiding column Entry
Model::ParentGroup. This column now has fixed index 0 wether it's shown
or hidden, thus all indices need to be shifted by +1 when not in search
mode
2018-01-21 15:17:05 +01:00
Janek Bevendorff
90380adc90
Fix test compilation errors
* Use legacy AES-KDF mode for KeePass1Reader
2018-01-13 14:25:02 -05:00
Janek Bevendorff
72a1c65d00
Fix memory leaks in tests 2018-01-13 14:24:58 -05:00
Janek Bevendorff
ccfd7a065c
Fix coding style and GUI test 2018-01-13 14:24:57 -05:00
Jonathan White
7dba788d09
Correct failure in GUI tests due to widget name 2018-01-13 14:24:54 -05:00
Janek Bevendorff
15648991fc
Refactor Kdf class, remove fields concept 2018-01-13 14:23:28 -05:00
angelsl
4532108678
Add support for KDFs and cyphers to the db settings widget 2018-01-13 14:23:25 -05:00
frostasm
3720c5ef79 Add test for drag and drop database files into main window 2018-01-03 16:12:05 +02:00
Janek Bevendorff
8651736e61
Merge branch 'release/2.2.3' into develop 2017-11-26 18:23:48 +01:00
thez3ro
d6e8e1be6e
use QTemporaryFile when creating a database for guitest 2017-11-02 20:07:41 +01:00
thez3ro
c3c67f18b8
add test for DB creation 2017-11-02 20:07:41 +01:00
Jonathan White
4e7f2c6a4f
Fix apply button not saving new entries 2017-10-28 09:23:45 -04:00
Jonathan White
611a74d74d Added tests to confirm mismatched passwords block saving 2017-09-29 18:11:53 -04:00
Weslly
719323e9c3 Add option to limit search to current group 2017-06-21 01:01:50 -03:00
thez3ro
a53b111182
Update and fix copyright headers 2017-06-14 15:54:43 +02:00
Jonathan White
6ffca842e6 Add "Apply" button to entry and group edit windows (#624) 2017-06-13 20:55:53 -04:00
Weslly
d3ed14ebb7 Display TOTP code split in halfs 2017-05-03 21:26:08 -03:00
Weslly
bf57a28654 Add TOTP support 2017-05-03 20:55:14 -03:00
Jonathan White
5696178de4 Merge pull request #373 from keepassxreboot/feature/new-password-generator
New Diceware passphrase generator
2017-04-09 12:36:56 -04:00
Francois Ferrand
86e88c18b0 More compact search widget
* Move the search icon (with popup menu) and clear icon inside the
line edit
* Move the search widget to the right-side of toolbar
2017-04-06 07:19:56 -04:00
thez3ro
be9bd16b4c
Add diceware tests 2017-03-22 00:00:23 +01:00
Janek Bevendorff
c4d6fa855c Force event processing after adding entries to prevent test failure 2017-03-17 07:49:19 -04:00
thez3ro
e3602e3c75
fix regex for placeholders, fix #402, add regression test 2017-03-16 20:32:29 +01:00
Jonathan White
31494ec327 Enhance attribute entry and add protected attributes (#220)
* Allow protected attributes to be hidden
* Entry area is resizable
* Added test cases for protected attributes
2017-03-07 22:38:18 -05:00
Ryan Matthews
97150034bc Fix clone entry gui test 2017-03-04 19:49:33 -05:00
Jonathan White
16ed89c471
Implement ability to clone an entry when in search mode.
* Cloned entries have "- Clone" appended to their name
2017-01-25 20:02:32 -05:00