mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 11:28:12 +00:00
PDFViewer: Add list of recently-opened files
This commit is contained in:
parent
15532df83d
commit
5c76b63f79
2 changed files with 9 additions and 0 deletions
|
@ -215,6 +215,12 @@ void PDFViewerWidget::initialize_menubar(GUI::Window& window)
|
|||
open_file(response.value().filename(), response.value().release_stream());
|
||||
}));
|
||||
file_menu.add_separator();
|
||||
file_menu.add_recent_files_list([&](auto& action) {
|
||||
auto response = FileSystemAccessClient::Client::the().request_file_read_only_approved(&window, action.text());
|
||||
if (!response.is_error())
|
||||
open_file(response.value().filename(), response.value().release_stream());
|
||||
})
|
||||
.release_value_but_fixme_should_propagate_errors();
|
||||
file_menu.add_action(GUI::CommonActions::make_quit_action([](auto&) {
|
||||
GUI::Application::the()->quit();
|
||||
}));
|
||||
|
@ -407,5 +413,7 @@ PDF::PDFErrorOr<void> PDFViewerWidget::try_open_file(StringView path, NonnullOwn
|
|||
m_sidebar_open = false;
|
||||
}
|
||||
|
||||
GUI::Application::the()->set_most_recently_open_file(TRY(String::from_utf8(path)));
|
||||
|
||||
return {};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue