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

FileManager: Show info about currently selected items in statusbar

When there's a non-zero number of selected items, we now show the
number in the statusbar, along with the total selected file size. :^)

Fixes #271.
This commit is contained in:
Andreas Kling 2019-09-12 18:59:13 +02:00
parent 13ca1ee8dc
commit d86fb8033e
3 changed files with 42 additions and 16 deletions

View file

@ -93,11 +93,12 @@ int main(int argc, char** argv)
directory_view->open_parent_directory();
});
directory_view->on_selection = [&](GAbstractView& view) {
directory_view->on_selection_change = [&](GAbstractView& view) {
Vector<String> paths;
auto model = static_cast<GDirectoryModel*>(view.model());
auto& model = *view.model();
view.selection().for_each_index([&](const GModelIndex& index) {
auto path = model->entry(index.row()).full_path(*model);
auto name_index = model.index(index.row(), GDirectoryModel::Column::Name);
auto path = model.data(name_index, GModel::Role::Custom).to_string();
paths.append(path);
});
selected_file_paths = paths;