Allow specifying initial directory via the KPXC_INITIAL_DIR environment variable

This commit is contained in:
ShellCode33 2023-03-04 13:39:05 +01:00 committed by Jonathan White
parent 6c9078c870
commit 64281b508b
No known key found for this signature in database
GPG key ID: 440FC65F2E0C6E01
4 changed files with 20 additions and 9 deletions

View file

@ -2031,7 +2031,7 @@ bool DatabaseWidget::saveAs()
if (!QFileInfo::exists(oldFilePath)) {
QString defaultFileName = config()->get(Config::DefaultDatabaseFileName).toString();
oldFilePath =
QDir::toNativeSeparators(config()->get(Config::LastDir).toString() + "/"
QDir::toNativeSeparators(FileDialog::getLastDir("db") + "/"
+ (defaultFileName.isEmpty() ? tr("Passwords").append(".kdbx") : defaultFileName));
}
const QString newFilePath = fileDialog()->getSaveFileName(
@ -2121,13 +2121,13 @@ bool DatabaseWidget::saveBackup()
if (!QFileInfo::exists(oldFilePath)) {
QString defaultFileName = config()->get(Config::DefaultDatabaseFileName).toString();
oldFilePath = QDir::toNativeSeparators(
config()->get(Config::LastDir).toString() + "/"
FileDialog::getLastDir("db") + "/"
+ (defaultFileName.isEmpty() ? tr("Passwords").append(".kdbx") : defaultFileName));
}
const QString newFilePath = fileDialog()->getSaveFileName(this,
tr("Save database backup"),
FileDialog::getLastDir("backup"),
FileDialog::getLastDir("backup", oldFilePath),
tr("KeePass 2 Database").append(" (*.kdbx)"),
nullptr,
nullptr);