Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

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);
f.close();
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 (!f.open(QIODevice::WriteOnly | QIODevice::Text)) {
KMessageBox::sorry(this, i18n("Unable to write to file %1", path));
} else {
QTextStream out(&f);
out << doc.toString();
f.close();
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);
qDebug()<<"*****************\n"<<doc.toString()<<"\n******************";
......
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