| 301 | } |
| 302 | |
| 303 | void 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 | |
| 350 | bool AbstractFileManagerPluginPrivate::rename(ProjectBaseItem* item, const Path& newPath) |
| 351 | { |
no test coverage detected