FileManager: Switch FileOperationProgressWidget::did_error() to SV&

This commit is contained in:
Sam Atkins 2021-06-24 16:28:24 +01:00 committed by Andreas Kling
parent 469bca9d3a
commit 9ac757647f
Notes: sideshowbarker 2024-07-18 08:34:08 +09:00
2 changed files with 5 additions and 5 deletions

View file

@ -66,7 +66,7 @@ FileOperationProgressWidget::FileOperationProgressWidget(FileOperation operation
m_notifier->on_ready_to_read = [this] { m_notifier->on_ready_to_read = [this] {
auto line = m_helper_pipe->read_line(); auto line = m_helper_pipe->read_line();
if (line.is_null()) { if (line.is_null()) {
did_error("Read from pipe returned null."); did_error("Read from pipe returned null."sv);
return; return;
} }
@ -74,12 +74,12 @@ FileOperationProgressWidget::FileOperationProgressWidget(FileOperation operation
VERIFY(!parts.is_empty()); VERIFY(!parts.is_empty());
if (parts[0] == "ERROR"sv) { if (parts[0] == "ERROR"sv) {
did_error(line.substring(6)); did_error(line.substring_view(6));
return; return;
} }
if (parts[0] == "WARN"sv) { if (parts[0] == "WARN"sv) {
did_error(line.substring(5)); did_error(line.substring_view(5));
return; return;
} }
@ -115,7 +115,7 @@ void FileOperationProgressWidget::did_finish()
window()->close(); window()->close();
} }
void FileOperationProgressWidget::did_error(String const message) void FileOperationProgressWidget::did_error(StringView const& message)
{ {
// FIXME: Communicate more with the user about errors. // FIXME: Communicate more with the user about errors.
close_pipe(); close_pipe();

View file

@ -22,7 +22,7 @@ private:
FileOperationProgressWidget(FileOperation, NonnullRefPtr<Core::File> helper_pipe); FileOperationProgressWidget(FileOperation, NonnullRefPtr<Core::File> helper_pipe);
void did_finish(); void did_finish();
void did_error(String message); void did_error(StringView const& message);
void did_progress(off_t bytes_done, off_t total_byte_count, size_t files_done, size_t total_file_count, off_t current_file_done, off_t current_file_size, StringView const& current_filename); void did_progress(off_t bytes_done, off_t total_byte_count, size_t files_done, size_t total_file_count, off_t current_file_done, off_t current_file_size, StringView const& current_filename);
void close_pipe(); void close_pipe();