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

Spreadsheet: Properly pass parent window to Workbook

Change the parent of the WizardDialog to that of the Spreadsheet window.
Previously the WizardDialog was using the open file dialog as the
parent resulting in the csv import dialog
This commit is contained in:
Glenford Williams 2022-01-09 14:31:51 -05:00 committed by Linus Groh
parent 876424923a
commit f5ff011c1b
5 changed files with 10 additions and 7 deletions

View file

@ -17,12 +17,13 @@
namespace Spreadsheet {
Workbook::Workbook(NonnullRefPtrVector<Sheet>&& sheets)
Workbook::Workbook(NonnullRefPtrVector<Sheet>&& sheets, GUI::Window* parent_window)
: m_sheets(move(sheets))
, m_vm(JS::VM::create())
, m_interpreter(JS::Interpreter::create<JS::GlobalObject>(m_vm))
, m_interpreter_scope(*m_interpreter)
, m_main_execution_context(m_vm->heap())
, m_parent_window(parent_window)
{
m_workbook_object = m_vm->heap().allocate<WorkbookObject>(m_interpreter->global_object(), *this);
m_interpreter->global_object().define_direct_property("workbook", workbook_object(), JS::default_attributes);
@ -62,7 +63,7 @@ Result<bool, String> Workbook::load(StringView filename)
auto mime = Core::guess_mime_type_based_on_filename(filename);
// Make an import dialog, we might need to import it.
auto result = ImportDialog::make_and_run_for(mime, file_or_error.value(), *this);
auto result = ImportDialog::make_and_run_for(m_parent_window, mime, file_or_error.value(), *this);
if (result.is_error())
return result.error();