mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 06:27:45 +00:00
Playground: Show last saved time when asked about unsaved changes
This commit is contained in:
parent
92449e2f1c
commit
cb332bdd2a
1 changed files with 4 additions and 4 deletions
|
@ -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())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue