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

Method toggleBreakpoint

kdevplatform/debugger/breakpoint/breakpointmodel.cpp:648–676  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

646}
647
648void BreakpointModel::toggleBreakpoint(const QUrl& url, const KTextEditor::Cursor& cursor)
649{
650 Q_D(BreakpointModel);
651
652 Breakpoint *b = breakpoint(url, cursor.line());
653 if (b) {
654 removeBreakpoint(b);
655 } else {
656 // We forbid adding breakpoints to an untitled/unsaved document by not enabling its breakpoint actions.
657 // The Toggle Breakpoint action is always enabled though, hence the check and early-return below.
658 const auto* const documentController = ICore::self()->documentController();
659 const auto* const doc = documentController ? documentController->documentForUrl(url) : nullptr;
660 const auto* const textDocument = doc ? doc->textDocument() : nullptr;
661 if (textDocument && !(textDocument->editableMarks() & BreakpointMark)) {
662 // Discard the previous message (if any) to prevent stacking of identical messages,
663 // which the user must dismiss one by one.
664 delete d->noBreakpointsInUntitledDocumentMessage.data();
665
666 auto* const message = new Sublime::Message(
667 i18n("A breakpoint cannot be added to an untitled document. Please save the document first."),
668 Sublime::Message::Error);
669 ICore::self()->uiController()->postMessage(message);
670 d->noBreakpointsInUntitledDocumentMessage = message;
671 return;
672 }
673
674 addCodeBreakpoint(url, cursor.line());
675 }
676}
677
678void BreakpointModel::reportChange(Breakpoint* breakpoint, Breakpoint::Column column)
679{

Callers

nothing calls this directly

Calls 7

documentControllerMethod · 0.80
documentForUrlMethod · 0.80
uiControllerMethod · 0.80
lineMethod · 0.45
textDocumentMethod · 0.45
dataMethod · 0.45
postMessageMethod · 0.45

Tested by

no test coverage detected