1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 00:57:45 +00:00

Spreadsheet: Allow importing sheets into an existing workbook

This commit is contained in:
Ali Mohammad Pur 2022-06-25 22:06:18 +04:30 committed by Linus Groh
parent 135683795b
commit 64ef808aeb
4 changed files with 50 additions and 0 deletions

View file

@ -76,4 +76,15 @@ Result<bool, String> Workbook::write_to_file(Core::File& file)
return true;
}
Result<bool, String> Workbook::import_file(Core::File& file)
{
auto mime = Core::guess_mime_type_based_on_filename(file.filename());
auto sheets = TRY(ImportDialog::make_and_run_for(m_parent_window, mime, file, *this));
auto has_any_changes = !sheets.is_empty();
m_sheets.extend(move(sheets));
return has_any_changes;
}
}