| 455 | } |
| 456 | |
| 457 | void RepoStatusModel::statusReady(KJob* job) |
| 458 | { |
| 459 | auto* status = qobject_cast<VcsJob*>(job); |
| 460 | if (!status) |
| 461 | return; |
| 462 | |
| 463 | const QList<QVariant> states = status->fetchResults().toList(); |
| 464 | auto* project = job->property("project").value<IProject*>(); |
| 465 | |
| 466 | const auto itProject = projectItem(project); |
| 467 | if (!itProject.isValid()) |
| 468 | return; |
| 469 | |
| 470 | QSet<QUrl> foundUrls; |
| 471 | foundUrls.reserve(states.size()); |
| 472 | for (const auto& state : states) { |
| 473 | const VcsStatusInfo st = state.value<VcsStatusInfo>(); |
| 474 | foundUrls += st.url(); |
| 475 | updateState(itProject, st); |
| 476 | } |
| 477 | |
| 478 | IBasicVersionControl::RecursionMode mode = IBasicVersionControl::RecursionMode(job->property("mode").toInt()); |
| 479 | const QList<QUrl> projectUrls = childUrls(itProject); |
| 480 | const QSet<QUrl> uncertainUrls = QSet<QUrl>(projectUrls.begin(), projectUrls.end()).subtract(foundUrls); |
| 481 | const QList<QUrl> sourceUrls = job->property("urls").value<QList<QUrl>>(); |
| 482 | for (const QUrl& url : sourceUrls) { |
| 483 | if (url.isLocalFile() && QDir(url.toLocalFile()).exists()) { |
| 484 | for (const QUrl& currentUrl : uncertainUrls) { |
| 485 | if ((mode == IBasicVersionControl::NonRecursive |
| 486 | && currentUrl.adjusted(QUrl::RemoveFilename | QUrl::StripTrailingSlash) |
| 487 | == url.adjusted(QUrl::StripTrailingSlash)) |
| 488 | || (mode == IBasicVersionControl::Recursive && url.isParentOf(currentUrl))) { |
| 489 | removeUrl(currentUrl, itProject.project); |
| 490 | } |
| 491 | } |
| 492 | } |
| 493 | } |
| 494 | } |
| 495 | |
| 496 | void RepoStatusModel::documentSaved(const IDocument* document) |
| 497 | { |
nothing calls this directly
no test coverage detected