| 475 | } |
| 476 | |
| 477 | bool KDevelop::BreakpointModel::removeRows(int row, int count, const QModelIndex& parent) |
| 478 | { |
| 479 | Q_D(BreakpointModel); |
| 480 | |
| 481 | if (count < 1 || (row < 0) || (row + count) > rowCount(parent)) |
| 482 | return false; |
| 483 | |
| 484 | IBreakpointController* controller = breakpointController(); |
| 485 | |
| 486 | beginRemoveRows(parent, row, row+count-1); |
| 487 | for (int i=0; i < count; ++i) { |
| 488 | Breakpoint* b = d->breakpoints.at(row); |
| 489 | b->m_deleted = true; |
| 490 | if (controller) |
| 491 | controller->breakpointAboutToBeDeleted(row); |
| 492 | |
| 493 | b->stopDocumentLineTracking(); |
| 494 | d->breakpoints.removeAt(row); |
| 495 | b->m_model = nullptr; |
| 496 | // To be changed: the controller is currently still responsible for deleting the breakpoint |
| 497 | // object |
| 498 | // FIXME: this whole notion of m_deleted is utterly broken and needs to be fixed properly |
| 499 | // for now just prevent a leak... |
| 500 | d->deletedBreakpoints.append(b); |
| 501 | } |
| 502 | endRemoveRows(); |
| 503 | scheduleSave(); |
| 504 | return true; |
| 505 | } |
| 506 | |
| 507 | int KDevelop::BreakpointModel::rowCount(const QModelIndex& parent) const |
| 508 | { |