Commit f14277da authored by Nicolas Carion's avatar Nicolas Carion

Fix: import folder now properly creates an undo object

parent d4e17558
Pipeline #1600 passed with stage
in 14 minutes and 19 seconds
...@@ -223,7 +223,6 @@ bool ClipCreator::createClipsFromList(const QList<QUrl> &list, bool checkRemovab ...@@ -223,7 +223,6 @@ bool ClipCreator::createClipsFromList(const QList<QUrl> &list, bool checkRemovab
QStringList result = dir.entryList(QDir::Files); QStringList result = dir.entryList(QDir::Files);
QStringList subfolders = dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot); QStringList subfolders = dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot);
QList<QUrl> folderFiles; QList<QUrl> folderFiles;
// QStringList allExtensions = ClipCreationDialog::getExtensions();
for (const QString &path : result) { for (const QString &path : result) {
QUrl url = QUrl::fromLocalFile(dir.absoluteFilePath(path)); QUrl url = QUrl::fromLocalFile(dir.absoluteFilePath(path));
// Check file is of a supported type // Check file is of a supported type
...@@ -256,12 +255,13 @@ bool ClipCreator::createClipsFromList(const QList<QUrl> &list, bool checkRemovab ...@@ -256,12 +255,13 @@ bool ClipCreator::createClipsFromList(const QList<QUrl> &list, bool checkRemovab
} }
if (!sublist.isEmpty()) { if (!sublist.isEmpty()) {
// load subfolders // load subfolders
createClipsFromList(sublist, checkRemovable, parentFolder, model, undo, redo); created = created || createClipsFromList(sublist, checkRemovable, parentFolder, model, undo, redo);
} }
} else { } else {
bool ok = pCore->projectItemModel()->requestAddFolder(folderId, dir.dirName(), parentFolder, local_undo, local_redo); bool ok = pCore->projectItemModel()->requestAddFolder(folderId, dir.dirName(), parentFolder, local_undo, local_redo);
if (ok) { if (ok) {
ok = createClipsFromList(folderFiles, checkRemovable, folderId, model, local_undo, local_redo); ok = createClipsFromList(folderFiles, checkRemovable, folderId, model, local_undo, local_redo);
created = true;
if (!ok) { if (!ok) {
local_undo(); local_undo();
} else { } else {
...@@ -296,7 +296,7 @@ bool ClipCreator::createClipsFromList(const QList<QUrl> &list, bool checkRemovab ...@@ -296,7 +296,7 @@ bool ClipCreator::createClipsFromList(const QList<QUrl> &list, bool checkRemovab
QString id = ClipCreator::createClipFromFile(file.toLocalFile(), parentFolder, model, undo, redo); QString id = ClipCreator::createClipFromFile(file.toLocalFile(), parentFolder, model, undo, redo);
created = created || (id != QStringLiteral("-1")); created = created || (id != QStringLiteral("-1"));
} }
qDebug() << "/////////// creatclipsfromlist return"; qDebug() << "/////////// creatclipsfromlist return" << created;
return created; return created;
} }
......
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