Set the application name and version in QApplication.

This commit is contained in:
Felix Geyer 2014-01-18 15:31:24 +01:00
parent c2781274a0
commit 678c4a8ece
2 changed files with 7 additions and 3 deletions

View File

@ -71,7 +71,7 @@ Config::Config(QObject* parent)
userPath += "/keepassx/"; userPath += "/keepassx/";
#else #else
userPath = QDir::fromNativeSeparators(QDesktopServices::storageLocation(QDesktopServices::DataLocation)); userPath = QDir::fromNativeSeparators(QDesktopServices::storageLocation(QDesktopServices::DataLocation));
userPath += "/keepassx/"; // storageLocation() appends the application name ("/keepassx/") to the end
#endif #endif
userPath += "keepassx2.ini"; userPath += "keepassx2.ini";

View File

@ -17,6 +17,7 @@
#include <QFile> #include <QFile>
#include "config-keepassx.h"
#include "core/Config.h" #include "core/Config.h"
#include "core/qcommandlineparser.h" #include "core/qcommandlineparser.h"
#include "core/Tools.h" #include "core/Tools.h"
@ -31,8 +32,10 @@ int main(int argc, char** argv)
#endif #endif
Application app(argc, argv); Application app(argc, argv);
// don't set applicationName or organizationName as that changes Application::setApplicationName("keepassx");
// QDesktopServices::storageLocation() Application::setApplicationVersion(KEEPASSX_VERSION);
// don't set organizationName as that changes the return value of
// QDesktopServices::storageLocation(QDesktopServices::DataLocation)
Crypto::init(); Crypto::init();
@ -51,6 +54,7 @@ int main(int argc, char** argv)
"keyfile"); "keyfile");
parser.addHelpOption(); parser.addHelpOption();
parser.addVersionOption();
parser.addOption(configOption); parser.addOption(configOption);
parser.addOption(passwordOption); parser.addOption(passwordOption);
parser.addOption(keyfileOption); parser.addOption(keyfileOption);