diff --git a/src/vmdtab.cpp b/src/vmdtab.cpp index 2436cd5a..7c506610 100644 --- a/src/vmdtab.cpp +++ b/src/vmdtab.cpp @@ -1023,6 +1023,14 @@ bool VMdTab::checkPreviousBackupFile() return true; } + QString backupContent = m_file->readBackupFile(preFile); + if (m_file->getContent() == backupContent) { + // Found backup file with identical content. + // Just discard the backup file. + VUtils::deleteFile(preFile); + return true; + } + QMessageBox box(QMessageBox::Warning, tr("Backup File Found"), tr("Found backup file %2 " @@ -1032,17 +1040,13 @@ bool VMdTab::checkPreviousBackupFile() .arg(m_file->fetchPath()), QMessageBox::NoButton, this); - QString backupContent = m_file->readBackupFile(preFile); QString info = tr("VNote may crash while editing this note before.
" "Please choose to recover from the backup file or delete it.

" "Note file last modified: %2
" - "Backup file last modified: %3
" - "Content comparison: %4") + "Backup file last modified: %3") .arg(g_config->c_dataTextStyle) .arg(VUtils::displayDateTime(QFileInfo(m_file->fetchPath()).lastModified())) - .arg(VUtils::displayDateTime(QFileInfo(preFile).lastModified())) - .arg(m_file->getContent() == backupContent ? tr("Identical") - : tr("Different")); + .arg(VUtils::displayDateTime(QFileInfo(preFile).lastModified())); box.setInformativeText(info); QPushButton *recoverBtn = box.addButton(tr("Recover From Backup File"), QMessageBox::YesRole); box.addButton(tr("Discard Backup File"), QMessageBox::NoRole);