| 597 | } |
| 598 | |
| 599 | bool AbstractFileManagerPlugin::moveFilesAndFolders(const QList< ProjectBaseItem* >& items, ProjectFolderItem* newParent) |
| 600 | { |
| 601 | Q_D(AbstractFileManagerPlugin); |
| 602 | |
| 603 | bool success = true; |
| 604 | for (ProjectBaseItem* item : items) { |
| 605 | Q_ASSERT(item->folder() || item->file()); |
| 606 | |
| 607 | ProjectFolderItem* oldParent = parentFolder(item); |
| 608 | d->stopWatcher(oldParent); |
| 609 | d->stopWatcher(newParent); |
| 610 | |
| 611 | const Path oldPath = item->path(); |
| 612 | const Path newPath(newParent->path(), item->baseName()); |
| 613 | |
| 614 | success &= renameUrl(oldParent->project(), oldPath.toUrl(), newPath. toUrl()); |
| 615 | if ( success ) { |
| 616 | if (item->file()) { |
| 617 | emit fileRemoved(item->file()); |
| 618 | } else { |
| 619 | emit folderRemoved(item->folder()); |
| 620 | } |
| 621 | delete item; |
| 622 | auto* const readJob = d->eventuallyReadFolder(newParent); |
| 623 | // reload first level synchronously, deeper levels will run async |
| 624 | // this is required for code that expects the new item to exist after |
| 625 | // this method finished |
| 626 | readJob->exec(); |
| 627 | } |
| 628 | |
| 629 | d->continueWatcher(oldParent); |
| 630 | d->continueWatcher(newParent); |
| 631 | if ( !success ) |
| 632 | break; |
| 633 | } |
| 634 | return success; |
| 635 | } |
| 636 | |
| 637 | bool AbstractFileManagerPlugin::copyFilesAndFolders(const Path::List& items, ProjectFolderItem* newParent) |
| 638 | { |
no test coverage detected