mirror of
https://github.com/RGBCube/serenity
synced 2025-05-30 14:28:11 +00:00
FileManager: Hook up a GSortingProxyTableModel so we get sorted files. :^)
The next step here is coming up with a nice way to always put directories ahead of files.
This commit is contained in:
parent
7d2c962836
commit
e14dd06b8c
4 changed files with 25 additions and 10 deletions
|
@ -137,8 +137,21 @@ String DirectoryTableModel::name_for_gid(uid_t gid) const
|
|||
|
||||
GVariant DirectoryTableModel::data(const GModelIndex& index, Role role) const
|
||||
{
|
||||
ASSERT(role == Role::Display);
|
||||
ASSERT(is_valid(index));
|
||||
auto& entry = this->entry(index.row());
|
||||
if (role == Role::Sort) {
|
||||
switch (index.column()) {
|
||||
case Column::Icon: return entry.is_directory() ? 0 : 1;
|
||||
case Column::Name: return entry.name;
|
||||
case Column::Size: return (int)entry.size;
|
||||
case Column::Owner: return name_for_uid(entry.uid);
|
||||
case Column::Group: return name_for_gid(entry.gid);
|
||||
case Column::Permissions: return permission_string(entry.mode);
|
||||
case Column::Inode: return (int)entry.inode;
|
||||
}
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
ASSERT(role == Role::Display);
|
||||
switch (index.column()) {
|
||||
case Column::Icon: return icon_for(entry);
|
||||
case Column::Name: return entry.name;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue