Commit 2087c023 authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Reloading a playlist clip in a project now checks for missing files in it and allows fixing

parent ba6dda5c
......@@ -863,6 +863,29 @@ void Bin::slotReloadClip()
ProjectClip *currentItem = qobject_cast<ProjectClip*>(item);
if (currentItem) {
emit openClip(NULL);
if (currentItem->clipType() == Playlist) {
//Check if a clip inside playlist is missing
QString path = currentItem->url().path();
QFile f(path);
QDomDocument doc;
doc.setContent(&f, false);
DocumentChecker d(QUrl::fromLocalFile(path), doc);
if (!d.hasErrorInClips() && doc.documentElement().attribute(QStringLiteral("modified")) == QLatin1String("1")) {
QString backupFile = path + QStringLiteral(".backup");
KIO::FileCopyJob *copyjob = KIO::file_copy(QUrl::fromLocalFile(path), QUrl::fromLocalFile(backupFile));
if (copyjob->exec()) {
if (! | QIODevice::Text)) {
KMessageBox::sorry(this, i18n("Unable to write to file %1", path));
} else {
QTextStream out(&f);
out << doc.toString();
KMessageBox::information(this, i18n("Your project file was modified by Kdenlive.\nTo make sure you don't lose data, a backup copy called %1 was created.", backupFile));
QDomDocument doc;
QDomElement xml = currentItem->toXml(doc);
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