| 604 | */ |
| 605 | |
| 606 | bool KUndo2QStack::checkUndoLimit() |
| 607 | { |
| 608 | if (m_undo_limit <= 0 || !m_macro_stack.isEmpty() || m_undo_limit >= m_command_list.count()) |
| 609 | return false; |
| 610 | |
| 611 | int del_count = m_command_list.count() - m_undo_limit; |
| 612 | |
| 613 | for (int i = 0; i < del_count; ++i) |
| 614 | delete m_command_list.takeFirst(); |
| 615 | |
| 616 | m_index -= del_count; |
| 617 | if (m_clean_index != -1) { |
| 618 | if (m_clean_index < del_count) |
| 619 | m_clean_index = -1; // we've deleted the clean command |
| 620 | else |
| 621 | m_clean_index -= del_count; |
| 622 | } |
| 623 | return true; |
| 624 | } |
| 625 | |
| 626 | /*! |
| 627 | Constructs an empty undo stack with the parent \a parent. The |