mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-27 06:48:49 +00:00
GTreeView: Add basic selection support.
This commit is contained in:
parent
967eec1e52
commit
1963391ca6
Notes:
sideshowbarker
2024-07-19 14:53:57 +09:00
Author: https://github.com/awesomekling
Commit: 1963391ca6
4 changed files with 44 additions and 26 deletions
|
@ -26,23 +26,6 @@ struct GFileSystemModel::Node {
|
|||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
|
||||
String full_path(const GFileSystemModel& model) const
|
||||
{
|
||||
Vector<String> lineage;
|
||||
for (auto* ancestor = parent; ancestor; ancestor = ancestor->parent) {
|
||||
lineage.append(ancestor->name);
|
||||
}
|
||||
StringBuilder builder;
|
||||
builder.append(model.root_path());
|
||||
for (int i = lineage.size() - 1; i >= 0; --i) {
|
||||
builder.append('/');
|
||||
builder.append(lineage[i]);
|
||||
}
|
||||
builder.append('/');
|
||||
builder.append(name);
|
||||
return FileSystemPath(builder.to_string()).string();
|
||||
}
|
||||
|
||||
void traverse_if_needed(const GFileSystemModel& model)
|
||||
{
|
||||
if (type != Node::Directory || has_traversed)
|
||||
|
@ -90,6 +73,23 @@ struct GFileSystemModel::Node {
|
|||
}
|
||||
type = S_ISDIR(st.st_mode) ? Node::Type::Directory : Node::Type::File;
|
||||
}
|
||||
|
||||
String full_path(const GFileSystemModel& model) const
|
||||
{
|
||||
Vector<String> lineage;
|
||||
for (auto* ancestor = parent; ancestor; ancestor = ancestor->parent) {
|
||||
lineage.append(ancestor->name);
|
||||
}
|
||||
StringBuilder builder;
|
||||
builder.append(model.root_path());
|
||||
for (int i = lineage.size() - 1; i >= 0; --i) {
|
||||
builder.append('/');
|
||||
builder.append(lineage[i]);
|
||||
}
|
||||
builder.append('/');
|
||||
builder.append(name);
|
||||
return FileSystemPath(builder.to_string()).string();
|
||||
}
|
||||
};
|
||||
|
||||
GFileSystemModel::GFileSystemModel(const String& root_path, Mode mode)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue