Changeset View
Changeset View
Standalone View
Standalone View
kdevplatform/project/abstractfilemanagerplugin.cpp
Show First 20 Lines • Show All 111 Lines • ▼ Show 20 Line(s) | 111 | if ( m_projectJobs.contains(project) ) { | |||
---|---|---|---|---|---|
112 | // make sure the import job does not live longer than the project | 112 | // make sure the import job does not live longer than the project | ||
113 | // see also addLotsOfFiles test | 113 | // see also addLotsOfFiles test | ||
114 | foreach( FileManagerListJob* job, m_projectJobs[project] ) { | 114 | foreach( FileManagerListJob* job, m_projectJobs[project] ) { | ||
115 | qCDebug(FILEMANAGER) << "killing project job:" << job; | 115 | qCDebug(FILEMANAGER) << "killing project job:" << job; | ||
116 | job->abort(); | 116 | job->abort(); | ||
117 | } | 117 | } | ||
118 | m_projectJobs.remove(project); | 118 | m_projectJobs.remove(project); | ||
119 | } | 119 | } | ||
120 | delete m_watchers.take(project); | 120 | delete m_watchers.take(project); | ||
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. | |||||
121 | m_filters.remove(project); | 121 | m_filters.remove(project); | ||
122 | } | 122 | } | ||
123 | 123 | | |||
124 | KIO::Job* AbstractFileManagerPluginPrivate::eventuallyReadFolder(ProjectFolderItem* item) | 124 | KIO::Job* AbstractFileManagerPluginPrivate::eventuallyReadFolder(ProjectFolderItem* item) | ||
125 | { | 125 | { | ||
126 | FileManagerListJob* listJob = new FileManagerListJob( item ); | 126 | FileManagerListJob* listJob = new FileManagerListJob( item ); | ||
127 | m_projectJobs[ item->project() ] << listJob; | 127 | m_projectJobs[ item->project() ] << listJob; | ||
128 | qCDebug(FILEMANAGER) << "adding job" << listJob << item << item->path() << "for project" << item->project(); | 128 | qCDebug(FILEMANAGER) << "adding job" << listJob << item << item->path() << "for project" << item->project(); | ||
▲ Show 20 Lines • Show All 343 Lines • ▼ Show 20 Line(s) | |||||
472 | ProjectFolderItem *AbstractFileManagerPlugin::import( IProject *project ) | 472 | ProjectFolderItem *AbstractFileManagerPlugin::import( IProject *project ) | ||
473 | { | 473 | { | ||
474 | ProjectFolderItem *projectRoot = createFolderItem( project, project->path(), nullptr ); | 474 | ProjectFolderItem *projectRoot = createFolderItem( project, project->path(), nullptr ); | ||
475 | emit folderAdded( projectRoot ); | 475 | emit folderAdded( projectRoot ); | ||
476 | qCDebug(FILEMANAGER) << "imported new project" << project->name() << "at" << projectRoot->path(); | 476 | qCDebug(FILEMANAGER) << "imported new project" << project->name() << "at" << projectRoot->path(); | ||
477 | 477 | | |||
478 | ///TODO: check if this works for remote files when something gets changed through another KDE app | 478 | ///TODO: check if this works for remote files when something gets changed through another KDE app | ||
479 | if ( project->path().isLocalFile() ) { | 479 | if ( project->path().isLocalFile() ) { | ||
480 | d->m_watchers[project] = new KDirWatch( project ); | 480 | d->m_watchers[project] = 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… | |||||
481 | 481 | | |||
482 | connect(d->m_watchers[project], &KDirWatch::created, | 482 | connect(d->m_watchers[project], &KDirWatch::created, | ||
483 | this, [&] (const QString& path_) { d->created(path_); }); | 483 | this, [&] (const QString& path_) { d->created(path_); }); | ||
484 | connect(d->m_watchers[project], &KDirWatch::deleted, | 484 | connect(d->m_watchers[project], &KDirWatch::deleted, | ||
485 | this, [&] (const QString& path_) { d->deleted(path_); }); | 485 | this, [&] (const QString& path_) { d->deleted(path_); }); | ||
486 | 486 | | |||
487 | d->m_watchers[project]->addDir(project->path().toLocalFile(), KDirWatch::WatchSubDirs | KDirWatch:: WatchFiles ); | 487 | d->m_watchers[project]->addDir(project->path().toLocalFile(), KDirWatch::WatchSubDirs | KDirWatch:: WatchFiles ); | ||
488 | } | 488 | } | ||
▲ Show 20 Lines • Show All 167 Lines • ▼ Show 20 Line(s) | 655 | { | |||
656 | return new ProjectFolderItem( project, path, parent ); | 656 | return new ProjectFolderItem( project, path, parent ); | ||
657 | } | 657 | } | ||
658 | 658 | | |||
659 | KDirWatch* AbstractFileManagerPlugin::projectWatcher( IProject* project ) const | 659 | KDirWatch* AbstractFileManagerPlugin::projectWatcher( IProject* project ) const | ||
660 | { | 660 | { | ||
661 | return d->m_watchers.value( project, nullptr ); | 661 | return d->m_watchers.value( project, nullptr ); | ||
662 | } | 662 | } | ||
663 | 663 | | |||
664 | int AbstractFileManagerPlugin::watchedItems( IProject* project ) const | ||||
665 | { | ||||
666 | return project->fileSet().size(); | ||||
667 | } | ||||
668 | | ||||
669 | void AbstractFileManagerPlugin::projectClosing( IProject *project ) | ||||
670 | { | ||||
671 | d->projectClosing(project); | ||||
672 | } | ||||
673 | | ||||
664 | //END Plugin | 674 | //END Plugin | ||
665 | 675 | | |||
666 | #include "moc_abstractfilemanagerplugin.cpp" | 676 | #include "moc_abstractfilemanagerplugin.cpp" |
If you find this overly useful (I don't personally, but OK), please commit this part right away with the following code: