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

Method import

kdevplatform/project/abstractfilemanagerplugin.cpp:458–498  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

456}
457
458ProjectFolderItem *AbstractFileManagerPlugin::import( IProject *project )
459{
460 Q_D(AbstractFileManagerPlugin);
461
462 ProjectFolderItem *projectRoot = createFolderItem( project, project->path(), nullptr );
463 emit folderAdded( projectRoot );
464 qCDebug(FILEMANAGER) << "imported new project" << project->name() << "at" << projectRoot->path();
465
466 ///TODO: check if this works for remote files when something gets changed through another KDE app
467 if ( project->path().isLocalFile() ) {
468 auto watcher = new KDirWatch( project );
469
470 // set up the signal handling
471 // NOTE: We delay handling of the creation/deletion events here by one second to prevent
472 // useless or even outright wrong handling of events during common git workflows.
473 // I.e. sometimes we used to get a 'delete' event during a rebase which was never
474 // followed up by a 'created' signal, even though the file actually exists after
475 // the rebase.
476 // see also: https://bugs.kde.org/show_bug.cgi?id=404184
477 connect(watcher, &KDirWatch::created,
478 this, [this] (const QString& path) {
479 QTimer::singleShot(1000, this, [this, path]() {
480 Q_D(AbstractFileManagerPlugin);
481 d->created(path);
482 });
483 });
484 connect(watcher, &KDirWatch::deleted,
485 this, [this] (const QString& path) {
486 QTimer::singleShot(1000, this, [this, path]() {
487 Q_D(AbstractFileManagerPlugin);
488 d->deleted(path);
489 });
490 });
491 watcher->addDir(project->path().toLocalFile(), KDirWatch::WatchSubDirs | KDirWatch:: WatchFiles );
492 d->m_watchers[project] = watcher;
493 }
494
495 d->m_filters.add(project);
496
497 return projectRoot;
498}
499
500KJob* AbstractFileManagerPlugin::createImportJob(ProjectFolderItem* item)
501{

Callers 2

startFunction · 0.45
mainFunction · 0.45

Calls 7

isLocalFileMethod · 0.80
createdMethod · 0.80
toLocalFileMethod · 0.80
pathMethod · 0.45
nameMethod · 0.45
deletedMethod · 0.45
addMethod · 0.45

Tested by 2

startFunction · 0.36
mainFunction · 0.36