mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 13:07:46 +00:00
Playground: Ask to save changes even when the document was never saved
This makes sure to ask the user whether they want to save changes to their current document when opening a file even if the document has never been saved before.
This commit is contained in:
parent
3d42297ecd
commit
de84b3fa1c
1 changed files with 2 additions and 2 deletions
|
@ -172,11 +172,11 @@ int main(int argc, char** argv)
|
|||
});
|
||||
|
||||
file_menu.add_action(GUI::CommonActions::make_open_action([&](auto&) {
|
||||
if (!file_path.is_empty() && window->is_modified()) {
|
||||
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)
|
||||
save_action->activate();
|
||||
if (save_document_first_result == GUI::Dialog::ExecResult::ExecCancel)
|
||||
if (save_document_first_result != GUI::Dialog::ExecResult::ExecNo && window->is_modified())
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue