mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 21:07:35 +00:00
Spreadsheet: Generate file previews in memory and save directly to file
When we were asked to make a new preview text, we first generated the whole file in the /tmp directory and then read the first 8 lines to put them in a text box. This was doing a bit of unnecessary work at first, but more importantly, didn't work on a given file descriptor from FileSystemAccessServer as we were copying a file to a filename instead, meaning that we also had to unveil the whole home directory. Anyway, previews will be written now to a MemoryStream by the generator, which will limit to 8 lines. File saves will omit /tmp entirely, allowing us to tighten program unveil list a little. :^)
This commit is contained in:
parent
c74441395b
commit
29a3cdcfb7
4 changed files with 60 additions and 113 deletions
|
@ -23,17 +23,14 @@ struct CSVExportDialogPage {
|
|||
explicit CSVExportDialogPage(Sheet const&);
|
||||
|
||||
NonnullRefPtr<GUI::WizardPage> page() { return *m_page; }
|
||||
Optional<XSV>& writer() { return m_previously_made_writer; }
|
||||
Result<void, DeprecatedString> move_into(DeprecatedString const& target);
|
||||
Optional<XSV> make_writer(OutputStream&);
|
||||
|
||||
protected:
|
||||
void update_preview();
|
||||
Optional<XSV> make_writer();
|
||||
|
||||
private:
|
||||
Vector<Vector<DeprecatedString>> m_data;
|
||||
Vector<DeprecatedString> m_headers;
|
||||
Optional<XSV> m_previously_made_writer;
|
||||
RefPtr<GUI::WizardPage> m_page;
|
||||
RefPtr<GUI::RadioButton> m_delimiter_comma_radio;
|
||||
RefPtr<GUI::RadioButton> m_delimiter_semicolon_radio;
|
||||
|
@ -54,8 +51,6 @@ private:
|
|||
"Repeat",
|
||||
"Backslash",
|
||||
};
|
||||
|
||||
DeprecatedString m_temp_output_file_path;
|
||||
};
|
||||
|
||||
struct ExportDialog {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue