1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 02:07:34 +00:00

Playground: Show last saved time when asked about unsaved changes

This commit is contained in:
Karol Kosek 2022-02-14 13:21:13 +01:00 committed by Tim Flynn
parent 92449e2f1c
commit cb332bdd2a

View file

@ -181,10 +181,10 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
return;
if (window->is_modified()) {
auto save_document_first_result = GUI::MessageBox::show(window, "Save changes to current document first?", "Warning", GUI::MessageBox::Type::Warning, GUI::MessageBox::InputType::YesNoCancel);
if (save_document_first_result == GUI::Dialog::ExecResult::ExecYes)
auto result = GUI::MessageBox::ask_about_unsaved_changes(window, file_path, editor->document().undo_stack().last_unmodified_timestamp());
if (result == GUI::MessageBox::ExecYes)
save_action->activate();
if (save_document_first_result != GUI::Dialog::ExecResult::ExecNo && window->is_modified())
if (result != GUI::MessageBox::ExecNo && window->is_modified())
return;
}
@ -257,7 +257,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
if (!window->is_modified())
return GUI::Window::CloseRequestDecision::Close;
auto result = GUI::MessageBox::show(window, "The document has been modified. Would you like to save?", "Unsaved changes", GUI::MessageBox::Type::Warning, GUI::MessageBox::InputType::YesNoCancel);
auto result = GUI::MessageBox::ask_about_unsaved_changes(window, file_path, editor->document().undo_stack().last_unmodified_timestamp());
if (result == GUI::MessageBox::ExecYes) {
save_action->activate();
if (window->is_modified())