| 234 | } |
| 235 | |
| 236 | void FileEditController::undoAllForCurrentMessage() |
| 237 | { |
| 238 | if (m_currentRequestId.isEmpty()) { |
| 239 | emit errorOccurred(QString("No active message with file edits")); |
| 240 | return; |
| 241 | } |
| 242 | |
| 243 | LOG_MESSAGE(QString("Undoing all file edits for message: %1").arg(m_currentRequestId)); |
| 244 | |
| 245 | QString errorMsg; |
| 246 | bool success = Context::ChangesManager::instance() |
| 247 | .undoAllEditsForRequest(m_currentRequestId, &errorMsg); |
| 248 | |
| 249 | if (success) { |
| 250 | emit infoMessage(QString("All file edits undone successfully")); |
| 251 | } else { |
| 252 | emit errorOccurred( |
| 253 | errorMsg.isEmpty() |
| 254 | ? QString("Failed to undo some file edits") |
| 255 | : QString("Failed to undo some file edits:\n%1").arg(errorMsg)); |
| 256 | } |
| 257 | |
| 258 | auto edits = Context::ChangesManager::instance().getEditsForRequest(m_currentRequestId); |
| 259 | for (const auto &edit : edits) { |
| 260 | if (edit.status == Context::ChangesManager::Rejected) { |
| 261 | updateFileEditStatus(edit.editId, "rejected"); |
| 262 | } |
| 263 | } |
| 264 | |
| 265 | updateStats(); |
| 266 | } |
| 267 | |
| 268 | void FileEditController::updateStats() |
| 269 | { |
no test coverage detected