| 150 | } |
| 151 | |
| 152 | void ProjectChangesModel::statusReady(KJob* job) |
| 153 | { |
| 154 | auto* status=static_cast<VcsJob*>(job); |
| 155 | |
| 156 | const QList<QVariant> states = status->fetchResults().toList(); |
| 157 | auto* project = job->property("project").value<KDevelop::IProject*>(); |
| 158 | if(!project) |
| 159 | return; |
| 160 | |
| 161 | QSet<QUrl> foundUrls; |
| 162 | foundUrls.reserve(states.size()); |
| 163 | for (const QVariant& state : states) { |
| 164 | const VcsStatusInfo st = state.value<VcsStatusInfo>(); |
| 165 | foundUrls += st.url(); |
| 166 | |
| 167 | updateState(project, st); |
| 168 | } |
| 169 | |
| 170 | QStandardItem* itProject = projectItem(project); |
| 171 | if (!itProject) { |
| 172 | qCDebug(PROJECT) << "Project no longer listed in model:" << project->name() << "- skipping update"; |
| 173 | return; |
| 174 | } |
| 175 | |
| 176 | IBasicVersionControl::RecursionMode mode = IBasicVersionControl::RecursionMode(job->property("mode").toInt()); |
| 177 | const QList<QUrl> projectUrls = urls(itProject); |
| 178 | const QSet<QUrl> uncertainUrls = QSet<QUrl>(projectUrls.begin(), projectUrls.end()).subtract(foundUrls); |
| 179 | const QList<QUrl> sourceUrls = job->property("urls").value<QList<QUrl>>(); |
| 180 | for (const QUrl& url : sourceUrls) { |
| 181 | if(url.isLocalFile() && QDir(url.toLocalFile()).exists()) { |
| 182 | for (const QUrl& currentUrl : uncertainUrls) { |
| 183 | if((mode == IBasicVersionControl::NonRecursive && currentUrl.adjusted(QUrl::RemoveFilename | QUrl::StripTrailingSlash) == url.adjusted(QUrl::StripTrailingSlash)) |
| 184 | || (mode == IBasicVersionControl::Recursive && url.isParentOf(currentUrl)) |
| 185 | ) { |
| 186 | removeUrl(itProject->index(), currentUrl); |
| 187 | } |
| 188 | } |
| 189 | } |
| 190 | } |
| 191 | } |
| 192 | |
| 193 | void ProjectChangesModel::documentSaved(KDevelop::IDocument* document) |
| 194 | { |
nothing calls this directly
no test coverage detected