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

FileManager: Show an open folder icon for the selected directory

The currently selected directory now displays an open folder icon
in the directory tree.
This commit is contained in:
thankyouverycool 2020-07-10 09:51:15 -04:00 committed by Andreas Kling
parent e6ddc7e022
commit deceb91c48
3 changed files with 36 additions and 0 deletions

View file

@ -95,6 +95,9 @@ public:
bool is_directory() const { return S_ISDIR(mode); }
bool is_executable() const { return mode & (S_IXUSR | S_IXGRP | S_IXOTH); }
bool is_selected() const { return m_selected; }
void set_selected(bool selected);
bool has_error() const { return m_error != 0; }
int error() const { return m_error; }
const char* error_string() const { return strerror(m_error); }
@ -108,6 +111,8 @@ public:
NonnullOwnPtrVector<Node> children;
bool has_traversed { false };
bool m_selected { false };
int m_watch_fd { -1 };
RefPtr<Core::Notifier> m_notifier;
@ -130,6 +135,9 @@ public:
String full_path(const ModelIndex&) const;
ModelIndex index(const StringView& path, int column) const;
void update_node_on_selection(const ModelIndex&, const bool);
ModelIndex m_previously_selected_index {};
const Node& node(const ModelIndex& index) const;
GUI::Icon icon_for_file(const mode_t mode, const String& name) const;
@ -171,6 +179,7 @@ private:
OwnPtr<Node> m_root { nullptr };
GUI::Icon m_directory_icon;
GUI::Icon m_directory_open_icon;
GUI::Icon m_file_icon;
GUI::Icon m_symlink_icon;
GUI::Icon m_socket_icon;