| 237 | } |
| 238 | |
| 239 | int SubsController::TryToClose(bool allow_cancel) const { |
| 240 | if (!IsModified()) |
| 241 | return wxYES; |
| 242 | |
| 243 | int flags = wxYES_NO; |
| 244 | if (allow_cancel) |
| 245 | flags |= wxCANCEL; |
| 246 | int result = wxMessageBox(fmt_tl("Do you want to save changes to %s?", Filename()), _("Unsaved changes"), flags, context->parent); |
| 247 | if (result == wxYES) { |
| 248 | cmd::call("subtitle/save", context); |
| 249 | // If it fails saving, return cancel anyway |
| 250 | return IsModified() ? wxCANCEL : wxYES; |
| 251 | } |
| 252 | return result; |
| 253 | } |
| 254 | |
| 255 | void SubsController::AutoSave() { |
| 256 | if (commit_id == autosaved_commit_id) |
no test coverage detected