From a04316403e0fae3848438b496acc866fc2a01313 Mon Sep 17 00:00:00 2001 From: Abuneri Date: Fri, 21 Apr 2023 12:18:54 -0700 Subject: [PATCH] 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 --- Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp b/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp index 8d0b2abd5f..717ff58c1b 100644 --- a/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp +++ b/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp @@ -517,6 +517,9 @@ void SpreadsheetWidget::load_file(String const& filename, Core::File& file) auto result = m_workbook->open_file(filename, file); if (result.is_error()) { GUI::MessageBox::show_error(window(), result.error()); + if (!m_workbook->has_sheets()) { + add_sheet(); + } return; }