summaryrefslogtreecommitdiff
path: root/src/mainwindow.cpp
diff options
context:
space:
mode:
authorRJ <122295667+Liderate@users.noreply.github.com>2025-05-23 03:18:03 -0400
committerGitHub <noreply@github.com>2025-05-23 09:18:03 +0200
commitb531bbff39bfe6df18e324b0d0785eb1f8e0163d (patch)
tree02ecabce1db3f9dfc137df5e281abdb11375b041 /src/mainwindow.cpp
parent3ef0db4cca1971ed1552c0314e0039dac792d2e5 (diff)
Update following SafeWriteFile changes (#2218)
Co-authored-by: RJ <Liderate@users.noreply.github.com>
Diffstat (limited to 'src/mainwindow.cpp')
-rw-r--r--src/mainwindow.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index c8847534..aa2c7641 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -2565,7 +2565,7 @@ void MainWindow::saveArchiveList()
}
}
}
- archiveFile.commitIfDifferent(m_ArchiveListHash);
+ archiveFile->commit();
} else {
log::debug("archive list not initialised");
}
@@ -3773,16 +3773,25 @@ QString MainWindow::queryRestore(const QString& filePath)
SelectionDialog dialog(tr("Choose backup to restore"), this);
QRegularExpression exp(QRegularExpression::anchoredPattern(pluginFileInfo.fileName() +
PATTERN_BACKUP_REGEX));
- QRegularExpression exp2(
+ // match orphaned SafeWriteFile temporaries
+ QRegularExpression exp2(QRegularExpression::anchoredPattern(
+ pluginFileInfo.fileName() + "\\.([A-Za-z]{6})"));
+ QRegularExpression exp3(
QRegularExpression::anchoredPattern(pluginFileInfo.fileName() + "\\.(.*)"));
for (const QFileInfo& info : boost::adaptors::reverse(files)) {
auto match = exp.match(info.fileName());
auto match2 = exp2.match(info.fileName());
+ auto match3 = exp3.match(info.fileName());
if (match.hasMatch()) {
QDateTime time = QDateTime::fromString(match.captured(1), PATTERN_BACKUP_DATE);
dialog.addChoice(time.toString(), "", match.captured(1));
} else if (match2.hasMatch()) {
- dialog.addChoice(match2.captured(1), "", match2.captured(1));
+ dialog.addChoice(match2.captured(1),
+ tr("This file might be left over following a crash or power "
+ "loss event. Check its contents before restoring."),
+ match2.captured(1));
+ } else if (match3.hasMatch()) {
+ dialog.addChoice(match3.captured(1), "", match3.captured(1));
}
}