mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-10-01 01:26:01 -04:00
Add config variable for specifying a default file name for the database
This commit is contained in:
parent
7e8a672de4
commit
4d20cb1654
@ -81,6 +81,7 @@ static const QHash<Config::ConfigKey, ConfigDirective> configStrings = {
|
||||
{Config::GlobalAutoTypeRetypeTime,{QS("GlobalAutoTypeRetypeTime"), Roaming, 15}},
|
||||
{Config::FaviconDownloadTimeout,{QS("FaviconDownloadTimeout"), Roaming, 10}},
|
||||
{Config::UpdateCheckMessageShown,{QS("UpdateCheckMessageShown"), Roaming, false}},
|
||||
{Config::DefaultDatabaseFileName,{QS("DefaultDatabaseFileName"), Roaming, {}}},
|
||||
|
||||
{Config::LastDatabases, {QS("LastDatabases"), Local, {}}},
|
||||
{Config::LastKeyFiles, {QS("LastKeyFiles"), Local, {}}},
|
||||
|
@ -63,6 +63,7 @@ public:
|
||||
GlobalAutoTypeRetypeTime,
|
||||
FaviconDownloadTimeout,
|
||||
UpdateCheckMessageShown,
|
||||
DefaultDatabaseFileName,
|
||||
|
||||
LastDatabases,
|
||||
LastKeyFiles,
|
||||
|
@ -1980,8 +1980,10 @@ bool DatabaseWidget::saveAs()
|
||||
|
||||
QString oldFilePath = m_db->filePath();
|
||||
if (!QFileInfo::exists(oldFilePath)) {
|
||||
QString defaultFileName = config()->get(Config::DefaultDatabaseFileName).toString();
|
||||
oldFilePath =
|
||||
QDir::toNativeSeparators(config()->get(Config::LastDir).toString() + "/" + tr("Passwords").append(".kdbx"));
|
||||
QDir::toNativeSeparators(config()->get(Config::LastDir).toString() + "/"
|
||||
+ (defaultFileName.isEmpty() ? tr("Passwords").append(".kdbx") : defaultFileName));
|
||||
}
|
||||
const QString newFilePath = fileDialog()->getSaveFileName(
|
||||
this, tr("Save database as"), oldFilePath, tr("KeePass 2 Database").append(" (*.kdbx)"), nullptr, nullptr);
|
||||
@ -2068,8 +2070,10 @@ bool DatabaseWidget::saveBackup()
|
||||
while (true) {
|
||||
QString oldFilePath = m_db->filePath();
|
||||
if (!QFileInfo::exists(oldFilePath)) {
|
||||
oldFilePath = QDir::toNativeSeparators(config()->get(Config::LastDir).toString() + "/"
|
||||
+ tr("Passwords").append(".kdbx"));
|
||||
QString defaultFileName = config()->get(Config::DefaultDatabaseFileName).toString();
|
||||
oldFilePath = QDir::toNativeSeparators(
|
||||
config()->get(Config::LastDir).toString() + "/"
|
||||
+ (defaultFileName.isEmpty() ? tr("Passwords").append(".kdbx") : defaultFileName));
|
||||
}
|
||||
|
||||
const QString newFilePath = fileDialog()->getSaveFileName(this,
|
||||
|
Loading…
Reference in New Issue
Block a user