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

Method deleted

kdevplatform/project/abstractfilemanagerplugin.cpp:303–348  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

301}
302
303void AbstractFileManagerPluginPrivate::deleted(const QString& path_)
304{
305 if ( QFile::exists(path_) ) {
306 // we delay handling of the signal, so maybe the path actually exists again
307 return;
308 }
309 // ensure that the path is not inside a stopped folder
310 for (const QString& folder : std::as_const(m_stoppedFolders)) {
311 if (path_.startsWith(folder)) {
312 return;
313 }
314 }
315 qCDebug(FILEMANAGER) << "deleted:" << path_;
316
317 const Path path(QUrl::fromLocalFile(path_));
318 const IndexedString indexed(path.pathOrUrl());
319
320 QHashIterator<IProject*, KDirWatch*> it(m_watchers);
321 while (it.hasNext()) {
322 const auto p = it.next().key();
323 if (path == p->path()) {
324 KMessageBox::error(qApp->activeWindow(),
325 i18n("The base folder of project <b>%1</b>"
326 " got deleted or moved outside of KDevelop.\n"
327 "The project has to be closed.", p->name()),
328 i18nc("@title:window", "Project Folder Deleted") );
329 ICore::self()->projectController()->closeProject(p);
330 continue;
331 }
332 if ( !p->projectItem()->model() ) {
333 // not yet finished with loading
334 // FIXME: how should this be handled? see unit test
335 continue;
336 }
337 const auto folderItems = p->foldersForPath(indexed);
338 for (ProjectFolderItem* item : folderItems) {
339 delete item;
340 }
341 const auto fileItems = p->filesForPath(indexed);
342 for (ProjectFileItem* item : fileItems) {
343 emit q->fileRemoved(item);
344 ifDebug(qCDebug(FILEMANAGER) << "removing file" << item;)
345 delete item;
346 }
347 }
348}
349
350bool AbstractFileManagerPluginPrivate::rename(ProjectBaseItem* item, const Path& newPath)
351{

Callers 1

importMethod · 0.45

Calls 12

pathOrUrlMethod · 0.80
projectControllerMethod · 0.80
foldersForPathMethod · 0.80
hasNextMethod · 0.45
keyMethod · 0.45
nextMethod · 0.45
pathMethod · 0.45
nameMethod · 0.45
closeProjectMethod · 0.45
modelMethod · 0.45
projectItemMethod · 0.45
filesForPathMethod · 0.45

Tested by

no test coverage detected