| 569 | } |
| 570 | |
| 571 | void KUndo2QStack::purgeRedoState() |
| 572 | { |
| 573 | bool macro = !m_macro_stack.isEmpty(); |
| 574 | if (macro) return; |
| 575 | |
| 576 | bool redoStateChanged = false; |
| 577 | bool cleanStateChanged = false; |
| 578 | |
| 579 | while (m_index < m_command_list.size()) { |
| 580 | delete m_command_list.takeLast(); |
| 581 | redoStateChanged = true; |
| 582 | } |
| 583 | |
| 584 | if (m_clean_index > m_index) { |
| 585 | m_clean_index = -1; // we've deleted the clean state |
| 586 | cleanStateChanged = true; |
| 587 | } |
| 588 | |
| 589 | if (redoStateChanged) { |
| 590 | Q_EMIT canRedoChanged(canRedo()); |
| 591 | Q_EMIT redoTextChanged(redoText()); |
| 592 | } |
| 593 | |
| 594 | if (cleanStateChanged) { |
| 595 | Q_EMIT cleanChanged(isClean()); |
| 596 | } |
| 597 | } |
| 598 | |
| 599 | /*! \internal |
| 600 | If the number of commands on the stack exceeds the undo limit, deletes commands from |