1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-24 22:17:42 +00:00

LibGUI: Add 'on_rename_successful' callback to FileSystemModel

This commit is contained in:
Marco Cutecchia 2021-09-24 18:30:12 +02:00 committed by Andreas Kling
parent 5565db5aa1
commit 05630d2d5d
2 changed files with 5 additions and 0 deletions

View file

@ -746,7 +746,11 @@ void FileSystemModel::set_data(ModelIndex const& index, Variant const& data)
if (rc < 0) {
if (on_rename_error)
on_rename_error(errno, strerror(errno));
return;
}
if (on_rename_successful)
on_rename_successful(node.full_path(), new_full_path);
}
Vector<ModelIndex> FileSystemModel::matches(StringView const& searching, unsigned flags, ModelIndex const& index)

View file

@ -118,6 +118,7 @@ public:
Function<void()> on_complete;
Function<void(int error, char const* error_string)> on_directory_change_error;
Function<void(int error, char const* error_string)> on_rename_error;
Function<void(String const& old_name, String const& new_name)> on_rename_successful;
virtual int tree_column() const override { return Column::Name; }
virtual int row_count(ModelIndex const& = ModelIndex()) const override;