mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-11-20 23:12:34 -05:00
Add direct write save option
* Closes #6335 * Modify application settings presentation to allow for alternative saving strategies * Transition Database::save calls to using flags to control saving behavior. Reduces boolean flags on function call. * Made direct write save option a local setting to prevent unintentional carry over between platforms.
This commit is contained in:
parent
484bc5dd01
commit
f2aa32c7b0
18 changed files with 158 additions and 64 deletions
|
|
@ -1867,16 +1867,20 @@ bool DatabaseWidget::performSave(QString& errorMessage, const QString& fileName)
|
|||
m_groupView->setDisabled(true);
|
||||
QApplication::processEvents();
|
||||
|
||||
Database::SaveAction saveAction = Database::Atomic;
|
||||
if (!config()->get(Config::UseAtomicSaves).toBool()) {
|
||||
if (config()->get(Config::UseDirectWriteSaves).toBool()) {
|
||||
saveAction = Database::DirectWrite;
|
||||
} else {
|
||||
saveAction = Database::TempFile;
|
||||
}
|
||||
}
|
||||
|
||||
bool ok;
|
||||
if (fileName.isEmpty()) {
|
||||
ok = m_db->save(&errorMessage,
|
||||
config()->get(Config::UseAtomicSaves).toBool(),
|
||||
config()->get(Config::BackupBeforeSave).toBool());
|
||||
ok = m_db->save(saveAction, config()->get(Config::BackupBeforeSave).toBool(), &errorMessage);
|
||||
} else {
|
||||
ok = m_db->saveAs(fileName,
|
||||
&errorMessage,
|
||||
config()->get(Config::UseAtomicSaves).toBool(),
|
||||
config()->get(Config::BackupBeforeSave).toBool());
|
||||
ok = m_db->saveAs(fileName, saveAction, config()->get(Config::BackupBeforeSave).toBool(), &errorMessage);
|
||||
}
|
||||
|
||||
// Return control
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue