| 518 | } |
| 519 | |
| 520 | EditFormComboCommand::EditFormComboCommand(Okular::DocumentPrivate *docPriv, FormFieldChoice *form, int pageNumber, const QString &newContents, int newCursorPos, const QString &prevContents, int prevCursorPos, int prevAnchorPos) |
| 521 | : EditTextCommand(newContents, newCursorPos, prevContents, prevCursorPos, prevAnchorPos) |
| 522 | , m_docPriv(docPriv) |
| 523 | , m_form(form) |
| 524 | , m_pageNumber(pageNumber) |
| 525 | , m_newIndex(-1) |
| 526 | , m_prevIndex(-1) |
| 527 | { |
| 528 | setText(i18nc("Edit a combo form's selection", "edit combo form selection")); |
| 529 | |
| 530 | // Determine new and previous choice indices (if any) |
| 531 | for (int i = 0; i < m_form->choices().size(); i++) { |
| 532 | if (m_form->choices().at(i) == m_prevContents) { |
| 533 | m_prevIndex = i; |
| 534 | } |
| 535 | |
| 536 | if (m_form->choices().at(i) == m_newContents) { |
| 537 | m_newIndex = i; |
| 538 | } |
| 539 | } |
| 540 | } |
| 541 | |
| 542 | void EditFormComboCommand::undo() |
| 543 | { |