1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 04:37:44 +00:00

Userland: Port Model::column_name() to String

This commit is contained in:
Karol Kosek 2023-05-14 19:02:08 +02:00 committed by Andreas Kling
parent 741f07dedf
commit 945f05ed76
70 changed files with 218 additions and 222 deletions

View file

@ -166,10 +166,12 @@ void CSVImportDialogPage::update_preview()
return;
}
auto headers = reader.headers();
Vector<String> headers;
for (auto const& header : reader.headers())
headers.append(String::from_deprecated_string(header).release_value_but_fixme_should_propagate_errors());
m_data_preview_table_view->set_model(
GUI::ItemListModel<Reader::XSV::Row, Reader::XSV, Vector<DeprecatedString>>::create(reader, headers, min(8ul, reader.size())));
GUI::ItemListModel<Reader::XSV::Row, Reader::XSV, Vector<String>>::create(reader, headers, min(8ul, reader.size())));
m_data_preview_widget->set_active_widget(m_data_preview_table_view);
m_data_preview_table_view->update();
}

View file

@ -162,12 +162,12 @@ RefPtr<Core::MimeData> SheetModel::mime_data(const GUI::ModelSelection& selectio
return mime_data;
}
DeprecatedString SheetModel::column_name(int index) const
String SheetModel::column_name(int index) const
{
if (index < 0)
return {};
return m_sheet->column(index);
return String::from_deprecated_string(m_sheet->column(index)).release_value_but_fixme_should_propagate_errors();
}
bool SheetModel::is_editable(const GUI::ModelIndex& index) const

View file

@ -23,7 +23,7 @@ public:
virtual int row_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override { return m_sheet->row_count(); }
virtual int column_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override { return m_sheet->column_count(); }
virtual DeprecatedString column_name(int) const override;
virtual String column_name(int) const override;
virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override;
virtual RefPtr<Core::MimeData> mime_data(const GUI::ModelSelection&) const override;
virtual bool is_editable(const GUI::ModelIndex&) const override;