summaryrefslogtreecommitdiff
path: root/Applications/FileManager
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-09-16 19:56:58 +0200
committerAndreas Kling <kling@serenityos.org>2020-09-16 21:08:55 +0200
commit17ae1c37bbd21ae5de691c5dded61d017260f92c (patch)
treea94617ea7ef50f2410510727a770d4dc2b77d408 /Applications/FileManager
parent4d2782db5a4e1e257500d70c57068250953b3d9b (diff)
downloadserenity-17ae1c37bbd21ae5de691c5dded61d017260f92c.zip
FileManager: Show the root (/) directory in the treeview on the left
This gives you something to click on if you actually want to open the root directory. Previously, if you wanted to get to /, you had to use the "to parent directory" repeatedly. Silly. :^)
Diffstat (limited to 'Applications/FileManager')
-rw-r--r--Applications/FileManager/main.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/Applications/FileManager/main.cpp b/Applications/FileManager/main.cpp
index 7e87f4d8b6..4ac97955c6 100644
--- a/Applications/FileManager/main.cpp
+++ b/Applications/FileManager/main.cpp
@@ -231,7 +231,7 @@ int run_in_windowed_mode(RefPtr<Core::ConfigFile> config, String initial_locatio
auto& splitter = widget.add<GUI::HorizontalSplitter>();
auto& tree_view = splitter.add<GUI::TreeView>();
- auto directories_model = GUI::FileSystemModel::create("/", GUI::FileSystemModel::Mode::DirectoriesOnly);
+ auto directories_model = GUI::FileSystemModel::create({}, GUI::FileSystemModel::Mode::DirectoriesOnly);
tree_view.set_model(directories_model);
tree_view.set_column_hidden(GUI::FileSystemModel::Column::Icon, true);
tree_view.set_column_hidden(GUI::FileSystemModel::Column::Size, true);
@@ -245,6 +245,9 @@ int run_in_windowed_mode(RefPtr<Core::ConfigFile> config, String initial_locatio
tree_view.set_preferred_size(150, 0);
auto& directory_view = splitter.add<DirectoryView>(DirectoryView::Mode::Normal);
+ // Open the root directory. FIXME: This is awkward.
+ tree_view.toggle_index(directories_model->index(0, 0, {}));
+
auto& statusbar = widget.add<GUI::StatusBar>();
auto& progressbar = statusbar.add<GUI::ProgressBar>();