Changeset View
Changeset View
Standalone View
Standalone View
kdevplatform/project/abstractfilemanagerplugin.cpp
Show First 20 Lines • Show All 114 Lines • ▼ Show 20 Line(s) | 114 | if ( m_projectJobs.contains(project) ) { | |||
---|---|---|---|---|---|
115 | // make sure the import job does not live longer than the project | 115 | // make sure the import job does not live longer than the project | ||
116 | // see also addLotsOfFiles test | 116 | // see also addLotsOfFiles test | ||
117 | foreach( FileManagerListJob* job, m_projectJobs[project] ) { | 117 | foreach( FileManagerListJob* job, m_projectJobs[project] ) { | ||
118 | qCDebug(FILEMANAGER) << "killing project job:" << job; | 118 | qCDebug(FILEMANAGER) << "killing project job:" << job; | ||
119 | job->abort(); | 119 | job->abort(); | ||
120 | } | 120 | } | ||
121 | m_projectJobs.remove(project); | 121 | m_projectJobs.remove(project); | ||
122 | } | 122 | } | ||
123 | #ifdef TIME_IMPORT_JOB | 123 | #ifdef TIME_IMPORT_JOB | ||
mwolff: If you find this overly useful (I don't personally, but OK), please commit this part right away… | |||||
Not exactly like that: the timer should only be started when the project is still being watched. Without that conditional the debug statement can print multiple additional times with a 0s timing. I'll push to 5.2 and hold off updating this rev. until the commit has been merged by someone. rjvbb: Not exactly like that: the timer should only be started when the project is still being watched. | |||||
124 | QElapsedTimer timer; | 124 | QElapsedTimer timer; | ||
125 | if (m_watchers.contains(project)) { | 125 | if (m_watchers.contains(project)) { | ||
126 | timer.start(); | 126 | timer.start(); | ||
127 | } | 127 | } | ||
128 | #endif | 128 | #endif | ||
129 | delete m_watchers.take(project); | 129 | delete m_watchers.take(project); | ||
130 | #ifdef TIME_IMPORT_JOB | 130 | #ifdef TIME_IMPORT_JOB | ||
131 | if (timer.isValid()) { | 131 | if (timer.isValid()) { | ||
▲ Show 20 Lines • Show All 354 Lines • ▼ Show 20 Line(s) | |||||
486 | ProjectFolderItem *AbstractFileManagerPlugin::import( IProject *project ) | 486 | ProjectFolderItem *AbstractFileManagerPlugin::import( IProject *project ) | ||
487 | { | 487 | { | ||
488 | ProjectFolderItem *projectRoot = createFolderItem( project, project->path(), nullptr ); | 488 | ProjectFolderItem *projectRoot = createFolderItem( project, project->path(), nullptr ); | ||
489 | emit folderAdded( projectRoot ); | 489 | emit folderAdded( projectRoot ); | ||
490 | qCDebug(FILEMANAGER) << "imported new project" << project->name() << "at" << projectRoot->path(); | 490 | qCDebug(FILEMANAGER) << "imported new project" << project->name() << "at" << projectRoot->path(); | ||
491 | 491 | | |||
492 | ///TODO: check if this works for remote files when something gets changed through another KDE app | 492 | ///TODO: check if this works for remote files when something gets changed through another KDE app | ||
493 | if ( project->path().isLocalFile() ) { | 493 | if ( project->path().isLocalFile() ) { | ||
494 | d->m_watchers[project] = new KDirWatch( project ); | 494 | auto watcher = new KDirWatch( project ); | ||
this part of the patch (i.e. introducing the temporary and referencing it instead of looking it up repeatedly in m_watchers) is fine, but unrelated to this patch. Please commit it separately. mwolff: this part of the patch (i.e. introducing the temporary and referencing it instead of looking it… | |||||
495 | 495 | | |||
496 | connect(d->m_watchers[project], &KDirWatch::created, | 496 | // set up the signal handling | ||
497 | connect(watcher, &KDirWatch::created, | ||||
497 | this, [&] (const QString& path_) { d->created(path_); }); | 498 | this, [&] (const QString& path_) { d->created(path_); }); | ||
498 | connect(d->m_watchers[project], &KDirWatch::deleted, | 499 | connect(watcher, &KDirWatch::deleted, | ||
499 | this, [&] (const QString& path_) { d->deleted(path_); }); | 500 | this, [&] (const QString& path_) { d->deleted(path_); }); | ||
500 | 501 | watcher->addDir(project->path().toLocalFile(), KDirWatch::WatchSubDirs | KDirWatch:: WatchFiles ); | |||
501 | d->m_watchers[project]->addDir(project->path().toLocalFile(), KDirWatch::WatchSubDirs | KDirWatch:: WatchFiles ); | 502 | d->m_watchers[project] = watcher; | ||
502 | } | 503 | } | ||
503 | 504 | | |||
504 | d->m_filters.add(project); | 505 | d->m_filters.add(project); | ||
505 | 506 | | |||
506 | return projectRoot; | 507 | return projectRoot; | ||
507 | } | 508 | } | ||
508 | 509 | | |||
509 | KJob* AbstractFileManagerPlugin::createImportJob(ProjectFolderItem* item) | 510 | KJob* AbstractFileManagerPlugin::createImportJob(ProjectFolderItem* item) | ||
▲ Show 20 Lines • Show All 171 Lines • Show Last 20 Lines |
If you find this overly useful (I don't personally, but OK), please commit this part right away with the following code: