Merge remote-tracking branch 'keepassx/master'

# Conflicts:
#	README.md
#	share/translations/keepassx_de.ts
#	src/CMakeLists.txt
#	src/gui/MainWindow.h
This commit is contained in:
Jonathan White 2016-02-27 19:11:09 -05:00
commit aba4fa94be
244 changed files with 17683 additions and 6918 deletions

View file

@ -15,11 +15,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <QCommandLineParser>
#include <QFile>
#include "config-keepassx.h"
#include "core/Config.h"
#include "core/qcommandlineparser.h"
#include "core/Tools.h"
#include "core/Translator.h"
#include "crypto/Crypto.h"
@ -32,12 +32,13 @@ int main(int argc, char** argv)
#ifdef QT_NO_DEBUG
Tools::disableCoreDumps();
#endif
Tools::setupSearchPaths();
Application app(argc, argv);
Application::setApplicationName("keepassx");
Application::setApplicationVersion(KEEPASSX_VERSION);
// don't set organizationName as that changes the return value of
// QDesktopServices::storageLocation(QDesktopServices::DataLocation)
// QStandardPaths::writableLocation(QDesktopServices::DataLocation)
QApplication::setQuitOnLastWindowClosed(false);
@ -46,7 +47,7 @@ int main(int argc, char** argv)
"Fatal error while testing the cryptographic functions.");
error.append("\n");
error.append(Crypto::errorString());
MessageBox::critical(Q_NULLPTR, QCoreApplication::translate("Main", "KeePassX - Error"), error);
MessageBox::critical(nullptr, QCoreApplication::translate("Main", "KeePassX - Error"), error);
return 1;
}
@ -57,9 +58,6 @@ int main(int argc, char** argv)
QCommandLineOption configOption("config",
QCoreApplication::translate("main", "path to a custom config file"),
"config");
QCommandLineOption passwordOption("password",
QCoreApplication::translate("main", "password of the database (DANGEROUS!)"),
"password");
QCommandLineOption keyfileOption("keyfile",
QCoreApplication::translate("main", "key file of the database"),
"keyfile");
@ -67,7 +65,6 @@ int main(int argc, char** argv)
parser.addHelpOption();
parser.addVersionOption();
parser.addOption(configOption);
parser.addOption(passwordOption);
parser.addOption(keyfileOption);
parser.process(app);
@ -86,13 +83,14 @@ int main(int argc, char** argv)
MainWindow mainWindow;
mainWindow.show();
app.setMainWindow(&mainWindow);
QObject::connect(&app, SIGNAL(openFile(QString)), &mainWindow, SLOT(openDatabase(QString)));
for (int ii=0; ii < args.length(); ii++) {
QString filename = args[ii];
if (!filename.isEmpty() && QFile::exists(filename)) {
mainWindow.openDatabase(filename, parser.value(passwordOption), parser.value(keyfileOption));
mainWindow.openDatabase(filename, QString(), parser.value(keyfileOption));
}
}