Commit ea3031cd authored by Julius Künzel's avatar Julius Künzel
Browse files

Backup subtitles too

FIxes #942
parent 301cfeb8
......@@ -1048,6 +1048,15 @@ void KdenliveDoc::backupLastSavedVersion(const QString &path)
if (!QFile::copy(path, backupFile)) {
KMessageBox::information(QApplication::activeWindow(), i18n("Cannot create backup copy:\n%1", backupFile));
}
// backup subitle file in case we have one
QString subpath(path + QStringLiteral(".srt"));
QString subbackupFile(backupFile + QStringLiteral(".srt"));
if(QFile(subpath).exists()) {
QFile::remove(subbackupFile);
if (!QFile::copy(subpath, subbackupFile)) {
KMessageBox::information(QApplication::activeWindow(), i18n("Cannot create backup copy:\n%1", subbackupFile));
}
}
}
}
......@@ -1131,21 +1140,25 @@ void KdenliveDoc::cleanupBackupFiles()
f = hourList.takeFirst();
QFile::remove(f);
QFile::remove(f + QStringLiteral(".png"));
QFile::remove(f + QStringLiteral(".srt"));
}
while (dayList.count() > 0) {
f = dayList.takeFirst();
QFile::remove(f);
QFile::remove(f + QStringLiteral(".png"));
QFile::remove(f + QStringLiteral(".srt"));
}
while (weekList.count() > 0) {
f = weekList.takeFirst();
QFile::remove(f);
QFile::remove(f + QStringLiteral(".png"));
QFile::remove(f + QStringLiteral(".srt"));
}
while (oldList.count() > 0) {
f = oldList.takeFirst();
QFile::remove(f);
QFile::remove(f + QStringLiteral(".png"));
QFile::remove(f + QStringLiteral(".srt"));
}
}
......
......@@ -655,6 +655,7 @@ bool ProjectManager::slotOpenBackup(const QUrl &url)
if (m_project) {
if (!m_project->url().isEmpty()) {
// Only update if restore succeeded
pCore->window()->slotEditSubtitle();
m_project->setUrl(projectFile);
m_project->setModified(true);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment