1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 06:07:34 +00:00

ThemeEditor: Add 'Open file' menu action

This commit is contained in:
Karol Kosek 2021-08-25 22:37:15 +02:00 committed by Andreas Kling
parent f878e4464f
commit 23137f0a8d
3 changed files with 19 additions and 0 deletions

View file

@ -143,6 +143,14 @@ int main(int argc, char** argv)
theme->sync();
};
file_menu.add_action(GUI::CommonActions::make_open_action([&](auto&) {
auto result = FileSystemAccessClient::Client::the().open_file(window->window_id(), "Select theme file", "/res/themes");
if (result.error != 0)
return;
preview_widget.set_theme_from_file(*result.chosen_file, *result.fd);
}));
file_menu.add_action(GUI::CommonActions::make_save_action([&](auto&) {
if (path.has_value()) {
save_to_result(FileSystemAccessClient::Client::the().request_file(window->window_id(), *path, Core::OpenMode::WriteOnly | Core::OpenMode::Truncate));