Initialize Application before parser arguments (#6177)

Co-authored-by: Jonathan White <[email protected]>
This commit is contained in:
Toni SpetsandJonathan White authored and GitHub committed 2021-02-24 23:10:13 -05:00
1 parent c0d673b46f
commit 46f5596e59
1 file changed
+6 -7
+6 -7
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