mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 05:48:12 +00:00
FileManager: Fix TreeView collapsing on file system changes (#4348)
TreeViews using FileSystemModels collapse whenever the file system is changed in anyway. This includes creating, dragging, deleting or pasting any files/folders. This commit updates the refresh_tree_view() lambda, which seems to have stopped working at some point, and calls it whenever any of the actions mentioned above are activated.
This commit is contained in:
parent
6496895b16
commit
eb810d14c3
3 changed files with 37 additions and 13 deletions
|
@ -563,6 +563,7 @@ void DirectoryView::handle_drop(const GUI::ModelIndex& index, const GUI::DropEve
|
|||
if (!target_node.is_directory())
|
||||
return;
|
||||
|
||||
bool had_accepted_drop = false;
|
||||
for (auto& url_to_copy : urls) {
|
||||
if (!url_to_copy.is_valid() || url_to_copy.path() == target_node.full_path())
|
||||
continue;
|
||||
|
@ -573,8 +574,12 @@ void DirectoryView::handle_drop(const GUI::ModelIndex& index, const GUI::DropEve
|
|||
if (!FileUtils::copy_file_or_directory(url_to_copy.path(), new_path)) {
|
||||
auto error_message = String::formatted("Could not copy {} into {}.", url_to_copy.to_string(), new_path);
|
||||
GUI::MessageBox::show(window(), error_message, "File Manager", GUI::MessageBox::Type::Error);
|
||||
} else {
|
||||
had_accepted_drop = true;
|
||||
}
|
||||
}
|
||||
};
|
||||
if (had_accepted_drop)
|
||||
on_accepted_drop();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue