summaryrefslogtreecommitdiff
path: root/Userland/Applications/FontEditor
diff options
context:
space:
mode:
authorKarol Kosek <krkk@serenityos.org>2021-10-13 22:09:38 +0200
committerLinus Groh <mail@linusgroh.de>2021-10-17 13:53:08 +0100
commit72378fd36c92686e8a7d9dccb8df8c3727cc887d (patch)
treebee188a5afab530d03cfd8437872f64b78f5092c /Userland/Applications/FontEditor
parent59caa4edda77dcad4664027ac4def4a64833a0b3 (diff)
downloadserenity-72378fd36c92686e8a7d9dccb8df8c3727cc887d.zip
FontEditor: Reuse the request_close() function in Open action
Diffstat (limited to 'Userland/Applications/FontEditor')
-rw-r--r--Userland/Applications/FontEditor/FontEditor.cpp13
1 files changed, 3 insertions, 10 deletions
diff --git a/Userland/Applications/FontEditor/FontEditor.cpp b/Userland/Applications/FontEditor/FontEditor.cpp
index f4e8b4b9c2..e17adbc5ca 100644
--- a/Userland/Applications/FontEditor/FontEditor.cpp
+++ b/Userland/Applications/FontEditor/FontEditor.cpp
@@ -165,16 +165,9 @@ FontEditorWidget::FontEditorWidget(const String& path, RefPtr<Gfx::BitmapFont>&&
});
m_new_action->set_status_tip("Create a new font");
m_open_action = GUI::CommonActions::make_open_action([&](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;
+
Optional<String> open_path = GUI::FilePicker::get_open_filepath(window(), {}, "/res/fonts/");
if (!open_path.has_value())
return;