| 470 | } |
| 471 | |
| 472 | void PatchReviewToolView::kompareModelChanged() { |
| 473 | |
| 474 | QList<QUrl> oldCheckedUrls = m_fileModel->checkedUrls(); |
| 475 | |
| 476 | m_fileModel->clear(); |
| 477 | |
| 478 | if ( !m_plugin->modelList() ) |
| 479 | return; |
| 480 | |
| 481 | QMap<QUrl, KDevelop::VcsStatusInfo::State> additionalUrls = m_plugin->patch()->additionalSelectableFiles(); |
| 482 | |
| 483 | const auto* const models = m_plugin->modelList()->models(); |
| 484 | if( models ) |
| 485 | { |
| 486 | for (auto* model : *models) { |
| 487 | const auto* const diffs = model->differences(); |
| 488 | int cnt = 0; |
| 489 | if ( diffs ) |
| 490 | cnt = diffs->count(); |
| 491 | |
| 492 | const QUrl file = m_plugin->urlForFileModel(model); |
| 493 | if( file.isLocalFile() && !QFileInfo( file.toLocalFile() ).isReadable() ) |
| 494 | continue; |
| 495 | |
| 496 | VcsStatusInfo status; |
| 497 | status.setUrl( file ); |
| 498 | status.setState( cnt>0 ? VcsStatusInfo::ItemModified : VcsStatusInfo::ItemUpToDate ); |
| 499 | |
| 500 | m_fileModel->updateState( status, cnt ); |
| 501 | } |
| 502 | } |
| 503 | |
| 504 | for( QMap<QUrl, KDevelop::VcsStatusInfo::State>::const_iterator it = additionalUrls.constBegin(); it != additionalUrls.constEnd(); ++it ) { |
| 505 | VcsStatusInfo status; |
| 506 | status.setUrl( it.key() ); |
| 507 | status.setState( it.value() ); |
| 508 | m_fileModel->updateState( status ); |
| 509 | } |
| 510 | |
| 511 | if(!m_resetCheckedUrls) |
| 512 | m_fileModel->setCheckedUrls(oldCheckedUrls); |
| 513 | else |
| 514 | m_resetCheckedUrls = false; |
| 515 | |
| 516 | for (auto c = 0, columnCount = m_fileSortProxyModel->columnCount(); c != columnCount; ++c) { |
| 517 | m_editPatch.filesList->resizeColumnToContents(c); |
| 518 | } |
| 519 | |
| 520 | // Eventually select the active document |
| 521 | documentActivated( ICore::self()->documentController()->activeDocument() ); |
| 522 | } |
| 523 | |
| 524 | void PatchReviewToolView::documentActivated( IDocument* doc ) { |
| 525 | if( !doc ) |
nothing calls this directly
no test coverage detected