mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-08-09 23:12:23 -04:00
Merge branch 'release/2.4.2' into develop
This commit is contained in:
commit
bc891761b6
62 changed files with 710 additions and 243 deletions
|
@ -84,7 +84,7 @@ int Add::execute(const QStringList& arguments)
|
|||
|
||||
const QStringList args = parser.positionalArguments();
|
||||
if (args.size() != 2) {
|
||||
errorTextStream << parser.helpText().replace("keepassxc-cli", "keepassxc-cli add");
|
||||
errorTextStream << parser.helpText().replace("[options]", "add [options]");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@ target_link_libraries(keepassxc-cli
|
|||
keepassx_core
|
||||
Qt5::Core
|
||||
${GCRYPT_LIBRARIES}
|
||||
${sodium_LIBRARY_RELEASE}
|
||||
${ARGON2_LIBRARIES}
|
||||
${GPGERROR_LIBRARIES}
|
||||
${ZLIB_LIBRARIES}
|
||||
|
|
|
@ -63,7 +63,7 @@ int Clip::execute(const QStringList& arguments)
|
|||
|
||||
const QStringList args = parser.positionalArguments();
|
||||
if (args.size() != 2 && args.size() != 3) {
|
||||
errorTextStream << parser.helpText().replace("keepassxc-cli", "keepassxc-cli clip");
|
||||
errorTextStream << parser.helpText().replace("[options]", "clip [options]");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ int Create::execute(const QStringList& arguments)
|
|||
|
||||
const QStringList args = parser.positionalArguments();
|
||||
if (args.size() < 1) {
|
||||
out << parser.helpText().replace("keepassxc-cli", "keepassxc-cli create");
|
||||
out << parser.helpText().replace("[options]", "create [options]");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ int Diceware::execute(const QStringList& arguments)
|
|||
|
||||
const QStringList args = parser.positionalArguments();
|
||||
if (!args.isEmpty()) {
|
||||
errorTextStream << parser.helpText().replace("keepassxc-cli", "keepassxc-cli diceware");
|
||||
errorTextStream << parser.helpText().replace("[options]", "diceware [options]");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
|
@ -78,7 +78,7 @@ int Diceware::execute(const QStringList& arguments)
|
|||
}
|
||||
|
||||
if (!dicewareGenerator.isValid()) {
|
||||
outputTextStream << parser.helpText().replace("keepassxc-cli", "keepassxc-cli diceware");
|
||||
outputTextStream << parser.helpText().replace("[options]", "diceware [options]");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@ int Edit::execute(const QStringList& arguments)
|
|||
|
||||
const QStringList args = parser.positionalArguments();
|
||||
if (args.size() != 2) {
|
||||
errorTextStream << parser.helpText().replace("keepassxc-cli", "keepassxc-cli edit");
|
||||
errorTextStream << parser.helpText().replace("[options]", "edit [options]");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
|
|
|
@ -171,7 +171,7 @@ int Estimate::execute(const QStringList& arguments)
|
|||
|
||||
const QStringList args = parser.positionalArguments();
|
||||
if (args.size() > 1) {
|
||||
errorTextStream << parser.helpText().replace("keepassxc-cli", "keepassxc-cli estimate");
|
||||
errorTextStream << parser.helpText().replace("[options]", "estimate [options]");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ int Extract::execute(const QStringList& arguments)
|
|||
|
||||
const QStringList args = parser.positionalArguments();
|
||||
if (args.size() != 1) {
|
||||
errorTextStream << parser.helpText().replace("keepassxc-cli", "keepassxc-cli extract");
|
||||
errorTextStream << parser.helpText().replace("[options]", "extract [options]");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ int Generate::execute(const QStringList& arguments)
|
|||
|
||||
const QStringList args = parser.positionalArguments();
|
||||
if (!args.isEmpty()) {
|
||||
errorTextStream << parser.helpText().replace("keepassxc-cli", "keepassxc-cli generate");
|
||||
errorTextStream << parser.helpText().replace("[options]", "generate [options]");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
|
@ -128,7 +128,7 @@ int Generate::execute(const QStringList& arguments)
|
|||
passwordGenerator.setExcludedChars(parser.value(exclude));
|
||||
|
||||
if (!passwordGenerator.isValid()) {
|
||||
errorTextStream << parser.helpText().replace("keepassxc-cli", "keepassxc-cli generate");
|
||||
errorTextStream << parser.helpText().replace("[options]", "generate [options]");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ int List::execute(const QStringList& arguments)
|
|||
|
||||
const QStringList args = parser.positionalArguments();
|
||||
if (args.size() != 1 && args.size() != 2) {
|
||||
errorTextStream << parser.helpText().replace("keepassxc-cli", "keepassxc-cli ls");
|
||||
errorTextStream << parser.helpText().replace("[options]", "ls [options]");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ int Locate::execute(const QStringList& arguments)
|
|||
|
||||
const QStringList args = parser.positionalArguments();
|
||||
if (args.size() != 2) {
|
||||
errorTextStream << parser.helpText().replace("keepassxc-cli", "keepassxc-cli locate");
|
||||
errorTextStream << parser.helpText().replace("[options]", "locate [options]");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ int Merge::execute(const QStringList& arguments)
|
|||
|
||||
const QStringList args = parser.positionalArguments();
|
||||
if (args.size() != 2) {
|
||||
errorTextStream << parser.helpText().replace("keepassxc-cli", "keepassxc-cli merge");
|
||||
errorTextStream << parser.helpText().replace("[options]", "merge [options]");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ int Remove::execute(const QStringList& arguments)
|
|||
|
||||
const QStringList args = parser.positionalArguments();
|
||||
if (args.size() != 2) {
|
||||
errorTextStream << parser.helpText().replace("keepassxc-cli", "keepassxc-cli rm");
|
||||
errorTextStream << parser.helpText().replace("[options]", "rm [options]");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ int Show::execute(const QStringList& arguments)
|
|||
|
||||
const QStringList args = parser.positionalArguments();
|
||||
if (args.size() != 2) {
|
||||
errorTextStream << parser.helpText().replace("keepassxc-cli", "keepassxc-cli show");
|
||||
errorTextStream << parser.helpText().replace("[options]", "show [options]");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,9 @@
|
|||
|
||||
#include <QProcessEnvironment>
|
||||
#include <QTextCodec>
|
||||
#ifdef Q_OS_WIN
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
TextStream::TextStream()
|
||||
{
|
||||
|
@ -59,12 +62,26 @@ void TextStream::detectCodec()
|
|||
{
|
||||
QString codecName = "UTF-8";
|
||||
auto env = QProcessEnvironment::systemEnvironment();
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
if (!env.contains("SHELL")) {
|
||||
// native shell (no Msys or cygwin)
|
||||
WINBOOL success = false;
|
||||
#ifdef CP_UTF8
|
||||
success = SetConsoleOutputCP(CP_UTF8);
|
||||
#endif
|
||||
if (!success && !env.contains("SHELL")) {
|
||||
// Fall back to cp850 if this is Windows without CP_UTF8 and we
|
||||
// are running in a native shell (i.e., no Msys or Cygwin).
|
||||
codecName = "Windows-850";
|
||||
}
|
||||
#else
|
||||
if (env.contains("LANG") && !env.value("LANG").isEmpty() && env.value("LANG") != "C") {
|
||||
// Only override codec if LANG is set, otherwise Qt will assume
|
||||
// US-ASCII, which is almost always wrong and results in
|
||||
// Unicode passwords being displayed as question marks.
|
||||
codecName = QTextCodec::codecForLocale()->name();
|
||||
}
|
||||
#endif
|
||||
|
||||
codecName = env.value("ENCODING_OVERRIDE", codecName);
|
||||
auto* codec = QTextCodec::codecForName(codecName.toLatin1());
|
||||
if (codec) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue