diff --git a/Userland/Applications/ImageViewer/CMakeLists.txt b/Userland/Applications/ImageViewer/CMakeLists.txt index 6add0cf6fc..0826d53a56 100644 --- a/Userland/Applications/ImageViewer/CMakeLists.txt +++ b/Userland/Applications/ImageViewer/CMakeLists.txt @@ -12,4 +12,4 @@ set(SOURCES ) serenity_app(ImageViewer ICON filetype-image) -target_link_libraries(ImageViewer PRIVATE LibCore LibDesktop LibGUI LibGfx LibImageDecoderClient LibMain) +target_link_libraries(ImageViewer PRIVATE LibCore LibDesktop LibGUI LibGfx LibConfig LibImageDecoderClient LibMain) diff --git a/Userland/Applications/ImageViewer/ViewWidget.cpp b/Userland/Applications/ImageViewer/ViewWidget.cpp index 6bdfd5d05b..0941251da4 100644 --- a/Userland/Applications/ImageViewer/ViewWidget.cpp +++ b/Userland/Applications/ImageViewer/ViewWidget.cpp @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -196,6 +197,7 @@ void ViewWidget::load_from_file(DeprecatedString const& path) } m_path = Core::DeprecatedFile::real_path_for(path); + GUI::Application::the()->set_most_recently_open_file(String::from_utf8(path).release_value_but_fixme_should_propagate_errors()); reset_view(); } diff --git a/Userland/Applications/ImageViewer/main.cpp b/Userland/Applications/ImageViewer/main.cpp index 8970b09737..165a76a7c8 100644 --- a/Userland/Applications/ImageViewer/main.cpp +++ b/Userland/Applications/ImageViewer/main.cpp @@ -8,6 +8,7 @@ #include "MainWidget.h" #include "ViewWidget.h" #include +#include #include #include #include @@ -40,6 +41,10 @@ ErrorOr serenity_main(Main::Arguments arguments) auto app = TRY(GUI::Application::try_create(arguments)); + Config::pledge_domain("ImageViewer"); + + app->set_config_domain(TRY(String::from_utf8("ImageViewer"sv))); + TRY(Desktop::Launcher::add_allowed_handler_with_any_url("/bin/ImageViewer")); TRY(Desktop::Launcher::add_allowed_handler_with_only_specific_urls("/bin/Help", { URL::create_with_file_scheme("/usr/share/man/man1/ImageViewer.md") })); TRY(Desktop::Launcher::seal_allowlist()); @@ -286,6 +291,13 @@ ErrorOr serenity_main(Main::Arguments arguments) TRY(file_menu->try_add_action(open_action)); TRY(file_menu->try_add_action(delete_action)); TRY(file_menu->try_add_separator()); + + TRY(file_menu->add_recent_files_list([&](auto& action) { + auto path = action.text(); + widget->set_path(path); + widget->load_from_file(path); + })); + TRY(file_menu->try_add_action(quit_action)); auto image_menu = TRY(window->try_add_menu("&Image"));