MCPcopy Create free account
hub / github.com/KDE/kdevelop / kompareModelChanged

Method kompareModelChanged

plugins/patchreview/patchreviewtoolview.cpp:472–522  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

470}
471
472void 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
524void PatchReviewToolView::documentActivated( IDocument* doc ) {
525 if( !doc )

Callers

nothing calls this directly

Calls 15

checkedUrlsMethod · 0.80
modelListMethod · 0.80
patchMethod · 0.80
modelsMethod · 0.80
urlForFileModelMethod · 0.80
isLocalFileMethod · 0.80
isReadableMethod · 0.80
toLocalFileMethod · 0.80
constBeginMethod · 0.80
constEndMethod · 0.80
activeDocumentMethod · 0.80
documentControllerMethod · 0.80

Tested by

no test coverage detected