diff options
author | sin-ack <sin-ack@users.noreply.github.com> | 2021-08-08 10:01:03 +0000 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-08-08 14:13:37 +0200 |
commit | 8c9c2f46c7dc85daf2885241991d905ed5d8eed5 (patch) | |
tree | ef0a4d5420ec1671b01b7f0ec2d70bd319afe995 /Userland/Libraries/LibGUI/FileSystemModel.h | |
parent | e377b508b7400f29846790071b1fba37b828721b (diff) | |
download | serenity-8c9c2f46c7dc85daf2885241991d905ed5d8eed5.zip |
LibGUI: Implement granular updates for FileSystemModel
FileSystemModel will now react to specific events from Core::FileWatcher
in order to granularly update its data based on addition or removal of
files from the tree. Metadata changes are currently not handled, but in
the future they can be used to re-stat() a file to get its updated
statistics.
Diffstat (limited to 'Userland/Libraries/LibGUI/FileSystemModel.h')
-rw-r--r-- | Userland/Libraries/LibGUI/FileSystemModel.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Userland/Libraries/LibGUI/FileSystemModel.h b/Userland/Libraries/LibGUI/FileSystemModel.h index 6a8f768ec3..3bbfeecfaf 100644 --- a/Userland/Libraries/LibGUI/FileSystemModel.h +++ b/Userland/Libraries/LibGUI/FileSystemModel.h @@ -93,7 +93,9 @@ public: ModelIndex index(int column) const; void traverse_if_needed(); void reify_if_needed(); - bool fetch_data(const String& full_path, bool is_root); + bool fetch_data(String const& full_path, bool is_root); + + OwnPtr<Node> create_child(String const& child_name); }; static NonnullRefPtr<FileSystemModel> create(String root_path = "/", Mode mode = Mode::FilesAndDirectories) @@ -155,6 +157,8 @@ private: bool fetch_thumbnail_for(const Node& node); GUI::Icon icon_for(const Node& node) const; + void handle_file_event(Core::FileWatcherEvent const& event); + String m_root_path; Mode m_mode { Invalid }; OwnPtr<Node> m_root { nullptr }; |