diff options
-rw-r--r-- | Userland/Applications/Spreadsheet/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp | 12 | ||||
-rw-r--r-- | Userland/Applications/Spreadsheet/main.cpp | 4 |
3 files changed, 17 insertions, 1 deletions
diff --git a/Userland/Applications/Spreadsheet/CMakeLists.txt b/Userland/Applications/Spreadsheet/CMakeLists.txt index e4affa4cb4..f800fd4288 100644 --- a/Userland/Applications/Spreadsheet/CMakeLists.txt +++ b/Userland/Applications/Spreadsheet/CMakeLists.txt @@ -42,7 +42,7 @@ set(GENERATED_SOURCES ) serenity_app(Spreadsheet ICON app-spreadsheet) -target_link_libraries(Spreadsheet PRIVATE LibCore LibFileSystem LibFileSystemAccessClient LibGfx LibGUI LibJS LibMain LibMarkdown LibSyntax LibWebView LibWeb) +target_link_libraries(Spreadsheet PRIVATE LibConfig LibCore LibFileSystem LibFileSystemAccessClient LibGfx LibGUI LibJS LibMain LibMarkdown LibSyntax LibWebView LibWeb) serenity_test(Writers/Test/TestXSVWriter.cpp Spreadsheet) diff --git a/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp b/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp index a663d68633..c2f1b1bffa 100644 --- a/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp +++ b/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp @@ -502,6 +502,7 @@ void SpreadsheetWidget::save(String const& filename, Core::File& file) } undo_stack().set_current_unmodified(); window()->set_modified(false); + GUI::Application::the()->set_most_recently_open_file(filename); } void SpreadsheetWidget::load_file(String const& filename, Core::File& file) @@ -521,6 +522,7 @@ void SpreadsheetWidget::load_file(String const& filename, Core::File& file) setup_tabs(m_workbook->sheets()); update_window_title(); + GUI::Application::the()->set_most_recently_open_file(filename); } void SpreadsheetWidget::import_sheets(String const& filename, Core::File& file) @@ -654,6 +656,16 @@ void SpreadsheetWidget::initialize_menubar(GUI::Window& window) file_menu.add_separator(); file_menu.add_action(*m_import_action); file_menu.add_separator(); + file_menu.add_recent_files_list([&](auto& action) { + if (!request_close()) + return; + + auto response = FileSystemAccessClient::Client::the().request_file_read_only_approved(&window, action.text()); + if (response.is_error()) + return; + load_file(response.value().filename(), response.value().stream()); + }) + .release_value_but_fixme_should_propagate_errors(); file_menu.add_action(*m_quit_action); auto& edit_menu = window.add_menu("&Edit"); diff --git a/Userland/Applications/Spreadsheet/main.cpp b/Userland/Applications/Spreadsheet/main.cpp index bd1cc8a8a0..5ae81a6aeb 100644 --- a/Userland/Applications/Spreadsheet/main.cpp +++ b/Userland/Applications/Spreadsheet/main.cpp @@ -9,6 +9,7 @@ #include "SpreadsheetWidget.h" #include <AK/ScopeGuard.h> #include <AK/Try.h> +#include <LibConfig/Client.h> #include <LibCore/ArgsParser.h> #include <LibCore/System.h> #include <LibFileSystem/FileSystem.h> @@ -40,6 +41,9 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) } } + Config::pledge_domain("Spreadsheet"); + app->set_config_domain(TRY("Spreadsheet"_string)); + TRY(Core::System::unveil("/tmp/session/%sid/portal/filesystemaccess", "rw")); TRY(Core::System::unveil("/tmp/session/%sid/portal/webcontent", "rw")); TRY(Core::System::unveil("/etc", "r")); |