1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 05:28:11 +00:00

Applications: Use GUI::CommonActions for save and save as menu options

This commit is contained in:
Brendan Coles 2020-11-01 21:32:27 +00:00 committed by Andreas Kling
parent 9e80c67608
commit e8ff7c895b
4 changed files with 13 additions and 14 deletions

View file

@ -105,11 +105,11 @@ int main(int argc, char** argv)
set_edited_font(open_path.value(), move(new_font), window->position());
}));
app_menu.add_action(GUI::Action::create("Save", { Mod_Ctrl, Key_S }, Gfx::Bitmap::load_from_file("/res/icons/16x16/save.png"), [&](auto&) {
app_menu.add_action(GUI::CommonActions::make_save_action([&](auto&) {
FontEditorWidget* editor = static_cast<FontEditorWidget*>(window->main_widget());
editor->save_as(editor->path());
}));
app_menu.add_action(GUI::Action::create("Save as...", { Mod_Ctrl | Mod_Shift, Key_S }, Gfx::Bitmap::load_from_file("/res/icons/16x16/save.png"), [&](auto&) {
app_menu.add_action(GUI::CommonActions::make_save_as_action([&](auto&) {
FontEditorWidget* editor = static_cast<FontEditorWidget*>(window->main_widget());
LexicalPath lexical_path(editor->path());
Optional<String> save_path = GUI::FilePicker::get_save_filepath(window, lexical_path.title(), lexical_path.extension());