mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-08-02 03:26:14 -04:00
Adding debug info to CLI.
Adding debug info to the CLI and the general option of the main Qt app. Also took time to: * use `EXIT_SUCCESS`/`EXIT_FAILURE` constants for main.cpp (this is what is used in `src/cli`); * fixed `m_initalized` typo; * added info on debugging mode being disabled or not; * regrouped Qt related stuff in the debug output.
This commit is contained in:
parent
76913a5dd1
commit
a58e3d5ee0
11 changed files with 126 additions and 82 deletions
18
src/main.cpp
18
src/main.cpp
|
@ -82,16 +82,19 @@ int main(int argc, char** argv)
|
|||
|
||||
QCommandLineOption helpOption = parser.addHelpOption();
|
||||
QCommandLineOption versionOption = parser.addVersionOption();
|
||||
QCommandLineOption debugInfoOption(QStringList() << "debug-info",
|
||||
QObject::tr("Displays debugging information."));
|
||||
parser.addOption(configOption);
|
||||
parser.addOption(keyfileOption);
|
||||
parser.addOption(pwstdinOption);
|
||||
parser.addOption(parentWindowOption);
|
||||
parser.addOption(debugInfoOption);
|
||||
|
||||
parser.process(app);
|
||||
|
||||
// Don't try and do anything with the application if we're only showing the help / version
|
||||
if (parser.isSet(versionOption) || parser.isSet(helpOption)) {
|
||||
return 0;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
const QStringList fileNames = parser.positionalArguments();
|
||||
|
@ -101,7 +104,7 @@ int main(int argc, char** argv)
|
|||
app.sendFileNamesToRunningInstance(fileNames);
|
||||
}
|
||||
qWarning() << QObject::tr("Another instance of KeePassXC is already running.").toUtf8().constData();
|
||||
return 0;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
QApplication::setQuitOnLastWindowClosed(false);
|
||||
|
@ -111,7 +114,16 @@ int main(int argc, char** argv)
|
|||
error.append("\n");
|
||||
error.append(Crypto::errorString());
|
||||
MessageBox::critical(nullptr, QObject::tr("KeePassXC - Error"), error);
|
||||
return 1;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
// Displaying the debugging informations must be done after Crypto::init,
|
||||
// to make sure we know which libgcrypt version is used.
|
||||
if (parser.isSet(debugInfoOption)) {
|
||||
QTextStream out(stdout, QIODevice::WriteOnly);
|
||||
QString debugInfo = Tools::debugInfo().append("\n").append(Crypto::debugInfo());
|
||||
out << debugInfo << endl;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
if (parser.isSet(configOption)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue