* @brief Deletes the action at @p actionId via the existing selection-based path. */
| 7965 | * @brief Deletes the action at @p actionId via the existing selection-based path. |
| 7966 | */ |
| 7967 | void DataModel::ProjectModel::deleteAction(int actionId, bool confirm) |
| 7968 | { |
| 7969 | if (actionId < 0 || static_cast<size_t>(actionId) >= m_actions.size()) |
| 7970 | return; |
| 7971 | |
| 7972 | const auto previousSelection = m_selectedAction; |
| 7973 | setSelectedAction(m_actions[actionId]); |
| 7974 | |
| 7975 | const bool previousSuppress = m_suppressMessageBoxes; |
| 7976 | m_suppressMessageBoxes = !confirm; |
| 7977 | deleteCurrentAction(); |
| 7978 | m_suppressMessageBoxes = previousSuppress; |
| 7979 | |
| 7980 | if (previousSelection.actionId >= 0 |
| 7981 | && static_cast<size_t>(previousSelection.actionId) < m_actions.size() |
| 7982 | && previousSelection.actionId != actionId) |
| 7983 | setSelectedAction(m_actions[previousSelection.actionId]); |
| 7984 | } |
| 7985 | |
| 7986 | /** |
| 7987 | * @brief Duplicates the action at @p actionId. |