LibGUI: Don't require passing model to FileSystemModel::Node APIs

The Node API was obnoxiously requiring you to pass the model into it
all the time, simply because nodes could not find their way back to
the containing model. This patch adds a back-reference to the model
and simplifies the API.
This commit is contained in:
Andreas Kling 2020-08-17 22:02:21 +02:00
parent 38d8426f32
commit f0349323c4
Notes: sideshowbarker 2024-07-19 03:28:28 +09:00
5 changed files with 47 additions and 40 deletions

View file

@ -202,7 +202,7 @@ FilePicker::FilePicker(Window* parent_window, Mode mode, Options options, const
auto& filter_model = (SortingProxyModel&)*m_view->model();
auto local_index = filter_model.map_to_source(index);
const FileSystemModel::Node& node = m_model->node(local_index);
LexicalPath path { node.full_path(m_model) };
LexicalPath path { node.full_path() };
if (have_preview())
clear_preview();
@ -240,7 +240,7 @@ FilePicker::FilePicker(Window* parent_window, Mode mode, Options options, const
auto& filter_model = (SortingProxyModel&)*m_view->model();
auto local_index = filter_model.map_to_source(index);
const FileSystemModel::Node& node = m_model->node(local_index);
auto path = node.full_path(m_model);
auto path = node.full_path();
if (node.is_directory()) {
set_path(path);