Commit Graph

3072 Commits

Author SHA1 Message Date
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
louis
156b480f93 Better error message for invalid db file 2018-11-09 19:09:55 -05:00
Jonathan White
82bf00de73
Merge pull request #2433 from brainplot/code-cleanup
* Remove redundant headers from the build system
* Pin AutoTypeAction's vtable to a translation unit
* Remove redundant check for the version flag
* Improve performance of a few for-loops
* Replace old for-loops with range-based for-loops
* Remove redundant null-checks for pointer deletion 
* Reduce QString::arg function call overhead
* Reduce number of unneeded copies when calling functions
* Enhance readability when accessing static members 
* Convert to nullptrs where necessary
* Reduce unnecessary copies using std::move
* Normalize signature of SIGNAL() and SLOT()
* Add missing `override` keyword for some member functions which override functions of their base class
2018-10-31 13:32:21 -04:00
Gianluca Recchia
e06eae423e
Add missing 'override' for overridden functions 2018-10-31 15:16:04 +01:00
Gianluca Recchia
0f604aa8c7
Normalize signature of SIGNAL() and SLOT()
See https://stackoverflow.com/q/18091058/6335279
2018-10-31 15:16:04 +01:00
Gianluca Recchia
379c41d20c
Reduce unnecessary copies using move semantics 2018-10-31 15:16:04 +01:00
Gianluca Recchia
896a66e6d8
Improve readability and type-safety
Use nullptr instead of 0 or NULL to initialize a null pointer. In some
cases, readability was enhanced by replacing 0 with more meaningful
values according to the type of the pointer being initialized.
2018-10-31 15:16:04 +01:00
Gianluca Recchia
7208635502
Enhance readability when accessing static members
The sole purpose of a few objects was calling a static member of the
class they belonged to. This is not needed, as you can access a static
member with the <class_name>::<member_name> notation.
2018-10-31 15:16:04 +01:00
Gianluca Recchia
da9afd3f6f
Reduce number of unneeded copies
This patch aims at reducing the number of copies for obejcts that could
be referenced rather than copied, because they're not modified during
the computation.
2018-10-31 15:16:04 +01:00
Gianluca Recchia
a67a574b89
Reduce function call overhead
The arg() function of the QString class has a variable length argument
which allows to reduce the number of chained calls to the same function.
With proper formatting, readability is not affected.
2018-10-31 14:23:06 +01:00
Gianluca Recchia
18fd20f898
Remove redundant null-checks for pointer deletion
Deleting a null pointer is defined behavior and results in a no-op at
the assembly level, so it's perfectly safe.
2018-10-31 14:23:06 +01:00
Gianluca Recchia
4ac1601696
Replace old for-loops with range-based for-loops 2018-10-31 14:23:06 +01:00
Gianluca Recchia
4876beabed
Improve performance of a few for-loops
Some for-loops needlessly copied the collection they were looping over.
2018-10-31 14:23:06 +01:00
Gianluca Recchia
e2ee82169c
Remove redundant check for the version flag
Just a couple lines above, the application would already exit if the
version option is set. This extra check is not needed.
2018-10-31 14:19:01 +01:00
Gianluca Recchia
7a823e8dc7
Pin AutoTypeAction's vtable to a translation unit
AutoTypeAction class had no out-of-line definitions and because of this
the compiler would place its vtable everywhere the class is used.
By simply defining the virtual destructor in the .cpp file, the issue
goes away.

Also, a few classes derived from AutoTypeAction had missing 'override'
qualifiers, which have now been added.
2018-10-31 14:19:01 +01:00
Gianluca Recchia
09fbb6d35a
Remove redundant headers from the build system
Headers are not to be placed amongst the source files in the CMake
script. The preprocessor and the linker will take care of glue all the
files together. Also, the "include_directories()" statement at the top
of the file already tells CMake where to look for all the needed
header files.
2018-10-31 14:19:01 +01:00
st-sloth
4ae5ddf80f Add more expiration presets 2018-10-30 11:09:08 -04:00
hidden by cloudflare
2ad8036823 Added Linux, MacOS, and Windows support for Tor Browser. (#2387)
Add path for native-messaging-hosts on Linux, Windows, and macOS for Tor Browser
2018-10-30 11:07:59 -04:00
Darwin Shameran
5bf4f51389 Don't obscure password field after invalid password attempt if setting is off (#2353) 2018-10-30 09:16:49 -04:00
Gianluca Recchia
4e1d3bfd73 Extract the OS event filter implementation (#2422) 2018-10-30 08:46:12 -04:00
Jonathan White
fa687f246e
Fix issues with group functions (#2410) 2018-10-30 08:42:35 -04:00
Janek Bevendorff
7263dcddfe
Fix stdin/stdout encoding on Windows. (#2425)
QTextStream uses the system default locale, but this breaks in
various situations: (1) It does not work on the native Windows shell
(cmd.exe, Powershell), since the default Windows locale is Windows-1252,
but the shell uses Windows-850. (2) It also breaks on *nix systems where
the locale is Latin1 or C, which is the case for most CI systems or
build servers.

We allow overriding the detected codec by setting the ENCODING_OVERRIDE
environment variable, but otherwise prefer Windows-850 on Windows and
UTF-8 on any other system, even if LANG is set to something else.

This resolves #2413
2018-10-28 19:55:00 +01:00
Nathan Merritt
c9cab250c7 Only check for scheme matches when an entry has a scheme (#2426) 2018-10-28 13:51:20 -04:00
Gianluca Recchia
f31d65bdaf Replace deprecated parts of the code (#2419)
Performing a dev build against the latest version of Qt failed
because of some deprecated members. They have been replaced
according to the Qt documentation.

Further, Q_OS_MACOS is now the only macro available to identify a
machine running macOS, the others are now deprecated.
See https://doc.qt.io/qt-5/qtglobal.html#Q_OS_OSX and
https://doc.qt.io/qt-5/qtglobal.html#Q_OS_MAC.
2018-10-26 15:19:04 +02:00
Sami Vänttinen
efdb43dc53 Browser connection keys and rules are stored in custom data instead of attributes (#1497) 2018-10-24 10:49:53 -04:00
Kyle Kneitinger
cfa1eca249 Make preview panel expiration date use local time (#2382)
Adds call to toLocalTime() to convert expiration date string
to correct timezone instead of UTC, which matches the date string
in the database view.
2018-10-24 08:11:58 -04:00
Kyle Kneitinger
d990f12f56 Convert preview panel close button from checkbox to momentary (#2384)
The {group,entry}CloseButton QToolButton, had the "checkable" property set.
This caused it to act like a toggle flip flop instead of a momentary push
button.  After removing that property, the signal it was changed to use
was clicked() instead of toggled(bool).  Trigger upon click is
consistent with the rest of the UI's momentary buttons.
2018-10-24 08:11:18 -04:00
Gianluca Recchia
1d9f46ebc5 Fix the position of the Q_REQUIRED_RESULT macro (#2411)
The Q_REQUIRED_RESULT macro was appended to a few method declarations.
It should've been prepended instead.
2018-10-24 08:09:12 -04:00
Chih-Hsuan Yen
6ea869bb18 Replace all .svgz in paths to .svg (#2405) 2018-10-24 08:08:37 -04:00
Sami Vänttinen
5c92082f7c Add warning message to browser integration settings when keepassxc-proxy is not found (#2396) 2018-10-23 09:03:18 -04:00
Janek Bevendorff
b45f0e3e46 Enable high-DPI scaling to support 4k screens.
This enables coordinate system scaling for high-DPI
displays, which enforces correct proportions even
on small 4k displays. The icons are scaled up without
interpolation, which makes them crisp, but a bit
pixelated. A new scalable icon set will solve this
problem, but is not scope of this patch.

Resolves #548, #1381, #1710, #1888

In addition, this patch enforces the KeePassXC icon
theme for the KMessageBox close icon, since using
the system theme produces very ugly icons on some
Linux systems.
2018-10-21 20:34:46 +02:00
Jonathan White
a44138dd5c Multiple fixes to MainWindow and some cleanup
* Fix MainWindow startup when minimize to tray was enabled
* Reduce duplicate code in DatabaseWidget.cpp
* Fix snapcraft build dependencies
* Add support for CTRL+TAB, CTRL+PGUP, CTRL+SHIFT+TAB, CTRL+PGDN to control database tabs from any focus location
* Add CTRL+SHIFT+M shortcut to minimize to tray
* Allow minimize instead of app exit without tray icon
2018-10-20 15:30:48 +02:00
Jonathan White
c749f7018e
Merge pull request #2351 from keepassxreboot/feature/coverage
Improve test coverage, reformat CMakeFiles, and cleanup CLI
2018-10-19 19:44:36 -04:00
Janek Bevendorff
77adbef401 Reformat CMakeLists.txt files 2018-10-19 22:16:44 +02:00
Janek Bevendorff
0ca7fd369a Implement review feedback 2018-10-19 22:16:44 +02:00
Janek Bevendorff
bea31f9bcc Rename TestClock to MockClock and move it to the mock directory 2018-10-19 21:49:55 +02: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
Janek Bevendorff
18b22834c1 Update and fix test coverage report generation
Generation of unit test coverage reports used to be quite complicated
and required a lot of different settings, including a custom CMake
build type. This patch updates the coverage CMake module to only
require -DWITH_COVERAGE=ON to be set on a normal Debug build in order
to create a coverage target.

This patch also moves away from lcov in favor of gcovr, since lcov appears
to be broken in GCC 8. However, the routines for generating lcov reports
still exist, so provided lcov receives updates and there is sufficient
reason to switch back, it is easy to do so.
2018-10-19 21:45:53 +02:00
Sami Vänttinen
b8d2d5d877 Choose database for saving or updating entries from KeePassXC-Browser (#2391) 2018-10-19 14:44:08 -04:00
Adolfo E. García
bb16dc6d01 Add QR code generator for TOTP export (#1167)
* Resolves #764
* Add libqrencode and qtsvg dependencies 
* Ensure QR code remains square
* Auto-close QR code dialog when database is locked
* Add databaseLocked() Signal to databaseWidget
* Correct otpauth URI output in Totp::writeSettings(...)
2018-10-19 14:42:49 -04:00
varjolintu
80749958b7 Fix checking subdomains 2018-10-18 08:14:42 -04:00
林博仁(Buo-ren, Lin)
d3069eb734 Add Git tracking ignore rules for snapcraft
This patch implements gitignore(5) rules for snapcraft, this prevents
snap build artifacts from listed as untracked files.

[ci skip]
2018-10-16 14:27:31 -04:00
Jake Howard
ca328242bc Don't show application if we're only showing the help / version 2018-10-14 16:20:28 -04:00
Kyle Kneitinger
265325057a Create config file deprecation mechanism & rename Details->Preview (#2371)
Rename UI elements involved with the bottom preview panel to use the
terminology "entry preview panel" instead of "details view" or "preview
panel". Change all associated variables, widgets, and classes to
reference EntryPreviewPanel. Create Config::upgrade() function and
deprecation mapping to help rename/remove previous config settings in a
clean manner.

Fixes #2327
2018-10-08 21:11:44 -04:00