Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/keepassxreboot/keepassxc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormetaphys <jl.biasini@laposte.net>2019-09-04 00:17:33 +0300
committerJonathan White <support@dmapps.us>2019-09-07 14:46:01 +0300
commit72c1783b5bd56afb2f536417dc930066a1b568da (patch)
tree3e70a70e4f2e07f069483d531607487ffd5e643c /src/gui/DatabaseWidget.cpp
parent0a75b475096821484546e780387dccaa016e3bca (diff)
Support key files with Auto Open feature
Fixes #3495 * Look for keyfile in username parameter of the Auto Open entries. If present, pass on to unlock call to the database.
Diffstat (limited to 'src/gui/DatabaseWidget.cpp')
-rw-r--r--src/gui/DatabaseWidget.cpp25
1 files changed, 19 insertions, 6 deletions
diff --git a/src/gui/DatabaseWidget.cpp b/src/gui/DatabaseWidget.cpp
index b5698aafc..05fc01ca3 100644
--- a/src/gui/DatabaseWidget.cpp
+++ b/src/gui/DatabaseWidget.cpp
@@ -987,10 +987,8 @@ void DatabaseWidget::unlockDatabase(bool accepted)
}
replaceDatabase(db);
if (db->isReadOnly()) {
- showMessage(tr("This database is opened in read-only mode. Autosave is disabled."),
- MessageWidget::Warning,
- false,
- -1);
+ showMessage(
+ tr("This database is opened in read-only mode. Autosave is disabled."), MessageWidget::Warning, false, -1);
}
restoreGroupEntryFocus(m_groupBeforeLock, m_entryBeforeLock);
@@ -1740,6 +1738,8 @@ void DatabaseWidget::processAutoOpen()
continue;
}
QFileInfo filepath;
+ QFileInfo keyfile;
+
if (entry->url().startsWith("file://")) {
QUrl url(entry->url());
filepath.setFile(url.toLocalFile());
@@ -1755,7 +1755,20 @@ void DatabaseWidget::processAutoOpen()
continue;
}
- // Request to open the database file in the background
- emit requestOpenDatabase(filepath.canonicalFilePath(), true, entry->password());
+ if (!entry->username().isEmpty()) {
+ if (entry->username().startsWith("file://")) {
+ QUrl keyfileUrl(entry->username());
+ keyfile.setFile(keyfileUrl.toLocalFile());
+ } else {
+ keyfile.setFile(entry->username());
+ if (keyfile.isRelative()) {
+ QFileInfo currentpath(m_db->filePath());
+ keyfile.setFile(currentpath.absoluteDir(), entry->username());
+ }
+ }
+ }
+
+ // Request to open the database file in the background with a password and keyfile
+ emit requestOpenDatabase(filepath.canonicalFilePath(), true, entry->password(), keyfile.canonicalFilePath());
}
}