Commit 5a80aff6 authored by Niko Sams's avatar Niko Sams
Browse files

add context menu to breakpoint mark in kate icon border

Depends on the latest kate 4.8 version (without the menu will
not be shown)

Will not be in KDevelop 4.3 because of new strings.

BUG: 289047
parent 56abdf0c
......@@ -36,6 +36,8 @@
#include "../interfaces/ipartcontroller.h"
#include "breakpoint.h"
#include <KConfigGroup>
#include <QAction>
#include <QMenu>
#define IF_DEBUG(x)
......@@ -89,7 +91,6 @@ void BreakpointModel::slotPartAdded(KParts::Part* part)
iface->setMarkPixmap((MarkInterface::MarkTypes)ReachedBreakpointMark, *reachedBreakpointPixmap());
iface->setMarkPixmap((MarkInterface::MarkTypes)DisabledBreakpointMark, *disabledBreakpointPixmap());
iface->setEditableMarks( MarkInterface::Bookmark | BreakpointMark );
updateMarks();
}
}
......@@ -108,9 +109,47 @@ void BreakpointModel::textDocumentCreated(KDevelop::IDocument* doc)
SLOT(markChanged(KTextEditor::Document*,
KTextEditor::Mark,
KTextEditor::MarkInterface::MarkChangeAction)));
connect(doc->textDocument(), SIGNAL(markContextMenuRequested(KTextEditor::Document*, KTextEditor::Mark, QPoint, bool&)),
SLOT(markContextMenuRequested(KTextEditor::Document*, KTextEditor::Mark, QPoint, bool&)));
}
}
void BreakpointModel::markContextMenuRequested(Document* document, Mark mark, const QPoint &pos, bool& handled)
{
int type = mark.type;
kDebug() << type;
/* Is this a breakpoint mark, to begin with? */
if (!(type & AllBreakpointMarks)) return;
Breakpoint *b = breakpoint(document->url(), mark.line);
Q_ASSERT(b);
if (!b) return;
QMenu menu;
QAction deleteAction(KIcon("edit-delete"), i18n("&Delete Breakpoint"), 0);
QAction disableAction(KIcon("dialog-cancel"), i18n("&Disable Breakpoint"), 0);
QAction enableAction(KIcon("dialog-ok-apply"), i18n("&Enable Breakpoint"), 0);
menu.addAction(&deleteAction);
if (b->enabled()) {
menu.addAction(&disableAction);
} else {
menu.addAction(&enableAction);
}
QAction *a = menu.exec(pos);
if (a == &deleteAction) {
b->setDeleted();
} else if (a == &disableAction) {
b->setData(Breakpoint::EnableColumn, Qt::Unchecked);
} else if (a == &enableAction) {
b->setData(Breakpoint::EnableColumn, Qt::Checked);
}
handled = true;
}
QVariant
BreakpointModel::headerData(int section, Qt::Orientation orientation,
int role) const
......
......@@ -117,6 +117,10 @@ private Q_SLOTS:
void textDocumentCreated(KDevelop::IDocument*);
void documentSaved(KDevelop::IDocument*);
void aboutToDeleteMovingInterfaceContent(KTextEditor::Document *document);
void markContextMenuRequested( KTextEditor::Document* document, KTextEditor::Mark mark,
const QPoint &pos, bool& handled );
private:
static const QPixmap* breakpointPixmap();
static const QPixmap* pendingBreakpointPixmap();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment