1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:38:11 +00:00

FileManager: Make DirectoryView vend indexes from view model

Instead of translating between the sorting proxy and the underlying
file system model at all the DirectoryView API boundaries, just hand
out indexes into the sorting proxy model.

The only thing those indexes are used for on the outside is to
retrieve a GUI::FileSystemModel::Node for an index, so add a nice
helper on DirectoryView that turns a ModelIndex into a Node&.
This commit is contained in:
Andreas Kling 2020-08-17 22:49:52 +02:00
parent f0349323c4
commit d1e83b4f6e
3 changed files with 20 additions and 20 deletions

View file

@ -128,7 +128,7 @@ public:
void set_should_show_dotfiles(bool);
GUI::FileSystemModel& model() { return *m_model; }
const GUI::FileSystemModel::Node& node(const GUI::ModelIndex&) const;
bool is_desktop() const { return m_mode == Mode::Desktop; }
@ -140,6 +140,7 @@ public:
private:
explicit DirectoryView(Mode);
const GUI::FileSystemModel& model() const { return *m_model; }
GUI::FileSystemModel& model() { return *m_model; }
// ^GUI::ModelClient
virtual void model_did_update(unsigned) override;
@ -151,7 +152,6 @@ private:
void setup_table_view();
void handle_activation(const GUI::ModelIndex&);
GUI::ModelIndex map_index(const GUI::ModelIndex&) const;
void set_status_message(const StringView&);
void update_statusbar();