summaryrefslogtreecommitdiff
path: root/Libraries/LibGUI/FileSystemModel.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-07-18 18:46:37 +0200
committerAndreas Kling <kling@serenityos.org>2020-07-19 21:15:00 +0200
commit9710c9742ca55986abc4cb7e9f21c95bc3ad4db0 (patch)
tree5fad2b15e398f9d52aede401e47f79b9dbe0cf5c /Libraries/LibGUI/FileSystemModel.cpp
parentad57a2f18b4915ba57b9c9e1e9c0ddd6ff4cfe2a (diff)
downloadserenity-9710c9742ca55986abc4cb7e9f21c95bc3ad4db0.zip
LibGUI+FileManager: Add setting for showing/hiding dotfiles
GUI::FileSystemModel can now be told to display (or not display) files whose name start with a dot (other than . and ..)
Diffstat (limited to 'Libraries/LibGUI/FileSystemModel.cpp')
-rw-r--r--Libraries/LibGUI/FileSystemModel.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/Libraries/LibGUI/FileSystemModel.cpp b/Libraries/LibGUI/FileSystemModel.cpp
index 2fc0913a60..bff0f5857e 100644
--- a/Libraries/LibGUI/FileSystemModel.cpp
+++ b/Libraries/LibGUI/FileSystemModel.cpp
@@ -91,7 +91,7 @@ void FileSystemModel::Node::traverse_if_needed(const FileSystemModel& model)
total_size = 0;
auto full_path = this->full_path(model);
- Core::DirIterator di(full_path, Core::DirIterator::SkipDots);
+ Core::DirIterator di(full_path, model.should_show_dotfiles() ? Core::DirIterator::SkipParentAndBaseDir : Core::DirIterator::SkipDots);
if (di.has_error()) {
m_error = di.error();
fprintf(stderr, "DirIterator: %s\n", di.error_string());
@@ -600,4 +600,12 @@ bool FileSystemModel::accepts_drag(const ModelIndex& index, const StringView& da
return node.is_directory();
}
+void FileSystemModel::set_should_show_dotfiles(bool show)
+{
+ if (m_should_show_dotfiles == show)
+ return;
+ m_should_show_dotfiles = show;
+ update();
+}
+
}