Commit 66cb75ac authored by Nathan Hinton's avatar Nathan Hinton 💬 Committed by Julius Künzel
Browse files

Fix subtitle save, in cases where the file extension was missing

Now when the subtitle export feature is used there is a check for the extension and if not present is appended automatically

Fixes #988
parent 47b4ace1
Pipeline #187226 passed with stage
in 6 minutes and 32 seconds
......@@ -4906,16 +4906,15 @@ void TimelineController::exportSubtitle()
pCore->displayMessage(i18n("No subtitles in current project"), ErrorMessage);
return;
}
const QString url = QFileDialog::getSaveFileName(qApp->activeWindow(), i18n("Export subtitle file"), pCore->currentDoc()->url().toLocalFile(),
QString url = QFileDialog::getSaveFileName(qApp->activeWindow(), i18n("Export subtitle file"), pCore->currentDoc()->url().toLocalFile(),
i18n("Subtitle File (*.srt)"));
if (url.isEmpty()) {
return;
}
QFile srcFile(url);
if (!url.endsWith(QStringLiteral(".srt"))) {
KMessageBox::error(qApp->activeWindow(), i18n("Cannot write to file %1", url));
return;
url.append(QStringLiteral(".srt"));
}
QFile srcFile(url);
if (srcFile.exists()) {
srcFile.remove();
}
......
Supports Markdown
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