summaryrefslogtreecommitdiff
path: root/LibGUI/GFileSystemModel.cpp
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-03-30 02:22:38 +0100
committerAndreas Kling <awesomekling@gmail.com>2019-03-30 02:22:38 +0100
commitf10e0d054612eef415ce96a0e2383910d39668c0 (patch)
treec7abc33c39c98287c55c6281d57d8bbaa405e850 /LibGUI/GFileSystemModel.cpp
parentbe42382a3a1c10585d272394557caed170ae0093 (diff)
downloadserenity-f10e0d054612eef415ce96a0e2383910d39668c0.zip
FileManager: Make the directory view follow the tree view selection.
Diffstat (limited to 'LibGUI/GFileSystemModel.cpp')
-rw-r--r--LibGUI/GFileSystemModel.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/LibGUI/GFileSystemModel.cpp b/LibGUI/GFileSystemModel.cpp
index 2bed9f2090..b13b863838 100644
--- a/LibGUI/GFileSystemModel.cpp
+++ b/LibGUI/GFileSystemModel.cpp
@@ -92,6 +92,15 @@ struct GFileSystemModel::Node {
}
};
+String GFileSystemModel::path(const GModelIndex& index) const
+{
+ if (!index.is_valid())
+ return { };
+ auto& node = *(Node*)index.internal_data();
+ node.reify_if_needed(*this);
+ return node.full_path(*this);
+}
+
GFileSystemModel::GFileSystemModel(const String& root_path, Mode mode)
: m_root_path(FileSystemPath(root_path).string())
, m_mode(mode)