Merge branch 'release/2.2.2' into develop

This commit is contained in:
Janek Bevendorff 2017-10-20 23:08:04 +02:00
commit f634f20ccc
No known key found for this signature in database
GPG key ID: 2FDEB0D40BCA5E11
2 changed files with 9 additions and 4 deletions

View file

@ -129,7 +129,12 @@ void DatabaseTabWidget::openDatabase(const QString& fileName, const QString& pw,
while (i.hasNext()) {
i.next();
if (i.value().canonicalFilePath == canonicalFilePath) {
setCurrentIndex(databaseIndex(i.key()));
if (!i.value().dbWidget->dbHasKey() && !(pw.isNull() && keyFile.isEmpty())) {
// If the database is locked and a pw or keyfile is provided, unlock it
i.value().dbWidget->switchToOpenDatabase(i.value().filePath, pw, keyFile);
} else {
setCurrentIndex(databaseIndex(i.key()));
}
return;
}
}
@ -204,7 +209,7 @@ void DatabaseTabWidget::openDatabase(const QString& fileName, const QString& pw,
updateLastDatabases(dbStruct.filePath);
if (!pw.isNull() || !keyFile.isEmpty()) {
if (!(pw.isNull() && keyFile.isEmpty())) {
dbStruct.dbWidget->switchToOpenDatabase(dbStruct.filePath, pw, keyFile);
}
else {