diff options
author | Gunnar Beutner <gbeutner@serenityos.org> | 2021-06-22 19:19:47 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-06-22 22:56:22 +0200 |
commit | de84b3fa1c9bcba80a675e837414eb0f96b24aef (patch) | |
tree | d864a5028a6a0622ed9346907e4c60d70f0f6a73 /Userland/DevTools/Playground/main.cpp | |
parent | 3d42297ecdf82ddf82ccec8c715468b99e79ab88 (diff) | |
download | serenity-de84b3fa1c9bcba80a675e837414eb0f96b24aef.zip |
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.
Diffstat (limited to 'Userland/DevTools/Playground/main.cpp')
-rw-r--r-- | Userland/DevTools/Playground/main.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Userland/DevTools/Playground/main.cpp b/Userland/DevTools/Playground/main.cpp index b65d65b9a4..0fc5ecb5a0 100644 --- a/Userland/DevTools/Playground/main.cpp +++ b/Userland/DevTools/Playground/main.cpp @@ -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; } |