| 417 | //BEGIN Plugin |
| 418 | |
| 419 | AbstractFileManagerPlugin::AbstractFileManagerPlugin(const QString& componentName, QObject* parent, |
| 420 | const KPluginMetaData& metaData, const QVariantList& /*args*/) |
| 421 | : IProjectFileManager() |
| 422 | , IPlugin(componentName, parent, metaData) |
| 423 | , d_ptr(new AbstractFileManagerPluginPrivate(this)) |
| 424 | { |
| 425 | connect(core()->projectController(), &IProjectController::projectClosing, |
| 426 | this, [this] (IProject* project) { Q_D(AbstractFileManagerPlugin); d->projectClosing(project); }); |
| 427 | connect(core()->projectController()->projectModel(), &ProjectModel::rowsAboutToBeRemoved, |
| 428 | this, [this] (const QModelIndex& parent, int first, int last) { |
| 429 | Q_D(AbstractFileManagerPlugin); |
| 430 | // cleanup list jobs to remove about-to-be-dangling pointers |
| 431 | auto* model = core()->projectController()->projectModel(); |
| 432 | for (int i = first; i <= last; ++i) { |
| 433 | const auto index = model->index(i, 0, parent); |
| 434 | auto* item = index.data(ProjectModel::ProjectItemRole).value<ProjectBaseItem*>(); |
| 435 | Q_ASSERT(item); |
| 436 | for (auto* job : d->m_projectJobs.value(item->project())) { |
| 437 | job->handleRemovedItem(item); |
| 438 | } |
| 439 | } |
| 440 | }); |
| 441 | } |
| 442 | |
| 443 | AbstractFileManagerPlugin::~AbstractFileManagerPlugin() = default; |
| 444 |
nothing calls this directly
no test coverage detected