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

Method vcsAnnotateCurrentDocument

kdevplatform/shell/documentcontroller.cpp:1268–1292  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1266}
1267
1268void DocumentController::vcsAnnotateCurrentDocument()
1269{
1270 IDocument* doc = activeDocument();
1271 if (!doc)
1272 return;
1273
1274 QUrl url = doc->url();
1275 IProject* project = KDevelop::ICore::self()->projectController()->findProjectForUrl(url);
1276 if(project && project->versionControlPlugin()) {
1277 auto* iface = project->versionControlPlugin()->extension<IBasicVersionControl>();
1278 auto helper = new VcsPluginHelper(project->versionControlPlugin(), iface);
1279 connect(doc->textDocument(), &KTextEditor::Document::aboutToClose, helper,
1280 qOverload<KTextEditor::Document*>(&VcsPluginHelper::disposeEventually));
1281 connect(doc->activeTextView(), &KTextEditor::View::annotationBorderVisibilityChanged, helper,
1282 qOverload<KTextEditor::View*, bool>(&VcsPluginHelper::disposeEventually));
1283 helper->addContextDocument(url);
1284 helper->annotation();
1285 }
1286 else {
1287 const QString messageText =
1288 i18n("Could not annotate the document because it is not part of a version-controlled project.");
1289 auto* message = new Sublime::Message(messageText, Sublime::Message::Error);
1290 ICore::self()->uiController()->postMessage(message);
1291 }
1292}
1293
1294#include "moc_documentcontroller.cpp"

Callers

nothing calls this directly

Calls 10

findProjectForUrlMethod · 0.80
projectControllerMethod · 0.80
versionControlPluginMethod · 0.80
addContextDocumentMethod · 0.80
annotationMethod · 0.80
uiControllerMethod · 0.80
urlMethod · 0.45
textDocumentMethod · 0.45
activeTextViewMethod · 0.45
postMessageMethod · 0.45

Tested by

no test coverage detected