mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 00:57:45 +00:00
FontEditor: Reuse the request_close() function in Open action
This commit is contained in:
parent
59caa4edda
commit
72378fd36c
1 changed files with 3 additions and 10 deletions
|
@ -165,16 +165,9 @@ FontEditorWidget::FontEditorWidget(const String& path, RefPtr<Gfx::BitmapFont>&&
|
||||||
});
|
});
|
||||||
m_new_action->set_status_tip("Create a new font");
|
m_new_action->set_status_tip("Create a new font");
|
||||||
m_open_action = GUI::CommonActions::make_open_action([&](auto&) {
|
m_open_action = GUI::CommonActions::make_open_action([&](auto&) {
|
||||||
if (window()->is_modified()) {
|
if (!request_close())
|
||||||
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;
|
return;
|
||||||
}
|
|
||||||
if (result == GUI::Dialog::ExecResult::ExecCancel)
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Optional<String> open_path = GUI::FilePicker::get_open_filepath(window(), {}, "/res/fonts/");
|
Optional<String> open_path = GUI::FilePicker::get_open_filepath(window(), {}, "/res/fonts/");
|
||||||
if (!open_path.has_value())
|
if (!open_path.has_value())
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue