void BreakpointWidget::slotPopupMenuAboutToShow()
{
    if (m_debugController->breakpointModel()->rowCount() < 1) {
        m_breakpointDisableAllAction->setDisabled(true);
        m_breakpointEnableAllAction->setDisabled(true);
        m_breakpointRemoveAll->setDisabled(true);
    } else {
        m_breakpointRemoveAll->setEnabled(true);
        bool allDisabled = true;
        bool allEnabled = true;
        for (int i = 0; i < m_debugController->breakpointModel()->rowCount(); i++) {
            Breakpoint *bp = m_debugController->breakpointModel()->breakpoint(i);
            if (bp->enabled())
                allDisabled = false;
            else
                allEnabled = false;
        }
        m_breakpointDisableAllAction->setDisabled(allDisabled);
        m_breakpointEnableAllAction->setDisabled(allEnabled);
    }

}
void BreakpointModel::markContextMenuRequested(Document* document, Mark mark, const QPoint &pos, bool& handled)
{

    int type = mark.type;
    qCDebug(DEBUGGER) << type;

    /* Is this a breakpoint mark, to begin with? */
    if (!(type & AllBreakpointMarks)) return;

    Breakpoint *b = breakpoint(document->url(), mark.line);
    if (!b) {
        QMessageBox::critical(nullptr, i18n("Breakpoint not found"), i18n("Couldn't find breakpoint at %1:%2", document->url().toString(), mark.line));
        return;
    }

    QMenu menu;
    QAction deleteAction(QIcon::fromTheme(QStringLiteral("edit-delete")), i18n("&Delete Breakpoint"), 0);
    QAction disableAction(QIcon::fromTheme(QStringLiteral("dialog-cancel")), i18n("&Disable Breakpoint"), 0);
    QAction enableAction(QIcon::fromTheme(QStringLiteral("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;
}