From 9ae97c8cb1f604ba06e61c5779e1a8a65c06f558 Mon Sep 17 00:00:00 2001 From: Lucas CHOLLET Date: Wed, 7 Dec 2022 23:02:03 +0100 Subject: [PATCH] LibFileSystemAccessClient: Rename `try_save_file` => `try_save_file_deprecated` This precedes the addition of a new api using `Core::Stream` --- Userland/Applications/CrashReporter/main.cpp | 2 +- Userland/Applications/HexEditor/HexEditorWidget.cpp | 2 +- Userland/Applications/Magnifier/main.cpp | 2 +- Userland/Applications/PixelPaint/ImageEditor.cpp | 2 +- Userland/Applications/PixelPaint/MainWidget.cpp | 8 ++++---- Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp | 2 +- Userland/Applications/TextEditor/MainWidget.cpp | 2 +- Userland/Applications/ThemeEditor/MainWidget.cpp | 4 ++-- Userland/DevTools/GMLPlayground/main.cpp | 2 +- Userland/Games/Chess/main.cpp | 2 +- Userland/Libraries/LibFileSystemAccessClient/Client.cpp | 2 +- Userland/Libraries/LibFileSystemAccessClient/Client.h | 2 +- 12 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Userland/Applications/CrashReporter/main.cpp b/Userland/Applications/CrashReporter/main.cpp index f004ca430c..9a35a0e050 100644 --- a/Userland/Applications/CrashReporter/main.cpp +++ b/Userland/Applications/CrashReporter/main.cpp @@ -278,7 +278,7 @@ ErrorOr serenity_main(Main::Arguments arguments) save_backtrace_button.set_icon(TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/save.png"sv))); save_backtrace_button.on_click = [&](auto) { LexicalPath lexical_path(DeprecatedString::formatted("{}_{}_backtrace.txt", pid, app_name)); - auto file_or_error = FileSystemAccessClient::Client::the().try_save_file(window, lexical_path.title(), lexical_path.extension()); + auto file_or_error = FileSystemAccessClient::Client::the().try_save_file_deprecated(window, lexical_path.title(), lexical_path.extension()); if (file_or_error.is_error()) return; diff --git a/Userland/Applications/HexEditor/HexEditorWidget.cpp b/Userland/Applications/HexEditor/HexEditorWidget.cpp index 9ab336836e..2f050770e6 100644 --- a/Userland/Applications/HexEditor/HexEditorWidget.cpp +++ b/Userland/Applications/HexEditor/HexEditorWidget.cpp @@ -142,7 +142,7 @@ HexEditorWidget::HexEditorWidget() }); m_save_as_action = GUI::CommonActions::make_save_as_action([&](auto&) { - auto response = FileSystemAccessClient::Client::the().try_save_file(window(), m_name, m_extension, Core::OpenMode::ReadWrite | Core::OpenMode::Truncate); + auto response = FileSystemAccessClient::Client::the().try_save_file_deprecated(window(), m_name, m_extension, Core::OpenMode::ReadWrite | Core::OpenMode::Truncate); if (response.is_error()) return; auto file = response.release_value(); diff --git a/Userland/Applications/Magnifier/main.cpp b/Userland/Applications/Magnifier/main.cpp index 0e30e4189d..49b6628758 100644 --- a/Userland/Applications/Magnifier/main.cpp +++ b/Userland/Applications/Magnifier/main.cpp @@ -64,7 +64,7 @@ ErrorOr serenity_main(Main::Arguments arguments) TRY(file_menu->try_add_action(GUI::CommonActions::make_save_as_action([&](auto&) { AK::DeprecatedString filename = "file for saving"; auto do_save = [&]() -> ErrorOr { - auto response = FileSystemAccessClient::Client::the().try_save_file(window, "Capture", "png"); + auto response = FileSystemAccessClient::Client::the().try_save_file_deprecated(window, "Capture", "png"); if (response.is_error()) return {}; auto file = response.release_value(); diff --git a/Userland/Applications/PixelPaint/ImageEditor.cpp b/Userland/Applications/PixelPaint/ImageEditor.cpp index ee05fcc299..66a4a9b447 100644 --- a/Userland/Applications/PixelPaint/ImageEditor.cpp +++ b/Userland/Applications/PixelPaint/ImageEditor.cpp @@ -694,7 +694,7 @@ void ImageEditor::save_project() void ImageEditor::save_project_as() { - auto response = FileSystemAccessClient::Client::the().try_save_file(window(), m_title, "pp"); + auto response = FileSystemAccessClient::Client::the().try_save_file_deprecated(window(), m_title, "pp"); if (response.is_error()) return; auto file = response.value(); diff --git a/Userland/Applications/PixelPaint/MainWidget.cpp b/Userland/Applications/PixelPaint/MainWidget.cpp index 8898d9796b..76a918acda 100644 --- a/Userland/Applications/PixelPaint/MainWidget.cpp +++ b/Userland/Applications/PixelPaint/MainWidget.cpp @@ -212,7 +212,7 @@ void MainWidget::initialize_menubar(GUI::Window& window) "As &BMP", [&](auto&) { auto* editor = current_image_editor(); VERIFY(editor); - auto response = FileSystemAccessClient::Client::the().try_save_file(&window, editor->title(), "bmp"); + auto response = FileSystemAccessClient::Client::the().try_save_file_deprecated(&window, editor->title(), "bmp"); if (response.is_error()) return; auto preserve_alpha_channel = GUI::MessageBox::show(&window, "Do you wish to preserve transparency?"sv, "Preserve transparency?"sv, GUI::MessageBox::Type::Question, GUI::MessageBox::InputType::YesNo); @@ -227,7 +227,7 @@ void MainWidget::initialize_menubar(GUI::Window& window) auto* editor = current_image_editor(); VERIFY(editor); // TODO: fix bmp on line below? - auto response = FileSystemAccessClient::Client::the().try_save_file(&window, editor->title(), "png"); + auto response = FileSystemAccessClient::Client::the().try_save_file_deprecated(&window, editor->title(), "png"); if (response.is_error()) return; auto preserve_alpha_channel = GUI::MessageBox::show(&window, "Do you wish to preserve transparency?"sv, "Preserve transparency?"sv, GUI::MessageBox::Type::Question, GUI::MessageBox::InputType::YesNo); @@ -241,7 +241,7 @@ void MainWidget::initialize_menubar(GUI::Window& window) "As &QOI", [&](auto&) { auto* editor = current_image_editor(); VERIFY(editor); - auto response = FileSystemAccessClient::Client::the().try_save_file(&window, editor->title(), "qoi"); + auto response = FileSystemAccessClient::Client::the().try_save_file_deprecated(&window, editor->title(), "qoi"); if (response.is_error()) return; auto result = editor->image().export_qoi_to_file(response.value()); @@ -410,7 +410,7 @@ void MainWidget::initialize_menubar(GUI::Window& window) })); m_edit_menu->add_action(GUI::Action::create( "Sa&ve Color Palette", g_icon_bag.save_color_palette, [&](auto&) { - auto response = FileSystemAccessClient::Client::the().try_save_file(&window, "untitled", "palette"); + auto response = FileSystemAccessClient::Client::the().try_save_file_deprecated(&window, "untitled", "palette"); if (response.is_error()) return; diff --git a/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp b/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp index f4061093ec..b34b998ec7 100644 --- a/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp +++ b/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp @@ -155,7 +155,7 @@ SpreadsheetWidget::SpreadsheetWidget(GUI::Window& parent_window, NonnullRefPtrVe m_save_as_action = GUI::CommonActions::make_save_as_action([&](auto&) { DeprecatedString name = "workbook"; - auto response = FileSystemAccessClient::Client::the().try_save_file(window(), name, "sheets"); + auto response = FileSystemAccessClient::Client::the().try_save_file_deprecated(window(), name, "sheets"); if (response.is_error()) return; save(*response.value()); diff --git a/Userland/Applications/TextEditor/MainWidget.cpp b/Userland/Applications/TextEditor/MainWidget.cpp index 0ee90882a5..cb1e31946e 100644 --- a/Userland/Applications/TextEditor/MainWidget.cpp +++ b/Userland/Applications/TextEditor/MainWidget.cpp @@ -280,7 +280,7 @@ MainWidget::MainWidget() }); m_save_as_action = GUI::CommonActions::make_save_as_action([&](auto&) { - auto response = FileSystemAccessClient::Client::the().try_save_file(window(), m_name, m_extension); + auto response = FileSystemAccessClient::Client::the().try_save_file_deprecated(window(), m_name, m_extension); if (response.is_error()) return; diff --git a/Userland/Applications/ThemeEditor/MainWidget.cpp b/Userland/Applications/ThemeEditor/MainWidget.cpp index 0c823b9b9a..e8b57ba897 100644 --- a/Userland/Applications/ThemeEditor/MainWidget.cpp +++ b/Userland/Applications/ThemeEditor/MainWidget.cpp @@ -222,7 +222,7 @@ ErrorOr MainWidget::initialize_menubar(GUI::Window& window) return; save_to_file(result.value()); } else { - auto result = FileSystemAccessClient::Client::the().try_save_file(&window, "Theme", "ini", Core::OpenMode::ReadWrite | Core::OpenMode::Truncate); + auto result = FileSystemAccessClient::Client::the().try_save_file_deprecated(&window, "Theme", "ini", Core::OpenMode::ReadWrite | Core::OpenMode::Truncate); if (result.is_error()) return; save_to_file(result.value()); @@ -231,7 +231,7 @@ ErrorOr MainWidget::initialize_menubar(GUI::Window& window) TRY(file_menu->try_add_action(*m_save_action)); TRY(file_menu->try_add_action(GUI::CommonActions::make_save_as_action([&](auto&) { - auto result = FileSystemAccessClient::Client::the().try_save_file(&window, "Theme", "ini", Core::OpenMode::ReadWrite | Core::OpenMode::Truncate); + auto result = FileSystemAccessClient::Client::the().try_save_file_deprecated(&window, "Theme", "ini", Core::OpenMode::ReadWrite | Core::OpenMode::Truncate); if (result.is_error()) return; save_to_file(result.value()); diff --git a/Userland/DevTools/GMLPlayground/main.cpp b/Userland/DevTools/GMLPlayground/main.cpp index 9152c12329..0ac67fe984 100644 --- a/Userland/DevTools/GMLPlayground/main.cpp +++ b/Userland/DevTools/GMLPlayground/main.cpp @@ -134,7 +134,7 @@ ErrorOr serenity_main(Main::Arguments arguments) auto file_menu = TRY(window->try_add_menu("&File")); auto save_as_action = GUI::CommonActions::make_save_as_action([&](auto&) { - auto response = FileSystemAccessClient::Client::the().try_save_file(window, "Untitled", "gml"); + auto response = FileSystemAccessClient::Client::the().try_save_file_deprecated(window, "Untitled", "gml"); if (response.is_error()) return; diff --git a/Userland/Games/Chess/main.cpp b/Userland/Games/Chess/main.cpp index 4ea167e4c0..5dfa1145fd 100644 --- a/Userland/Games/Chess/main.cpp +++ b/Userland/Games/Chess/main.cpp @@ -75,7 +75,7 @@ ErrorOr serenity_main(Main::Arguments arguments) dbgln("Imported PGN file from {}", result.value()->filename()); }))); TRY(game_menu->try_add_action(GUI::Action::create("&Export PGN...", { Mod_Ctrl, Key_S }, [&](auto&) { - auto result = FileSystemAccessClient::Client::the().try_save_file(window, "Untitled", "pgn"); + auto result = FileSystemAccessClient::Client::the().try_save_file_deprecated(window, "Untitled", "pgn"); if (result.is_error()) return; diff --git a/Userland/Libraries/LibFileSystemAccessClient/Client.cpp b/Userland/Libraries/LibFileSystemAccessClient/Client.cpp index dc3961797b..fff5efaa55 100644 --- a/Userland/Libraries/LibFileSystemAccessClient/Client.cpp +++ b/Userland/Libraries/LibFileSystemAccessClient/Client.cpp @@ -93,7 +93,7 @@ DeprecatedResult Client::try_open_file(GUI::Window* parent_window, DeprecatedStr return handle_promise(id); } -DeprecatedResult Client::try_save_file(GUI::Window* parent_window, DeprecatedString const& name, DeprecatedString const ext, Core::OpenMode requested_access) +DeprecatedResult Client::try_save_file_deprecated(GUI::Window* parent_window, DeprecatedString const& name, DeprecatedString const ext, Core::OpenMode requested_access) { auto const id = get_new_id(); m_promises.set(id, PromiseAndWindow { Core::Promise::construct(), parent_window }); diff --git a/Userland/Libraries/LibFileSystemAccessClient/Client.h b/Userland/Libraries/LibFileSystemAccessClient/Client.h index 5cc4585f18..d63713dc63 100644 --- a/Userland/Libraries/LibFileSystemAccessClient/Client.h +++ b/Userland/Libraries/LibFileSystemAccessClient/Client.h @@ -29,7 +29,7 @@ public: DeprecatedResult try_request_file_read_only_approved(GUI::Window* parent_window, DeprecatedString const& path); DeprecatedResult try_request_file(GUI::Window* parent_window, DeprecatedString const& path, Core::OpenMode mode); DeprecatedResult try_open_file(GUI::Window* parent_window, DeprecatedString const& window_title = {}, StringView path = Core::StandardPaths::home_directory(), Core::OpenMode requested_access = Core::OpenMode::ReadOnly); - DeprecatedResult try_save_file(GUI::Window* parent_window, DeprecatedString const& name, DeprecatedString const ext, Core::OpenMode requested_access = Core::OpenMode::WriteOnly | Core::OpenMode::Truncate); + DeprecatedResult try_save_file_deprecated(GUI::Window* parent_window, DeprecatedString const& name, DeprecatedString const ext, Core::OpenMode requested_access = Core::OpenMode::WriteOnly | Core::OpenMode::Truncate); static Client& the();