Initialize Application before parser arguments (#6177)

Co-authored-by: Jonathan White <support@dmapps.us>
This commit is contained in:
Toni Spets 2021-02-25 06:10:13 +02:00 committed by GitHub
parent c0d673b46f
commit 46f5596e59
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -56,6 +56,12 @@ int main(int argc, char** argv)
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) && defined(Q_OS_WIN)
QGuiApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough);
#endif
Application app(argc, argv);
// don't set organizationName as that changes the return value of
// QStandardPaths::writableLocation(QDesktopServices::DataLocation)
Application::setApplicationName("KeePassXC");
Application::setApplicationVersion(KEEPASSXC_VERSION);
app.setProperty("KPXC_QUALIFIED_APPNAME", "org.keepassxc.KeePassXC");
QCommandLineParser parser;
parser.setApplicationDescription(QObject::tr("KeePassXC - cross-platform password manager"));
@ -83,13 +89,6 @@ int main(int argc, char** argv)
parser.addOption(allowScreenCaptureOption);
}
Application app(argc, argv);
// don't set organizationName as that changes the return value of
// QStandardPaths::writableLocation(QDesktopServices::DataLocation)
Application::setApplicationName("KeePassXC");
Application::setApplicationVersion(KEEPASSXC_VERSION);
app.setProperty("KPXC_QUALIFIED_APPNAME", "org.keepassxc.KeePassXC");
parser.process(app);
// Exit early if we're only showing the help / version