MCPcopy Create free account
hub / github.com/KDE/kdevelop / moveFilesAndFolders

Method moveFilesAndFolders

kdevplatform/project/abstractfilemanagerplugin.cpp:599–635  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

597}
598
599bool 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
637bool AbstractFileManagerPlugin::copyFilesAndFolders(const Path::List& items, ProjectFolderItem* newParent)
638{

Callers 2

dropEventMethod · 0.45
copyMoveItemsFunction · 0.45

Calls 11

parentFolderFunction · 0.85
folderMethod · 0.80
stopWatcherMethod · 0.80
baseNameMethod · 0.80
eventuallyReadFolderMethod · 0.80
execMethod · 0.80
continueWatcherMethod · 0.80
fileMethod · 0.45
pathMethod · 0.45
projectMethod · 0.45
toUrlMethod · 0.45

Tested by

no test coverage detected