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

Method annotationContextMenuAboutToShow

kdevplatform/vcs/vcspluginhelper.cpp:429–460  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

427}
428
429void VcsPluginHelper::annotationContextMenuAboutToShow( KTextEditor::View* view, QMenu* menu, int line )
430{
431 Q_D(VcsPluginHelper);
432
433 view->annotationItemDelegate()->hideTooltip(view);
434
435 const auto* const model = qobject_cast<VcsAnnotationModel*>(view->document()->annotationModel());
436 Q_ASSERT(model);
437
438 VcsRevision rev = model->revisionForLine(line);
439 // check if the user clicked on a row without revision information
440 if (rev.revisionType() == VcsRevision::Invalid) {
441 // in this case, do not action depending on revision information
442 return;
443 }
444
445 d->diffForRevAction->setData(QVariant::fromValue(rev));
446 d->diffForRevGlobalAction->setData(QVariant::fromValue(rev));
447 menu->addSeparator();
448 menu->addAction(d->diffForRevAction);
449 menu->addAction(d->diffForRevGlobalAction);
450
451 QAction* copyAction = menu->addAction(QIcon::fromTheme(QStringLiteral("edit-copy")), i18nc("@action:inmenu", "Copy Revision Id"));
452 connect(copyAction, &QAction::triggered, this, [rev]() {
453 QApplication::clipboard()->setText(rev.revisionValue().toString());
454 });
455
456 QAction* historyAction = menu->addAction(QIcon::fromTheme(QStringLiteral("view-history")), i18nc("@action:inmenu revision history", "History..."));
457 connect(historyAction, &QAction::triggered, this, [this, rev]() {
458 history(rev);
459 });
460}
461
462void VcsPluginHelper::handleAnnotationBorderVisibilityChanged(KTextEditor::View* view, bool visible)
463{

Callers

nothing calls this directly

Calls 9

hideTooltipMethod · 0.80
revisionForLineMethod · 0.80
revisionTypeMethod · 0.80
revisionValueMethod · 0.80
documentMethod · 0.45
setDataMethod · 0.45
addActionMethod · 0.45
setTextMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected