mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-06 09:36:08 +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
Notes:
sideshowbarker
2024-07-18 11:38:52 +09:00
Author: https://github.com/gunnarbeutner
Commit: de84b3fa1c
Pull-request: https://github.com/SerenityOS/serenity/pull/8206
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