| 47 | } |
| 48 | |
| 49 | QVariant VcsOverlayProxyModel::data(const QModelIndex& proxyIndex, int role) const |
| 50 | { |
| 51 | if(role == VcsStatusRole) { |
| 52 | auto* const project = qobject_cast<IProject*>(proxyIndex.data(ProjectModel::ProjectRole).value<QObject*>()); |
| 53 | if (!proxyIndex.parent().isValid()) { |
| 54 | return m_branchName.value(project); |
| 55 | } |
| 56 | |
| 57 | // Display the VCS status of the item only if the changes model already exists. The VCS status |
| 58 | // is not essential, not worth the overhead and possible UI freezes due to the inefficient |
| 59 | // tracking of VCS statuses by ProjectChangesModel. See https://bugs.kde.org/show_bug.cgi?id=486949 |
| 60 | if (const auto model = ICore::self()->projectController()->changesModel()) { |
| 61 | if (const auto* const projectItem = model->projectItem(project)) { |
| 62 | const QUrl url = proxyIndex.data(ProjectModel::UrlRole).toUrl(); |
| 63 | return ProjectChangesModel::statusIndexForUrl(*model, projectItem->index(), url).data(Qt::DisplayRole); |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | return {}; |
| 68 | } |
| 69 | |
| 70 | return QIdentityProxyModel::data(proxyIndex, role); |
| 71 | } |
| 72 | |
| 73 | void VcsOverlayProxyModel::addProject(IProject* p) |
| 74 | { |
no test coverage detected