Commit Graph

3220 Commits

Author SHA1 Message Date
Jonathan White
b96b86bfa7 Cleanup and replumb back to functional state 2018-12-28 17:54:52 -05:00
George Shakhnazaryan
b1ff346f63 Allow Enter key to select recent DB on OS X
* Override `keyPressEvent`on WelcomeWidget on OS X to `openDatabaseFromFile`.

openDatabaseFromFile is already invoked via the QListWidget::itemActivated signal,
  but this signal doesn't fire on OS X for Enter.
QListWidget::itemActivated activates on an OS specific activation key. [1]
On Windows/X11, this is Enter, which lets the user easily
  navigate with just the keyboard.
On OS X, this is Ctrl+O, which is already bound to Open Database. This means that itemActivated cannot fire via the keyboard.

Per StackOverflow [2], the recommended solution is to catch
the enter/return key press manually.

This seems like a common problem with Qt. [3] [4]

[1] https://doc.qt.io/archives/qt-4.8/qlistwidget.html#itemActivated
[2] https://stackoverflow.com/questions/31650780/when-does-a-qtreeview-emit-the-activated-signal-on-mac
[3] https://forum.qt.io/topic/36147/pyside-itemactivated-not-triggered-on-mac-os-x-with-return-key
[4] https://github.com/dolphin-emu/dolphin/pull/6099
2018-12-25 16:00:02 -05:00
Toni Spets
c34b0069ff SSH Agent: Add support for OpenSSH for Windows (#1994)
* Fixed missing includes in Bootstrap.cpp
2018-12-25 14:28:02 -05:00
varjolintu
5488f1bfc3 Switch browser integration to use native raising of windows 2018-12-24 18:17:56 -05:00
Wojtek Gumuła
c630214915 Warn user if deleting entries that are referenced. (#1744)
On warning, references can be replaced with original values or ignored.
Removal process can be also skipped for each conflicting entry. Resolves #852.
2018-12-24 18:15:46 -05:00
Kyle Kneitinger
4d4c839afa Customize buttons on MessageBox and confirm before recycling (#2376)
* Add confirmation prompt before moving groups to the recycling bin

Spawn a yes/no QMessage box when "Delete Group" is selected on a group
that is not already in the recycle bin (note: the prompt for deletion
from the recycle bin was already implemented).  This follows the same
pattern and language as entry deletion.

Fixes #2125

* Make prompts for destructive operations use action words on buttons

Replace yes/no, yes/cancel (and other such buttons on prompts that cause
data to be destroyed) use language that indicates the action that it is
going to take. This makes destructive/unsafe and/or irreversible operations
more clear to the user.

Address feedback on PR #2376

* Refactor MessageBox class to allow for custom buttons

Replaces arguments and return values of type QMessageBox::StandardButton(s)
with MessageBox::Button(s), which reimplements the entire set of
QMessageBox::StandardButton and allows for custom KeePassXC buttons,
such as "Skip". Modifies all calls to MessageBox functions to use
MessageBox::Button(s).

Addresses feedback on #2376

* Remove MessageBox::addButton in favor of map lookup

Replaced the switch statement mechanism in MessageBox::addButton with
a map lookup to address CodeFactor Complex Method issue. This has a
side-effect of a small performance/cleanliness increase, as an
extra QPushButton is no longer created/destroyed (to obtain it's label
text) everytime a MessageBox button based on QMessageBox::StandardButton
is created; now the text is obtained once, at application start up.
2018-12-19 23:14:11 -05:00
louib
8ac9d0a131 Add create command to keepassxc-cli (#2540)
* Add tests for CLI::Create
2018-12-19 23:10:46 -05:00
Jonathan White
9e2be34897
Merge branch 'develop'
Conflicts:
	CMakeLists.txt
	cmake/CLangFormat.cmake
	snapcraft.yaml
	src/CMakeLists.txt
	src/core/Database.cpp
	src/core/Database.h
	src/core/Tools.cpp
	src/crypto/CryptoHash.h
	src/crypto/ssh/ASN1Key.h
	src/crypto/ssh/OpenSSHKey.cpp
	src/format/Kdbx4Reader.cpp
	src/gui/DatabaseTabWidget.cpp
	src/gui/DatabaseTabWidget.h
	src/gui/DatabaseWidget.cpp
	src/gui/DatabaseWidget.h
	src/gui/DetailsWidget.cpp
	src/gui/DetailsWidget.ui
	src/gui/EditWidgetProperties.cpp
	src/gui/EntryPreviewWidget.cpp
	src/gui/EntryPreviewWidget.ui
	src/gui/FileDialog.cpp
	src/gui/dbsettings/DatabaseSettingsDialog.cpp
	src/gui/dbsettings/DatabaseSettingsDialog.h
	src/gui/group/EditGroupWidget.cpp
	src/gui/group/EditGroupWidget.h
	src/sshagent/ASN1Key.h
	src/sshagent/OpenSSHKey.cpp
	src/sshagent/SSHAgent.cpp
	tests/CMakeLists.txt
2018-12-18 22:28:56 -05:00
varjolintu
a070f1bce7 Handle retrieving credentials from HTTP Basic Auth 2018-12-11 15:34:32 -05:00
louib
cb3c4893dc Move unlockDatabase to CLI/Utils (#2539)
Move unlockDatabase from Database to to cli/Utils
2018-12-11 16:49:51 +01:00
Carlo Teubner
b6eeabab5e KeePass2Reader: fix error message logic (#2523) 2018-12-02 10:05:54 -05:00
Carlo Teubner
bdee748a6a Make Entry::m_tmpHistoryItem a QScopedPointer (#2524)
* Make m_tmpHistoryItem a QScopedPointer

Most of the time, `m_tmpHistoryItem` should be null by the time an
`Entry` is destroyed. However, if a caller ever calls `beginUpdate()`
without later calling `endUpdate()` -- perhaps because an exception was
throw in the meantime -- it may not be null. This change avoids a memory 
leak in that case.

Found via https://lgtm.com/projects/g/keepassxreboot/keepassxc/alerts
2018-12-01 16:08:55 -05:00
Carlo Teubner
1af293847c LayeredStream dtor: fully qualify 'close()' call
`close()` is a virtual function. Since we are calling it from a
destructor, make it clear that we are specifically calling the base
class (`QIODevice`) implementation, as opposed to an implementation in
any derived class.

[Found by lgtm.com](https://lgtm.com/projects/g/keepassxreboot/keepassxc/alerts)
2018-12-01 14:07:10 -05:00
Janek Bevendorff
9be538a5f6
Update translations from Transifex 2018-12-01 10:54:55 +01:00
Jonathan White
294188dea1
Fix typo in EditEntryWidget after code cleanup #2 2018-11-28 21:51:57 -05:00
Jonathan White
c66f293f1e
Merge pull request #2443 from brainplot/code-cleanup
Code cleanup and performance improvements - Part 2
2018-11-28 20:03:33 -05:00
Gianluca Recchia
e81841550b
Correct checks for containers' emptiness 2018-11-28 18:29:15 -05:00
Gianluca Recchia
fc930bae69
Restore correct formatting
Many lines were not conformant with the project's formatting rules.
This patch should fix all formatting and whitespace issues in the code
base.
A clang-format directive was put around the connect() calls containing
SIGNALs and SLOTs whose signatures would be denormalized because of the
formatting rules.
2018-11-28 18:29:15 -05:00
Gianluca Recchia
f9625189cb
Fix typo in parameter name
A typo in a parameter name caused an inconsistency between declaration
and definition of a function.
2018-11-28 18:29:14 -05:00
Gianluca Recchia
a9fa8915d9
Use QVariant::toUrl() instead of QVariant::value<QUrl>() 2018-11-28 18:29:14 -05:00
Gianluca Recchia
9d106d6bfc
Remove unused variables 2018-11-28 18:29:13 -05:00
Gianluca Recchia
b39522f874
Avoid allocating temporary containers 2018-11-28 18:29:05 -05:00
louib
49b82ea6a2 Global const for KeyFileOption (CLI) (#2505) 2018-11-28 16:15:15 -05:00
Jonathan White
1a2721529d Correct simultaneous saving with Yubikey
* Move mutex lock to right before challenge call and wait for up to 1 second for unlock
* Fix bug where ALREADY_RUNNING was interpreted as success and causing database corruption
2018-11-28 16:14:17 -05:00
Jonathan White
d84ba23c81
Correct refactor issues with entry selection and search (#2518)
* Align entryview selection change signals with groupview
* Eliminate redundent and confusing signals/slots
* Correct group selection canceling search
2018-11-28 16:13:56 -05:00
louib
fff0f11b33 Adding --quiet option to the CLI. (#2507) 2018-11-28 11:24:12 -05:00
Lantizia
4e49de1afb Ability to set 7-digit TOTP codes from the UI (#2517) 2018-11-28 11:23:06 -05:00
Jonathan White
a67cac1322 Address comments 2018-11-24 17:31:20 -05:00
Jonathan White
4aab93084a Update Github templates 2018-11-24 17:31:20 -05:00
Kyle Kneitinger
a90a577ee1 Add favicon fetch button next to entry's url edit textbox (#2439)
When WITH_XC_NETWORKING is defined, create a QToolButton beside the Edit Entry -> Entry -> URL, which when pressed, acts as though the Edit Entry -> Icon -> Download Favicon button is pressed.  This button is disabled (grayed-out) when the URL text is empty, and enabled when the text is present.

Fixes #936

* Add favicon download button 
* Remove the progress dialog that appears when
downloading an entry's URL's favicon since (when working correctly) it disappears before it can be read. When downloading icons from the button
located next to the URL text box, display a message panel that confirms the download was a success.

* Do not show successful icon download msg if icon alread exists
2018-11-24 17:30:55 -05:00
Janek Bevendorff
3c362ac822 Refactor DatabaseOpenWidget/Dialog and Auto-Type Database unlocking.
This patch removes redundant lock widget members of the DatabaseWidget
and consolidates all unlocking functionality into a single
DatabaseOpenWidget (with the exception of KeePass1OpenWidget).
Distinction between different unlock actions is now done via a dedicated
Intent enum class instead of using individual widgets.

Further, the DatabaseUnlockDialog has been generalized so that it is
usable for unlock intents other than just Auto-Type and is now also
used for merging databases which is less confusing to the user.

The KeePassXC main window is no longer a parent of the
DatabaseUnlockDialog and has the Qt::ForeignWindow flag set, which
should cause fewer issues with Auto-Type trying to type into KeePassXC
after unlock instead of the intended target window.

In addition, its instance has been moved into the DatabaseTabWidget
class so that it is no longer bound to individual DatabaseWidgets,
potentially allowing for database selection during Auto-Type. The actual
selection has not yet been implemented, but Auto-Type has been adjusted
to use the currently selected tab instead of the first one as an
intermediary improvement.
2018-11-24 15:51:05 +01:00
Jonathan White
ff7191eef3 Re-implement AutoOpen functionality after refactor (#2504)
The database refactor in #2491 removed auto-open functionality.
2018-11-23 19:24:59 +01:00
Janek Bevendorff
785a64cc3b Fix bugs introduced by database refactor #2491 (#2503)
* Fix SSHAgent identity removal on database lock
* Refactor storage and manipulation of SSHAgent keys to streamline process with multiple db's
* Clear password field when widget is hidden, resolves #2502
2018-11-23 07:49:55 -05:00
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
917c4cc18b
Merge pull request #1797 from keepassxreboot/feature/better-search
Implement advanced search
2018-11-17 11:51:27 -05:00
Jonathan White
340076974e
Correct logic error in EntrySearcher and add more tests 2018-11-17 09:55:57 -05: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
d6ffee5e99
Implement search auto-clear and goto group
* Search clears if the search box does not have focus for 5 minutes (fixes #2178)
* Goto group from search results after double clicking the group name (fixes #2043)
2018-11-17 09:02:36 -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
4b57fcb563
Clean up Entry Model/View code 2018-11-17 08:49:47 -05:00
Jonathan White
d8d758f0e1
Streamlined searcher code
* Remove searching of group title and notes
* End search when selecting a new group
* Correct entry searcher tests to align with new code
2018-11-17 08:49:02 -05:00
Jonathan White
a5e7da67d8
Correct CI badges in readme 2018-11-17 08:28:23 -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
louib
f06742cf41 CLI Merge: Only save database file when modified. (#2466)
* Merge: detect if database was changed.
* Adding unit test.
* Only saving on change.
2018-11-09 21:59:16 -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
varjolintu
91bccf75d5 Include older settings type to conversion 2018-11-09 19:17:28 -05:00
louib
c339470496 Updating CLI man page authorship (#2456) 2018-11-09 19:15:50 -05:00
louis
b1d481893e Adding tests for modified signal on merge. 2018-11-09 19:15:15 -05:00
Weslly
d7f5a15f68 Add missing header to cmakelists when building without YubiKey 2018-11-09 19:14:43 -05:00
louib
91160c5f36 Document list -R option. 2018-11-09 19:10:16 -05:00