1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 09:48:11 +00:00

PDFViewer: Use FileSystemAccessClient::try_* APIs

This commit is contained in:
Mustafa Quraish 2022-01-16 20:47:11 -05:00 committed by Andreas Kling
parent 1c3e93c6e0
commit effb19f996
3 changed files with 11 additions and 25 deletions

View file

@ -38,14 +38,10 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
window->set_icon(app_icon.bitmap_for_size(16));
if (arguments.argc >= 2) {
auto response = FileSystemAccessClient::Client::the().request_file_read_only_approved(window->window_id(), arguments.argv[1]);
if (response.error != 0) {
if (response.error != -1)
GUI::MessageBox::show_error(window, String::formatted("Opening \"{}\" failed: {}", *response.chosen_file, strerror(response.error)));
auto response = FileSystemAccessClient::Client::the().try_request_file_read_only_approved(window, arguments.argv[1]);
if (response.is_error())
return 1;
}
pdf_viewer_widget->open_file(*response.fd, *response.chosen_file);
pdf_viewer_widget->open_file(*response.value());
}
return app->exec();