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

Spreadsheet: Add blank sheet when import dialog is cancelled

If you launch the Spreadsheet app by clicking on a CSV
(or other supported formats) the import dialog is immediately
launched. If you cancel out of the import the application ends
up in an empty state where there are no sheets added. When you
launch the app normally it defaults to having a blank sheet, so
we should have the same behaviour in this scenario to prevent users
from having to manually add the new/blank sheet before being able to
use the app
This commit is contained in:
Abuneri 2023-04-21 12:18:54 -07:00 committed by Sam Atkins
parent 8bc232e6be
commit a04316403e

View file

@ -517,6 +517,9 @@ void SpreadsheetWidget::load_file(String const& filename, Core::File& file)
auto result = m_workbook->open_file(filename, file); auto result = m_workbook->open_file(filename, file);
if (result.is_error()) { if (result.is_error()) {
GUI::MessageBox::show_error(window(), result.error()); GUI::MessageBox::show_error(window(), result.error());
if (!m_workbook->has_sheets()) {
add_sheet();
}
return; return;
} }