mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-10-01 01:26:01 -04:00
Minor changes to address comments
This commit is contained in:
parent
3db9a86a4c
commit
6a4b275d40
@ -111,7 +111,7 @@ void Config::init(const QString& fileName)
|
|||||||
m_defaults.insert("RememberLastDatabases", true);
|
m_defaults.insert("RememberLastDatabases", true);
|
||||||
m_defaults.insert("RememberLastKeyFiles", true);
|
m_defaults.insert("RememberLastKeyFiles", true);
|
||||||
m_defaults.insert("OpenPreviousDatabasesOnStartup", true);
|
m_defaults.insert("OpenPreviousDatabasesOnStartup", true);
|
||||||
m_defaults.insert("AutoSaveAfterEveryChange", false);
|
m_defaults.insert("AutoSaveAfterEveryChange", true);
|
||||||
m_defaults.insert("AutoReloadOnChange", true);
|
m_defaults.insert("AutoReloadOnChange", true);
|
||||||
m_defaults.insert("AutoSaveOnExit", false);
|
m_defaults.insert("AutoSaveOnExit", false);
|
||||||
m_defaults.insert("BackupBeforeSave", false);
|
m_defaults.insert("BackupBeforeSave", false);
|
||||||
|
@ -476,7 +476,7 @@ Database* Database::unlockFromStdin(QString databaseFilename, QString keyFilenam
|
|||||||
*
|
*
|
||||||
* This function uses QTemporaryFile instead of QSaveFile due to a bug
|
* This function uses QTemporaryFile instead of QSaveFile due to a bug
|
||||||
* in Qt (https://bugreports.qt.io/browse/QTBUG-57299) that may prevent
|
* in Qt (https://bugreports.qt.io/browse/QTBUG-57299) that may prevent
|
||||||
* the QSaveFile from renaming itself when using DropBox, Drive, or OneDrive.
|
* the QSaveFile from renaming itself when using Dropbox, Drive, or OneDrive.
|
||||||
*
|
*
|
||||||
* The risk in using QTemporaryFile is that the rename function is not atomic
|
* The risk in using QTemporaryFile is that the rename function is not atomic
|
||||||
* and may result in loss of data if there is a crash or power loss at the
|
* and may result in loss of data if there is a crash or power loss at the
|
||||||
@ -554,7 +554,7 @@ QString Database::writeDatabase(QIODevice* device)
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove the old backup and replace it with a new one
|
* Remove the old backup and replace it with a new one
|
||||||
* backups are named <filename>.old.kdbx4
|
* backups are named <filename>.old.kdbx
|
||||||
*
|
*
|
||||||
* @param filePath Path to the file to backup
|
* @param filePath Path to the file to backup
|
||||||
* @return
|
* @return
|
||||||
@ -562,11 +562,8 @@ QString Database::writeDatabase(QIODevice* device)
|
|||||||
bool Database::backupDatabase(QString filePath)
|
bool Database::backupDatabase(QString filePath)
|
||||||
{
|
{
|
||||||
QString backupFilePath = filePath;
|
QString backupFilePath = filePath;
|
||||||
backupFilePath.replace(".kdbx", ".old.kdbx", Qt::CaseInsensitive);
|
auto re = QRegularExpression("(?:\\.kdbx)?$", QRegularExpression::CaseInsensitiveOption);
|
||||||
if (!backupFilePath.endsWith(".old.kdbx")) {
|
backupFilePath.replace(re, ".old.kdbx");
|
||||||
// Fallback in case of poorly named file
|
|
||||||
backupFilePath = filePath + ".old";
|
|
||||||
}
|
|
||||||
QFile::remove(backupFilePath);
|
QFile::remove(backupFilePath);
|
||||||
return QFile::copy(filePath, backupFilePath);
|
return QFile::copy(filePath, backupFilePath);
|
||||||
}
|
}
|
||||||
|
@ -325,7 +325,7 @@ bool DatabaseTabWidget::saveDatabase(Database* db, QString filePath)
|
|||||||
|
|
||||||
dbStruct.dbWidget->blockAutoReload(true);
|
dbStruct.dbWidget->blockAutoReload(true);
|
||||||
// TODO: Make this async, but lock out the database widget to prevent re-entrance
|
// TODO: Make this async, but lock out the database widget to prevent re-entrance
|
||||||
bool useAtomicSaves = config()->get("UseAtomicSaves").toBool();
|
bool useAtomicSaves = config()->get("UseAtomicSaves", true).toBool();
|
||||||
QString errorMessage = db->saveToFile(filePath, useAtomicSaves, config()->get("BackupBeforeSave").toBool());
|
QString errorMessage = db->saveToFile(filePath, useAtomicSaves, config()->get("BackupBeforeSave").toBool());
|
||||||
dbStruct.dbWidget->blockAutoReload(false);
|
dbStruct.dbWidget->blockAutoReload(false);
|
||||||
|
|
||||||
|
@ -95,7 +95,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="useAtomicSavesCheckBox">
|
<widget class="QCheckBox" name="useAtomicSavesCheckBox">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Safely save database files (may be incompatible with DropBox, etc)</string>
|
<string>Safely save database files (may be incompatible with Dropbox, etc)</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="checked">
|
<property name="checked">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
|
Loading…
Reference in New Issue
Block a user