mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-26 19:29:16 +00:00
File Manager: Differentiate between navigation and rename errors
Adds a new on_rename_error handler and renames the old on_error handler to on_directory_change_error in FileSystemModel. The on_rename_error handler creates a MessageDialog with the error message.
This commit is contained in:
@@ -367,8 +367,8 @@ void FileSystemModel::set_root_path(String root_path)
|
||||
update();
|
||||
|
||||
if (m_root->has_error()) {
|
||||
if (on_error)
|
||||
on_error(m_root->error(), m_root->error_string());
|
||||
if (on_directory_change_error)
|
||||
on_directory_change_error(m_root->error(), m_root->error_string());
|
||||
} else if (on_complete) {
|
||||
on_complete();
|
||||
}
|
||||
@@ -676,8 +676,8 @@ void FileSystemModel::set_data(const ModelIndex& index, const Variant& data)
|
||||
auto new_full_path = String::formatted("{}/{}", dirname, data.to_string());
|
||||
int rc = rename(node.full_path().characters(), new_full_path.characters());
|
||||
if (rc < 0) {
|
||||
if (on_error)
|
||||
on_error(errno, strerror(errno));
|
||||
if (on_rename_error)
|
||||
on_rename_error(errno, strerror(errno));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user