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
a740fe128c
commit
806b8b0901
@ -81,6 +81,7 @@ static const QHash<Config::ConfigKey, ConfigDirective> configStrings = {
|
|||||||
{Config::GlobalAutoTypeRetypeTime,{QS("GlobalAutoTypeRetypeTime"), Roaming, 15}},
|
{Config::GlobalAutoTypeRetypeTime,{QS("GlobalAutoTypeRetypeTime"), Roaming, 15}},
|
||||||
{Config::FaviconDownloadTimeout,{QS("FaviconDownloadTimeout"), Roaming, 10}},
|
{Config::FaviconDownloadTimeout,{QS("FaviconDownloadTimeout"), Roaming, 10}},
|
||||||
{Config::UpdateCheckMessageShown,{QS("UpdateCheckMessageShown"), Roaming, false}},
|
{Config::UpdateCheckMessageShown,{QS("UpdateCheckMessageShown"), Roaming, false}},
|
||||||
|
{Config::DefaultDatabaseFileName,{QS("DefaultDatabaseFileName"), Roaming, {}}},
|
||||||
|
|
||||||
{Config::LastDatabases, {QS("LastDatabases"), Local, {}}},
|
{Config::LastDatabases, {QS("LastDatabases"), Local, {}}},
|
||||||
{Config::LastKeyFiles, {QS("LastKeyFiles"), Local, {}}},
|
{Config::LastKeyFiles, {QS("LastKeyFiles"), Local, {}}},
|
||||||
|
@ -63,6 +63,7 @@ public:
|
|||||||
GlobalAutoTypeRetypeTime,
|
GlobalAutoTypeRetypeTime,
|
||||||
FaviconDownloadTimeout,
|
FaviconDownloadTimeout,
|
||||||
UpdateCheckMessageShown,
|
UpdateCheckMessageShown,
|
||||||
|
DefaultDatabaseFileName,
|
||||||
|
|
||||||
LastDatabases,
|
LastDatabases,
|
||||||
LastKeyFiles,
|
LastKeyFiles,
|
||||||
|
@ -1980,8 +1980,10 @@ bool DatabaseWidget::saveAs()
|
|||||||
|
|
||||||
QString oldFilePath = m_db->filePath();
|
QString oldFilePath = m_db->filePath();
|
||||||
if (!QFileInfo::exists(oldFilePath)) {
|
if (!QFileInfo::exists(oldFilePath)) {
|
||||||
|
QString defaultFileName = config()->get(Config::DefaultDatabaseFileName).toString();
|
||||||
oldFilePath =
|
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(
|
const QString newFilePath = fileDialog()->getSaveFileName(
|
||||||
this, tr("Save database as"), oldFilePath, tr("KeePass 2 Database").append(" (*.kdbx)"), nullptr, nullptr);
|
this, tr("Save database as"), oldFilePath, tr("KeePass 2 Database").append(" (*.kdbx)"), nullptr, nullptr);
|
||||||
@ -2068,8 +2070,10 @@ bool DatabaseWidget::saveBackup()
|
|||||||
while (true) {
|
while (true) {
|
||||||
QString oldFilePath = m_db->filePath();
|
QString oldFilePath = m_db->filePath();
|
||||||
if (!QFileInfo::exists(oldFilePath)) {
|
if (!QFileInfo::exists(oldFilePath)) {
|
||||||
oldFilePath = QDir::toNativeSeparators(config()->get(Config::LastDir).toString() + "/"
|
QString defaultFileName = config()->get(Config::DefaultDatabaseFileName).toString();
|
||||||
+ tr("Passwords").append(".kdbx"));
|
oldFilePath = QDir::toNativeSeparators(
|
||||||
|
config()->get(Config::LastDir).toString() + "/"
|
||||||
|
+ (defaultFileName.isEmpty() ? tr("Passwords").append(".kdbx") : defaultFileName));
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString newFilePath = fileDialog()->getSaveFileName(this,
|
const QString newFilePath = fileDialog()->getSaveFileName(this,
|
||||||
|
Loading…
Reference in New Issue
Block a user