mirror of
https://github.com/RGBCube/serenity
synced 2025-05-28 12:45:07 +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:
parent
35b930112f
commit
fe7bacc2df
3 changed files with 11 additions and 6 deletions
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue