mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-07-11 17:19:40 -04:00
Unlock previously opened databases with --pw-stdin
This commit is contained in:
parent
d3208bddb0
commit
37aa4f0257
1 changed files with 7 additions and 2 deletions
|
@ -129,7 +129,12 @@ void DatabaseTabWidget::openDatabase(const QString& fileName, const QString& pw,
|
||||||
while (i.hasNext()) {
|
while (i.hasNext()) {
|
||||||
i.next();
|
i.next();
|
||||||
if (i.value().canonicalFilePath == canonicalFilePath) {
|
if (i.value().canonicalFilePath == canonicalFilePath) {
|
||||||
|
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()));
|
setCurrentIndex(databaseIndex(i.key()));
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -204,7 +209,7 @@ void DatabaseTabWidget::openDatabase(const QString& fileName, const QString& pw,
|
||||||
|
|
||||||
updateLastDatabases(dbStruct.filePath);
|
updateLastDatabases(dbStruct.filePath);
|
||||||
|
|
||||||
if (!pw.isNull() || !keyFile.isEmpty()) {
|
if (!(pw.isNull() && keyFile.isEmpty())) {
|
||||||
dbStruct.dbWidget->switchToOpenDatabase(dbStruct.filePath, pw, keyFile);
|
dbStruct.dbWidget->switchToOpenDatabase(dbStruct.filePath, pw, keyFile);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue