mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-26 22:38:51 +00:00
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:
parent
38d8426f32
commit
f0349323c4
Notes:
sideshowbarker
2024-07-19 03:28:28 +09:00
Author: https://github.com/awesomekling
Commit: f0349323c4
5 changed files with 47 additions and 40 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue