From 05630d2d5d203c42cfcf1e0e3321c253ad038aef Mon Sep 17 00:00:00 2001 From: Marco Cutecchia Date: Fri, 24 Sep 2021 18:30:12 +0200 Subject: LibGUI: Add 'on_rename_successful' callback to FileSystemModel --- Userland/Libraries/LibGUI/FileSystemModel.cpp | 4 ++++ Userland/Libraries/LibGUI/FileSystemModel.h | 1 + 2 files changed, 5 insertions(+) (limited to 'Userland/Libraries/LibGUI') diff --git a/Userland/Libraries/LibGUI/FileSystemModel.cpp b/Userland/Libraries/LibGUI/FileSystemModel.cpp index eb03b50850..cb4b437030 100644 --- a/Userland/Libraries/LibGUI/FileSystemModel.cpp +++ b/Userland/Libraries/LibGUI/FileSystemModel.cpp @@ -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 FileSystemModel::matches(StringView const& searching, unsigned flags, ModelIndex const& index) diff --git a/Userland/Libraries/LibGUI/FileSystemModel.h b/Userland/Libraries/LibGUI/FileSystemModel.h index b523b25236..67973e5625 100644 --- a/Userland/Libraries/LibGUI/FileSystemModel.h +++ b/Userland/Libraries/LibGUI/FileSystemModel.h @@ -118,6 +118,7 @@ public: Function on_complete; Function on_directory_change_error; Function on_rename_error; + Function on_rename_successful; virtual int tree_column() const override { return Column::Name; } virtual int row_count(ModelIndex const& = ModelIndex()) const override; -- cgit v1.2.3