mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-29 21:57:18 +00:00
Spreadsheet: Use TRY() on file load and save
This commit is contained in:
parent
ca42da23c2
commit
01824fd19a
Notes:
sideshowbarker
2024-07-17 11:34:34 +09:00
Author: https://github.com/krkk
Commit: 01824fd19a
Pull-request: https://github.com/SerenityOS/serenity/pull/14085
Reviewed-by: https://github.com/kennethmyhra ✅
2 changed files with 4 additions and 12 deletions
|
@ -57,11 +57,7 @@ Result<bool, String> Workbook::open_file(Core::File& file)
|
|||
auto mime = Core::guess_mime_type_based_on_filename(file.filename());
|
||||
|
||||
// Make an import dialog, we might need to import it.
|
||||
auto result = ImportDialog::make_and_run_for(m_parent_window, mime, file, *this);
|
||||
if (result.is_error())
|
||||
return result.error();
|
||||
|
||||
m_sheets = result.release_value();
|
||||
m_sheets = TRY(ImportDialog::make_and_run_for(m_parent_window, mime, file, *this));
|
||||
|
||||
set_filename(file.filename());
|
||||
|
||||
|
@ -99,9 +95,7 @@ Result<bool, String> Workbook::save(StringView filename)
|
|||
}
|
||||
|
||||
// Make an export dialog, we might need to import it.
|
||||
auto result = ExportDialog::make_and_run_for(mime, *file, *this);
|
||||
if (result.is_error())
|
||||
return result.error();
|
||||
TRY(ExportDialog::make_and_run_for(mime, *file, *this));
|
||||
|
||||
set_filename(filename);
|
||||
set_dirty(false);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue