SpreadSheet: Use FileSystemAccessClient::try_* APIs

This commit is contained in:
Mustafa Quraish 2022-01-17 06:09:19 -05:00 committed by Andreas Kling
commit bba32de857
Notes: sideshowbarker 2024-07-17 20:34:14 +09:00
5 changed files with 17 additions and 33 deletions

View file

@ -94,14 +94,10 @@ int main(int argc, char* argv[])
window->show();
if (filename) {
auto response = FileSystemAccessClient::Client::the().request_file_read_only_approved(window->window_id(), filename);
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, filename);
if (response.is_error())
return 1;
}
spreadsheet_widget.load_file(*response.fd, filename);
spreadsheet_widget.load_file(*response.value());
}
return app->exec();