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

Method updateReview

plugins/patchreview/patchreview.cpp:432–481  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

430}
431
432void PatchReviewPlugin::updateReview()
433{
434 if( !m_patch )
435 return;
436
437 m_updateKompareTimer->stop();
438
439 switchToEmptyReviewArea();
440
441 KDevelop::IDocumentController *docController = ICore::self()->documentController();
442 // don't add documents opened automatically to the Files/Open Recent list
443 IDocument* futureActiveDoc = docController->openDocument( m_patch->file(), KTextEditor::Range::invalid(),
444 IDocumentController::DoNotAddToRecentOpen );
445
446 updateKompareModel();
447
448 if ( !m_modelList || !futureActiveDoc || !futureActiveDoc->textDocument() ) {
449 // might happen if e.g. openDocument dialog was cancelled by user
450 // or under the theoretic possibility of a non-text document getting opened
451 return;
452 }
453
454 futureActiveDoc->textDocument()->setReadWrite( false );
455 futureActiveDoc->setPrettyName(i18nc("@title complete patch", "Overview"));
456 futureActiveDoc->textDocument()->setModifiedOnDiskWarning(false);
457
458 docController->activateDocument( futureActiveDoc );
459
460 auto* toolView = qobject_cast<PatchReviewToolView*>(ICore::self()->uiController()->findToolView(i18nc("@title:window", "Patch Review"), m_factory));
461 Q_ASSERT( toolView );
462
463 //Open all relates files
464 for( int a = 0; a < m_modelList->modelCount() && a < maximumFilesToOpenDirectly; ++a ) {
465 QUrl absoluteUrl = urlForFileModel( m_modelList->modelAt( a ) );
466 if (absoluteUrl.isRelative()) {
467 const QString messageText = i18n("The base directory of the patch must be an absolute directory.");
468 auto* message = new Sublime::Message(messageText, Sublime::Message::Error);
469 ICore::self()->uiController()->postMessage(message);
470 break;
471 }
472
473 if( QFileInfo::exists( absoluteUrl.toLocalFile() ) && absoluteUrl.toLocalFile() != QLatin1String("/dev/null") )
474 {
475 toolView->open( absoluteUrl, false );
476 }else{
477 // Maybe the file was deleted
478 qCDebug(PLUGIN_PATCHREVIEW) << "could not open" << absoluteUrl << "because it doesn't exist";
479 }
480 }
481}
482
483void PatchReviewPlugin::setPatch( IPatchSource* patch ) {
484 if ( patch == m_patch ) {

Callers

nothing calls this directly

Calls 13

stopMethod · 0.80
documentControllerMethod · 0.80
activateDocumentMethod · 0.80
findToolViewMethod · 0.80
uiControllerMethod · 0.80
toLocalFileMethod · 0.80
invalidFunction · 0.50
openDocumentMethod · 0.45
fileMethod · 0.45
textDocumentMethod · 0.45
setPrettyNameMethod · 0.45
postMessageMethod · 0.45

Tested by

no test coverage detected