1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-20 03:05:07 +00:00

GFileSystemModel: Add a "DirectoriesOnly" mode.

This commit is contained in:
Andreas Kling 2019-03-29 17:14:03 +01:00
parent 4d3c5fd83e
commit 6b72c62c5f
3 changed files with 11 additions and 6 deletions

View file

@ -5,9 +5,11 @@
class GFileSystemModel : public GModel {
friend class Node;
public:
static Retained<GFileSystemModel> create(const String& root_path = "/")
enum Mode { Invalid, DirectoriesOnly, FilesAndDirectories };
static Retained<GFileSystemModel> create(const String& root_path = "/", Mode mode = Mode::FilesAndDirectories)
{
return adopt(*new GFileSystemModel(root_path));
return adopt(*new GFileSystemModel(root_path, mode));
}
virtual ~GFileSystemModel() override;
@ -22,9 +24,10 @@ public:
virtual void activate(const GModelIndex&) override;
private:
explicit GFileSystemModel(const String& root_path);
GFileSystemModel(const String& root_path, Mode);
String m_root_path;
Mode m_mode { Invalid };
struct Node;
Node* m_root { nullptr };