| 1266 | } |
| 1267 | |
| 1268 | void 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" |
nothing calls this directly
no test coverage detected