mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-30 08:41:15 +00:00
FontEditor: Factor out redundant code for a request to close
This commit is contained in:
parent
1e052f5a91
commit
74938e6f42
Notes:
sideshowbarker
2024-07-17 23:21:05 +09:00
Author: https://github.com/thankyouverycool Commit: https://github.com/SerenityOS/serenity/commit/74938e6f426 Pull-request: https://github.com/SerenityOS/serenity/pull/11132
|
@ -135,16 +135,8 @@ FontEditorWidget::FontEditorWidget()
|
|||
m_glyph_map_widget = glyph_map_container.add<GlyphMapWidget>();
|
||||
|
||||
m_new_action = GUI::Action::create("&New Font...", { Mod_Ctrl, Key_N }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-font.png").release_value_but_fixme_should_propagate_errors(), [&](auto&) {
|
||||
if (window()->is_modified()) {
|
||||
auto result = GUI::MessageBox::show(window(), "Save changes to the current font?", "Unsaved changes", GUI::MessageBox::Type::Warning, GUI::MessageBox::InputType::YesNoCancel);
|
||||
if (result == GUI::Dialog::ExecResult::ExecYes) {
|
||||
m_save_action->activate();
|
||||
if (window()->is_modified())
|
||||
return;
|
||||
}
|
||||
if (result == GUI::Dialog::ExecResult::ExecCancel)
|
||||
return;
|
||||
}
|
||||
if (!request_close())
|
||||
return;
|
||||
auto new_font_wizard = NewFontDialog::construct(window());
|
||||
if (new_font_wizard->exec() == GUI::Dialog::ExecOK) {
|
||||
auto metadata = new_font_wizard->new_font_metadata();
|
||||
|
|
Loading…
Reference in a new issue