| 202 | } |
| 203 | |
| 204 | void FileEditController::applyAllForCurrentMessage() |
| 205 | { |
| 206 | if (m_currentRequestId.isEmpty()) { |
| 207 | emit errorOccurred(QString("No active message with file edits")); |
| 208 | return; |
| 209 | } |
| 210 | |
| 211 | LOG_MESSAGE(QString("Applying all file edits for message: %1").arg(m_currentRequestId)); |
| 212 | |
| 213 | QString errorMsg; |
| 214 | bool success = Context::ChangesManager::instance() |
| 215 | .reapplyAllEditsForRequest(m_currentRequestId, &errorMsg); |
| 216 | |
| 217 | if (success) { |
| 218 | emit infoMessage(QString("All file edits applied successfully")); |
| 219 | } else { |
| 220 | emit errorOccurred( |
| 221 | errorMsg.isEmpty() |
| 222 | ? QString("Failed to apply some file edits") |
| 223 | : QString("Failed to apply some file edits:\n%1").arg(errorMsg)); |
| 224 | } |
| 225 | |
| 226 | auto edits = Context::ChangesManager::instance().getEditsForRequest(m_currentRequestId); |
| 227 | for (const auto &edit : edits) { |
| 228 | if (edit.status == Context::ChangesManager::Applied) { |
| 229 | updateFileEditStatus(edit.editId, "applied"); |
| 230 | } |
| 231 | } |
| 232 | |
| 233 | updateStats(); |
| 234 | } |
| 235 | |
| 236 | void FileEditController::undoAllForCurrentMessage() |
| 237 | { |
no test coverage detected